diff --git a/Classes/ChatConversationTableView.m b/Classes/ChatConversationTableView.m index 3383cfb81..46f02b49e 100644 --- a/Classes/ChatConversationTableView.m +++ b/Classes/ChatConversationTableView.m @@ -139,6 +139,9 @@ } linphone_chat_room_mark_as_read(chatRoom); + TabBarView *tab = (TabBarView *)[PhoneMainView.instance.mainViewController + getCachedController:NSStringFromClass(TabBarView.class)]; + [tab update:YES]; // Scroll to unread if (index >= 0) { diff --git a/Classes/ChatConversationView.m b/Classes/ChatConversationView.m index d5d4cc6f2..d9780f84d 100644 --- a/Classes/ChatConversationView.m +++ b/Classes/ChatConversationView.m @@ -161,7 +161,9 @@ static UICompositeViewDescription *compositeDescription = nil; [self update]; linphone_chat_room_mark_as_read(chatRoom); [self setComposingVisible:linphone_chat_room_is_remote_composing(chatRoom) withDelay:0]; - // [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneMessageReceived object:self]; + TabBarView *tab = (TabBarView *)[PhoneMainView.instance.mainViewController + getCachedController:NSStringFromClass(TabBarView.class)]; + [tab update:YES]; } else { _chatView.hidden = YES; } @@ -170,7 +172,9 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)applicationWillEnterForeground:(NSNotification *)notif { if (chatRoom != nil) { linphone_chat_room_mark_as_read(chatRoom); - // [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneMessageReceived object:self]; + TabBarView *tab = (TabBarView *)[PhoneMainView.instance.mainViewController + getCachedController:NSStringFromClass(TabBarView.class)]; + [tab update:YES]; } } diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index f3972ed4a..9061a233f 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -290,7 +290,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:ChatsListView.compositeViewDescription]; @@ -431,6 +431,9 @@ LinphoneChatRoom *room = linphone_core_get_chat_room_from_uri(lc, [from UTF8String]); if (room) { linphone_chat_room_mark_as_read(room); + TabBarView *tab = (TabBarView *)[PhoneMainView.instance.mainViewController + getCachedController:NSStringFromClass(TabBarView.class)]; + [tab update:YES]; [PhoneMainView.instance updateApplicationBadgeNumber]; } } diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index 3a98baf8e..c2bf4a6c3 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -375,6 +375,7 @@ 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:YES] 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); @@ -812,6 +813,7 @@ 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 938df5ad6..bea52ff95 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -925,10 +925,13 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char NSString *from = [FastAddressBook displayNameForAddress:remoteAddress]; char *c_address = linphone_address_as_string_uri_only(remoteAddress); NSString *remote_uri = [NSString stringWithUTF8String:c_address]; + const char *chat = linphone_chat_message_get_text(msg); + if (chat == NULL) + chat = ""; + ms_free(c_address); if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) { - // Create a new notification UILocalNotification *notif = [[UILocalNotification alloc] init]; if (notif) { @@ -936,7 +939,11 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char if ([[UIDevice currentDevice].systemVersion floatValue] >= 8) { notif.category = @"incoming_msg"; } - notif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"IM_MSG", nil), from]; + if ([[LinphoneManager instance] lpConfigBoolForKey:@"show_msg_in_notif" withDefault:YES]) { + notif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"IM_FULLMSG", nil), from, @(chat)]; + } else { + notif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"IM_MSG", nil), from]; + } notif.alertAction = NSLocalizedString(@"Show", nil); notif.soundName = @"msg.caf"; notif.userInfo = @{ @"from" : from, @"from_addr" : remote_uri, @"call-id" : callID }; diff --git a/Classes/LinphoneUI/TabBarView.h b/Classes/LinphoneUI/TabBarView.h index 9f249378b..d132c3433 100644 --- a/Classes/LinphoneUI/TabBarView.h +++ b/Classes/LinphoneUI/TabBarView.h @@ -34,6 +34,8 @@ @property(nonatomic, strong) IBOutlet UILabel *historyNotificationLabel; @property(weak, nonatomic) IBOutlet UIImageView *selectedButtonImage; +- (void)update:(BOOL)appear; + - (IBAction)onHistoryClick:(id)event; - (IBAction)onContactsClick:(id)event; - (IBAction)onDialerClick:(id)event; diff --git a/Classes/LinphoneUI/UIBouncingView.m b/Classes/LinphoneUI/UIBouncingView.m index a7f4b4d0c..0407ddb70 100644 --- a/Classes/LinphoneUI/UIBouncingView.m +++ b/Classes/LinphoneUI/UIBouncingView.m @@ -45,10 +45,10 @@ INIT_WITH_COMMON { - (void)applicationWillEnterForeground:(NSNotification *)notif { // Force the animations - if (!self.isHidden) { - [self startAnimating:NO]; - } else { + if (self.isHidden) { [self stopAnimating:NO]; + } else { + [self startAnimating:NO]; } } diff --git a/Resources/en.lproj/Localizable.strings b/Resources/en.lproj/Localizable.strings index e4a4563e3..3869e1634 100644 Binary files a/Resources/en.lproj/Localizable.strings and b/Resources/en.lproj/Localizable.strings differ diff --git a/Settings/InAppSettings.bundle/Advanced.plist b/Settings/InAppSettings.bundle/Advanced.plist index 807ca601d..9d778bd59 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 bbb80be67..f6676e75a 100755 --- a/Tools/i18n_generate_strings_files.sh +++ b/Tools/i18n_generate_strings_files.sh @@ -54,12 +54,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\";/= \"$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