From 3ae3090e7f7b2168e21451c926e2e984c8a092b4 Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Tue, 21 Feb 2017 10:25:32 +0100 Subject: [PATCH] Go to GPLv2 website when taping on licenceLabel --- Classes/AboutView.h | 2 + Classes/AboutView.m | 12 ++++++ Classes/Base.lproj/AboutView.xib | 64 +++++++++++++++++--------------- 3 files changed, 48 insertions(+), 30 deletions(-) diff --git a/Classes/AboutView.h b/Classes/AboutView.h index 0fd2aca63..2421ad552 100644 --- a/Classes/AboutView.h +++ b/Classes/AboutView.h @@ -27,7 +27,9 @@ @property(weak, nonatomic) IBOutlet UILabel *descriptionLabel; @property(weak, nonatomic) IBOutlet UILabel *appVersionLabel; @property(weak, nonatomic) IBOutlet UILabel *libVersionLabel; +@property(weak, nonatomic) IBOutlet UILabel *licenceLabel; - (IBAction)onLinkTap:(id)sender; +- (IBAction)onLicenceTap; - (IBAction)onDialerBackClick:(id)sender; @end diff --git a/Classes/AboutView.m b/Classes/AboutView.m index 7cbd64eee..92af96b16 100644 --- a/Classes/AboutView.m +++ b/Classes/AboutView.m @@ -51,6 +51,11 @@ static UICompositeViewDescription *compositeDescription = nil; _nameLabel.text = name; _appVersionLabel.text = [NSString stringWithFormat:@"%@ iOS %s", name, LINPHONE_IOS_VERSION]; _libVersionLabel.text = [NSString stringWithFormat:@"%@ Core %s", name, linphone_core_get_version()]; + UITapGestureRecognizer *tapGestureRecognizer = + [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onLicenceTap)]; + tapGestureRecognizer.numberOfTapsRequired = 1; + [_licenceLabel addGestureRecognizer:tapGestureRecognizer]; + _licenceLabel.userInteractionEnabled = YES; } #pragma mark - Action Functions @@ -63,6 +68,13 @@ static UICompositeViewDescription *compositeDescription = nil; } } +- (IBAction)onLicenceTap { + NSString *url = @"https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html"; + if (![UIApplication.sharedApplication openURL:[NSURL URLWithString:url]]) { + LOGE(@"Failed to open %@, invalid URL", url); + } +} + - (IBAction)onDialerBackClick:(id)sender { [PhoneMainView.instance popToView:DialerView.compositeViewDescription]; } diff --git a/Classes/Base.lproj/AboutView.xib b/Classes/Base.lproj/AboutView.xib index df96118cf..51aa8db00 100644 --- a/Classes/Base.lproj/AboutView.xib +++ b/Classes/Base.lproj/AboutView.xib @@ -1,8 +1,11 @@ - + + + + - + @@ -12,6 +15,7 @@ + @@ -23,19 +27,19 @@ - + - + - + - + - + - +