mirror of
https://github.com/vishalxl/nostr_console.git
synced 2025-11-19 10:29:01 +01:00
added clear screen to encrypted group menu
This commit is contained in:
@@ -793,6 +793,7 @@ Future<void> channelMenuUI(Store node) async {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
|
clearScreen();
|
||||||
printInColor(" All Public Channels ", gCommentColor);
|
printInColor(" All Public Channels ", gCommentColor);
|
||||||
node.printChannelsOverview(node.channels, node.channels.length, selectorShowAllRooms);
|
node.printChannelsOverview(node.channels, node.channels.length, selectorShowAllRooms);
|
||||||
justShowedChannels = true;
|
justShowedChannels = true;
|
||||||
@@ -840,7 +841,8 @@ Future<void> createEncryptedChannel(Store node) async {
|
|||||||
EventData eventData = EventData('id', userPublicKey, createdAt, 140, content, [], [], [], [], {}, );
|
EventData eventData = EventData('id', userPublicKey, createdAt, 140, content, [], [], [], [], {}, );
|
||||||
Event encryptedChannelCreateEvent = Event("EVENT", "id", eventData, [], "");
|
Event encryptedChannelCreateEvent = Event("EVENT", "id", eventData, [], "");
|
||||||
String newEncryptedChannelId = await sendEventWithTags(node, encryptedChannelCreateEvent, pTags); // takes 400 ms
|
String newEncryptedChannelId = await sendEventWithTags(node, encryptedChannelCreateEvent, pTags); // takes 400 ms
|
||||||
print("Created new encrypted channel with id: $newEncryptedChannelId");
|
clearScreen();
|
||||||
|
print("Created new encrypted channel with id: $newEncryptedChannelId\n");
|
||||||
|
|
||||||
|
|
||||||
String newPriKey = getRandomPrivKey();
|
String newPriKey = getRandomPrivKey();
|
||||||
@@ -990,9 +992,16 @@ Future<void> encryptedChannelMenuUI(Store node) async {
|
|||||||
if( channelId == "x") {
|
if( channelId == "x") {
|
||||||
showChannelOption = false;
|
showChannelOption = false;
|
||||||
}
|
}
|
||||||
|
bool firstIteration = true;
|
||||||
int pageNum = 1;
|
int pageNum = 1;
|
||||||
while(showChannelOption) {
|
while(showChannelOption) {
|
||||||
reAdjustAlignment();
|
reAdjustAlignment();
|
||||||
|
|
||||||
|
if( firstIteration) {
|
||||||
|
clearScreen();
|
||||||
|
firstIteration = false;
|
||||||
|
}
|
||||||
|
|
||||||
String fullChannelId = node.showChannel(node.encryptedChannels, channelId, pageNum);
|
String fullChannelId = node.showChannel(node.encryptedChannels, channelId, pageNum);
|
||||||
if( fullChannelId == "") {
|
if( fullChannelId == "") {
|
||||||
//print("Could not find the given channel.");
|
//print("Could not find the given channel.");
|
||||||
@@ -1000,6 +1009,8 @@ Future<void> encryptedChannelMenuUI(Store node) async {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
stdout.write("\nType message; or type 'x' to exit, or press <enter> to refresh: ");
|
stdout.write("\nType message; or type 'x' to exit, or press <enter> to refresh: ");
|
||||||
$tempUserInput = stdin.readLineSync(encoding: utf8);
|
$tempUserInput = stdin.readLineSync(encoding: utf8);
|
||||||
String messageToSend = $tempUserInput??"";
|
String messageToSend = $tempUserInput??"";
|
||||||
@@ -1041,18 +1052,21 @@ Future<void> encryptedChannelMenuUI(Store node) async {
|
|||||||
} else {
|
} else {
|
||||||
print("Refreshing...");
|
print("Refreshing...");
|
||||||
}
|
}
|
||||||
|
clearScreen();
|
||||||
await processAnyIncomingEvents(node, false);
|
await processAnyIncomingEvents(node, false);
|
||||||
}
|
} // end while showChennelOption ( showing each page)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
|
clearScreen();
|
||||||
printInColor(" All Encrypted Channels ", gCommentColor);
|
printInColor(" All Encrypted Channels ", gCommentColor);
|
||||||
node.printChannelsOverview(node.encryptedChannels, node.encryptedChannels.length, selectorShowAllRooms);
|
node.printChannelsOverview(node.encryptedChannels, node.encryptedChannels.length, selectorShowAllRooms);
|
||||||
justShowedChannels = true;
|
justShowedChannels = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
|
clearScreen();
|
||||||
|
print("Creating new encrypted channel. Kindly enter info about channel: \n");
|
||||||
await createEncryptedChannel(node);
|
await createEncryptedChannel(node);
|
||||||
justShowedChannels = false;
|
justShowedChannels = false;
|
||||||
break;
|
break;
|
||||||
@@ -1170,11 +1184,13 @@ void showInitialNotifications(Store node) {
|
|||||||
|
|
||||||
Future<void> mainMenuUi(Store node) async {
|
Future<void> mainMenuUi(Store node) async {
|
||||||
|
|
||||||
|
clearScreen();
|
||||||
|
|
||||||
//Show only notifications
|
//Show only notifications
|
||||||
showInitialNotifications(node);
|
showInitialNotifications(node);
|
||||||
|
|
||||||
bool userContinue = true;
|
bool mainMenuContinue = true;
|
||||||
while(userContinue) {
|
while(mainMenuContinue) {
|
||||||
|
|
||||||
await processAnyIncomingEvents(node); // this takes 300 ms
|
await processAnyIncomingEvents(node); // this takes 300 ms
|
||||||
|
|
||||||
@@ -1252,7 +1268,7 @@ Future<void> mainMenuUi(Store node) async {
|
|||||||
|
|
||||||
case 7:
|
case 7:
|
||||||
default:
|
default:
|
||||||
userContinue = false;
|
mainMenuContinue = false;
|
||||||
String authorName = getAuthorName(userPublicKey);
|
String authorName = getAuthorName(userPublicKey);
|
||||||
print("\nFinished Nostr session for user with name and public key: ${authorName} ($userPublicKey)");
|
print("\nFinished Nostr session for user with name and public key: ${authorName} ($userPublicKey)");
|
||||||
if( gEventsFilename != "") {
|
if( gEventsFilename != "") {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ homepage: https://github.com/vishalxl/nostr_console
|
|||||||
# clear screen for public channels +
|
# clear screen for public channels +
|
||||||
# improved howto messages
|
# improved howto messages
|
||||||
# removed red error for default invokation related to invalid old encrypted group keys
|
# removed red error for default invokation related to invalid old encrypted group keys
|
||||||
|
# more clear screen
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.17.3 <3.0.0'
|
sdk: '>=2.17.3 <3.0.0'
|
||||||
|
|||||||
Reference in New Issue
Block a user