From c2201bf07d9bf3e5789571f015ddaae74e1870b7 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Wed, 3 Feb 2016 14:16:30 +0100 Subject: [PATCH] about: update view --- Classes/AboutView.h | 16 +- Classes/AboutView.m | 87 ++------ Classes/Base.lproj/AboutView.xib | 309 ++++++++++++++++++++--------- Resources/licenses.html | 77 ------- linphone.xcodeproj/project.pbxproj | 4 - 5 files changed, 233 insertions(+), 260 deletions(-) delete mode 100644 Resources/licenses.html diff --git a/Classes/AboutView.h b/Classes/AboutView.h index cf06159a4..0fd2aca63 100644 --- a/Classes/AboutView.h +++ b/Classes/AboutView.h @@ -21,18 +21,12 @@ #import "UICompositeView.h" -@interface AboutView : UIViewController { -} - -@property(nonatomic, strong) IBOutlet UILabel *linphoneLabel; -@property(nonatomic, strong) IBOutlet UILabel *linphoneIphoneVersionLabel; -@property(nonatomic, strong) IBOutlet UILabel *linphoneCoreVersionLabel; -@property(nonatomic, strong) IBOutlet UILabel *linkLabel; -@property(nonatomic, strong) IBOutlet UILabel *copyrightLabel; -@property(nonatomic, strong) IBOutlet UILabel *licenseLabel; -@property(weak, nonatomic) IBOutlet UIView *contentView; -@property(nonatomic, strong) IBOutlet UIWebView *licensesView; +@interface AboutView : TPMultiLayoutViewController +@property(weak, nonatomic) IBOutlet UILabel *nameLabel; +@property(weak, nonatomic) IBOutlet UILabel *descriptionLabel; +@property(weak, nonatomic) IBOutlet UILabel *appVersionLabel; +@property(weak, nonatomic) IBOutlet UILabel *libVersionLabel; - (IBAction)onLinkTap:(id)sender; - (IBAction)onDialerBackClick:(id)sender; diff --git a/Classes/AboutView.m b/Classes/AboutView.m index 884a34013..dda1604ec 100644 --- a/Classes/AboutView.m +++ b/Classes/AboutView.m @@ -19,43 +19,10 @@ #import "PhoneMainView.h" #import "LinphoneManager.h" -#include "linphone/lpconfig.h" -#include "LinphoneIOSVersion.h" +#import "LinphoneIOSVersion.h" @implementation AboutView -#pragma mark - ViewController Functions - -- (void)viewDidLoad { - [super viewDidLoad]; - - UIScrollView *scrollView = (UIScrollView *)self.view; - [scrollView addSubview:_contentView]; - [scrollView setContentSize:[_contentView bounds].size]; - - [_linphoneLabel setText:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]]; - - [_linphoneIphoneVersionLabel - setText:[NSString stringWithFormat:@"%@ iPhone %@", - [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"], - [NSString stringWithUTF8String:LINPHONE_IOS_VERSION]]]; - - [_linphoneCoreVersionLabel - setText:[NSString stringWithFormat:@"%@ Core %s", - [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"], - linphone_core_get_version()]]; - - [AboutView removeBackground:_licensesView]; - - // Create a request to the resource - NSURLRequest *request = - [NSURLRequest requestWithURL:[NSURL fileURLWithPath:[LinphoneManager bundleFile:@"licenses.html"]]]; - // Load the resource using the request - [_licensesView setDelegate:self]; - [_licensesView loadRequest:request]; - [[AboutView defaultScrollView:_licensesView] setScrollEnabled:FALSE]; -} - #pragma mark - UICompositeViewDelegate Functions static UICompositeViewDescription *compositeDescription = nil; @@ -77,54 +44,24 @@ static UICompositeViewDescription *compositeDescription = nil; return self.class.compositeViewDescription; } -#pragma mark - +#pragma mark - ViewController Functions -+ (void)removeBackground:(UIView *)view { - for (UIView *subview in [view subviews]) { - [subview setOpaque:NO]; - [subview setBackgroundColor:[UIColor clearColor]]; - } - [view setOpaque:NO]; - [view setBackgroundColor:[UIColor clearColor]]; -} - -+ (UIScrollView *)defaultScrollView:(UIWebView *)webView { - return webView.scrollView; +- (void)viewDidLoad { + [super viewDidLoad]; + NSString *name = [NSBundle.mainBundle objectForInfoDictionaryKey:@"CFBundleDisplayName"]; + _nameLabel.text = name; + _appVersionLabel.text = [NSString stringWithFormat:@"%@ iOS %s", name, LINPHONE_IOS_VERSION]; + _libVersionLabel.text = [NSString stringWithFormat:@"%@ Core %s", name, linphone_core_get_version()]; } #pragma mark - Action Functions - (IBAction)onLinkTap:(id)sender { - [[UIApplication sharedApplication] openURL:[NSURL URLWithString:_linkLabel.text]]; -} - -#pragma mark - UIWebViewDelegate Functions - -- (void)webViewDidFinishLoad:(UIWebView *)webView { - CGSize size = [webView sizeThatFits:CGSizeMake(self.view.bounds.size.width, 10000.0f)]; - float diff = size.height - webView.bounds.size.height; - - CGRect contentFrame = [self.view bounds]; - contentFrame.size.height += diff; - [_contentView setAutoresizesSubviews:FALSE]; - [_contentView setFrame:contentFrame]; - [_contentView setAutoresizesSubviews:TRUE]; - [(UIScrollView *)self.view setContentSize:contentFrame.size]; - - CGRect licensesViewFrame = [_licensesView frame]; - licensesViewFrame.size.height += diff; - [_licensesView setFrame:licensesViewFrame]; -} - -- (BOOL)webView:(UIWebView *)inWeb - shouldStartLoadWithRequest:(NSURLRequest *)inRequest - navigationType:(UIWebViewNavigationType)inType { - if (inType == UIWebViewNavigationTypeLinkClicked) { - [[UIApplication sharedApplication] openURL:[inRequest URL]]; - return NO; + UIGestureRecognizer *gest = sender; + NSString *url = ((UILabel *)gest.view).text; + if (![UIApplication.sharedApplication openURL:[NSURL URLWithString:url]]) { + LOGE(@"Failed to open %@, invalid URL", url); } - - return YES; } - (IBAction)onDialerBackClick:(id)sender { diff --git a/Classes/Base.lproj/AboutView.xib b/Classes/Base.lproj/AboutView.xib index 8ea48f462..e3588ad2b 100644 --- a/Classes/Base.lproj/AboutView.xib +++ b/Classes/Base.lproj/AboutView.xib @@ -1,21 +1,19 @@ - + - + - - - - - - - - - + + + + + + + @@ -23,23 +21,21 @@ - - - + + + - - + + - - + + - - - - - - - + + + - - - - + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + - + diff --git a/Resources/licenses.html b/Resources/licenses.html deleted file mode 100644 index 183077683..000000000 --- a/Resources/licenses.html +++ /dev/null @@ -1,77 +0,0 @@ - - -
- -

Third party softwares

- -

CAAnimationBlocks

-

Xissburg
-http://xissburg.com

- -

ColorConverter

-

Matteo Alessani
-http://www.extendi.it

- -

DCRoundSwitch

-

Patrick Richards
-http://domesticcat.com.au
-MIT license

- -

DTFoundation

-

Oliver Drobnik
-http://www.cocoanetics.com
-BSD license

- -

HPGrowingTextView

-

Hans Pinckaers
-http://hanspinckaers.com
-MIT license

- -

InAppSettingsKit

-

Luc Vandal, Edovia Inc., Ortwin Gentz, FutureTap GmbH
-http://www.inappsettingskit.com/
-BSD license

- -

NinePatch

-

Tortuga 22, Inc.
-http://www.tortuga22.com
-Apache license

- -

Ryan Maxwell

-

UIAlertview+Blocks

-https://github.com/ryanmaxwell/UIAlertView-Blocks
-MIT license - -

OrderedDictionary

-

Matt Gallagher
-http://cocoawithlove.com

- -

TPMultiLayoutViewController

-

Michael Tyson
-http://atastypixel.com
-MIT license

- -

UACellBackgroundView

-

Matt Coneybeare
-http://code.coneybeare.net

- -

XMLRPC

-

Eric Czarny
-http://divisiblebyzero.com/
-MIT license

- -

Graphics

- -

Kerosine

-

http://www.kerosine.fr

- -

Translations

- -

Russian

-

Maxim Solodovnik
- -solomax666@gmail.com

- -
- - diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index 34a464b10..c8b423ee2 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -563,7 +563,6 @@ 639E9CB51C0DB88200019A75 /* PhoneMainView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 639E9CB31C0DB88200019A75 /* PhoneMainView.xib */; }; 63AADBE81B6A0FF200AA16FD /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 63AADBC41B6A0FF200AA16FD /* Localizable.strings */; }; 63AADBEA1B6A0FF200AA16FD /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 63AADBCA1B6A0FF200AA16FD /* Images.xcassets */; }; - 63AADBF31B6A0FF200AA16FD /* licenses.html in Resources */ = {isa = PBXBuildFile; fileRef = 63AADBD51B6A0FF200AA16FD /* licenses.html */; }; 63AADBF51B6A0FF200AA16FD /* linphonerc in Resources */ = {isa = PBXBuildFile; fileRef = 63AADBD71B6A0FF200AA16FD /* linphonerc */; }; 63AADBF61B6A0FF200AA16FD /* linphonerc-factory in Resources */ = {isa = PBXBuildFile; fileRef = 63AADBD81B6A0FF200AA16FD /* linphonerc-factory */; }; 63AADBF81B6A0FF200AA16FD /* linphonerc~ipad in Resources */ = {isa = PBXBuildFile; fileRef = 63AADBDA1B6A0FF200AA16FD /* linphonerc~ipad */; }; @@ -1459,7 +1458,6 @@ 63AADBC81B6A0FF200AA16FD /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = ""; }; 63AADBCA1B6A0FF200AA16FD /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 63AADBCB1B6A0FF200AA16FD /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = ""; }; - 63AADBD51B6A0FF200AA16FD /* licenses.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = licenses.html; sourceTree = ""; }; 63AADBD71B6A0FF200AA16FD /* linphonerc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = linphonerc; sourceTree = ""; }; 63AADBD81B6A0FF200AA16FD /* linphonerc-factory */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "linphonerc-factory"; sourceTree = ""; }; 63AADBDA1B6A0FF200AA16FD /* linphonerc~ipad */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "linphonerc~ipad"; sourceTree = ""; }; @@ -2724,7 +2722,6 @@ 63AADBE61B6A0FF200AA16FD /* assistant_remote.rc */, 6316A07A1C5F64330073BFA4 /* images */, 63AADBCA1B6A0FF200AA16FD /* Images.xcassets */, - 63AADBD51B6A0FF200AA16FD /* licenses.html */, 63AADBD71B6A0FF200AA16FD /* linphonerc */, 63AADBD81B6A0FF200AA16FD /* linphonerc-factory */, 63AADBDA1B6A0FF200AA16FD /* linphonerc~ipad */, @@ -3151,7 +3148,6 @@ 6316A3981C5F64350073BFA4 /* options_start_conference_disabled@2x.png in Resources */, 6316A26C1C5F64350073BFA4 /* call_start_body_disabled~ipad.png in Resources */, 6316A3531C5F64350073BFA4 /* numpad_5_default@2x.png in Resources */, - 63AADBF31B6A0FF200AA16FD /* licenses.html in Resources */, 6316A35F1C5F64350073BFA4 /* numpad_6_over~ipad@2x.png in Resources */, 6316A3931C5F64350073BFA4 /* options_selected.png in Resources */, 6316A2BE1C5F64350073BFA4 /* color_F.png in Resources */,