mirror of
https://github.com/vishalxl/nostr_console.git
synced 2025-06-01 10:39:17 +02:00
fixed exception on name lookup in json in tree
also added notifications in other menu for sending contact addition event
This commit is contained in:
parent
ea250f8b72
commit
2a50d09e17
@ -280,6 +280,9 @@ int showMenu(List<String> menuOptions, String menuName) {
|
||||
Future<void> 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<void> 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<void> 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);
|
||||
|
||||
|
@ -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')) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user