From 16f721f4008f2bf1c2a3b22deb4f9352e76048a7 Mon Sep 17 00:00:00 2001 From: Louis Romero Date: Sat, 29 Jul 2017 14:40:26 +0200 Subject: [PATCH 1/2] Modernize the projects and the source code. --- .../project.pbxproj | 38 ++++++++++++++++--- .../BrowserSimulator-Info.plist | 2 +- .../BrowserSimulator-Prefix.pch | 4 +- .../BrowserSimulator/FlipsideViewController.m | 19 +++------- .../BrowserSimulator/MainViewController.m | 8 ++-- .../project.pbxproj | 33 ++++++++++++++-- .../OpenInChromeSampleApp-Info.plist | 2 +- 7 files changed, 75 insertions(+), 31 deletions(-) diff --git a/BrowserSimulator/BrowserSimulator.xcodeproj/project.pbxproj b/BrowserSimulator/BrowserSimulator.xcodeproj/project.pbxproj index 0e9a2e9..ad034f1 100644 --- a/BrowserSimulator/BrowserSimulator.xcodeproj/project.pbxproj +++ b/BrowserSimulator/BrowserSimulator.xcodeproj/project.pbxproj @@ -122,7 +122,6 @@ D132B941162766E100E4F30D /* NSURL+XCallbackURL.m */, D132B91C1627652F00E4F30D /* Supporting Files */, ); - name = BrowserSimulator; path = BrowserSimulator; sourceTree = ""; }; @@ -182,7 +181,7 @@ D132B9081627652F00E4F30D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0450; + LastUpgradeCheck = 0830; ORGANIZATIONNAME = "Google Inc."; }; buildConfigurationList = D132B90B1627652F00E4F30D /* Build configuration list for PBXProject "BrowserSimulator" */; @@ -284,22 +283,35 @@ ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -312,15 +324,27 @@ ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -334,7 +358,8 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "BrowserSimulator/BrowserSimulator-Prefix.pch"; INFOPLIST_FILE = "BrowserSimulator/BrowserSimulator-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 5.1; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.google.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = BrowserSimulator; WRAPPER_EXTENSION = app; }; @@ -346,7 +371,8 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "BrowserSimulator/BrowserSimulator-Prefix.pch"; INFOPLIST_FILE = "BrowserSimulator/BrowserSimulator-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 5.1; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.google.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = BrowserSimulator; WRAPPER_EXTENSION = app; }; diff --git a/BrowserSimulator/BrowserSimulator/BrowserSimulator-Info.plist b/BrowserSimulator/BrowserSimulator/BrowserSimulator-Info.plist index 8064fa7..7003b50 100644 --- a/BrowserSimulator/BrowserSimulator/BrowserSimulator-Info.plist +++ b/BrowserSimulator/BrowserSimulator/BrowserSimulator-Info.plist @@ -24,7 +24,7 @@ CFBundleIdentifier - com.google.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/BrowserSimulator/BrowserSimulator/BrowserSimulator-Prefix.pch b/BrowserSimulator/BrowserSimulator/BrowserSimulator-Prefix.pch index a8430ca..cbbf320 100644 --- a/BrowserSimulator/BrowserSimulator/BrowserSimulator-Prefix.pch +++ b/BrowserSimulator/BrowserSimulator/BrowserSimulator-Prefix.pch @@ -34,8 +34,8 @@ #import -#ifndef __IPHONE_4_0 -#warning "This project uses features only available in iOS SDK 4.0 and later." +#ifndef __IPHONE_7_0 +#warning "This project uses features only available in iOS SDK 7.0 and later." #endif #ifdef __OBJC__ diff --git a/BrowserSimulator/BrowserSimulator/FlipsideViewController.m b/BrowserSimulator/BrowserSimulator/FlipsideViewController.m index 07f60fd..3bf32a2 100644 --- a/BrowserSimulator/BrowserSimulator/FlipsideViewController.m +++ b/BrowserSimulator/BrowserSimulator/FlipsideViewController.m @@ -29,24 +29,11 @@ #import "FlipsideViewController.h" -@interface FlipsideViewController () - -@end - @implementation FlipsideViewController @synthesize textView = textView_; @synthesize delegate = delegate_; -- (id)initWithNibName:(NSString *)nibNameOrNil - bundle:(NSBundle *)nibBundleOrNil { - self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; - if (self) { - self.contentSizeForViewInPopover = CGSizeMake(320.0, 480.0); - } - return self; -} - - (void)dealloc { [textView_ release]; [super dealloc]; @@ -56,10 +43,14 @@ - (void)viewWillAppear:(BOOL)animated { self.textView.text = self.delegate.information; } +- (CGSize)preferredContentSize { + return CGSizeMake(320.0, 480.0); +} + #pragma mark - Actions - (IBAction)done:(id)sender { - [self.delegate flipsideViewControllerDidFinish:self]; + [self.delegate flipsideViewControllerDidFinish:self]; } @end diff --git a/BrowserSimulator/BrowserSimulator/MainViewController.m b/BrowserSimulator/BrowserSimulator/MainViewController.m index c7f6d99..246edf0 100644 --- a/BrowserSimulator/BrowserSimulator/MainViewController.m +++ b/BrowserSimulator/BrowserSimulator/MainViewController.m @@ -111,15 +111,15 @@ - (void)load:(NSURL *)url { [self.navigationBar setItems:[NSArray array] animated:NO]; UINavigationItem *item = - [[[UINavigationItem alloc] initWithTitle:nil] autorelease]; + [[[UINavigationItem alloc] initWithTitle:@""] autorelease]; item.title = self.sourceApp; [self.navigationBar pushNavigationItem:item animated:NO]; - item = [[[UINavigationItem alloc] initWithTitle:nil] autorelease]; + item = [[[UINavigationItem alloc] initWithTitle:@""] autorelease]; if (!self.sourceApp) { item.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"" - style:UIBarButtonItemStyleBordered + style:UIBarButtonItemStylePlain target:nil action:nil] autorelease]; } @@ -139,7 +139,7 @@ - (void)load:(NSURL *)url { UIBarButtonItem *infoButton = [[[UIBarButtonItem alloc] initWithTitle:@"Info" - style:UIBarButtonItemStyleBordered + style:UIBarButtonItemStylePlain target:self action:@selector(showInfo:)] autorelease]; diff --git a/OpenInChromeSampleApp/OpenInChromeSampleApp.xcodeproj/project.pbxproj b/OpenInChromeSampleApp/OpenInChromeSampleApp.xcodeproj/project.pbxproj index 164c617..f18ed5f 100644 --- a/OpenInChromeSampleApp/OpenInChromeSampleApp.xcodeproj/project.pbxproj +++ b/OpenInChromeSampleApp/OpenInChromeSampleApp.xcodeproj/project.pbxproj @@ -141,7 +141,7 @@ D1C1042D162FF67B0074F0BA /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0450; + LastUpgradeCheck = 0830; ORGANIZATIONNAME = "Google Inc."; }; buildConfigurationList = D1C10430162FF67B0074F0BA /* Build configuration list for PBXProject "OpenInChromeSampleApp" */; @@ -225,22 +225,35 @@ ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 5.1; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -253,15 +266,27 @@ ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 5.1; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -278,6 +303,7 @@ GCC_PREFIX_HEADER = "OpenInChromeSampleApp/OpenInChromeSampleApp-Prefix.pch"; INFOPLIST_FILE = "OpenInChromeSampleApp/OpenInChromeSampleApp-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.mycompany.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; @@ -293,6 +319,7 @@ GCC_PREFIX_HEADER = "OpenInChromeSampleApp/OpenInChromeSampleApp-Prefix.pch"; INFOPLIST_FILE = "OpenInChromeSampleApp/OpenInChromeSampleApp-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.mycompany.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; diff --git a/OpenInChromeSampleApp/OpenInChromeSampleApp/OpenInChromeSampleApp-Info.plist b/OpenInChromeSampleApp/OpenInChromeSampleApp/OpenInChromeSampleApp-Info.plist index 6d3d283..10b3680 100644 --- a/OpenInChromeSampleApp/OpenInChromeSampleApp/OpenInChromeSampleApp-Info.plist +++ b/OpenInChromeSampleApp/OpenInChromeSampleApp/OpenInChromeSampleApp-Info.plist @@ -9,7 +9,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - com.mycompany.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName From 1b402c08304b18c77aaa93fafc6049341002a6f4 Mon Sep 17 00:00:00 2001 From: Louis Romero Date: Sat, 29 Jul 2017 15:11:05 +0200 Subject: [PATCH 2/2] instancetype --- OpenInChromeController.h | 2 +- OpenInChromeController.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenInChromeController.h b/OpenInChromeController.h index b6b6a13..1c1d969 100644 --- a/OpenInChromeController.h +++ b/OpenInChromeController.h @@ -34,7 +34,7 @@ @interface OpenInChromeController : NSObject // Returns a shared instance of the OpenInChromeController. -+ (OpenInChromeController *)sharedInstance; ++ (instancetype)sharedInstance; // Returns YES if Google Chrome is installed in the user's system. - (BOOL)isChromeInstalled; diff --git a/OpenInChromeController.m b/OpenInChromeController.m index b8cd374..05037f7 100644 --- a/OpenInChromeController.m +++ b/OpenInChromeController.m @@ -40,7 +40,7 @@ @implementation OpenInChromeController -+ (OpenInChromeController *)sharedInstance { ++ (instancetype)sharedInstance { static OpenInChromeController *sharedInstance; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{