From bb7458e276478515334e7e9a33f57a85af7fdd4d Mon Sep 17 00:00:00 2001 From: David Idmansour Date: Wed, 13 Jun 2018 15:04:23 +0200 Subject: [PATCH] changed url scheme to launch app from extension --- Classes/LinphoneAppDelegate.m | 22 ++++++++++------------ latestCallsWidget/TodayViewController.m | 2 +- linphone-Info.plist | 12 ++++++++++++ 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index e11481415..c37e877e4 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -336,18 +336,16 @@ [errView addAction:yesAction]; [PhoneMainView.instance presentViewController:errView animated:YES completion:nil]; - } else { - if ([[url scheme] isEqualToString:@"sip"]) { - // remove "sip://" from the URI, and do it correctly by taking resourceSpecifier and removing leading and - // trailing "/" - if ([[url host] isEqualToString:@"call_log"] && - [[url path] isEqualToString:@"/show"]) { - [VIEW(HistoryDetailsView) setCallLogId:[url query]]; - [PhoneMainView.instance popToView:HistoryDetailsView.compositeViewDescription]; - } else { - NSString *sipUri = [[url resourceSpecifier] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"/"]]; - [VIEW(DialerView) setAddress:sipUri]; - } + } else if ([scheme isEqualToString:@"sip"]) { + // remove "sip://" from the URI, and do it correctly by taking resourceSpecifier and removing leading and + // trailing "/" + NSString *sipUri = [[url resourceSpecifier] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"/"]]; + [VIEW(DialerView) setAddress:sipUri]; + } else if ([scheme isEqualToString:@"linphone-widget"]) { + if ([[url host] isEqualToString:@"call_log"] && + [[url path] isEqualToString:@"/show"]) { + [VIEW(HistoryDetailsView) setCallLogId:[url query]]; + [PhoneMainView.instance changeCurrentView:HistoryDetailsView.compositeViewDescription]; } } return YES; diff --git a/latestCallsWidget/TodayViewController.m b/latestCallsWidget/TodayViewController.m index 548764a36..e44c90c5f 100644 --- a/latestCallsWidget/TodayViewController.m +++ b/latestCallsWidget/TodayViewController.m @@ -163,7 +163,7 @@ } - (void)launchOnHistoryDetailsWithId:(NSString *)logId { - [self launchAppWithURL:[NSURL URLWithString:[@"sip://call_log/show?" stringByAppendingString:logId]]]; + [self launchAppWithURL:[NSURL URLWithString:[@"linphone-widget://call_log/show?" stringByAppendingString:logId]]]; } - (IBAction)firstButtonTapped { diff --git a/linphone-Info.plist b/linphone-Info.plist index 554a300a7..432f166e5 100644 --- a/linphone-Info.plist +++ b/linphone-Info.plist @@ -51,6 +51,18 @@ linphone-config + + CFBundleTypeRole + Viewer + CFBundleURLIconFile + linphone_icon_72@2x + CFBundleURLName + org.linphone.phone + CFBundleURLSchemes + + linphone-widget + + CFBundleVersion 0