зеркало из https://github.com/nextcloud/talk-ios.git
Sort rooms by last activity.
Signed-off-by: Ivan Sein <ivan@nextcloud.com>
This commit is contained in:
Родитель
82c8b3c8d2
Коммит
4d464ef047
|
@ -132,8 +132,9 @@ NSString * const kNCSpreedAPIVersion = @"/apps/spreed/api/v1";
|
|||
[rooms addObject:ncRoom];
|
||||
}
|
||||
|
||||
// Sort by lastPing
|
||||
NSSortDescriptor *valueDescriptor = [[NSSortDescriptor alloc] initWithKey:@"lastPing" ascending:NO];
|
||||
// Sort by lastPing or lastActivity
|
||||
NSString *sortKey = ([[NCSettingsController sharedInstance] serverHasTalkCapability:kCapabilityLastRoomActivity]) ? @"lastActivity" : @"lastPing";
|
||||
NSSortDescriptor *valueDescriptor = [[NSSortDescriptor alloc] initWithKey:sortKey ascending:NO];
|
||||
NSArray *descriptors = [NSArray arrayWithObject:valueDescriptor];
|
||||
[rooms sortUsingDescriptors:descriptors];
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ typedef enum NCRoomType {
|
|||
@property (nonatomic, assign) NSInteger unreadMessages;
|
||||
@property (nonatomic, copy) NSString *guestList;
|
||||
@property (nonatomic, copy) NSDictionary *participants;
|
||||
@property (nonatomic, assign) NSInteger lastActivity;
|
||||
|
||||
+ (instancetype)roomWithDictionary:(NSDictionary *)roomDict;
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
room.unreadMessages = [[roomDict objectForKey:@"unreadMessages"] integerValue];
|
||||
room.guestList = [roomDict objectForKey:@"guestList"];
|
||||
room.participants = [roomDict objectForKey:@"participants"];
|
||||
room.lastActivity = [[roomDict objectForKey:@"lastActivity"] integerValue];
|
||||
|
||||
id name = [roomDict objectForKey:@"name"];
|
||||
if ([name isKindOfClass:[NSString class]]) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче