damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit e6598928d051dbd3b47823e6e34cb70d531af1e5
parent a4253a613c894035e1658bb42d3d516dfb134be6
Author: William Casarin <jb55@jb55.com>
Date:   Thu, 25 Jan 2024 12:10:34 -0800

Revert "mute: add new UI views for new mute list"

This reverts commit 9f332a148fe4fc5af70b2e2a6206d8efb4e78dce.

Diffstat:
Mdamus.xcodeproj/project.pbxproj | 8--------
Ddamus/Views/Muting/AddMuteItemView.swift | 102-------------------------------------------------------------------------------
Ddamus/Views/Muting/MuteDurationMenu.swift | 40----------------------------------------
3 files changed, 0 insertions(+), 150 deletions(-)

diff --git a/damus.xcodeproj/project.pbxproj b/damus.xcodeproj/project.pbxproj @@ -421,8 +421,6 @@ 9CA876E229A00CEA0003B9A3 /* AttachMediaUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CA876E129A00CE90003B9A3 /* AttachMediaUtility.swift */; }; ADFE73552AD4793100EC7326 /* QRScanNSECView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADFE73542AD4793100EC7326 /* QRScanNSECView.swift */; }; B501062D2B363036003874F5 /* AuthIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B501062C2B363036003874F5 /* AuthIntegrationTests.swift */; }; - B51C1CEA2B55A60A00E312A9 /* AddMuteItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B51C1CE82B55A60A00E312A9 /* AddMuteItemView.swift */; }; - B51C1CEB2B55A60A00E312A9 /* MuteDurationMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = B51C1CE92B55A60A00E312A9 /* MuteDurationMenu.swift */; }; B57B4C622B312BD700A232C0 /* ReconnectRelaysNotify.swift in Sources */ = {isa = PBXBuildFile; fileRef = B57B4C612B312BD700A232C0 /* ReconnectRelaysNotify.swift */; }; B57B4C642B312BFA00A232C0 /* RelayAuthenticationDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = B57B4C632B312BFA00A232C0 /* RelayAuthenticationDetail.swift */; }; B57B4C662B312C3700A232C0 /* NostrAuth.swift in Sources */ = {isa = PBXBuildFile; fileRef = B57B4C652B312C3700A232C0 /* NostrAuth.swift */; }; @@ -1321,8 +1319,6 @@ 9CA876E129A00CE90003B9A3 /* AttachMediaUtility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttachMediaUtility.swift; sourceTree = "<group>"; }; ADFE73542AD4793100EC7326 /* QRScanNSECView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QRScanNSECView.swift; sourceTree = "<group>"; }; B501062C2B363036003874F5 /* AuthIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthIntegrationTests.swift; sourceTree = "<group>"; usesTabs = 0; }; - B51C1CE82B55A60A00E312A9 /* AddMuteItemView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddMuteItemView.swift; sourceTree = "<group>"; }; - B51C1CE92B55A60A00E312A9 /* MuteDurationMenu.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MuteDurationMenu.swift; sourceTree = "<group>"; }; B57B4C612B312BD700A232C0 /* ReconnectRelaysNotify.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReconnectRelaysNotify.swift; sourceTree = "<group>"; }; B57B4C632B312BFA00A232C0 /* RelayAuthenticationDetail.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RelayAuthenticationDetail.swift; sourceTree = "<group>"; }; B57B4C652B312C3700A232C0 /* NostrAuth.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NostrAuth.swift; sourceTree = "<group>"; }; @@ -2560,8 +2556,6 @@ 4CF0ABDF2981A83000D66079 /* Muting */ = { isa = PBXGroup; children = ( - B51C1CE82B55A60A00E312A9 /* AddMuteItemView.swift */, - B51C1CE92B55A60A00E312A9 /* MuteDurationMenu.swift */, 4CF0ABE02981A83900D66079 /* MutelistView.swift */, ); path = Muting; @@ -3039,7 +3033,6 @@ F7F0BA272978E54D009531F3 /* ParticipantsView.swift in Sources */, 4CF0ABE32981BC7D00D66079 /* UserView.swift in Sources */, 4CE0E2AF29A2E82100DB4CA2 /* EventHolder.swift in Sources */, - B51C1CEA2B55A60A00E312A9 /* AddMuteItemView.swift in Sources */, 4C5D5C992A6AF8F80024563C /* NdbNote.swift in Sources */, 4CF0ABF029857E9200D66079 /* Bech32Object.swift in Sources */, 4C3D52B8298DB5C6001C5831 /* TextEvent.swift in Sources */, @@ -3302,7 +3295,6 @@ 50A60D142A28BEEE00186190 /* RelayLog.swift in Sources */, D7EDED212B117DCA0018B19C /* SequenceUtils.swift in Sources */, BA37598A2ABCCDE40018D73B /* ImageResizer.swift in Sources */, - B51C1CEB2B55A60A00E312A9 /* MuteDurationMenu.swift in Sources */, 4CB88389296AF99A00DC99E7 /* EventDetailBar.swift in Sources */, 4C32B9512A9AD44700DC3548 /* FlatbuffersErrors.swift in Sources */, 4CE8794E2996B16A00F758CC /* RelayToggle.swift in Sources */, diff --git a/damus/Views/Muting/AddMuteItemView.swift b/damus/Views/Muting/AddMuteItemView.swift @@ -1,102 +0,0 @@ -// -// AddMuteItemView.swift -// damus -// -// Created by Charlie Fish on 1/10/24. -// -import SwiftUI - -struct AddMuteItemView: View { - let state: DamusState - @State var new_text: String = "" - @State var expiration: DamusDuration? - - @Environment(\.dismiss) var dismiss - - var body: some View { - VStack { - Text("Add mute item", comment: "Title text to indicate user to an add an item to their mutelist.") - .font(.system(size: 20, weight: .bold)) - .padding(.vertical) - - Divider() - .padding(.bottom) - - Picker(selection: $expiration) { - Text("Indefinite", comment: "Mute a given item indefinitly (until user unmutes it). As opposed to muting the item for a given period of time.") - ForEach(DamusDuration.allCases, id: \.self) { duration in - Text(duration.title).tag(duration) - } - } label: { - Text("Duration", comment: "The duration in which to mute the given item.") - } - - - HStack { - Label("", image: "copy2") - .onTapGesture { - if let pasted_text = UIPasteboard.general.string { - self.new_text = pasted_text - } - } - TextField(NSLocalizedString("npub, #hashtag, phrase", comment: "Placeholder example for relay server address."), text: $new_text) - .autocorrectionDisabled(true) - .textInputAutocapitalization(.never) - - Label("", image: "close-circle") - .foregroundColor(.accentColor) - .opacity((new_text == "") ? 0.0 : 1.0) - .onTapGesture { - self.new_text = "" - } - } - .padding(10) - .background(.secondary.opacity(0.2)) - .cornerRadius(10) - - Button(action: { - let expiration_date: Date? = self.expiration?.date_from_now - let mute_item: MuteItem? = { - if new_text.starts(with: "npub") { - if let pubkey: Pubkey = bech32_pubkey_decode(new_text) { - return .user(pubkey, expiration_date) - } else { - return nil - } - } else if new_text.starts(with: "#") { - // Remove the starting `#` character - new_text.removeFirst() - return .hashtag(Hashtag(hashtag: new_text), expiration_date) - } else { - return .word(new_text, expiration_date) - } - }() - - // @TODO: in future patch - actually update & relay the new mute list - - new_text = "" - - UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) - - dismiss() - }) { - HStack { - Text(verbatim: "Add mute item") - .bold() - } - .frame(minWidth: 300, maxWidth: .infinity, alignment: .center) - } - .buttonStyle(GradientButtonStyle(padding: 10)) - .padding(.vertical) - - Spacer() - } - .padding() - } -} - -struct AddMuteItemView_Previews: PreviewProvider { - static var previews: some View { - AddMuteItemView(state: test_damus_state) - } -} diff --git a/damus/Views/Muting/MuteDurationMenu.swift b/damus/Views/Muting/MuteDurationMenu.swift @@ -1,40 +0,0 @@ -// -// MuteDurationMenu.swift -// damus -// -// Created by Charlie Fish on 1/14/24. -// - -import SwiftUI - -struct MuteDurationMenu<T: View>: View { - var action: (DamusDuration?) -> Void - @ViewBuilder var label: () -> T - - var body: some View { - Menu { - Button { - action(nil) - } label: { - Text("Indefinite", comment: "Mute a given item indefinitly (until user unmutes it). As opposed to muting the item for a given period of time.") - } - ForEach(DamusDuration.allCases, id: \.self) { duration in - Button { - action(duration) - } label: { - Text("\(duration.title)") - } - } - } label: { - self.label() - } - } -} - -#Preview { - MuteDurationMenu { _ in - - } label: { - Text("Mute hashtag") - } -}