Skip to content

Commit

Permalink
printed name of channel at top
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalxl committed Aug 24, 2022
1 parent 6f6caea commit 002d418
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/tree_ds.dart
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,15 @@ class Tree {
}

void printChannel(ChatRoom room) {
String displayName = room.chatRoomId;
if( room.name != "") {
displayName = "${room.name} ( ${displayName.substring(0, 6)} )";
}

int lenDashes = 10;
String str = getNumSpaces(gNumLeftMarginSpaces + 10) + getNumDashes(lenDashes) + displayName + getNumDashes(lenDashes);
print(" ${getNumSpaces(gNumLeftMarginSpaces + displayName.length~/2 + 4)}In Channel");
print("\n$str\n");

for(int i = 0; i < room.messageIds.length; i++) {
String eId = room.messageIds[i];
Expand All @@ -430,10 +439,9 @@ class Tree {
}
}


// shows the given channelId, where channelId is prefix-id or channel name as mentioned in room.name. returns full id of channel.
String showChannel(String channelId) {

for( String key in chatRooms.keys) {
if( key.substring(0, channelId.length) == channelId ) {
ChatRoom? room = chatRooms[key];
Expand All @@ -451,7 +459,6 @@ class Tree {
if( room.name.length < channelId.length) {
continue;
}

print("room = ${room.name} channelId = $channelId");
if( room.name.substring(0, channelId.length) == channelId ) {
printChannel(room);
Expand Down

0 comments on commit 002d418

Please sign in to comment.