From f77e02840e531ff36b6f811713d4a9dbf28f1b9c Mon Sep 17 00:00:00 2001 From: Vishal <64505169+vishalxl@users.noreply.github.com> Date: Mon, 28 Nov 2022 01:35:41 +0530 Subject: [PATCH] changed menu ordering for profile print and removed unnecessary asserts which were giving unneeded issues when run with --enable-asserts --- lib/console_ui.dart | 46 ++++++++++++++++++++++----------------------- lib/event_ds.dart | 3 +-- pubspec.yaml | 3 ++- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/lib/console_ui.dart b/lib/console_ui.dart index 5ad73db..69be926 100644 --- a/lib/console_ui.dart +++ b/lib/console_ui.dart @@ -1208,8 +1208,8 @@ Future socialMenuUi(Store node) async { 'Friends Posts/Replies/Likes', // 6 'Search word(s) or event id', // 7 'Follow new contact', // 8 - 'Change number of days printed', // 9 - 'Show user profile', // 10 + 'Show user profile', // 9 + 'Change number of days printed', // 10 'E(x)it to main menu'], // 11 "Social Network Menu"); @@ -1376,27 +1376,7 @@ Future socialMenuUi(Store node) async { } break; - case 9: // change number of days printed - clearScreen(); - stdout.write("Enter number of days for which you want to see posts: "); - String? $tempNumDays = stdin.readLineSync(); - String newNumDays = $tempNumDays??""; - - try { - gNumLastDays = int.parse(newNumDays); - print("Changed number of days printed to $gNumLastDays"); - } on FormatException catch (e) { - printWarning("Invalid input. Kindly try again."); - if( gDebug > 0) print(" ${e.message}"); - continue; - } on Exception catch (e) { - printWarning("Invalid input. Kindly try again."); - if( gDebug > 0) print(" ${e}"); - continue; - } - break; - - case 10: + case 9: clearScreen(); stdout.write("Printing profile of a user; type username or first few letters of user's public key( or full public key): "); String? $tempUserName = stdin.readLineSync(); @@ -1421,6 +1401,26 @@ Future socialMenuUi(Store node) async { } break; + case 10: // change number of days printed + clearScreen(); + stdout.write("Enter number of days for which you want to see posts: "); + String? $tempNumDays = stdin.readLineSync(); + String newNumDays = $tempNumDays??""; + + try { + gNumLastDays = int.parse(newNumDays); + print("Changed number of days printed to $gNumLastDays"); + } on FormatException catch (e) { + printWarning("Invalid input. Kindly try again."); + if( gDebug > 0) print(" ${e.message}"); + continue; + } on Exception catch (e) { + printWarning("Invalid input. Kindly try again."); + if( gDebug > 0) print(" ${e}"); + continue; + } + break; + case 11: default: socialMenuContinue = false; diff --git a/lib/event_ds.dart b/lib/event_ds.dart index 0091c10..43d639d 100644 --- a/lib/event_ds.dart +++ b/lib/event_ds.dart @@ -1686,7 +1686,6 @@ try { //remove padding offset += cipherImpl.doFinal(cipherText, offset, finalPlainText, offset); - assert(offset == cipherText.length); return finalPlainText.sublist(0, offset); } catch(e) { if( gDebug >= 0) print("Decryption error = $e"); @@ -1738,7 +1737,7 @@ String myEncryptRaw( String privateString, //add padding offset += cipherImpl.doFinal(uintInputText, offset, outputEncodedText, offset); - assert(offset == uintInputText.length); + //assert(offset == uintInputText.length); final Uint8List finalEncodedText = outputEncodedText.sublist(0, offset); String stringIv = convert.base64.encode(iv);; diff --git a/pubspec.yaml b/pubspec.yaml index 9797824..8b7ce41 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -6,7 +6,8 @@ homepage: https://github.com/vishalxl/nostr_console # Release 0.1.9-beta # used kind 104 # fix for tag related test fail -# default without argument invocation now possible with no pubkey +# default without argument invocation now possible with no pubkey + environment: sdk: '>=2.17.3 <3.0.0'