From 5c5d0559c2ccd6b6d4839fc83387d8483b2a5b50 Mon Sep 17 00:00:00 2001 From: Ivan Sein Date: Fri, 27 Jul 2018 10:14:32 +0200 Subject: [PATCH] Fix guests display in participant list. Signed-off-by: Ivan Sein --- VideoCalls/NCRoomParticipants.m | 7 +++++ VideoCalls/RoomInfoTableViewController.m | 35 ++++++++++++++---------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/VideoCalls/NCRoomParticipants.m b/VideoCalls/NCRoomParticipants.m index 4c90cc35..5623d9e2 100644 --- a/VideoCalls/NCRoomParticipants.m +++ b/VideoCalls/NCRoomParticipants.m @@ -49,4 +49,11 @@ return (_participantType == kNCParticipantTypeGuest) ? _sessionId : _userId; } +- (NSString *)displayName +{ + if (self.canModerate) { + return [NSString stringWithFormat:@"%@ %@", _displayName, @"(moderator)"]; + } + return _displayName; +} @end diff --git a/VideoCalls/RoomInfoTableViewController.m b/VideoCalls/RoomInfoTableViewController.m index abcc944f..44b23758 100644 --- a/VideoCalls/RoomInfoTableViewController.m +++ b/VideoCalls/RoomInfoTableViewController.m @@ -525,22 +525,27 @@ typedef enum PublicSection { cell = [[ContactsTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kContactCellIdentifier]; } - NSString *participantName = participant.displayName; - NSString *moderatorString = @"(moderator)"; - if (participant.canModerate) { - participantName = [NSString stringWithFormat:@"%@ %@", participantName, moderatorString]; - } - cell.labelTitle.text = participantName; + // Display name + cell.labelTitle.text = participant.displayName; - // Create avatar for every participant - [cell.contactImage setImageWithString:participant.displayName color:nil circular:true]; - // Request user avatar to the server and set it if exist - [cell.contactImage setImageWithURLRequest:[[NCAPIController sharedInstance] createAvatarRequestForUser:participant.userId andSize:96] - placeholderImage:nil - success:nil - failure:nil]; - cell.contactImage.layer.cornerRadius = 24.0; - cell.contactImage.layer.masksToBounds = YES; + // Avatar + if (participant.participantType == kNCParticipantTypeGuest) { + UIColor *guestAvatarColor = [UIColor colorWithRed:0.84 green:0.84 blue:0.84 alpha:1.0]; /*#d5d5d5*/ + NSString *avatarName = ([participant.displayName isEqualToString:@""]) ? @"?" : participant.displayName; + NSString *guestName = ([participant.displayName isEqualToString:@""]) ? @"Guest" : participant.displayName; + cell.labelTitle.text = guestName; + [cell.contactImage setImageWithString:avatarName color:guestAvatarColor circular:true]; + } else { + // Create avatar for every participant + [cell.contactImage setImageWithString:participant.displayName color:nil circular:true]; + // Request user avatar to the server and set it if exist + [cell.contactImage setImageWithURLRequest:[[NCAPIController sharedInstance] createAvatarRequestForUser:participant.userId andSize:96] + placeholderImage:nil + success:nil + failure:nil]; + cell.contactImage.layer.cornerRadius = 24.0; + cell.contactImage.layer.masksToBounds = YES; + } // Online status if (participant.isOffline) {