From 7f00ef5d9d61be9b968862bb9e93bcf4c561e1d6 Mon Sep 17 00:00:00 2001 From: chungwwei <39935368+chungwwei@users.noreply.github.com> Date: Wed, 21 Aug 2024 19:25:29 -0400 Subject: [PATCH] Add mute button to ProfileActionSheet This PR adds mute button to ProfileActionSheet, allowing user to quick mute npubs/bots Changelog-Added: Added mute button to ProfileActionSheet Signed-off-by: chungwwei --- damus/Views/ProfileActionSheetView.swift | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/damus/Views/ProfileActionSheetView.swift b/damus/Views/ProfileActionSheetView.swift index f2f7abd6..c9748b0d 100644 --- a/damus/Views/ProfileActionSheetView.swift +++ b/damus/Views/ProfileActionSheetView.swift @@ -45,6 +45,21 @@ struct ProfileActionSheetView: View { ) } + var muteButton: some View { + let target_pubkey = self.profile.pubkey + return VStack(alignment: .center, spacing: 10) { + MuteDurationMenu { duration in + notify(.mute(.user(target_pubkey, duration?.date_from_now))) + } label: { + Image("mute") + } + .buttonStyle(NeutralButtonShape.circle.style) + Text("Mute", comment: "Button label that allows the user to mute the user shown on-screen") + .foregroundStyle(.secondary) + .font(.caption) + } + } + var dmButton: some View { let dm_model = damus_state.dms.lookup_or_create(profile.pubkey) return VStack(alignment: .center, spacing: 10) { @@ -103,6 +118,9 @@ struct ProfileActionSheetView: View { self.followButton self.zapButton self.dmButton + if damus_state.keypair.pubkey != profile.pubkey && damus_state.keypair.privkey != nil { + self.muteButton + } } .padding()