repair flexisip pusher notification display

This commit is contained in:
Benjamin Reis 2018-03-12 12:01:59 +01:00
parent c898b72b7e
commit 190552d467
2 changed files with 33 additions and 20 deletions

View file

@ -434,7 +434,7 @@
return;
}
NSString *loc_key = [aps objectForKey:@"loc-key"];
NSString *loc_key = [aps objectForKey:@"loc-key"] ?: [[aps objectForKey:@"alert"] objectForKey:@"loc-key"];
NSString *callId = [aps objectForKey:@"call-id"] ?: @"";
if (!loc_key) {
LOGE(@"Notification [%p] has no loc_key, it's impossible to process it.", userInfo);
@ -486,6 +486,12 @@
}
- (BOOL)addLongTaskIDforCallID:(NSString *)callId {
if (!callId)
return FALSE;
if ([callId isEqualToString:@""])
return FALSE;
NSDictionary *dict = LinphoneManager.instance.pushDict;
if ([[dict allKeys] indexOfObject:callId] != NSNotFound)
return FALSE;

View file

@ -1163,18 +1163,18 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, LinphoneAut
@"provide password again, or check your "
@"account configuration in the settings.", nil), username, realm]
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[alertView addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = NSLocalizedString(@"Password", nil);
textField.clearButtonMode = UITextFieldViewModeWhileEditing;
textField.borderStyle = UITextBorderStyleRoundedRect;
textField.secureTextEntry = YES;
}];
UIAlertAction* continueAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Confirm password", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
@ -1185,13 +1185,13 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, LinphoneAut
linphone_core_add_auth_info(LC, info);
[LinphoneManager.instance refreshRegisters];
}];
UIAlertAction* settingsAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Go to settings", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[PhoneMainView.instance changeCurrentView:SettingsView.compositeViewDescription];
}];
[alertView addAction:defaultAction];
[alertView addAction:continueAction];
[alertView addAction:settingsAction];
@ -1674,7 +1674,7 @@ static void networkReachabilityNotification(CFNotificationCenterRef center, void
if ([newSSID compare:mgr.SSID] == NSOrderedSame)
return;
if (newSSID != Nil && newSSID.length > 0 && mgr.SSID != Nil && newSSID.length > 0) {
if (SCNetworkReachabilityGetFlags([mgr getProxyReachability], &flags)) {
LOGI(@"Wifi SSID changed, resesting transports.");
@ -1836,7 +1836,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach
/** Should be called once per linphone_core_new() */
- (void)finishCoreConfiguration {
//Force keep alive to workaround push notif on chat message
linphone_core_enable_keep_alive(theLinphoneCore, true);
@ -1901,7 +1901,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach
linphone_core_enable_video_display(theLinphoneCore, FALSE);
linphone_core_enable_video_capture(theLinphoneCore, FALSE);
}
[self enableProxyPublish:([UIApplication sharedApplication].applicationState == UIApplicationStateActive)];
LOGI(@"Linphone [%s] started on [%s]", linphone_core_get_version(), [[UIDevice currentDevice].model UTF8String]);
@ -1950,11 +1950,11 @@ static BOOL libStarted = FALSE;
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"No microphone", nil)
message:NSLocalizedString(@"You need to plug a microphone to your device to use the application.", nil)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[PhoneMainView.instance presentViewController:errView animated:YES completion:nil];
}
@ -1980,11 +1980,11 @@ void popup_link_account_cb(LinphoneAccountCreator *creator, LinphoneAccountCreat
message:[NSString stringWithFormat:NSLocalizedString(@"Link your Linphone.org account %s to your phone number.", nil),
linphone_address_get_username(linphone_proxy_config_get_identity_address(cfg))]
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Maybe later", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
UIAlertAction* continueAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Let's go", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
@ -2082,7 +2082,7 @@ void popup_link_account_cb(LinphoneAccountCreator *creator, LinphoneAccountCreat
libmsopenh264_init(f);
libmswebrtc_init(f);
libmscodec2_init(f);
linphone_core_reload_ms_plugins(theLinphoneCore, NULL);
[self migrationAllPost];
@ -2256,6 +2256,13 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
}
- (void)startPushLongRunningTask:(BOOL)msg callId:(NSString *)callId {
if (!callId)
return;
if ([callId isEqualToString:@""])
return;
if (msg) {
[[UIApplication sharedApplication] endBackgroundTask:pushBgTaskMsg];
pushBgTaskMsg = 0;
@ -2325,7 +2332,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
if (linphone_core_get_global_state(LC) != LinphoneGlobalOn || !linphone_core_get_default_friend_list(LC)) {
LOGW(@"Not changing presence configuration because linphone core not ready yet");
return;
}
}
if ([self lpConfigBoolForKey:@"publish_presence"]) {
// set present to "tv", because "available" does not work yet
@ -2360,7 +2367,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
// disable presence
[self enableProxyPublish:NO];
// handle proxy config if any
if (proxyCfg) {
const char *refkey = proxyCfg ? linphone_proxy_config_get_ref_key(proxyCfg) : NULL;
@ -2651,11 +2658,11 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Network Error", nil)
message:NSLocalizedString(@"There is no network connection available, enable WIFI or WWAN prior to place a call", nil)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[PhoneMainView.instance presentViewController:errView animated:YES completion:nil];
return;
@ -2684,11 +2691,11 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
message:NSLocalizedString(@"Either configure a SIP proxy server from settings prior to place a "
@"call or use a valid SIP address (I.E sip:john@example.net)", nil)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[PhoneMainView.instance presentViewController:errView animated:YES completion:nil];
return;