From c72c1f03b64b1ab6b9f2f3e232e523448976a1e9 Mon Sep 17 00:00:00 2001 From: David Idmansour Date: Mon, 11 Jun 2018 15:06:22 +0200 Subject: [PATCH] modified url support to launch app on call log view from widget --- Classes/LinphoneAppDelegate.m | 25 +++++++++++++++---------- latestCallsWidget/TodayViewController.m | 12 ++++++++---- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 31b1f027b..e11481415 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -336,16 +336,21 @@ [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 "/" - NSString *sipUri = [[url resourceSpecifier] - stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"/"]]; - [VIEW(DialerView) setAddress:sipUri]; - } - } - return YES; + } 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]; + } + } + } + return YES; } - (void)fixRing { diff --git a/latestCallsWidget/TodayViewController.m b/latestCallsWidget/TodayViewController.m index 6e2b44380..b8e2d92d8 100644 --- a/latestCallsWidget/TodayViewController.m +++ b/latestCallsWidget/TodayViewController.m @@ -39,19 +39,23 @@ completionHandler:nil]; } +- (void)launchOnHistoryDetailsWithId:(NSString *)logId { + [self launchAppWithURL:[NSURL URLWithString:[@"sip://call_log/show?" stringByAppendingString:logId]]]; +} + - (IBAction)firstButtonTapped { - [self launchAppWithURL:[NSURL URLWithString:@"sip://"]]; + [self launchOnHistoryDetailsWithId:@""]; } - (IBAction)secondButtonTapped { - [self launchAppWithURL:[NSURL URLWithString:@"sip://"]]; + [self launchOnHistoryDetailsWithId:@""]; } - (IBAction)thirdButtonTapped { - [self launchAppWithURL:[NSURL URLWithString:@"sip://"]]; + [self launchOnHistoryDetailsWithId:@""]; } - (IBAction)fourthButtonTapped { - [self launchAppWithURL:[NSURL URLWithString:@"sip://"]]; + [self launchOnHistoryDetailsWithId:@""]; } @end