added support for '#' in url when not breaking one

and imporved logic for kind 0 processing ( tested with b10 account)
This commit is contained in:
Vishal 2022-11-22 04:08:32 +05:30
parent 916da86ebf
commit ea062ebf88
2 changed files with 4 additions and 8 deletions

View File

@ -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) {

View File

@ -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<List<int>> getUrlRanges(String s) {
List<List<int>> 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<List<int>> 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; ) {