mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-25 09:41:02 +00:00
Feature: Use tagGroup icon in timeline quick access feature (#1834)
* Use tagGroup icon in timeline quick access feature * Make tagGroup symbol optional
This commit is contained in:
parent
6f42ed8de0
commit
334b09ebe3
3 changed files with 14 additions and 11 deletions
|
@ -94,7 +94,7 @@ struct TimelineTab: View {
|
|||
lastTimelineFilter = newValue
|
||||
}
|
||||
switch newValue {
|
||||
case let .tagGroup(title, _):
|
||||
case let .tagGroup(title, _, _):
|
||||
if let group = tagGroups.first(where: { $0.title == title}) {
|
||||
selectedTagGroup = group
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ struct TimelineTab: View {
|
|||
Menu("timeline.filter.tag-groups") {
|
||||
ForEach(tagGroups) { group in
|
||||
Button {
|
||||
timeline = .tagGroup(title: group.title, tags: group.tags)
|
||||
timeline = .tagGroup(title: group.title, tags: group.tags, symbolName: group.symbolName)
|
||||
} label: {
|
||||
VStack {
|
||||
let icon = group.symbolName.isEmpty ? "number" : group.symbolName
|
||||
|
|
|
@ -33,7 +33,7 @@ public enum TimelineFilter: Hashable, Equatable, Identifiable {
|
|||
|
||||
case home, local, federated, trending
|
||||
case hashtag(tag: String, accountId: String?)
|
||||
case tagGroup(title: String, tags: [String])
|
||||
case tagGroup(title: String, tags: [String], symbolName: String?)
|
||||
case list(list: Models.List)
|
||||
case remoteLocal(server: String, filter: RemoteTimelineFilter)
|
||||
case latest
|
||||
|
@ -81,7 +81,7 @@ public enum TimelineFilter: Hashable, Equatable, Identifiable {
|
|||
"Home"
|
||||
case let .hashtag(tag, _):
|
||||
"#\(tag)"
|
||||
case let .tagGroup(title, _):
|
||||
case let .tagGroup(title, _, _):
|
||||
title
|
||||
case let .list(list):
|
||||
list.title
|
||||
|
@ -106,7 +106,7 @@ public enum TimelineFilter: Hashable, Equatable, Identifiable {
|
|||
"timeline.home"
|
||||
case let .hashtag(tag, _):
|
||||
"#\(tag)"
|
||||
case let .tagGroup(title, _):
|
||||
case let .tagGroup(title, _, _):
|
||||
LocalizedStringKey(title) // ?? not sure since this can't be localized.
|
||||
case let .list(list):
|
||||
LocalizedStringKey(list.title)
|
||||
|
@ -133,8 +133,8 @@ public enum TimelineFilter: Hashable, Equatable, Identifiable {
|
|||
"list.bullet"
|
||||
case .remoteLocal:
|
||||
"dot.radiowaves.right"
|
||||
case .tagGroup:
|
||||
"tag"
|
||||
case let .tagGroup(_, _, symbolName):
|
||||
symbolName ?? "tag"
|
||||
case .hashtag:
|
||||
"number"
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ public enum TimelineFilter: Hashable, Equatable, Identifiable {
|
|||
} else {
|
||||
return Timelines.hashtag(tag: tag, additional: nil, maxId: maxId, minId: minId)
|
||||
}
|
||||
case let .tagGroup(_, tags):
|
||||
case let .tagGroup(_, tags, _):
|
||||
var tags = tags
|
||||
if !tags.isEmpty {
|
||||
let tag = tags.removeFirst()
|
||||
|
@ -214,9 +214,11 @@ extension TimelineFilter: Codable {
|
|||
var nestedContainer = try container.nestedUnkeyedContainer(forKey: .tagGroup)
|
||||
let title = try nestedContainer.decode(String.self)
|
||||
let tags = try nestedContainer.decode([String].self)
|
||||
let symbolName = try? nestedContainer.decode(String.self)
|
||||
self = .tagGroup(
|
||||
title: title,
|
||||
tags: tags
|
||||
tags: tags,
|
||||
symbolName: symbolName
|
||||
)
|
||||
case .list:
|
||||
let list = try container.decode(
|
||||
|
@ -259,10 +261,11 @@ extension TimelineFilter: Codable {
|
|||
var nestedContainer = container.nestedUnkeyedContainer(forKey: .hashtag)
|
||||
try nestedContainer.encode(tag)
|
||||
try nestedContainer.encode(accountId)
|
||||
case let .tagGroup(title, tags):
|
||||
case let .tagGroup(title, tags, symbolName):
|
||||
var nestedContainer = container.nestedUnkeyedContainer(forKey: .tagGroup)
|
||||
try nestedContainer.encode(title)
|
||||
try nestedContainer.encode(tags)
|
||||
try? nestedContainer.encode(symbolName)
|
||||
case let .list(list):
|
||||
try container.encode(list, forKey: .list)
|
||||
case let .remoteLocal(server, filter):
|
||||
|
|
|
@ -28,7 +28,7 @@ struct TimelineTagGroupheaderView: View {
|
|||
.scrollIndicators(.hidden)
|
||||
Button("status.action.edit") {
|
||||
routerPath.presentedSheet = .editTagGroup(tagGroup: group, onSaved: { group in
|
||||
timeline = .tagGroup(title: group.title, tags: group.tags)
|
||||
timeline = .tagGroup(title: group.title, tags: group.tags, symbolName: group.symbolName)
|
||||
})
|
||||
}
|
||||
.buttonStyle(.bordered)
|
||||
|
|
Loading…
Reference in a new issue