fixed get channel fetch so channels get printed

replies not supported yet
This commit is contained in:
Vishal 2022-09-14 23:57:38 +05:30
parent a20d7d0672
commit 149e06acf3
2 changed files with 15 additions and 7 deletions

View File

@ -686,7 +686,7 @@ Future<void> mainMenuUi(Store node) async {
// the main menu
int option = showMenu(['Display feed', // 1
'Post/Reply/Like', // 2
// 'Public Channels', // 3
'Public Channels', // 3
'Private Messages', // 4
'Other Options', // 5
'Quit'], // 6
@ -730,19 +730,19 @@ Future<void> mainMenuUi(Store node) async {
await sendReplyPostLike(node, replyToId, replyKind, content);
break;
case 9:
case 3:
await channelMenuUI(node);
break;
case 3:
case 4:
await PrivateMenuUI(node);
break;
case 4:
case 5:
await otherMenuUi(node);
break;
case 5:
case 6:
default:
userContinue = false;
String authorName = getAuthorName(userPublicKey);

View File

@ -255,12 +255,20 @@ class EventData {
return decrypted;
}
// only applicable for kind 42 event
// only applicable for kind 42 event; returns the channel 40 id of which the event is part of
String getChannelIdForMessage() {
if( kind != 42) {
return "";
}
return getParent();
// get first e tag, which should be the channel of which this is part of
for( int i = 0; i < tags.length; i++) {
List tag = tags[i];
if( tag[0] == 'e') {
return tag[1];
}
}
return '';
}
// prints event data in the format that allows it to be shown in tree form by the Tree class