mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-29 03:21:02 +00:00
View bookmarks
This commit is contained in:
parent
02cc1e3533
commit
2fc7b4dad8
9 changed files with 29 additions and 5 deletions
|
@ -44,7 +44,7 @@ extension TimelineRecord {
|
||||||
id = timeline.id
|
id = timeline.id
|
||||||
|
|
||||||
switch timeline {
|
switch timeline {
|
||||||
case .home, .local, .federated, .favorites:
|
case .home, .local, .federated, .favorites, .bookmarks:
|
||||||
listId = nil
|
listId = nil
|
||||||
listTitle = nil
|
listTitle = nil
|
||||||
tag = nil
|
tag = nil
|
||||||
|
|
|
@ -11,6 +11,7 @@ public enum Timeline: Hashable {
|
||||||
case tag(String)
|
case tag(String)
|
||||||
case profile(accountId: Account.Id, profileCollection: ProfileCollection)
|
case profile(accountId: Account.Id, profileCollection: ProfileCollection)
|
||||||
case favorites
|
case favorites
|
||||||
|
case bookmarks
|
||||||
}
|
}
|
||||||
|
|
||||||
public extension Timeline {
|
public extension Timeline {
|
||||||
|
@ -50,6 +51,8 @@ extension Timeline: Identifiable {
|
||||||
return "profile-\(accountId)-\(profileCollection)"
|
return "profile-\(accountId)-\(profileCollection)"
|
||||||
case .favorites:
|
case .favorites:
|
||||||
return "favorites"
|
return "favorites"
|
||||||
|
case .bookmarks:
|
||||||
|
return "bookmarks"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,8 @@ extension Timeline {
|
||||||
self = .profile(accountId: accountId, profileCollection: profileCollection)
|
self = .profile(accountId: accountId, profileCollection: profileCollection)
|
||||||
case (Timeline.favorites.id, _, _, _, _, _):
|
case (Timeline.favorites.id, _, _, _, _, _):
|
||||||
self = .favorites
|
self = .favorites
|
||||||
|
case (Timeline.bookmarks.id, _, _, _, _, _):
|
||||||
|
self = .bookmarks
|
||||||
default:
|
default:
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
"add-identity.unable-to-connect-to-instance" = "Unable to connect to instance";
|
"add-identity.unable-to-connect-to-instance" = "Unable to connect to instance";
|
||||||
"attachment.sensitive-content" = "Sensitive content";
|
"attachment.sensitive-content" = "Sensitive content";
|
||||||
"attachment.media-hidden" = "Media hidden";
|
"attachment.media-hidden" = "Media hidden";
|
||||||
|
"bookmarks" = "Bookmarks";
|
||||||
"cancel" = "Cancel";
|
"cancel" = "Cancel";
|
||||||
"favorites" = "Favorites";
|
"favorites" = "Favorites";
|
||||||
"registration.review-terms-of-use-and-privacy-policy-%@" = "Please review %@'s Terms of Use and Privacy Policy to continue";
|
"registration.review-terms-of-use-and-privacy-policy-%@" = "Please review %@'s Terms of Use and Privacy Policy to continue";
|
||||||
|
|
|
@ -11,6 +11,7 @@ public enum StatusesEndpoint {
|
||||||
case timelinesList(id: List.Id)
|
case timelinesList(id: List.Id)
|
||||||
case accountsStatuses(id: Account.Id, excludeReplies: Bool, onlyMedia: Bool, pinned: Bool)
|
case accountsStatuses(id: Account.Id, excludeReplies: Bool, onlyMedia: Bool, pinned: Bool)
|
||||||
case favourites
|
case favourites
|
||||||
|
case bookmarks
|
||||||
}
|
}
|
||||||
|
|
||||||
extension StatusesEndpoint: Endpoint {
|
extension StatusesEndpoint: Endpoint {
|
||||||
|
@ -22,7 +23,7 @@ extension StatusesEndpoint: Endpoint {
|
||||||
return defaultContext + ["timelines"]
|
return defaultContext + ["timelines"]
|
||||||
case .accountsStatuses:
|
case .accountsStatuses:
|
||||||
return defaultContext + ["accounts"]
|
return defaultContext + ["accounts"]
|
||||||
case .favourites:
|
case .favourites, .bookmarks:
|
||||||
return defaultContext
|
return defaultContext
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,6 +42,8 @@ extension StatusesEndpoint: Endpoint {
|
||||||
return [id, "statuses"]
|
return [id, "statuses"]
|
||||||
case .favourites:
|
case .favourites:
|
||||||
return ["favourites"]
|
return ["favourites"]
|
||||||
|
case .bookmarks:
|
||||||
|
return ["bookmarks"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,8 @@ extension Timeline {
|
||||||
pinned: false)
|
pinned: false)
|
||||||
case .favorites:
|
case .favorites:
|
||||||
return .favourites
|
return .favourites
|
||||||
|
case .bookmarks:
|
||||||
|
return .bookmarks
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ public extension NavigationViewModel {
|
||||||
switch timeline {
|
switch timeline {
|
||||||
case .home, .list:
|
case .home, .list:
|
||||||
return identification.identity.handle
|
return identification.identity.handle
|
||||||
case .local, .federated, .tag, .profile, .favorites:
|
case .local, .federated, .tag, .profile, .favorites, .bookmarks:
|
||||||
return identification.identity.instance?.uri ?? ""
|
return identification.identity.instance?.uri ?? ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,6 +146,12 @@ public extension NavigationViewModel {
|
||||||
collectionService: identification.service.service(timeline: .favorites),
|
collectionService: identification.service.service(timeline: .favorites),
|
||||||
identification: identification)
|
identification: identification)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func bookmarksViewModel() -> CollectionViewModel {
|
||||||
|
CollectionItemsViewModel(
|
||||||
|
collectionService: identification.service.service(timeline: .bookmarks),
|
||||||
|
identification: identification)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension NavigationViewModel.Tab: Identifiable {
|
extension NavigationViewModel.Tab: Identifiable {
|
||||||
|
|
|
@ -58,7 +58,11 @@ struct SecondaryNavigationView: View {
|
||||||
}
|
}
|
||||||
NavigationLink(destination: TableView(viewModel: viewModel.favoritesViewModel())
|
NavigationLink(destination: TableView(viewModel: viewModel.favoritesViewModel())
|
||||||
.navigationTitle(Text("favorites"))) {
|
.navigationTitle(Text("favorites"))) {
|
||||||
Label("favorites", systemImage: "star.fill")
|
Label("favorites", systemImage: "star")
|
||||||
|
}
|
||||||
|
NavigationLink(destination: TableView(viewModel: viewModel.bookmarksViewModel())
|
||||||
|
.navigationTitle(Text("bookmarks"))) {
|
||||||
|
Label("bookmarks", systemImage: "bookmark")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Section {
|
Section {
|
||||||
|
|
|
@ -161,6 +161,8 @@ private extension Timeline {
|
||||||
return ""
|
return ""
|
||||||
case .favorites:
|
case .favorites:
|
||||||
return NSLocalizedString("favorites", comment: "")
|
return NSLocalizedString("favorites", comment: "")
|
||||||
|
case .bookmarks:
|
||||||
|
return NSLocalizedString("bookmarks", comment: "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +174,8 @@ private extension Timeline {
|
||||||
case .list: return "scroll"
|
case .list: return "scroll"
|
||||||
case .tag: return "number"
|
case .tag: return "number"
|
||||||
case .profile: return "person"
|
case .profile: return "person"
|
||||||
case .favorites: return "star.fill"
|
case .favorites: return "star"
|
||||||
|
case .bookmarks: return "bookmark"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue