@@ -312,7 +312,7 @@ - (void)setupShareViewForAccount:(TalkAccount *)account
312
312
[self setProfileButtonForAccount: _shareAccount];
313
313
}
314
314
315
- NSArray *accountRooms = [self roomsForAccountId: _shareAccount.accountId];
315
+ NSArray *accountRooms = [[NCDatabaseManager sharedInstance ] roomsForAccountId: _shareAccount.accountId withRealm: _realm ];
316
316
_rooms = [[NSMutableArray alloc ] initWithArray: accountRooms];
317
317
_serverCapabilities = [self getServerCapabilitesForAccount: _shareAccount withRealm: _realm];
318
318
@@ -351,42 +351,6 @@ - (void)showAccountSelector
351
351
[self presentViewController: optionsActionSheet animated: YES completion: nil ];
352
352
}
353
353
354
- #pragma mark - Rooms
355
-
356
- - (NSArray *)roomsForAccountId : (NSString *)accountId
357
- {
358
- NSPredicate *query = [NSPredicate predicateWithFormat: @" accountId = %@" , accountId];
359
- RLMResults *managedRooms = [NCRoom objectsInRealm: _realm withPredicate: query];;
360
-
361
- // Create an unmanaged copy of the rooms
362
- NSMutableArray *unmanagedRooms = [NSMutableArray new ];
363
- for (NCRoom *managedRoom in managedRooms) {
364
- NCRoom *unmanagedRoom = [[NCRoom alloc ] initWithValue: managedRoom];
365
- // Filter out breakout rooms with lobby enabled
366
- if ([unmanagedRoom isBreakoutRoom ] && unmanagedRoom.lobbyState == NCRoomLobbyStateModeratorsOnly) {
367
- continue ;
368
- }
369
- [unmanagedRooms addObject: unmanagedRoom];
370
- }
371
- // Sort by favorites
372
- NSSortDescriptor *favoriteSorting = [NSSortDescriptor sortDescriptorWithKey: @" " ascending: YES comparator: ^NSComparisonResult (id _Nonnull obj1, id _Nonnull obj2) {
373
- NCRoom *first = (NCRoom*)obj1;
374
- NCRoom *second = (NCRoom*)obj2;
375
- BOOL favorite1 = first.isFavorite ;
376
- BOOL favorite2 = second.isFavorite ;
377
- if (favorite1 != favorite2) {
378
- return favorite2 - favorite1;
379
- }
380
- return NSOrderedSame;
381
- }];
382
- // Sort by lastActivity
383
- NSSortDescriptor *valueDescriptor = [[NSSortDescriptor alloc ] initWithKey: @" lastActivity" ascending: NO ];
384
- NSArray *descriptors = [NSArray arrayWithObjects: favoriteSorting, valueDescriptor, nil ];
385
- [unmanagedRooms sortUsingDescriptors: descriptors];
386
-
387
- return unmanagedRooms;
388
- }
389
-
390
354
#pragma mark - Shared items
391
355
392
356
- (void )setSharedItemToShareConfirmationViewController : (ShareConfirmationViewController *)shareConfirmationVC
0 commit comments