From 20cecfd178ada8dc1e530e1f454890803f5bd178 Mon Sep 17 00:00:00 2001 From: mplorentz Date: Thu, 24 Oct 2024 12:06:05 -0400 Subject: [PATCH 1/3] Change our mute UI to use the term 'block' --- CHANGELOG.md | 1 + Nos/Assets/Localization/Localizable.xcstrings | 174 +++++++++--------- 2 files changed, 88 insertions(+), 87 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7d355d65..689dd9c67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated the Age Verification onboarding screen. Currently behind the “New Onboarding Flow” feature flag. [#1651](https://github.com/planetary-social/nos/issues/1651) - Track opening mentions with Posthog. [#1480](https://github.com/planetary-social/nos/issues/1480) - Avoid crash and print extra debugging details when a reposted note that has not finished loading is clicked. [#1669](https://github.com/planetary-social/nos/issues/1669) +- Changed the term "mute" to "block". ## [0.2.2] - 2024-10-11Z diff --git a/Nos/Assets/Localization/Localizable.xcstrings b/Nos/Assets/Localization/Localizable.xcstrings index 159f44005..01a093a61 100644 --- a/Nos/Assets/Localization/Localizable.xcstrings +++ b/Nos/Assets/Localization/Localizable.xcstrings @@ -7747,24 +7747,24 @@ "en" : { "stringUnit" : { "state" : "translated", - "value" : "Don't Mute" + "value" : "Don't Block" } }, "es" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "No Silenciar" } }, "ko" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "뮤트하지 않기" } }, "zh-Hans" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "不静音" } } @@ -7887,24 +7887,24 @@ "en" : { "stringUnit" : { "state" : "translated", - "value" : "Mute This User?" + "value" : "Block This User?" } }, "es" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "¿Silenciar a este usuario?" } }, "ko" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "이 유저를 뮤트할건가요?" } }, "zh-Hans" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "静音此用户?" } } @@ -7945,24 +7945,24 @@ "en" : { "stringUnit" : { "state" : "translated", - "value" : "Mute" + "value" : "Block" } }, "es" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Silenciar" } }, "ko" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "뮤트" } }, "zh-Hans" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "静音" } } @@ -10661,73 +10661,73 @@ "localizations" : { "de" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Stummschalten" } }, "en" : { "stringUnit" : { "state" : "translated", - "value" : "Mute" + "value" : "Block" } }, "es" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Silenciar" } }, "fa" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "بی‌صدا" } }, "fr" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Silence" } }, "ja" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "ミュート" } }, "ko" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "뮤트" } }, "nl" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Dempen" } }, "sv" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Tysta" } }, "sw" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Nyamazisha" } }, "zh-Hans" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "静音" } }, "zh-Hant" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "靜音" } } @@ -10738,73 +10738,73 @@ "localizations" : { "de" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Stumm geschaltet" } }, "en" : { "stringUnit" : { "state" : "translated", - "value" : "Muted" + "value" : "Blocked" } }, "es" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Silenciado" } }, "fa" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "بی صدا شده" } }, "fr" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "En sourdine" } }, "ja" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "ミュート" } }, "ko" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "뮤트됨" } }, "nl" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Gedempt" } }, "sv" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Tystad" } }, "sw" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Imenyamazishwa" } }, "zh-Hans" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "已静音" } }, "zh-Hant" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "已靜音" } } @@ -10815,67 +10815,67 @@ "localizations" : { "de" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Stummgeschaltete Benutzer" } }, "en" : { "stringUnit" : { "state" : "translated", - "value" : "Muted Users" + "value" : "Blocked Users" } }, "es" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Usuarios Silenciados" } }, "fa" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "کاربران بی صدا شده" } }, "fr" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Utilisateurs en sourdine" } }, "ja" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "ミュートしたユーザー" } }, "ko" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "뮤트한 사용자" } }, "sv" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Tystade användare" } }, "sw" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Watumiaji Walionyamazishwa" } }, "zh-Hans" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "已静音的用户" } }, "zh-Hant" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "已靜音的用戶" } } @@ -10886,73 +10886,73 @@ "localizations" : { "de" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Möchtest du %@ stummschalten?" } }, "en" : { "stringUnit" : { "state" : "translated", - "value" : "Would you like to mute %@?" + "value" : "Would you like to block %@?" } }, "es" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "¿Te gustaría silenciar a %@?" } }, "fa" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "می خواهید %@ را بیصدا کنید؟" } }, "fr" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Voulez-vous mettre en sourdine %@?" } }, "ja" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "%@ をミュートしますか?" } }, "ko" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "%@를 뮤트하실건가요?" } }, "nl" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Wil je %@ dempen?" } }, "sv" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Vill du tysta %@?" } }, "sw" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Je, ungependa kunyamazisha %@?" } }, "zh-Hans" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "你是否想要静音 %@?" } }, "zh-Hant" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "你是否想要靜音 %@?" } } @@ -10963,79 +10963,79 @@ "localizations" : { "de" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Mute" } }, "en" : { "stringUnit" : { "state" : "translated", - "value" : "Mute User" + "value" : "Block User" } }, "es" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Silenciar Usuario" } }, "fa" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "بی صدا کردن کاربر" } }, "fr" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Mettre en sourdine" } }, "ja" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "ユーザーをミュートする" } }, "ko" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "뮤트하기" } }, "nl" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Demp gebruiker" } }, "pt-BR" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Mutar" } }, "sv" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Tysta användare" } }, "sw" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Nyamazisha Mtumiaji" } }, "zh-Hans" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "静音用户" } }, "zh-Hant" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "靜音用戶" } } @@ -13964,7 +13964,7 @@ "en" : { "stringUnit" : { "state" : "translated", - "value" : "Your **@username** is your identity in the Nos community.\u2028\nChoose a name that reflects you or your organization. Make it memorable and distinct!" + "value" : "Your **@username** is your identity in the Nos community.
\nChoose a name that reflects you or your organization. Make it memorable and distinct!" } }, "es" : { @@ -18840,79 +18840,79 @@ "localizations" : { "de" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Stummschaltung aufheben" } }, "en" : { "stringUnit" : { "state" : "translated", - "value" : "Un-Mute" + "value" : "Un-Block" } }, "es" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Desilenciar" } }, "fa" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "باصدا کردن" } }, "fr" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Démuseler" } }, "ja" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "ミュート解除" } }, "ko" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "뮤트 해제" } }, "nl" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Dempen opheffen" } }, "pt-BR" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Desfazer mutado" } }, "sv" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Av-tysta" } }, "sw" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "Acha Kunyamazisha" } }, "zh-Hans" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "取消静音" } }, "zh-Hant" : { "stringUnit" : { - "state" : "translated", + "state" : "needs_review", "value" : "取消靜音" } } @@ -19225,7 +19225,7 @@ "en" : { "stringUnit" : { "state" : "translated", - "value" : "Well done, you've successfully claimed your **@username**!\u2028\nYou can share this name with other people in the Nostr and Fediverse communities to make it easy to find you." + "value" : "Well done, you've successfully claimed your **@username**!
\nYou can share this name with other people in the Nostr and Fediverse communities to make it easy to find you." } }, "es" : { From 0592015f68308f0035819dbb1edbe722ba47b6e2 Mon Sep 17 00:00:00 2001 From: mplorentz Date: Thu, 24 Oct 2024 12:20:28 -0400 Subject: [PATCH 2/3] Hide notes from blocked users on their profile page --- Nos/Views/Fixtures/PreviewData.swift | 10 +++ Nos/Views/Profile/ProfileView.swift | 92 ++++++++++++++++++++-------- 2 files changed, 75 insertions(+), 27 deletions(-) diff --git a/Nos/Views/Fixtures/PreviewData.swift b/Nos/Views/Fixtures/PreviewData.swift index cac451732..18124ed89 100644 --- a/Nos/Views/Fixtures/PreviewData.swift +++ b/Nos/Views/Fixtures/PreviewData.swift @@ -65,6 +65,16 @@ struct PreviewData { return author }() + lazy var blockedUser: Author = { + let author = try! Author.findOrCreate(by: KeyFixture.eve.publicKeyHex, context: previewContext) + author.name = "Sam" + author.about = "I am a terrible person" + author.muted = true + author.nip05 = "sam@nos.social" + + return author + }() + // MARK: - Notes lazy var shortNote: Event = { diff --git a/Nos/Views/Profile/ProfileView.swift b/Nos/Views/Profile/ProfileView.swift index 6dfdd6042..7c836140b 100644 --- a/Nos/Views/Profile/ProfileView.swift +++ b/Nos/Views/Profile/ProfileView.swift @@ -81,33 +81,11 @@ struct ProfileView: View { var body: some View { VStack(spacing: 0) { VStack { - PagedNoteListView( - refreshController: $refreshController, - databaseFilter: databaseFilter, - relayFilter: selectedTab.relayFilter(author: author), - relay: nil, - managedObjectContext: viewContext, - tab: .profile, - header: { - ProfileHeader(author: author, selectedTab: $selectedTab) - .compositingGroup() - .shadow(color: .profileShadow, radius: 10, x: 0, y: 4) - }, - emptyPlaceholder: { - VStack { - Text("noEventsOnProfile") - .padding() - .readabilityPadding() - - SecondaryActionButton("tapToRefresh") { - refreshController.startRefresh = true - } - } - .frame(minHeight: 300) - } - ) - .padding(0) - .id(selectedTab) + if author.muted { + blockedUserListView + } else { + noteListView + } } .doubleTapToPop(tab: .profile, enabled: addDoubleTapToPop) { _ in NotificationCenter.default.post( @@ -219,6 +197,50 @@ struct ProfileView: View { relaySubscriptions.removeAll() } } + + var noteListView: some View { + PagedNoteListView( + refreshController: $refreshController, + databaseFilter: databaseFilter, + relayFilter: selectedTab.relayFilter(author: author), + relay: nil, + managedObjectContext: viewContext, + tab: .profile, + header: { + ProfileHeader(author: author, selectedTab: $selectedTab) + .compositingGroup() + .shadow(color: .profileShadow, radius: 10, x: 0, y: 4) + }, + emptyPlaceholder: { + VStack { + Text("noEventsOnProfile") + .padding() + .readabilityPadding() + + SecondaryActionButton("tapToRefresh") { + refreshController.startRefresh = true + } + } + .frame(minHeight: 300) + } + ) + .padding(0) + .id(selectedTab) + } + + var blockedUserListView: some View { + VStack { + ProfileHeader(author: author, selectedTab: $selectedTab) + .compositingGroup() + .shadow(color: .profileShadow, radius: 10, x: 0, y: 4) + Spacer() + Text("muted") + .padding() + .readabilityPadding() + Spacer() + } + .frame(maxHeight: .infinity) + } } #Preview("Generic user") { @@ -245,3 +267,19 @@ struct ProfileView: View { } .inject(previewData: previewData) } + +#Preview("Blocked user") { + + @Dependency(\.persistenceController) var persistenceController + + lazy var previewContext: NSManagedObjectContext = { + persistenceController.viewContext + }() + + var previewData = PreviewData(currentUserKey: KeyFixture.eve) + + return NavigationStack { + ProfileView(author: previewData.blockedUser) + } + .inject(previewData: previewData) +} From 751fffb68151477b187737cd0db8df577a7d8d32 Mon Sep 17 00:00:00 2001 From: mplorentz Date: Thu, 24 Oct 2024 12:25:49 -0400 Subject: [PATCH 3/3] update changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 689dd9c67..32e81c67e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Remove most usage of xcstringstool-generated strings to improve performance. [#1458](https://github.com/planetary-social/nos/issues/1458) - Added new authors and categories to the Discover tab. [#1592](https://github.com/planetary-social/nos/issues/1592) - Fix Search bar disappearing on Discover tab when scrolling. [#1679](https://github.com/planetary-social/nos/issues/1679) +- Nos now hides the notes from blocked users when viewing their profile page. [#1681](https://github.com/planetary-social/nos/pull/1681) ### Internal Changes - Added code to hide users on the Discover tab with no profile metadata. [#1592](https://github.com/planetary-social/nos/issues/1592) @@ -36,7 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated the Age Verification onboarding screen. Currently behind the “New Onboarding Flow” feature flag. [#1651](https://github.com/planetary-social/nos/issues/1651) - Track opening mentions with Posthog. [#1480](https://github.com/planetary-social/nos/issues/1480) - Avoid crash and print extra debugging details when a reposted note that has not finished loading is clicked. [#1669](https://github.com/planetary-social/nos/issues/1669) -- Changed the term "mute" to "block". +- Changed the term "mute" to "block". [#1681](https://github.com/planetary-social/nos/pull/1681) ## [0.2.2] - 2024-10-11Z