From ea062ebf8829fc92f92dda44a08821888c268f21 Mon Sep 17 00:00:00 2001 From: Vishal <64505169+vishalxl@users.noreply.github.com> Date: Tue, 22 Nov 2022 04:08:32 +0530 Subject: [PATCH] added support for '#' in url when not breaking one and imporved logic for kind 0 processing ( tested with b10 account) --- lib/console_ui.dart | 2 +- lib/event_ds.dart | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/console_ui.dart b/lib/console_ui.dart index d221468..09a7123 100644 --- a/lib/console_ui.dart +++ b/lib/console_ui.dart @@ -303,7 +303,7 @@ void printProfile(Store node, String profilePubkey) { print("About : $about"); print("Picture : $picture"); print("Nip 05 : ${verified?"yes. ${nip05Id}":"no"}"); - print("Last Updated: ${getPrintableDate(dateLastUpdated)}\n"); + print("\nLast Updated: ${getPrintableDate(dateLastUpdated)}\n"); if( profilePubkey != userPublicKey) { diff --git a/lib/event_ds.dart b/lib/event_ds.dart index 494892a..566ed46 100644 --- a/lib/event_ds.dart +++ b/lib/event_ds.dart @@ -985,13 +985,12 @@ bool processKind0Event(Event e) { bool newEntry = false, entryModified = false; if( !gKindONames.containsKey(e.eventData.pubkey)) { - gKindONames[e.eventData.pubkey] = UserNameInfo(e.eventData.createdAt, name, about, picture, null); + gKindONames[e.eventData.pubkey] = UserNameInfo(e.eventData.createdAt, name, about, picture, e); newEntry = true;; } else { int oldTime = gKindONames[e.eventData.pubkey]?.createdAt??0; if( oldTime < e.eventData.createdAt) { - Event? oldContactEvent = gKindONames[e.eventData.pubkey]?.latestContactEvent; - gKindONames[e.eventData.pubkey] = UserNameInfo(e.eventData.createdAt, name, about, picture, oldContactEvent); + gKindONames[e.eventData.pubkey] = UserNameInfo(e.eventData.createdAt, name, about, picture, e); entryModified = true; } } @@ -1188,7 +1187,7 @@ String getNumDashes(int num, [String dashType = "-"]) { List> getUrlRanges(String s) { List> urlRanges = []; - String regexp1 = "http[s]*:\/\/[a-zA-Z0-9]+([.a-zA-Z0-9/_-]*)"; + String regexp1 = "http[s]*:\/\/[a-zA-Z0-9]+([.a-zA-Z0-9/_\\-\\#]*)"; RegExp httpRegExp = RegExp(regexp1); for( var match in httpRegExp.allMatches(s) ) { @@ -1205,12 +1204,9 @@ String makeParagraphAtDepth(String s, int depthInSpaces) { List> urlRanges = getUrlRanges(s); - - String newString = ""; String spacesString = getNumSpaces(depthInSpaces + gNumLeftMarginSpaces); - int lenPerLine = gTextWidth - depthInSpaces; //print("In makeParagraphAtDepth: gNumLeftMarginSpaces = $gNumLeftMarginSpaces depthInSPaces = $depthInSpaces LenPerLine = $lenPerLine gTextWidth = $gTextWidth "); for(int startIndex = 0; startIndex < s.length; ) {