diff --git a/lib/console_ui.dart b/lib/console_ui.dart index 474d5ea..0bcb5fd 100644 --- a/lib/console_ui.dart +++ b/lib/console_ui.dart @@ -280,6 +280,9 @@ int showMenu(List menuOptions, String menuName) { Future otherMenuUi(Store node) async { bool continueOtherMenu = true; while(continueOtherMenu) { + + await processNotifications(node); // this takes 300 ms + int option = showMenu([ 'Show user profile', // 1 'Search by client name', // 2 'Search word(s) or event id', // 3 @@ -659,20 +662,25 @@ Future PrivateMenuUI(Store node) async { return; } +void showInitialNotifications(Store node) { + + bool hasNotifications (Tree t) => t.treeSelectorNotifications(); + node.printTree(0, DateTime.now().subtract(Duration(days:gNumLastDays)), hasNotifications); + print("\n"); + + bool showNotifications (ScrollableMessages room) => room.selectorNotifications(); + int numDirectRoomsPrinted = node.printDirectRoomInfo(showNotifications); + + if( numDirectRoomsPrinted > 0) + print("\n"); +} + Future mainMenuUi(Store node) async { // at the very beginning, show the tree with re reply and likes, and then show the options menu //Show only notifications - bool hasNotifications (Tree t) => t.treeSelectorNotifications(); - node.printTree(0, DateTime.now().subtract(Duration(days:gNumLastDays)), hasNotifications); - print("\n"); - - bool showNotifications (ScrollableMessages room) => room.selectorNotifications(); - int numDirectRoomsPrinted = node.printDirectRoomInfo(showNotifications); - - if( numDirectRoomsPrinted > 0) - print("\n"); + showInitialNotifications(node); //int numChannelsPrinted = node.printChannelsOverview(20, showNotifications); diff --git a/lib/tree_ds.dart b/lib/tree_ds.dart index 78dac2e..ebaa666 100644 --- a/lib/tree_ds.dart +++ b/lib/tree_ds.dart @@ -548,13 +548,13 @@ class Store { dynamic json = jsonDecode(ce.eventData.content); Channel? channel = getChannel(rooms, chatRoomId); if( channel != null) { - if( channel.chatRoomName == "") { + if( channel.chatRoomName == "" && json.containsKey('name')) { channel.chatRoomName = json['name']; } } else { String roomName = "", roomAbout = ""; if( json.containsKey('name') ) { - roomName = json['name']; + roomName = json['name']??""; } if( json.containsKey('about')) {