improved info printed if more than one account is listed

added about info
This commit is contained in:
Vishal 2022-11-22 12:17:08 +05:30
parent f2356d85fa
commit bc64b202f4
2 changed files with 29 additions and 4 deletions

View File

@ -445,6 +445,18 @@ int showMenu(List<String> menuOptions, String menuName, [String menuInfo = ""])
}
}
void printPubkeys(Set<String> pubkey) {
if( pubkey.length == 1) {
print("There is 1 public key for the given name, which is: ");
} else {
print("There are ${pubkey.length} public keys for the given name, which are: ");
}
print("${myPadRight("pubkey",64)} ${myPadRight("name", 20)} ${myPadRight("about", 40)}");
pubkey.forEach( (x) => print("$x ${myPadRight(getAuthorName(x), 20)} ${myPadRight(gKindONames[x]?.about??"", 40)}"));
print("");
}
Future<void> otherOptionsMenuUi(Store node) async {
bool continueOtherMenu = true;
while(continueOtherMenu) {
@ -472,8 +484,9 @@ Future<void> otherOptionsMenuUi(Store node) async {
String userName = $tempUserName??"";
if( userName != "") {
Set<String> pubkey = getPublicKeyFromName(userName);
print("There are ${ pubkey.length} public keys for the given name, which are/is: ");
pubkey.forEach( (x) => print(" $x : ${getNip05Name(x)} "));
printPubkeys(pubkey);
if( pubkey.length > 1) {
if( pubkey.length > 1) {
printWarning("Got multiple users with the same name. Try again, and/or type a more unique name or their full public keys.");
@ -532,8 +545,9 @@ Future<void> otherOptionsMenuUi(Store node) async {
String userName = $tempUserName??"";
if( userName != "") {
Set<String> pubkey = getPublicKeyFromName(userName);
print("There are ${ pubkey.length} public keys for the given name, which are/is: ");
pubkey.forEach( (x) => print(" $x : ${getNip05Name(x)} "));
printPubkeys(pubkey);
if( pubkey.length > 1) {
if( pubkey.length > 1) {
printWarning("Got multiple users with the same name. Try again, and type a more unique name or id-prefix");

View File

@ -54,6 +54,17 @@ Map< String, List<List<String>> > gReactions = {};
// is updated as kind 3 events are received
Map< String, List<Contact>> gContactLists = {};
String myPadRight(String str, int width) {
String newStr = "";
if( str.length < width) {
newStr = str.padRight(width);
} else {
newStr = str.substring(0, width);
}
return newStr;
}
// returns tags as string that can be used to calculate event has. called from EventData constructor
String getStrTagsFromJson(dynamic json) {
String str = "";