diff --git a/IceCubesApp/Resources/Localization/de.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/de.lproj/Localizable.strings index 333a0255..2607041b 100644 --- a/IceCubesApp/Resources/Localization/de.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/de.lproj/Localizable.strings @@ -141,6 +141,10 @@ "account.action.edit-info" = "Info bearbeiten"; "account.action.mention" = "Erwähnen"; "account.action.message" = "Nachricht"; +"account.action.notify-enable" = "Enable Notifications"; +"account.action.notify-disable" = "Disable Notifications"; +"account.action.reboosts-show" = "Show Boosts"; +"account.action.reboosts-hide" = "Hide Boosts"; "account.action.block" = "Blockieren"; "account.action.unblock" = "Block aufheben"; "account.action.mute" = "Stummschalten"; diff --git a/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings index 4c413b98..94e57acd 100644 --- a/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings @@ -144,6 +144,10 @@ "account.action.edit-info" = "Edit Info"; "account.action.mention" = "Mention"; "account.action.message" = "Message"; +"account.action.notify-enable" = "Enable Notifications"; +"account.action.notify-disable" = "Disable Notifications"; +"account.action.reboosts-show" = "Show Boosts"; +"account.action.reboosts-hide" = "Hide Boosts"; "account.action.block" = "Block"; "account.action.unblock" = "Unblock"; "account.action.mute" = "Mute"; diff --git a/IceCubesApp/Resources/Localization/es.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/es.lproj/Localizable.strings index 2c8b431b..3e568b72 100644 --- a/IceCubesApp/Resources/Localization/es.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/es.lproj/Localizable.strings @@ -144,6 +144,10 @@ "account.action.edit-info" = "Editar información"; "account.action.mention" = "Mencionar"; "account.action.message" = "Enviar mensaje"; +"account.action.notify-enable" = "Enable Notifications"; +"account.action.notify-disable" = "Disable Notifications"; +"account.action.reboosts-show" = "Show Boosts"; +"account.action.reboosts-hide" = "Hide Boosts"; "account.action.block" = "Bloquear"; "account.action.unblock" = "Desbloquear"; "account.action.mute" = "Silenciar"; diff --git a/IceCubesApp/Resources/Localization/it.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/it.lproj/Localizable.strings index a279a649..e52188bc 100644 --- a/IceCubesApp/Resources/Localization/it.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/it.lproj/Localizable.strings @@ -141,6 +141,10 @@ "account.action.edit-info" = "Modifica informazioni"; "account.action.mention" = "Menziona"; "account.action.message" = "Messaggio"; +"account.action.notify-enable" = "Enable Notifications"; +"account.action.notify-disable" = "Disable Notifications"; +"account.action.reboosts-show" = "Show Boosts"; +"account.action.reboosts-hide" = "Hide Boosts"; "account.action.block" = "Blocca"; "account.action.unblock" = "Sblocca"; "account.action.mute" = "Silenzia"; diff --git a/IceCubesApp/Resources/Localization/ja.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/ja.lproj/Localizable.strings index c50dd39d..c65151a9 100644 --- a/IceCubesApp/Resources/Localization/ja.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/ja.lproj/Localizable.strings @@ -127,6 +127,10 @@ "account.action.edit-info" = "プロフィールを編集"; "account.action.mention" = "返信"; "account.action.message" = "メッセージ"; +"account.action.notify-enable" = "Enable Notifications"; +"account.action.notify-disable" = "Disable Notifications"; +"account.action.reboosts-show" = "Show Boosts"; +"account.action.reboosts-hide" = "Hide Boosts"; "account.action.block" = "ブロック"; "account.action.unblock" = "ブロック解除"; "account.action.mute" = "ミュート"; diff --git a/IceCubesApp/Resources/Localization/nl.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/nl.lproj/Localizable.strings index a14fc685..f0bb6d2c 100644 --- a/IceCubesApp/Resources/Localization/nl.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/nl.lproj/Localizable.strings @@ -141,6 +141,10 @@ "account.action.edit-info" = "Bewerken"; "account.action.mention" = "Vermelden"; "account.action.message" = "Bericht sturen"; +"account.action.notify-enable" = "Enable Notifications"; +"account.action.notify-disable" = "Disable Notifications"; +"account.action.reboosts-show" = "Show Boosts"; +"account.action.reboosts-hide" = "Hide Boosts"; "account.action.block" = "Blokkeren"; "account.action.unblock" = "Deblokkeren"; "account.action.mute" = "Dempen"; diff --git a/IceCubesApp/Resources/Localization/tr.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/tr.lproj/Localizable.strings index d2ceaee6..50c5e0b0 100644 --- a/IceCubesApp/Resources/Localization/tr.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/tr.lproj/Localizable.strings @@ -131,6 +131,10 @@ "account.action.edit-info" = "Bilgiyi Düzenle"; "account.action.mention" = "Bahset"; "account.action.message" = "Mesaj Gönder"; +"account.action.notify-enable" = "Enable Notifications"; +"account.action.notify-disable" = "Disable Notifications"; +"account.action.reboosts-show" = "Show Boosts"; +"account.action.reboosts-hide" = "Hide Boosts"; "account.action.block" = "Engelle"; "account.action.unblock" = "Engeli Kaldır"; "account.action.mute" = "Sustur"; diff --git a/IceCubesApp/Resources/Localization/zh-Hans.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/zh-Hans.lproj/Localizable.strings index b06af0bd..c6b6fe98 100644 --- a/IceCubesApp/Resources/Localization/zh-Hans.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/zh-Hans.lproj/Localizable.strings @@ -142,6 +142,10 @@ "account.action.edit-info" = "编辑个人资料"; "account.action.mention" = "提及"; "account.action.message" = "私信"; +"account.action.notify-enable" = "Enable Notifications"; +"account.action.notify-disable" = "Disable Notifications"; +"account.action.reboosts-show" = "Show Boosts"; +"account.action.reboosts-hide" = "Hide Boosts"; "account.action.block" = "拉黑"; "account.action.unblock" = "取消拉黑"; "account.action.mute" = "免打扰"; diff --git a/Packages/Account/Sources/Account/AccountDetailView.swift b/Packages/Account/Sources/Account/AccountDetailView.swift index aa001806..a3127291 100644 --- a/Packages/Account/Sources/Account/AccountDetailView.swift +++ b/Packages/Account/Sources/Account/AccountDetailView.swift @@ -421,6 +421,66 @@ public struct AccountDetailView: View { Label("account.action.mute", systemImage: "speaker.slash") } } + + if let relationship = viewModel.relationship, + relationship.following + { + if relationship.notifying { + Button { + Task { + do { + viewModel.relationship = try await client.post(endpoint: Accounts.unmute(id: account.id)) + } catch { + print("Error while disabling notifications: \(error.localizedDescription)") + } + } + } label: { + Label("account.action.notify-disable", systemImage: "bell.fill") + } + } else { + Button { + Task { + do { + viewModel.relationship = try await client.post(endpoint: Accounts.mute(id: account.id)) + } catch { + print("Error while enabling notifications: \(error.localizedDescription)") + } + } + } label: { + Label("account.action.notify-enable", systemImage: "bell") + } + } + if relationship.showingReblogs { + Button { + Task { + do { + viewModel.relationship = try await client.post(endpoint: Accounts.follow(id: account.id, + notify: relationship.notifying, + reblogs: false)) + } catch { + print("Error while disabling reboosts: \(error.localizedDescription)") + } + } + } label: { + Label("account.action.reboosts-hide", systemImage: "arrow.left.arrow.right.circle.fill") + } + } else { + Button { + Task { + do { + viewModel.relationship = try await client.post(endpoint: Accounts.follow(id: account.id, + notify: relationship.notifying, + reblogs: true)) + } catch { + print("Error while enabling reboosts: \(error.localizedDescription)") + } + } + } label: { + Label("account.action.reboosts-show", systemImage: "arrow.left.arrow.right.circle") + } + } + } + Divider() } @@ -451,7 +511,7 @@ public struct AccountDetailView: View { } } } label: { - Image(systemName: "ellipsis") + Image(systemName: "ellipsis.circle.fill") } } } diff --git a/Packages/Account/Sources/Account/Follow/FollowButton.swift b/Packages/Account/Sources/Account/Follow/FollowButton.swift index 0a624918..387ead79 100644 --- a/Packages/Account/Sources/Account/Follow/FollowButton.swift +++ b/Packages/Account/Sources/Account/Follow/FollowButton.swift @@ -82,7 +82,7 @@ public struct FollowButton: View { } public var body: some View { - VStack { + VStack(alignment: .trailing) { Button { Task { if viewModel.relationship.following { @@ -98,9 +98,9 @@ public struct FollowButton: View { Text(viewModel.relationship.following ? "account.follow.following" : "account.follow.follow") } } - .buttonStyle(.bordered) - .disabled(viewModel.isUpdating) - if viewModel.relationship.following, viewModel.shouldDisplayNotify { + if viewModel.relationship.following, + viewModel.shouldDisplayNotify + { HStack { Button { Task { @@ -109,9 +109,6 @@ public struct FollowButton: View { } label: { Image(systemName: viewModel.relationship.notifying ? "bell.fill" : "bell") } - .buttonStyle(.bordered) - .disabled(viewModel.isUpdating) - Button { Task { await viewModel.toggleReboosts() @@ -119,11 +116,11 @@ public struct FollowButton: View { } label: { Image(systemName: viewModel.relationship.showingReblogs ? "arrow.left.arrow.right.circle.fill" : "arrow.left.arrow.right.circle") } - .buttonStyle(.bordered) - .disabled(viewModel.isUpdating) } } } + .buttonStyle(.bordered) + .disabled(viewModel.isUpdating) .onAppear { viewModel.client = client }