mirror of
https://github.com/vishalxl/nostr_console.git
synced 2025-03-27 02:01:51 +01:00
added some unused code for isRelevant logic in writing to file
This commit is contained in:
parent
97ed8ac742
commit
2edf5bb361
@ -2046,6 +2046,16 @@ class Store {
|
||||
return room;
|
||||
}
|
||||
|
||||
|
||||
// TODO to be finished
|
||||
bool isRelevant(Tree tree) {
|
||||
//Set<String> contacts = getContactList(userPublicKey);
|
||||
//contacts = contacts.union(gDefaultFollows);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Write the tree's events to file as one event's json per line
|
||||
Future<void> writeEventsToFile(String filename) async {
|
||||
if( gDebug > 0) print("opening $filename to write to.");
|
||||
@ -2083,6 +2093,11 @@ class Store {
|
||||
continue;
|
||||
}
|
||||
|
||||
if( !isRelevant(tree)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
String temp = tree.event.originalJson.trim();
|
||||
String line = "${temp}\n";
|
||||
nLinesStr += line;
|
||||
|
@ -92,4 +92,23 @@ Set<String> getOnlyUserEvents(Set<Event> initialEvents, String userPubkey) {
|
||||
}
|
||||
});
|
||||
return userEvents;
|
||||
}
|
||||
|
||||
|
||||
Set<String> getContactList(String pubkey) {
|
||||
Set<String> contacts = {};
|
||||
|
||||
if( pubkey != "") {
|
||||
// get the latest kind 3 event for the user, which has the 'follows' list
|
||||
Event? contactEvent = getContactEvent(userPublicKey);
|
||||
|
||||
// if contact list was found, get user's feed; also get some default contacts
|
||||
if (contactEvent != null ) {
|
||||
contactEvent.eventData.contactList.forEach((contact) {
|
||||
contacts.add(contact.contactPubkey);
|
||||
});
|
||||
} else {
|
||||
}
|
||||
}
|
||||
return contacts;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user