forked from mirrors/linphone-iphone
Fix external URL opening
This commit is contained in:
parent
c605914d80
commit
614a44d096
4 changed files with 22 additions and 21 deletions
|
|
@ -20,6 +20,7 @@
|
|||
#import "PhoneMainView.h"
|
||||
#import "LinphoneManager.h"
|
||||
#import "LinphoneIOSVersion.h"
|
||||
#import "linphoneapp-Swift.h"
|
||||
|
||||
@implementation AboutView
|
||||
|
||||
|
|
@ -79,29 +80,21 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
- (IBAction)onLinkTap:(id)sender {
|
||||
UIGestureRecognizer *gest = sender;
|
||||
NSString *url = ((UILabel *)gest.view).text;
|
||||
if (![UIApplication.sharedApplication openURL:[NSURL URLWithString:url]]) {
|
||||
LOGE(@"Failed to open %@, invalid URL", url);
|
||||
}
|
||||
[SwiftUtil openUrlWithUrlString:url];
|
||||
}
|
||||
|
||||
- (IBAction)onPolicyTap {
|
||||
NSString *url = @"https://www.linphone.org/privacy-policy";
|
||||
if (![UIApplication.sharedApplication openURL:[NSURL URLWithString:url]]) {
|
||||
LOGE(@"Failed to open %@, invalid URL", url);
|
||||
}
|
||||
[SwiftUtil openUrlWithUrlString:url];
|
||||
}
|
||||
|
||||
- (IBAction)onLicenceTap {
|
||||
NSString *url = @"https://www.gnu.org/licenses/gpl-3.0.html";
|
||||
if (![UIApplication.sharedApplication openURL:[NSURL URLWithString:url]]) {
|
||||
LOGE(@"Failed to open %@, invalid URL", url);
|
||||
}
|
||||
[SwiftUtil openUrlWithUrlString:url];
|
||||
}
|
||||
- (IBAction)onTranslateTap {
|
||||
NSString *url = @"https://weblate.linphone.org/projects/linphone-iphone";
|
||||
if (![UIApplication.sharedApplication openURL:[NSURL URLWithString:url]]) {
|
||||
LOGE(@"Failed to open %@, invalid URL", url);
|
||||
}
|
||||
[SwiftUtil openUrlWithUrlString:url];
|
||||
}
|
||||
|
||||
- (IBAction)onDialerBackClick:(id)sender {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#import "UITextField+DoneButton.h"
|
||||
#import "LinphoneAppDelegate.h"
|
||||
#import "SVProgressHUD.h"
|
||||
#import "linphoneapp-Swift.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#define PROVIDER_NAME "apns.dev"
|
||||
|
|
@ -100,9 +101,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
|
||||
- (IBAction)onContactTap {
|
||||
NSString *url = @"https://www.linphone.org/contact";
|
||||
if (![UIApplication.sharedApplication openURL:[NSURL URLWithString:url]]) {
|
||||
LOGE(@"[Assistant] Failed to open %@, invalid URL", url);
|
||||
}
|
||||
[SwiftUtil openUrlWithUrlString:url];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
|
|
@ -1928,9 +1927,7 @@ UIColor *previousColor = (UIColor*)[sender backgroundColor]; \
|
|||
|
||||
- (IBAction)onLinkTap:(id)sender {
|
||||
NSString *url = @"https://subscribe.linphone.org";
|
||||
if (![UIApplication.sharedApplication openURL:[NSURL URLWithString:url]]) {
|
||||
LOGE(@"[Assistant] Failed to open %@, invalid URL", url);
|
||||
}
|
||||
[SwiftUtil openUrlWithUrlString:url];
|
||||
}
|
||||
|
||||
- (IBAction)onAcceptTermsClick:(id)sender {
|
||||
|
|
|
|||
|
|
@ -149,8 +149,6 @@
|
|||
- (IBAction)onSubscribeTap:(id)sender {
|
||||
UIGestureRecognizer *gest = sender;
|
||||
NSString *url = ((UILabel *)gest.view).text;
|
||||
if (![UIApplication.sharedApplication openURL:[NSURL URLWithString:url]]) {
|
||||
LOGE(@"Failed to open %@, invalid URL", url);
|
||||
}
|
||||
[SwiftUtil openUrlWithUrlString:url];
|
||||
}
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -121,5 +121,18 @@ import linphonesw
|
|||
return log.dir == .Incoming && [.Missed,.Aborted,.EarlyAborted].contains(log.status)
|
||||
}
|
||||
|
||||
@objc static func openUrl(urlString:String) {
|
||||
if let url = URL(string: urlString) {
|
||||
UIApplication.shared.open(url, options: [:], completionHandler: { success in
|
||||
if (!success) {
|
||||
Log.e("Unable to open URL \(urlString)")
|
||||
}
|
||||
})
|
||||
} else {
|
||||
Log.e("Invalid URL \(urlString)")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue