зеркало из https://github.com/nextcloud/talk-ios.git
Guard creation of external signaling controller with background task
Signed-off-by: Marcel Müller <marcel-mueller@gmx.de>
This commit is contained in:
Родитель
83d52231f6
Коммит
3b624dee0f
|
@ -458,13 +458,17 @@ NSString * const kDidReceiveCallsFromOldAccount = @"receivedCallsFromOldAccount"
|
|||
- (void)setSignalingConfigurationForAccountId:(NSString *)accountId
|
||||
{
|
||||
NSDictionary *signalingConfiguration = [_signalingConfigutations objectForKey:accountId];
|
||||
NSString *externalSignalingTicket = [signalingConfiguration objectForKey:@"ticket"];
|
||||
NSString *externalSignalingServer = nil;
|
||||
|
||||
id server = [signalingConfiguration objectForKey:@"server"];
|
||||
if ([server isKindOfClass:[NSString class]] && ![server isEqualToString:@""]) {
|
||||
externalSignalingServer = server;
|
||||
}
|
||||
NSString *externalSignalingTicket = [signalingConfiguration objectForKey:@"ticket"];
|
||||
|
||||
if (externalSignalingServer && externalSignalingTicket) {
|
||||
BGTaskHelper *bgTask = [BGTaskHelper startBackgroundTaskWithName:@"NCSetSignalingConfiguration" expirationHandler:nil];
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
NCExternalSignalingController *extSignalingController = [self->_externalSignalingControllers objectForKey:accountId];
|
||||
|
||||
|
@ -475,6 +479,8 @@ NSString * const kDidReceiveCallsFromOldAccount = @"receivedCallsFromOldAccount"
|
|||
TalkAccount *account = [[NCDatabaseManager sharedInstance] talkAccountForAccountId:accountId];
|
||||
extSignalingController = [[NCExternalSignalingController alloc] initWithAccount:account server:externalSignalingServer andTicket:externalSignalingTicket];
|
||||
[self->_externalSignalingControllers setObject:extSignalingController forKey:accountId];
|
||||
|
||||
[bgTask stopBackgroundTask];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче