forked from mirrors/linphone-iphone
Add the option to show the user's message in notifications
This commit is contained in:
parent
0ed78b263b
commit
b40d8ab476
10 changed files with 45 additions and 24 deletions
|
|
@ -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]];
|
||||
|
||||
|
|
|
|||
|
|
@ -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"];
|
||||
|
|
|
|||
|
|
@ -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 };
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -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/>
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue