From 9142fb3c24036319f36efbc6716630346aeaa7df Mon Sep 17 00:00:00 2001 From: Vishal <64505169+vishalxl@users.noreply.github.com> Date: Sun, 21 Apr 2024 10:41:37 +0530 Subject: [PATCH] improved profile for users whose contact list wasn't found --- lib/console_ui.dart | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/console_ui.dart b/lib/console_ui.dart index 38ff878..59071a0 100644 --- a/lib/console_ui.dart +++ b/lib/console_ui.dart @@ -397,6 +397,26 @@ void printProfile(Store node, String profilePubkey) { stdout.write("${getAuthorName(x.contactPubkey)}, "); } print("\n"); + } else { + // check if you follow the other account + Event? selfContactEvent = getContactEvent(userPublicKey); + bool youFollowThem = false; + + if( selfContactEvent != null) { + List selfContacts = selfContactEvent.eventData.contactList; + for(int i = 0; i < selfContacts.length; i ++) { + if( selfContacts[i].contactPubkey == profilePubkey) { + youFollowThem = true; + print("* You follow $authorName"); + } + } + + if( youFollowThem == false) { + print("* You don't follow $authorName"); + } + + print("* Their contact list was not found.\n"); + } } // print followers