Move notification and reboosts actions into account menu (#382)
This commit is contained in:
parent
d10e71a7c3
commit
d0f16c84f7
|
@ -141,6 +141,10 @@
|
||||||
"account.action.edit-info" = "Info bearbeiten";
|
"account.action.edit-info" = "Info bearbeiten";
|
||||||
"account.action.mention" = "Erwähnen";
|
"account.action.mention" = "Erwähnen";
|
||||||
"account.action.message" = "Nachricht";
|
"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.block" = "Blockieren";
|
||||||
"account.action.unblock" = "Block aufheben";
|
"account.action.unblock" = "Block aufheben";
|
||||||
"account.action.mute" = "Stummschalten";
|
"account.action.mute" = "Stummschalten";
|
||||||
|
|
|
@ -144,6 +144,10 @@
|
||||||
"account.action.edit-info" = "Edit Info";
|
"account.action.edit-info" = "Edit Info";
|
||||||
"account.action.mention" = "Mention";
|
"account.action.mention" = "Mention";
|
||||||
"account.action.message" = "Message";
|
"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.block" = "Block";
|
||||||
"account.action.unblock" = "Unblock";
|
"account.action.unblock" = "Unblock";
|
||||||
"account.action.mute" = "Mute";
|
"account.action.mute" = "Mute";
|
||||||
|
|
|
@ -144,6 +144,10 @@
|
||||||
"account.action.edit-info" = "Editar información";
|
"account.action.edit-info" = "Editar información";
|
||||||
"account.action.mention" = "Mencionar";
|
"account.action.mention" = "Mencionar";
|
||||||
"account.action.message" = "Enviar mensaje";
|
"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.block" = "Bloquear";
|
||||||
"account.action.unblock" = "Desbloquear";
|
"account.action.unblock" = "Desbloquear";
|
||||||
"account.action.mute" = "Silenciar";
|
"account.action.mute" = "Silenciar";
|
||||||
|
|
|
@ -141,6 +141,10 @@
|
||||||
"account.action.edit-info" = "Modifica informazioni";
|
"account.action.edit-info" = "Modifica informazioni";
|
||||||
"account.action.mention" = "Menziona";
|
"account.action.mention" = "Menziona";
|
||||||
"account.action.message" = "Messaggio";
|
"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.block" = "Blocca";
|
||||||
"account.action.unblock" = "Sblocca";
|
"account.action.unblock" = "Sblocca";
|
||||||
"account.action.mute" = "Silenzia";
|
"account.action.mute" = "Silenzia";
|
||||||
|
|
|
@ -127,6 +127,10 @@
|
||||||
"account.action.edit-info" = "プロフィールを編集";
|
"account.action.edit-info" = "プロフィールを編集";
|
||||||
"account.action.mention" = "返信";
|
"account.action.mention" = "返信";
|
||||||
"account.action.message" = "メッセージ";
|
"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.block" = "ブロック";
|
||||||
"account.action.unblock" = "ブロック解除";
|
"account.action.unblock" = "ブロック解除";
|
||||||
"account.action.mute" = "ミュート";
|
"account.action.mute" = "ミュート";
|
||||||
|
|
|
@ -141,6 +141,10 @@
|
||||||
"account.action.edit-info" = "Bewerken";
|
"account.action.edit-info" = "Bewerken";
|
||||||
"account.action.mention" = "Vermelden";
|
"account.action.mention" = "Vermelden";
|
||||||
"account.action.message" = "Bericht sturen";
|
"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.block" = "Blokkeren";
|
||||||
"account.action.unblock" = "Deblokkeren";
|
"account.action.unblock" = "Deblokkeren";
|
||||||
"account.action.mute" = "Dempen";
|
"account.action.mute" = "Dempen";
|
||||||
|
|
|
@ -131,6 +131,10 @@
|
||||||
"account.action.edit-info" = "Bilgiyi Düzenle";
|
"account.action.edit-info" = "Bilgiyi Düzenle";
|
||||||
"account.action.mention" = "Bahset";
|
"account.action.mention" = "Bahset";
|
||||||
"account.action.message" = "Mesaj Gönder";
|
"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.block" = "Engelle";
|
||||||
"account.action.unblock" = "Engeli Kaldır";
|
"account.action.unblock" = "Engeli Kaldır";
|
||||||
"account.action.mute" = "Sustur";
|
"account.action.mute" = "Sustur";
|
||||||
|
|
|
@ -142,6 +142,10 @@
|
||||||
"account.action.edit-info" = "编辑个人资料";
|
"account.action.edit-info" = "编辑个人资料";
|
||||||
"account.action.mention" = "提及";
|
"account.action.mention" = "提及";
|
||||||
"account.action.message" = "私信";
|
"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.block" = "拉黑";
|
||||||
"account.action.unblock" = "取消拉黑";
|
"account.action.unblock" = "取消拉黑";
|
||||||
"account.action.mute" = "免打扰";
|
"account.action.mute" = "免打扰";
|
||||||
|
|
|
@ -421,6 +421,66 @@ public struct AccountDetailView: View {
|
||||||
Label("account.action.mute", systemImage: "speaker.slash")
|
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()
|
Divider()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,7 +511,7 @@ public struct AccountDetailView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} label: {
|
} label: {
|
||||||
Image(systemName: "ellipsis")
|
Image(systemName: "ellipsis.circle.fill")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ public struct FollowButton: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
public var body: some View {
|
public var body: some View {
|
||||||
VStack {
|
VStack(alignment: .trailing) {
|
||||||
Button {
|
Button {
|
||||||
Task {
|
Task {
|
||||||
if viewModel.relationship.following {
|
if viewModel.relationship.following {
|
||||||
|
@ -98,9 +98,9 @@ public struct FollowButton: View {
|
||||||
Text(viewModel.relationship.following ? "account.follow.following" : "account.follow.follow")
|
Text(viewModel.relationship.following ? "account.follow.following" : "account.follow.follow")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.buttonStyle(.bordered)
|
if viewModel.relationship.following,
|
||||||
.disabled(viewModel.isUpdating)
|
viewModel.shouldDisplayNotify
|
||||||
if viewModel.relationship.following, viewModel.shouldDisplayNotify {
|
{
|
||||||
HStack {
|
HStack {
|
||||||
Button {
|
Button {
|
||||||
Task {
|
Task {
|
||||||
|
@ -109,9 +109,6 @@ public struct FollowButton: View {
|
||||||
} label: {
|
} label: {
|
||||||
Image(systemName: viewModel.relationship.notifying ? "bell.fill" : "bell")
|
Image(systemName: viewModel.relationship.notifying ? "bell.fill" : "bell")
|
||||||
}
|
}
|
||||||
.buttonStyle(.bordered)
|
|
||||||
.disabled(viewModel.isUpdating)
|
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
Task {
|
Task {
|
||||||
await viewModel.toggleReboosts()
|
await viewModel.toggleReboosts()
|
||||||
|
@ -119,11 +116,11 @@ public struct FollowButton: View {
|
||||||
} label: {
|
} label: {
|
||||||
Image(systemName: viewModel.relationship.showingReblogs ? "arrow.left.arrow.right.circle.fill" : "arrow.left.arrow.right.circle")
|
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 {
|
.onAppear {
|
||||||
viewModel.client = client
|
viewModel.client = client
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue