Room Members: Add Admin/Moderator badge on members's picture

This commit is contained in:
giomfo
2016-04-11 21:28:11 +02:00
parent 44fb8e348f
commit 189766f75f
26 changed files with 135 additions and 6 deletions
@@ -590,6 +590,8 @@
participantCell.accessoryView = nil;
participantCell.contentView.alpha = 1;
participantCell.userInteractionEnabled = YES;
participantCell.thumbnailBadgeView.hidden = YES;
}
participantCell.mxRoom = self.mxRoom;
@@ -683,6 +685,22 @@
participantCell.accessoryView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"plus_icon"]];
}
}
else if (contact.mxMember)
{
// Update member badge
MXRoomPowerLevels *powerLevels = [self.mxRoom.state powerLevels];
NSInteger powerLevel = [powerLevels powerLevelOfUserWithUserID:contact.mxMember.userId];
if (powerLevel >= kVectorRoomAdminLevel)
{
participantCell.thumbnailBadgeView.image = [UIImage imageNamed:@"admin_icon_small"];
participantCell.thumbnailBadgeView.hidden = NO;
}
else if (powerLevel >= kVectorRoomModeratorLevel)
{
participantCell.thumbnailBadgeView.image = [UIImage imageNamed:@"mod_icon_small"];
participantCell.thumbnailBadgeView.hidden = NO;
}
}
}
return participantCell;