Merge pull request #285 from vector-im/update_room_members_list

Update room members list
This commit is contained in:
manuroe
2016-04-29 14:30:36 +02:00
7 changed files with 188 additions and 180 deletions
@@ -25,6 +25,7 @@
#import "RageShakeManager.h"
#import "AvatarGenerator.h"
#import "Tools.h"
#import "TableViewCellWithButton.h"
@@ -219,41 +220,12 @@
memberTitleView.memberBadge.hidden = YES;
}
NSString* presenceText = nil;
NSString* presenceText;
if (self.mxRoomMember.userId)
{
MXUser *user = [self.mxRoom.mxSession userWithUserId:self.mxRoomMember.userId];
if (user)
{
if (user.presence == MXPresenceOnline)
{
presenceText = NSLocalizedStringFromTable(@"room_participants_active", @"Vector", nil);
}
else
{
NSUInteger lastActiveMs = user.lastActiveAgo;
if (-1 != lastActiveMs)
{
NSUInteger lastActivehour = lastActiveMs / 1000 / 60 / 60;
NSUInteger lastActiveDays = lastActivehour / 24;
if (lastActivehour < 1)
{
presenceText = NSLocalizedStringFromTable(@"room_participants_active_less_1_hour", @"Vector", nil);
}
else if (lastActivehour < 24)
{
presenceText = [NSString stringWithFormat:NSLocalizedStringFromTable(@"room_participants_active_less_x_hours", @"Vector", nil), lastActivehour];
}
else
{
presenceText = [NSString stringWithFormat:NSLocalizedStringFromTable(@"room_participants_active_less_x_days", @"Vector", nil), lastActiveDays];
}
}
}
}
presenceText = [Tools presenceText:user];
}
self.roomMemberStatusLabel.text = presenceText;