diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 7e385dd6b..03e5fe394 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -276,11 +276,14 @@ if([notification.userInfo objectForKey:@"callId"] != nil) { + BOOL auto_answer = TRUE; // some local notifications have an internal timer to relaunch themselves at specified intervals if( [[notification.userInfo objectForKey:@"timer"] intValue] == 1 ){ [[LinphoneManager instance] cancelLocalNotifTimerForCallId:[notification.userInfo objectForKey:@"callId"]]; - } else { - // auto answer only for non-timed local notifications + auto_answer = [[LinphoneManager instance] lpConfigBoolForKey:@"autoanswer_notif_preference"]; + } + if(auto_answer) + { [[LinphoneManager instance] acceptCallForCallId:[notification.userInfo objectForKey:@"callId"]]; } } else if([notification.userInfo objectForKey:@"from"] != nil) { diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index 0eef88242..022a3c665 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -209,7 +209,8 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); [self setBool: lp_config_get_int(conf,LINPHONERC_APPLICATION_KEY,"start_at_boot_preference",1) forKey:@"start_at_boot_preference"]; [self setBool: lp_config_get_int(conf,LINPHONERC_APPLICATION_KEY,"backgroundmode_preference",1) forKey:@"backgroundmode_preference"]; - + [self setBool: lp_config_get_int(conf,LINPHONERC_APPLICATION_KEY,"autoanswer_notif_preference",1) forKey:@"autoanswer_notif_preference"]; + { const LinphoneVideoPolicy *pol; @@ -625,6 +626,8 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "backgroundmode_preference", isbackgroundModeEnabled); lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "start_at_boot_preference", [self boolForKey:@"start_at_boot_preference"]); + lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "autoanswer_notif_preference", [self boolForKey:@"autoanswer_notif_preference"]); + BOOL firstloginview = [self boolForKey:@"enable_first_login_view_preference"]; lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "enable_first_login_view_preference", firstloginview); diff --git a/Resources/linphonerc b/Resources/linphonerc index eb2ae79f8..4da97f006 100644 --- a/Resources/linphonerc +++ b/Resources/linphonerc @@ -28,6 +28,7 @@ edge_opt_preference=0 use_system_contacts=0 start_at_boot_preference=1 backgroundmode_preference=1 +autoanswer_notif_preference=1 [default_values] diff --git a/Resources/linphonerc~ipad b/Resources/linphonerc~ipad index 1f424bab1..008d4a702 100644 --- a/Resources/linphonerc~ipad +++ b/Resources/linphonerc~ipad @@ -28,6 +28,7 @@ edge_opt_preference=0 use_system_contacts=0 start_at_boot_preference=1 backgroundmode_preference=1 +autoanswer_notif_preference=1 [default_values] reg_expires=600 diff --git a/Settings/InAppSettings.bundle/Advanced.plist b/Settings/InAppSettings.bundle/Advanced.plist index 969901689..e29ca7a2e 100644 --- a/Settings/InAppSettings.bundle/Advanced.plist +++ b/Settings/InAppSettings.bundle/Advanced.plist @@ -86,6 +86,16 @@ Type PSToggleSwitchSpecifier + + DefaultValue + + Key + autoanswer_notif_preference + Title + Auto-answer after notification + Type + PSToggleSwitchSpecifier + DefaultValue diff --git a/Settings/InAppSettings.bundle/en.lproj/Advanced.strings b/Settings/InAppSettings.bundle/en.lproj/Advanced.strings index 0ef0faedf..c962e7a60 100644 --- a/Settings/InAppSettings.bundle/en.lproj/Advanced.strings +++ b/Settings/InAppSettings.bundle/en.lproj/Advanced.strings @@ -52,3 +52,4 @@ /* Landscape */ "Landscape" = "Landscape"; +"Auto-answer after notification" = "Auto-answer after notification"; \ No newline at end of file diff --git a/Settings/InAppSettings.bundle/fr.lproj/Advanced.strings b/Settings/InAppSettings.bundle/fr.lproj/Advanced.strings index 57d7e22a8..b73671ef1 100644 --- a/Settings/InAppSettings.bundle/fr.lproj/Advanced.strings +++ b/Settings/InAppSettings.bundle/fr.lproj/Advanced.strings @@ -52,3 +52,4 @@ /* Landscape */ "Landscape" = "Paysage"; +"Auto-answer after notification" = "Réponse auto. sur notification"; \ No newline at end of file diff --git a/Settings/InAppSettings.bundle/ru.lproj/Advanced.strings b/Settings/InAppSettings.bundle/ru.lproj/Advanced.strings index d05cbcd42..bc18bd31d 100644 --- a/Settings/InAppSettings.bundle/ru.lproj/Advanced.strings +++ b/Settings/InAppSettings.bundle/ru.lproj/Advanced.strings @@ -52,3 +52,4 @@ /* Landscape */ "Landscape" = "Альбомный"; +"Auto-answer after notification" = "Auto-answer after notification"; \ No newline at end of file