diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index fe20e12c3..cf246ea2d 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -297,7 +297,7 @@ LOGE(@"PushNotification: does not have call-id yet, fix it !"); } - if ([loc_key isEqualToString:@"IM_MSG"]) { + if ([loc_key isEqualToString:@"IM_MSG"] || [loc_key isEqualToString:@"IM_FULLMSG"]) { [[PhoneMainView instance] changeCurrentView:[ChatViewController compositeViewDescription]]; diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index d983e88d3..173bfcb58 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -325,6 +325,8 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); forKey:@"start_at_boot_preference"]; [self setBool:[lm lpConfigBoolForKey:@"autoanswer_notif_preference" withDefault:NO] forKey:@"autoanswer_notif_preference"]; + [self setBool:[lm lpConfigBoolForKey:@"show_msg_in_notif" withDefault:NO] + forKey:@"show_msg_in_notif"]; [self setBool:[lm lpConfigBoolForKey:@"enable_first_login_view_preference" withDefault:NO] forKey:@"enable_first_login_view_preference"]; LinphoneAddress *parsed = linphone_core_get_primary_contact_parsed(lc); @@ -765,6 +767,8 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); [lm lpConfigSetInt:[self integerForKey:@"start_at_boot_preference"] forKey:@"start_at_boot_preference"]; [lm lpConfigSetInt:[self integerForKey:@"autoanswer_notif_preference"] forKey:@"autoanswer_notif_preference"]; + [lm lpConfigSetInt:[self integerForKey:@"show_msg_in_notif"] forKey:@"show_msg_in_notif"]; + BOOL firstloginview = [self boolForKey:@"enable_first_login_view_preference"]; [lm lpConfigSetInt:firstloginview forKey:@"enable_first_login_view_preference"]; diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index a73ce1cf3..438ca1f50 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -901,6 +901,8 @@ static void linphone_iphone_registration_state(LinphoneCore *lc, LinphoneProxyCo NSString *remote_uri = [NSString stringWithUTF8String:c_address]; const char *call_id = linphone_chat_message_get_custom_header(msg, "Call-ID"); NSString *callID = [NSString stringWithUTF8String:call_id]; + const char* chat = linphone_chat_message_get_text(msg); + if( chat == NULL) chat = ""; ms_free(c_address); @@ -915,6 +917,8 @@ static void linphone_iphone_registration_state(LinphoneCore *lc, LinphoneProxyCo linphone_address_new([address cStringUsingEncoding:[NSString defaultCStringEncoding]]); address = [NSString stringWithUTF8String:linphone_address_get_username(linphoneAddress)]; linphone_address_destroy(linphoneAddress); + } else { + address = @(linphone_address_get_username(remoteAddress)); } } if (address == nil) { @@ -928,7 +932,11 @@ static void linphone_iphone_registration_state(LinphoneCore *lc, LinphoneProxyCo if ([[UIDevice currentDevice].systemVersion floatValue] >= 8) { notif.category = @"incoming_msg"; } - notif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"IM_MSG", nil), address]; + if ( [[LinphoneManager instance] lpConfigBoolForKey:@"show_msg_in_notif"] ){ + notif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"IM_FULLMSG", nil), address, @(chat)]; + } else { + notif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"IM_MSG", nil), address]; + } notif.alertAction = NSLocalizedString(@"Show", nil); notif.soundName = @"msg.caf"; notif.userInfo = @{ @"from" : address, @"from_addr" : remote_uri, @"call-id" : callID }; diff --git a/Resources/ar.lproj/Localizable.strings b/Resources/ar.lproj/Localizable.strings index 315cda811..7e78a6654 100644 Binary files a/Resources/ar.lproj/Localizable.strings and b/Resources/ar.lproj/Localizable.strings differ diff --git a/Resources/en.lproj/Localizable.strings b/Resources/en.lproj/Localizable.strings index c9e1b2b28..3f3682ccc 100644 Binary files a/Resources/en.lproj/Localizable.strings and b/Resources/en.lproj/Localizable.strings differ diff --git a/Resources/fr.lproj/Localizable.strings b/Resources/fr.lproj/Localizable.strings index 80a3c5ce6..31d53a8ca 100644 Binary files a/Resources/fr.lproj/Localizable.strings and b/Resources/fr.lproj/Localizable.strings differ diff --git a/Resources/ru.lproj/Localizable.strings b/Resources/ru.lproj/Localizable.strings index 36ef11b63..22272ae24 100644 Binary files a/Resources/ru.lproj/Localizable.strings and b/Resources/ru.lproj/Localizable.strings differ diff --git a/Settings/InAppSettings.bundle/Advanced.plist b/Settings/InAppSettings.bundle/Advanced.plist index ca86b640e..ab7621b1f 100644 --- a/Settings/InAppSettings.bundle/Advanced.plist +++ b/Settings/InAppSettings.bundle/Advanced.plist @@ -36,6 +36,32 @@ Type IASKButtonSpecifier + + Title + Notifications + Type + PSGroupSpecifier + + + DefaultValue + + Key + show_msg_in_notif + Title + Show message in notification + Type + PSToggleSwitchSpecifier + + + DefaultValue + + Key + autoanswer_notif_preference + Title + Auto-answer after notification + Type + PSToggleSwitchSpecifier + Title Other @@ -52,16 +78,6 @@ Type PSToggleSwitchSpecifier - - DefaultValue - - Key - backgroundmode_preference - Title - Background mode - Type - PSToggleSwitchSpecifier - DefaultValue @@ -72,16 +88,6 @@ 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 b43a5407d..d056b28b9 100644 --- a/Settings/InAppSettings.bundle/en.lproj/Advanced.strings +++ b/Settings/InAppSettings.bundle/en.lproj/Advanced.strings @@ -2,11 +2,12 @@ "Debug" = "Debug"; "Send Logs" = "Send Logs"; "Clear Logs" = "Clear Logs"; +"Notifications" = "Notifications"; +"Show message in notification" = "Show message in notification"; +"Auto-answer after notification" = "Auto-answer after notification"; "Other" = "Other"; "Animations" = "Animations"; -"Background mode" = "Background mode"; "Start at boot" = "Start at boot"; -"Auto-answer after notification" = "Auto-answer after notification"; "First login view" = "First login view"; "Expire" = "Expire"; "Primary account" = "Primary account"; diff --git a/Tools/i18n_generate_strings_files.sh b/Tools/i18n_generate_strings_files.sh index 6c18305cb..931cb4831 100755 --- a/Tools/i18n_generate_strings_files.sh +++ b/Tools/i18n_generate_strings_files.sh @@ -41,12 +41,14 @@ function generate_localizable_from_sources { iconv -f utf-16 -t utf-8 $localizable_en > $localizable_en.tmp IC_MSG_EN=$(sed -nE 's/"IC_MSG" = "(.*)";/\1/p' $localizable_en.tmp) IM_MSG_EN=$(sed -nE 's/"IM_MSG" = "(.*)";/\1/p' $localizable_en.tmp) + IM_FULLMSG_EN=$(sed -nE 's/"IM_FULLMSG_EN" = "(.*)";/\1/p' $localizable_en.tmp) rm -f $localizable_en $localizable_en.tmp find $root_directory/Classes -name '*.m' | xargs genstrings -u -a -o $(dirname $localizable_en) iconv -f utf-16LE -t utf-8 $localizable_en > $localizable_en.tmp sed -i.bak "s/= \"IC_MSG\";/= \"$IC_MSG_EN\";/" $localizable_en.tmp sed -i.bak "s/= \"IM_MSG\";/= \"$IM_MSG_EN\";/" $localizable_en.tmp + sed -i.bak "s/= \"IM_FULLMSG_EN\";/= \"$IM_FULLMSG_EN\";/" $localizable_en.tmp iconv -f utf-8 -t utf-16LE $localizable_en.tmp > $localizable_en rm $localizable_en.tmp.bak $localizable_en.tmp }