Merge remote-tracking branch 'public/dev_showmsg' into 3.0.x

This commit is contained in:
Gautier Pelloux-Prayer 2015-12-21 10:50:36 +01:00
commit 2a75f69ed2
11 changed files with 60 additions and 30 deletions

View file

@ -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) {

View file

@ -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];
}
}

View file

@ -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];
}
}

View file

@ -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"];

View file

@ -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 };

View file

@ -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;

View file

@ -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];
}
}

View file

@ -36,6 +36,32 @@
<key>Type</key>
<string>IASKButtonSpecifier</string>
</dict>
<dict>
<key>Title</key>
<string>Notifications</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>DefaultValue</key>
<true/>
<key>Key</key>
<string>show_msg_in_notif</string>
<key>Title</key>
<string>Show message in notification</string>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>DefaultValue</key>
<true/>
<key>Key</key>
<string>autoanswer_notif_preference</string>
<key>Title</key>
<string>Auto-answer after notification</string>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>Title</key>
<string>Other</string>
@ -52,16 +78,6 @@
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>DefaultValue</key>
<true/>
<key>Key</key>
<string>backgroundmode_preference</string>
<key>Title</key>
<string>Background mode</string>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>DefaultValue</key>
<true/>
@ -72,16 +88,6 @@
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>DefaultValue</key>
<true/>
<key>Key</key>
<string>autoanswer_notif_preference</string>
<key>Title</key>
<string>Auto-answer after notification</string>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>DefaultValue</key>
<true/>

View file

@ -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";

View file

@ -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