Better implementation of NCRoom class methods.

Signed-off-by: Ivan Sein <ivan@nextcloud.com>
This commit is contained in:
Ivan Sein 2020-06-15 17:40:57 +02:00
Родитель 6b85ecb4ea
Коммит 1883722885
2 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -71,6 +71,7 @@ extern NSString * const NCRoomObjectTypeSharePassword;
@property (nonatomic, assign) BOOL hasCall;
@property (nonatomic, assign) NSInteger lastUpdate;
+ (instancetype)roomWithDictionary:(NSDictionary *)roomDict;
+ (instancetype)roomWithDictionary:(NSDictionary *)roomDict andAccountId:(NSString *)accountId;
+ (void)updateRoom:(NCRoom *)managedRoom withRoom:(NCRoom *)room;

Просмотреть файл

@ -22,7 +22,7 @@ NSString * const NCRoomObjectTypeSharePassword = @"share:password";
return nil;
}
NCRoom *room = [[NCRoom alloc] init];
NCRoom *room = [[self alloc] init];
room.roomId = [[roomDict objectForKey:@"id"] integerValue];
room.token = [roomDict objectForKey:@"token"];
room.type = (NCRoomType)[[roomDict objectForKey:@"type"] integerValue];
@ -66,7 +66,7 @@ NSString * const NCRoomObjectTypeSharePassword = @"share:password";
+ (instancetype)roomWithDictionary:(NSDictionary *)roomDict andAccountId:(NSString *)accountId
{
NCRoom *room = [NCRoom roomWithDictionary:roomDict];
NCRoom *room = [self roomWithDictionary:roomDict];
if (room) {
room.accountId = accountId;
room.internalId = [NSString stringWithFormat:@"%@@%@", room.accountId, room.token];