mirror of
https://github.com/vishalxl/nostr_console.git
synced 2025-04-30 23:25:11 +02:00
Merge pull request #47 from radixrat/sort_userprofile
add sort to userprofile, makes it easier to view
This commit is contained in:
commit
f924ede1ad
@ -345,6 +345,7 @@ void printProfile(Store node, String profilePubkey) {
|
|||||||
|
|
||||||
// print follow list
|
// print follow list
|
||||||
stdout.write("$pronoun follow ${profileContactEvent.eventData.contactList.length} accounts: ");
|
stdout.write("$pronoun follow ${profileContactEvent.eventData.contactList.length} accounts: ");
|
||||||
|
profileContactEvent.eventData.contactList.sort();
|
||||||
profileContactEvent.eventData.contactList.forEach((x) => stdout.write("${getAuthorName(x.id, 0)}, "));
|
profileContactEvent.eventData.contactList.forEach((x) => stdout.write("${getAuthorName(x.id, 0)}, "));
|
||||||
print("\n");
|
print("\n");
|
||||||
}
|
}
|
||||||
@ -352,6 +353,7 @@ void printProfile(Store node, String profilePubkey) {
|
|||||||
// print followers
|
// print followers
|
||||||
List<String> followers = node.getFollowers(profilePubkey);
|
List<String> followers = node.getFollowers(profilePubkey);
|
||||||
stdout.write("$pronoun have ${followers.length} followers: ");
|
stdout.write("$pronoun have ${followers.length} followers: ");
|
||||||
|
followers.sort((a, b) => getAuthorName(a).compareTo(getAuthorName(b)));
|
||||||
followers.forEach((x) => stdout.write("${getAuthorName(x, 0)}, "));
|
followers.forEach((x) => stdout.write("${getAuthorName(x, 0)}, "));
|
||||||
print("");
|
print("");
|
||||||
print("");
|
print("");
|
||||||
|
@ -1377,7 +1377,7 @@ List getLineWithMaxLen(String s, int startIndex, int lenPerLine, String spacesSt
|
|||||||
|
|
||||||
|
|
||||||
// The contact only stores id and relay of contact. The actual name is stored in a global variable/map
|
// The contact only stores id and relay of contact. The actual name is stored in a global variable/map
|
||||||
class Contact {
|
class Contact implements Comparable<Contact> {
|
||||||
String id, relay;
|
String id, relay;
|
||||||
Contact(this.id, this.relay);
|
Contact(this.id, this.relay);
|
||||||
|
|
||||||
@ -1385,7 +1385,11 @@ class Contact {
|
|||||||
String toString() {
|
String toString() {
|
||||||
return 'id: $id ( ${getAuthorName(id)}) relay: $relay';
|
return 'id: $id ( ${getAuthorName(id)}) relay: $relay';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int compareTo(Contact other) {
|
||||||
|
return getAuthorName(id).compareTo(getAuthorName(other.id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String getShaId(String pubkey, String createdAt, String kind, String strTags, String content) {
|
String getShaId(String pubkey, String createdAt, String kind, String strTags, String content) {
|
||||||
|
@ -2243,6 +2243,7 @@ class Store {
|
|||||||
|
|
||||||
if( selfContactEvent != null) {
|
if( selfContactEvent != null) {
|
||||||
List<Contact> selfContacts = selfContactEvent.eventData.contactList;
|
List<Contact> selfContacts = selfContactEvent.eventData.contactList;
|
||||||
|
selfContacts.sort();
|
||||||
selfNumContacts = selfContacts.length;
|
selfNumContacts = selfContacts.length;
|
||||||
for(int i = 0; i < selfContacts.length; i ++) {
|
for(int i = 0; i < selfContacts.length; i ++) {
|
||||||
// check if you follow the other account
|
// check if you follow the other account
|
||||||
|
Loading…
x
Reference in New Issue
Block a user