mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-01 05:36:57 +02:00
Room member details: Factorised the pretty string for presence in [Tools presenceText]
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user