damus

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

commit 1701dbdfb94935fd7c0a1e8d4f3255e345d9ebb2
parent 8fe86115270c28beb8f360cb0314f36ae44f739c
Author: ericholguin <eric.holguinsanchez@gmail.com>
Date:   Mon,  3 Apr 2023 17:07:22 -0400

Add an empty view when a tagged user isnt found

Changelog-Added: Show a custom view when tagged user isn't found

Diffstat:
Mdamus.xcodeproj/project.pbxproj | 4++++
Adamus/Views/Empty Views/EmptyUserSearchView.swift | 37+++++++++++++++++++++++++++++++++++++
Mdamus/Views/Posting/UserSearch.swift | 15++++++++++-----
3 files changed, 51 insertions(+), 5 deletions(-)

diff --git a/damus.xcodeproj/project.pbxproj b/damus.xcodeproj/project.pbxproj @@ -233,6 +233,7 @@ 4CFF8F6D29CD022E008DB934 /* WideEventView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CFF8F6C29CD022E008DB934 /* WideEventView.swift */; }; 4FE60CDD295E1C5E00105A1F /* Wallet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FE60CDC295E1C5E00105A1F /* Wallet.swift */; }; 50A50A8D29A09E1C00C01BE7 /* RequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A50A8C29A09E1C00C01BE7 /* RequestTests.swift */; }; + 5C42E78C29DB76D90086AAC1 /* EmptyUserSearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C42E78B29DB76D90086AAC1 /* EmptyUserSearchView.swift */; }; 5C513FBA297F72980072348F /* CustomPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C513FB9297F72980072348F /* CustomPicker.swift */; }; 5C513FCC2984ACA60072348F /* QRCodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C513FCB2984ACA60072348F /* QRCodeView.swift */; }; 5CF72FC229B9142F00124A13 /* ShareAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CF72FC129B9142F00124A13 /* ShareAction.swift */; }; @@ -626,6 +627,7 @@ 4CFF8F6C29CD022E008DB934 /* WideEventView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WideEventView.swift; sourceTree = "<group>"; }; 4FE60CDC295E1C5E00105A1F /* Wallet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Wallet.swift; sourceTree = "<group>"; }; 50A50A8C29A09E1C00C01BE7 /* RequestTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestTests.swift; sourceTree = "<group>"; }; + 5C42E78B29DB76D90086AAC1 /* EmptyUserSearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyUserSearchView.swift; sourceTree = "<group>"; }; 5C513FB9297F72980072348F /* CustomPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomPicker.swift; sourceTree = "<group>"; }; 5C513FCB2984ACA60072348F /* QRCodeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QRCodeView.swift; sourceTree = "<group>"; }; 5CF72FC129B9142F00124A13 /* ShareAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareAction.swift; sourceTree = "<group>"; }; @@ -689,6 +691,7 @@ isa = PBXGroup; children = ( 3169CAE5294E69C000EE4006 /* EmptyTimelineView.swift */, + 5C42E78B29DB76D90086AAC1 /* EmptyUserSearchView.swift */, ); path = "Empty Views"; sourceTree = "<group>"; @@ -1569,6 +1572,7 @@ 5C513FCC2984ACA60072348F /* QRCodeView.swift in Sources */, 4C3EA64F28FF59F200C48A62 /* tal.c in Sources */, 4CB88393296F798300DC99E7 /* ReactionsModel.swift in Sources */, + 5C42E78C29DB76D90086AAC1 /* EmptyUserSearchView.swift in Sources */, 4CB88396296F7F8B00DC99E7 /* ReactionView.swift in Sources */, 4CFF8F6B29CD0079008DB934 /* RepostedEvent.swift in Sources */, 4C8682872814DE470026224F /* ProfileView.swift in Sources */, diff --git a/damus/Views/Empty Views/EmptyUserSearchView.swift b/damus/Views/Empty Views/EmptyUserSearchView.swift @@ -0,0 +1,37 @@ +// +// EmptyUserSearchView.swift +// damus +// +// Created by eric on 4/3/23. +// + +// +// EmptyUserSearchView.swift +// damus +// +// Created by eric on 4/3/23. +// + +import SwiftUI + +struct EmptyUserSearchView: View { + var body: some View { + VStack { + Image(systemName: "person.fill.questionmark") + .font(.system(size: 35)) + .padding() + Text("Could not find the user you're looking for", comment: "Indicates that there are no users found.") + .multilineTextAlignment(.center) + .font(.callout.weight(.medium)) + } + .foregroundColor(.gray) + .padding() + } +} + +struct EmptyUserSearchView_Previews: PreviewProvider { + static var previews: some View { + EmptyUserSearchView() + } +} + diff --git a/damus/Views/Posting/UserSearch.swift b/damus/Views/Posting/UserSearch.swift @@ -74,11 +74,16 @@ struct UserSearch: View { var body: some View { ScrollView { LazyVStack { - ForEach(users) { user in - UserView(damus_state: damus_state, pubkey: user.pubkey) - .onTapGesture { - on_user_tapped(user: user) - } + Divider() + if users.count == 0 { + EmptyUserSearchView() + } else { + ForEach(users) { user in + UserView(damus_state: damus_state, pubkey: user.pubkey) + .onTapGesture { + on_user_tapped(user: user) + } + } } } }