mirror of
https://github.com/vishalxl/nostr_console.git
synced 2025-04-19 01:01:26 +02:00
in menu 2->7 word search, now events can be searched by..
.. fewer letters, minimum 6 only. it was full event id before.
This commit is contained in:
parent
a865b5c1c6
commit
e7658a949d
@ -1232,7 +1232,7 @@ Future<void> socialMenuUi(Store node) async {
|
||||
'Your notifications',// 3
|
||||
'Your Posts', // 4
|
||||
'Your Replies/Likes',//5
|
||||
'Friends Posts/Replies/Likes', // 6
|
||||
'Follows\' Posts/Replies/Likes', // 6
|
||||
'Search word(s) or event id', // 7
|
||||
'Follow new contact', // 8
|
||||
'Show user profile', // 9
|
||||
@ -1314,9 +1314,9 @@ Future<void> socialMenuUi(Store node) async {
|
||||
clearScreen();
|
||||
Point numPrinted = node.printTree(0, DateTime.now().subtract(Duration(hours:gHoursDefaultPrint)), selectorTrees_followsPosts);
|
||||
if( numPrinted.x > 0) {
|
||||
print("Showed ${numPrinted.x.toInt()} threads where your follows/freiends participated.\n");
|
||||
print("Showed ${numPrinted.x.toInt()} threads where your follows participated.\n");
|
||||
} else {
|
||||
print("No threads to show where your follows/friends or other users participated in last $gHoursDefaultPrint hours.");
|
||||
print("No threads to show where your follows participated in last $gHoursDefaultPrint hours.");
|
||||
}
|
||||
break;
|
||||
case 7: // search word or event id
|
||||
|
@ -670,7 +670,7 @@ class EventData {
|
||||
}
|
||||
|
||||
|
||||
int n = 6;
|
||||
int n = gEventLenPrinted; // is 6
|
||||
String maxN(String v) => v.length > n? v.substring(0,n) : v.substring(0, v.length);
|
||||
|
||||
String name = getAuthorName(pubkey);
|
||||
|
@ -55,7 +55,6 @@ String defaultServerUrl = "wss://relay.damus.io";
|
||||
const String relayNostrInfo = 'wss://relay.nostr.info';
|
||||
|
||||
|
||||
|
||||
Set<String> gListRelayUrls1 = { defaultServerUrl,
|
||||
relayNostrInfo,
|
||||
"wss://nostr-2.zebedee.cloud",
|
||||
@ -182,6 +181,11 @@ List<String> gCheckMarksToRemove = ["✅","✔️"];
|
||||
bool gShowLnInvoicesAsQr = false;
|
||||
const int gMinWidthForLnQr = 140;
|
||||
|
||||
// event length printed
|
||||
const int gEventLenPrinted = 6;
|
||||
|
||||
// used in word/event search
|
||||
const int gMinEventIdLenInSearch = gEventLenPrinted;
|
||||
|
||||
// https://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html#8-colors
|
||||
// Color related settings
|
||||
|
@ -475,7 +475,8 @@ class Tree {
|
||||
}
|
||||
|
||||
// returns true if the treee or its children has a reply or like for the user with public key pk; and notification flags are set for such events
|
||||
bool treeSelectorRepliesAndLikes(String pubkey) {
|
||||
// only new controls whether replies/likes recieved are ignored if the user has already
|
||||
bool treeSelectorRepliesAndLikes(String pubkey, [bool onlyNew = false]) {
|
||||
bool hasReaction = false;
|
||||
bool childMatches = false;
|
||||
|
||||
@ -563,7 +564,15 @@ class Tree {
|
||||
}
|
||||
if( event.eventData.id == gCheckEventId) printWarning("found the event $gCheckEventId");
|
||||
|
||||
if( event.eventData.content.toLowerCase().contains(word) || event.eventData.id == word ) {
|
||||
// match event id if
|
||||
bool eventIdMatches = false;
|
||||
if( word.length >= gMinEventIdLenInSearch && word.length <= 64) {
|
||||
if( event.eventData.id.substring(0, word.length) == word) {
|
||||
eventIdMatches = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( event.eventData.content.toLowerCase().contains(word) || eventIdMatches ) {
|
||||
event.eventData.isNotification = true;
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user