mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-22 08:10:59 +00:00
View muted and blocked users
This commit is contained in:
parent
637b926db0
commit
32541e68e1
5 changed files with 38 additions and 4 deletions
|
@ -50,6 +50,7 @@
|
||||||
"pending.pending-confirmation" = "Your account is pending confirmation";
|
"pending.pending-confirmation" = "Your account is pending confirmation";
|
||||||
"preferences" = "Preferences";
|
"preferences" = "Preferences";
|
||||||
"preferences.app" = "App Preferences";
|
"preferences.app" = "App Preferences";
|
||||||
|
"preferences.blocked-users" = "Blocked Users";
|
||||||
"preferences.media" = "Media";
|
"preferences.media" = "Media";
|
||||||
"preferences.media.use-system-reduce-motion" = "Use system reduce motion setting";
|
"preferences.media.use-system-reduce-motion" = "Use system reduce motion setting";
|
||||||
"preferences.media.avatars" = "Avatars";
|
"preferences.media.avatars" = "Avatars";
|
||||||
|
@ -83,6 +84,7 @@
|
||||||
"preferences.notification-types.reblog" = "Reblog";
|
"preferences.notification-types.reblog" = "Reblog";
|
||||||
"preferences.notification-types.mention" = "Mention";
|
"preferences.notification-types.mention" = "Mention";
|
||||||
"preferences.notification-types.poll" = "Poll";
|
"preferences.notification-types.poll" = "Poll";
|
||||||
|
"preferences.muted-users" = "Muted Users";
|
||||||
"preferences.startup-and-syncing" = "Startup and Syncing";
|
"preferences.startup-and-syncing" = "Startup and Syncing";
|
||||||
"preferences.startup-and-syncing.home-timeline" = "Home timeline";
|
"preferences.startup-and-syncing.home-timeline" = "Home timeline";
|
||||||
"preferences.startup-and-syncing.notifications-tab" = "Notifications tab";
|
"preferences.startup-and-syncing.notifications-tab" = "Notifications tab";
|
||||||
|
|
|
@ -7,6 +7,8 @@ import Mastodon
|
||||||
public enum AccountsEndpoint {
|
public enum AccountsEndpoint {
|
||||||
case rebloggedBy(id: Status.Id)
|
case rebloggedBy(id: Status.Id)
|
||||||
case favouritedBy(id: Status.Id)
|
case favouritedBy(id: Status.Id)
|
||||||
|
case mutes
|
||||||
|
case blocks
|
||||||
}
|
}
|
||||||
|
|
||||||
extension AccountsEndpoint: Endpoint {
|
extension AccountsEndpoint: Endpoint {
|
||||||
|
@ -16,6 +18,8 @@ extension AccountsEndpoint: Endpoint {
|
||||||
switch self {
|
switch self {
|
||||||
case .rebloggedBy, .favouritedBy:
|
case .rebloggedBy, .favouritedBy:
|
||||||
return defaultContext + ["statuses"]
|
return defaultContext + ["statuses"]
|
||||||
|
case .mutes, .blocks:
|
||||||
|
return defaultContext
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,13 +29,14 @@ extension AccountsEndpoint: Endpoint {
|
||||||
return [id, "reblogged_by"]
|
return [id, "reblogged_by"]
|
||||||
case let .favouritedBy(id):
|
case let .favouritedBy(id):
|
||||||
return [id, "favourited_by"]
|
return [id, "favourited_by"]
|
||||||
|
case .mutes:
|
||||||
|
return ["mutes"]
|
||||||
|
case .blocks:
|
||||||
|
return ["blocks"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public var method: HTTPMethod {
|
public var method: HTTPMethod {
|
||||||
switch self {
|
.get
|
||||||
case .rebloggedBy, .favouritedBy:
|
|
||||||
return .get
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,6 +210,13 @@ public extension IdentityService {
|
||||||
TimelineService(timeline: timeline, mastodonAPIClient: mastodonAPIClient, contentDatabase: contentDatabase)
|
TimelineService(timeline: timeline, mastodonAPIClient: mastodonAPIClient, contentDatabase: contentDatabase)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func service(accountList: AccountsEndpoint) -> AccountListService {
|
||||||
|
AccountListService(
|
||||||
|
endpoint: accountList,
|
||||||
|
mastodonAPIClient: mastodonAPIClient,
|
||||||
|
contentDatabase: contentDatabase)
|
||||||
|
}
|
||||||
|
|
||||||
func notificationsService() -> NotificationsService {
|
func notificationsService() -> NotificationsService {
|
||||||
NotificationsService(mastodonAPIClient: mastodonAPIClient, contentDatabase: contentDatabase)
|
NotificationsService(mastodonAPIClient: mastodonAPIClient, contentDatabase: contentDatabase)
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,3 +16,17 @@ public final class PreferencesViewModel: ObservableObject {
|
||||||
shouldShowNotificationTypePreferences = identification.identity.lastRegisteredDeviceToken != nil
|
shouldShowNotificationTypePreferences = identification.identity.lastRegisteredDeviceToken != nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public extension PreferencesViewModel {
|
||||||
|
func mutedUsersViewModel() -> CollectionViewModel {
|
||||||
|
CollectionItemsViewModel(
|
||||||
|
collectionService: identification.service.service(accountList: .mutes),
|
||||||
|
identification: identification)
|
||||||
|
}
|
||||||
|
|
||||||
|
func blockedUsersViewModel() -> CollectionViewModel {
|
||||||
|
CollectionItemsViewModel(
|
||||||
|
collectionService: identification.service.service(accountList: .blocks),
|
||||||
|
identification: identification)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -21,6 +21,12 @@ struct PreferencesView: View {
|
||||||
destination: NotificationTypesPreferencesView(
|
destination: NotificationTypesPreferencesView(
|
||||||
viewModel: .init(identification: identification)))
|
viewModel: .init(identification: identification)))
|
||||||
}
|
}
|
||||||
|
NavigationLink("preferences.muted-users",
|
||||||
|
destination: TableView(viewModel: viewModel.mutedUsersViewModel())
|
||||||
|
.navigationTitle(Text("preferences.muted-users")))
|
||||||
|
NavigationLink("preferences.blocked-users",
|
||||||
|
destination: TableView(viewModel: viewModel.blockedUsersViewModel())
|
||||||
|
.navigationTitle(Text("preferences.blocked-users")))
|
||||||
}
|
}
|
||||||
Section(header: Text("preferences.app")) {
|
Section(header: Text("preferences.app")) {
|
||||||
NavigationLink("preferences.media",
|
NavigationLink("preferences.media",
|
||||||
|
|
Loading…
Reference in a new issue