diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 02c02893d..75bac7e0a 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -952,77 +952,6 @@ static void linphone_iphone_message_received(LinphoneCore *lc, LinphoneChatRoom static void linphone_iphone_message_received_unable_decrypt(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *message) { - - NSString *callId = [NSString stringWithUTF8String:linphone_chat_message_get_custom_header(message, "Call-ID")]; - int index = [(NSNumber *)[LinphoneManager.instance.pushDict objectForKey:callId] intValue] - 1; - LOGI(@"Decrementing index of long running task for call id : %@ with index : %d", callId, index); - [LinphoneManager.instance.pushDict setValue:[NSNumber numberWithInt:index] forKey:callId]; - BOOL need_bg_task = FALSE; - for (NSString *key in [LinphoneManager.instance.pushDict allKeys]) { - int value = [(NSNumber *)[LinphoneManager.instance.pushDict objectForKey:key] intValue]; - if (value > 0) { - need_bg_task = TRUE; - break; - } - } - if (theLinphoneManager->pushBgTaskMsg && !need_bg_task) { - LOGI(@"Message received, stopping message background task for call-id [%@]", callId); - [[UIApplication sharedApplication] endBackgroundTask:theLinphoneManager->pushBgTaskMsg]; - theLinphoneManager->pushBgTaskMsg = 0; - } - const LinphoneAddress *address = linphone_chat_message_get_peer_address(message); - NSString *strAddr = [FastAddressBook displayNameForAddress:address]; - NSString *title = NSLocalizedString(@"LIME warning", nil); - NSString *body = [NSString - stringWithFormat:NSLocalizedString(@"You have received an encrypted message you are unable to decrypt from " - @"%@.\nYou need to call your correspondant in order to exchange your ZRTP " - @"keys if you want to decrypt the future messages you will receive.", - nil), - strAddr]; - NSString *action = NSLocalizedString(@"Call", nil); - - if ([UIApplication sharedApplication].applicationState != UIApplicationStateActive) { - if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_9_x_Max) { - UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init]; - content.title = title; - content.body = body; - UNNotificationRequest *req = - [UNNotificationRequest requestWithIdentifier:@"decrypt_request" content:content trigger:NULL]; - [[UNUserNotificationCenter currentNotificationCenter] - addNotificationRequest:req - withCompletionHandler:^(NSError *_Nullable error) { - // Enable or disable features based on authorization. - if (error) { - LOGD(@"Error while adding notification request :"); - LOGD(error.description); - } - }]; - } else { - UILocalNotification *notification = [[UILocalNotification alloc] init]; - notification.repeatInterval = 0; - notification.alertTitle = title; - notification.alertBody = body; - [[UIApplication sharedApplication] presentLocalNotificationNow:notification]; - } - } else { - UIAlertController *errView = - [UIAlertController alertControllerWithTitle:title message:body preferredStyle:UIAlertControllerStyleAlert]; - - UIAlertAction *defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil) - style:UIAlertActionStyleDefault - handler:^(UIAlertAction *action){ - }]; - - UIAlertAction *callAction = [UIAlertAction actionWithTitle:action - style:UIAlertActionStyleDefault - handler:^(UIAlertAction *action) { - [LinphoneManager.instance call:address]; - }]; - - [errView addAction:defaultAction]; - [errView addAction:callAction]; - [PhoneMainView.instance presentViewController:errView animated:YES completion:nil]; - } } - (void)onNotifyReceived:(LinphoneCore *)lc