From a98de8649c8568d242b71ff1b9868a5282ad5ccf Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Mon, 15 Jun 2015 23:21:46 -0700 Subject: [PATCH 01/22] adopt project changes recommended by Xcode --- Blog.xcodeproj/project.pbxproj | 9 ++- .../xcshareddata/xcschemes/Blog.xcscheme | 4 ++ .../xcschemes/samhuri.net.xcscheme | 60 ++++++++++++++++-- Blog/Info.plist | 35 ++++++----- BlogTests/Info.plist | 2 +- .../Pods-Blog-CocoaLumberjack.xcscheme | 62 +++++++++++++++++-- .../Pods-Blog-FontAwesome+iOS.xcscheme | 62 +++++++++++++++++-- ...Blog-HockeySDK-HockeySDKResources.xcscheme | 5 +- .../xcschemes/Pods-Blog-HockeySDK.xcscheme | 5 +- .../Pods-Blog-MBProgressHUD.xcscheme | 62 +++++++++++++++++-- .../xcschemes/Pods-Blog-Mantle.xcscheme | 62 +++++++++++++++++-- .../xcschemes/Pods-Blog-OMGHTTPURLRQ.xcscheme | 62 +++++++++++++++++-- .../Pods-Blog-ObjectiveSugar.xcscheme | 62 +++++++++++++++++-- .../xcschemes/Pods-Blog-PromiseKit.xcscheme | 62 +++++++++++++++++-- .../xcschemes/Pods-Blog-YapDatabase.xcscheme | 62 +++++++++++++++++-- .../xcschemes/Pods-Blog-dyci.xcscheme | 62 +++++++++++++++++-- .../xcschemes/Pods-Blog-libextobjc.xcscheme | 62 +++++++++++++++++-- .../xcshareddata/xcschemes/Pods-Blog.xcscheme | 5 +- .../Pods-samhuri.net-CocoaLumberjack.xcscheme | 62 +++++++++++++++++-- .../Pods-samhuri.net-MBProgressHUD.xcscheme | 62 +++++++++++++++++-- .../Pods-samhuri.net-Mantle.xcscheme | 62 +++++++++++++++++-- .../Pods-samhuri.net-OMGHTTPURLRQ.xcscheme | 62 +++++++++++++++++-- .../Pods-samhuri.net-ObjectiveSugar.xcscheme | 62 +++++++++++++++++-- .../Pods-samhuri.net-PromiseKit.xcscheme | 62 +++++++++++++++++-- .../Pods-samhuri.net-YapDatabase.xcscheme | 62 +++++++++++++++++-- .../xcschemes/Pods-samhuri.net.xcscheme | 62 +++++++++++++++++-- samhuri.net/Info.plist | 2 +- 27 files changed, 1107 insertions(+), 136 deletions(-) diff --git a/Blog.xcodeproj/project.pbxproj b/Blog.xcodeproj/project.pbxproj index ce70aa5..9f39c8b 100644 --- a/Blog.xcodeproj/project.pbxproj +++ b/Blog.xcodeproj/project.pbxproj @@ -469,7 +469,7 @@ 7B5C4BD119F2606900667D48 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0600; + LastUpgradeCheck = 0700; ORGANIZATIONNAME = "Guru Logic Inc."; TargetAttributes = { 7B08B3E61AF9CAD300435579 = { @@ -745,6 +745,7 @@ INFOPLIST_FILE = samhuri.net/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "ca.gurulogic.Blog.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; }; @@ -761,6 +762,7 @@ INFOPLIST_FILE = samhuri.net/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "ca.gurulogic.Blog.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; }; @@ -786,6 +788,7 @@ "CODE_SIGN_IDENTITY[sdk=*]" = "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_OPTIMIZATION_LEVEL = 0; @@ -856,6 +859,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; INFOPLIST_FILE = Blog/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "ca.gurulogic.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; }; @@ -870,6 +874,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; INFOPLIST_FILE = Blog/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "ca.gurulogic.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; }; @@ -889,6 +894,7 @@ ); INFOPLIST_FILE = BlogTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "ca.gurulogic.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Blog.app/Blog"; }; @@ -904,6 +910,7 @@ ); INFOPLIST_FILE = BlogTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "ca.gurulogic.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Blog.app/Blog"; }; diff --git a/Blog.xcodeproj/xcshareddata/xcschemes/Blog.xcscheme b/Blog.xcodeproj/xcshareddata/xcschemes/Blog.xcscheme index 0f6a58e..0c5cbf8 100644 --- a/Blog.xcodeproj/xcshareddata/xcschemes/Blog.xcscheme +++ b/Blog.xcodeproj/xcshareddata/xcschemes/Blog.xcscheme @@ -1,5 +1,6 @@ + + diff --git a/Blog.xcodeproj/xcshareddata/xcschemes/samhuri.net.xcscheme b/Blog.xcodeproj/xcshareddata/xcschemes/samhuri.net.xcscheme index bbdf58a..5e97954 100644 --- a/Blog.xcodeproj/xcshareddata/xcschemes/samhuri.net.xcscheme +++ b/Blog.xcodeproj/xcshareddata/xcschemes/samhuri.net.xcscheme @@ -1,10 +1,17 @@ - + + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> - - + + + + + + + + + + + + + + + + + + + diff --git a/Blog/Info.plist b/Blog/Info.plist index b33d5e4..883e77c 100644 --- a/Blog/Info.plist +++ b/Blog/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - ca.gurulogic.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -22,6 +22,20 @@ 1 LSRequiresIPhoneOS + UIAppFonts + + FontAwesome.otf + MuseoSans-100-Italic.otf + MuseoSans-100.otf + MuseoSans-300-Italic.otf + MuseoSans-300.otf + MuseoSans-500-Italic.otf + MuseoSans-500.otf + MuseoSans-700-Italic.otf + MuseoSans-700.otf + MuseoSans-900-Italic.otf + MuseoSans-900.otf + UILaunchStoryboardName LaunchScreen UIMainStoryboardFile @@ -32,8 +46,6 @@ UIStatusBarStyle UIStatusBarStyleLightContent - UIViewControllerBasedStatusBarAppearance - UIStatusBarTintParameters UINavigationBar @@ -49,6 +61,7 @@ UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + UIInterfaceOrientationPortraitUpsideDown UISupportedInterfaceOrientations~ipad @@ -57,19 +70,7 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight - UIAppFonts - - FontAwesome.otf - MuseoSans-100-Italic.otf - MuseoSans-100.otf - MuseoSans-300-Italic.otf - MuseoSans-300.otf - MuseoSans-500-Italic.otf - MuseoSans-500.otf - MuseoSans-700-Italic.otf - MuseoSans-700.otf - MuseoSans-900-Italic.otf - MuseoSans-900.otf - + UIViewControllerBasedStatusBarAppearance + diff --git a/BlogTests/Info.plist b/BlogTests/Info.plist index c3aa203..ba72822 100644 --- a/BlogTests/Info.plist +++ b/BlogTests/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - ca.gurulogic.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-CocoaLumberjack.xcscheme b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-CocoaLumberjack.xcscheme index 25c3cd9..da8dea7 100644 --- a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-CocoaLumberjack.xcscheme +++ b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-CocoaLumberjack.xcscheme @@ -1,13 +1,20 @@ - + + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> @@ -15,10 +22,37 @@ - - + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-FontAwesome+iOS.xcscheme b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-FontAwesome+iOS.xcscheme index 71e5ef3..ba72d9b 100644 --- a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-FontAwesome+iOS.xcscheme +++ b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-FontAwesome+iOS.xcscheme @@ -1,13 +1,20 @@ - + + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> @@ -15,10 +22,37 @@ - - + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-HockeySDK-HockeySDKResources.xcscheme b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-HockeySDK-HockeySDKResources.xcscheme index 5b1866c..a73f523 100644 --- a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-HockeySDK-HockeySDKResources.xcscheme +++ b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-HockeySDK-HockeySDKResources.xcscheme @@ -1,6 +1,6 @@ + + + + - + + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> @@ -15,10 +22,37 @@ - - + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-Mantle.xcscheme b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-Mantle.xcscheme index b188793..3ec4505 100644 --- a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-Mantle.xcscheme +++ b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-Mantle.xcscheme @@ -1,13 +1,20 @@ - + + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> @@ -15,10 +22,37 @@ - - + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-OMGHTTPURLRQ.xcscheme b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-OMGHTTPURLRQ.xcscheme index 9a6a94c..c21d06d 100644 --- a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-OMGHTTPURLRQ.xcscheme +++ b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-OMGHTTPURLRQ.xcscheme @@ -1,13 +1,20 @@ - + + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> @@ -15,10 +22,37 @@ - - + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-ObjectiveSugar.xcscheme b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-ObjectiveSugar.xcscheme index 67fd424..fa9c247 100644 --- a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-ObjectiveSugar.xcscheme +++ b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-ObjectiveSugar.xcscheme @@ -1,13 +1,20 @@ - + + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> @@ -15,10 +22,37 @@ - - + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-PromiseKit.xcscheme b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-PromiseKit.xcscheme index 037229e..bef8370 100644 --- a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-PromiseKit.xcscheme +++ b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-PromiseKit.xcscheme @@ -1,13 +1,20 @@ - + + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> @@ -15,10 +22,37 @@ - - + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-YapDatabase.xcscheme b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-YapDatabase.xcscheme index faba1bc..8c59356 100644 --- a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-YapDatabase.xcscheme +++ b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-YapDatabase.xcscheme @@ -1,13 +1,20 @@ - + + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> @@ -15,10 +22,37 @@ - - + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-dyci.xcscheme b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-dyci.xcscheme index 681f1d7..e7a7fa8 100644 --- a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-dyci.xcscheme +++ b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-dyci.xcscheme @@ -1,13 +1,20 @@ - + + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> @@ -15,10 +22,37 @@ - - + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-libextobjc.xcscheme b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-libextobjc.xcscheme index 8f7046e..71ba4e4 100644 --- a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-libextobjc.xcscheme +++ b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog-libextobjc.xcscheme @@ -1,13 +1,20 @@ - + + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> @@ -15,10 +22,37 @@ - - + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog.xcscheme b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog.xcscheme index 35baa2f..879eb0f 100644 --- a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog.xcscheme +++ b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-Blog.xcscheme @@ -1,6 +1,6 @@ + + - + + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> @@ -15,10 +22,37 @@ - - + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net-MBProgressHUD.xcscheme b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net-MBProgressHUD.xcscheme index 517de45..6df3f5c 100644 --- a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net-MBProgressHUD.xcscheme +++ b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net-MBProgressHUD.xcscheme @@ -1,13 +1,20 @@ - + + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> @@ -15,10 +22,37 @@ - - + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net-Mantle.xcscheme b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net-Mantle.xcscheme index c759125..35970ba 100644 --- a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net-Mantle.xcscheme +++ b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net-Mantle.xcscheme @@ -1,13 +1,20 @@ - + + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> @@ -15,10 +22,37 @@ - - + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net-OMGHTTPURLRQ.xcscheme b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net-OMGHTTPURLRQ.xcscheme index da53b7c..5418d78 100644 --- a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net-OMGHTTPURLRQ.xcscheme +++ b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net-OMGHTTPURLRQ.xcscheme @@ -1,13 +1,20 @@ - + + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> @@ -15,10 +22,37 @@ - - + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net-ObjectiveSugar.xcscheme b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net-ObjectiveSugar.xcscheme index 05d1018..68a58d7 100644 --- a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net-ObjectiveSugar.xcscheme +++ b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net-ObjectiveSugar.xcscheme @@ -1,13 +1,20 @@ - + + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> @@ -15,10 +22,37 @@ - - + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net-PromiseKit.xcscheme b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net-PromiseKit.xcscheme index a617d19..2e4d488 100644 --- a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net-PromiseKit.xcscheme +++ b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net-PromiseKit.xcscheme @@ -1,13 +1,20 @@ - + + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> @@ -15,10 +22,37 @@ - - + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net-YapDatabase.xcscheme b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net-YapDatabase.xcscheme index 5150c98..0c295b7 100644 --- a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net-YapDatabase.xcscheme +++ b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net-YapDatabase.xcscheme @@ -1,13 +1,20 @@ - + + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> @@ -15,10 +22,37 @@ - - + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net.xcscheme b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net.xcscheme index 68e9510..a9746a3 100644 --- a/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net.xcscheme +++ b/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-samhuri.net.xcscheme @@ -1,13 +1,20 @@ - + + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> @@ -15,10 +22,37 @@ - - + + + + + + + + + + + + + + + + + + + diff --git a/samhuri.net/Info.plist b/samhuri.net/Info.plist index 09452bc..7a762f7 100644 --- a/samhuri.net/Info.plist +++ b/samhuri.net/Info.plist @@ -9,7 +9,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - ca.gurulogic.Blog.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName From cdf0ada9b6a38d436c39be9d70236e3dd32b5602 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Mon, 15 Jun 2015 23:22:06 -0700 Subject: [PATCH 02/22] use https --- Blog/SamhuriNet.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Blog/SamhuriNet.m b/Blog/SamhuriNet.m index c719cfa..0daac93 100644 --- a/Blog/SamhuriNet.m +++ b/Blog/SamhuriNet.m @@ -81,7 +81,7 @@ } - (NSString *)rootURL { - return @"http://ocean.samhuri.net:6706/"; + return @"https://ocean.samhuri.net/"; } - (BlogController *)blogController { From 8a9188553a4843c89dbd599b976f67c09db5c5a5 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Mon, 15 Jun 2015 23:33:49 -0700 Subject: [PATCH 03/22] =?UTF-8?q?disable=20bitcode,=20it=E2=80=99s=20incom?= =?UTF-8?q?patible=20with=20-weak=5Flibrary?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Blog.xcodeproj/project.pbxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Blog.xcodeproj/project.pbxproj b/Blog.xcodeproj/project.pbxproj index 9f39c8b..8503a82 100644 --- a/Blog.xcodeproj/project.pbxproj +++ b/Blog.xcodeproj/project.pbxproj @@ -787,6 +787,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; + ENABLE_BITCODE = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -831,6 +832,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=*]" = "iPhone Distribution"; COPY_PHASE_STRIP = YES; + ENABLE_BITCODE = NO; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; From 9a562d2ecb2b4997647a31e6f3f02905bded3518 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Mon, 15 Jun 2015 23:34:45 -0700 Subject: [PATCH 04/22] fix misplaced views --- Blog/Base.lproj/Main.storyboard | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/Blog/Base.lproj/Main.storyboard b/Blog/Base.lproj/Main.storyboard index f686ca9..de640d0 100644 --- a/Blog/Base.lproj/Main.storyboard +++ b/Blog/Base.lproj/Main.storyboard @@ -1,7 +1,8 @@ - + - + + @@ -45,7 +46,7 @@ - + @@ -69,7 +70,7 @@ + @@ -120,6 +125,7 @@ + @@ -136,6 +143,7 @@ + The latest technology I've been learning is Palm's SDK for webOS, Mojo. My first impression is that it's a great platform and @@ -181,6 +189,7 @@ wanted with as little input and thought as possible. + @@ -204,6 +213,7 @@ wanted with as little input and thought as possible. + @@ -285,6 +295,7 @@ wanted with as little input and thought as possible. + @@ -294,6 +305,7 @@ wanted with as little input and thought as possible. + @@ -327,11 +339,14 @@ wanted with as little input and thought as possible. + + @@ -375,11 +390,13 @@ wanted with as little input and thought as possible. + + @@ -397,17 +414,20 @@ wanted with as little input and thought as possible. + @@ -439,6 +459,7 @@ wanted with as little input and thought as possible. + @@ -463,6 +484,7 @@ wanted with as little input and thought as possible. + @@ -494,6 +516,7 @@ wanted with as little input and thought as possible. + From a50dfc9a1c71b65b0eb3a99a9bd736ad0944cc34 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sun, 28 Jun 2015 13:18:11 -0700 Subject: [PATCH 10/22] prevent red link view flashing when selecting a post --- Blog/EditorViewController.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Blog/EditorViewController.m b/Blog/EditorViewController.m index 4afd9cd..9707c89 100644 --- a/Blog/EditorViewController.m +++ b/Blog/EditorViewController.m @@ -42,6 +42,7 @@ - (void)viewDidLoad { [super viewDidLoad]; [self setupFontAwesomeIcons]; + self.linkView.hidden = YES; } - (void)viewWillAppear:(BOOL)animated { @@ -131,6 +132,7 @@ self.removeLinkButton.hidden = !url; const CGFloat titleLabelTop = TitleLabelTopMargin + CGRectGetMaxY(self.linkView.frame); if (self.titleLabelTopConstraint.constant <= titleLabelTop) { + self.linkView.hidden = NO; self.linkView.alpha = 1; self.linkButton.alpha = 0; [UIView animateWithDuration:0.3 animations:^{ @@ -143,6 +145,8 @@ [UIView animateWithDuration:0.3 animations:^{ self.linkView.alpha = 0; self.titleLabelTopConstraint.constant = TitleLabelTopMargin; + } completion:^(BOOL finished) { + self.linkView.hidden = YES; }]; } } From 4ce730490c3ccaa773bd66e74626ac9cdc5912e8 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sun, 28 Jun 2015 13:29:54 -0700 Subject: [PATCH 11/22] fix clearing post selection on compact horiz layouts --- Blog/BlogSplitViewController.m | 9 +++++++++ Blog/PostsViewController.m | 3 +-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Blog/BlogSplitViewController.m b/Blog/BlogSplitViewController.m index b8ab9c9..cef8dc0 100644 --- a/Blog/BlogSplitViewController.m +++ b/Blog/BlogSplitViewController.m @@ -22,8 +22,17 @@ self.postsViewController.preferredContentSize = CGSizeMake(320, 600); } +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + [self updateForNewTraitCollection:self.traitCollection]; +} + - (void)willTransitionToTraitCollection:(UITraitCollection *)newCollection withTransitionCoordinator:(id )coordinator { [super willTransitionToTraitCollection:newCollection withTransitionCoordinator:coordinator]; + [self updateForNewTraitCollection:newCollection]; +} + +- (void)updateForNewTraitCollection:(UITraitCollection *)newCollection { BOOL isCompact = newCollection.horizontalSizeClass == UIUserInterfaceSizeClassCompact; self.postsViewController.clearsSelectionOnViewWillAppear = isCompact; } diff --git a/Blog/PostsViewController.m b/Blog/PostsViewController.m index 9117015..dff7e7d 100644 --- a/Blog/PostsViewController.m +++ b/Blog/PostsViewController.m @@ -194,8 +194,7 @@ static const NSUInteger SectionPublished = 1; - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [self requestStatusWithCaching:YES]; - BOOL isPhone = [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone; - if (isPhone && self.tableView.indexPathForSelectedRow) { + if (self.clearsSelectionOnViewWillAppear && self.tableView.indexPathForSelectedRow) { [self.tableView deselectRowAtIndexPath:self.tableView.indexPathForSelectedRow animated:YES]; } if (!self.postCollections) { From eca3042fcff9c945db3c8c45e6785c8438e7a5a5 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sun, 28 Jun 2015 13:30:49 -0700 Subject: [PATCH 12/22] restore selected post --- Blog/PostsViewController.m | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/Blog/PostsViewController.m b/Blog/PostsViewController.m index dff7e7d..cc6a533 100644 --- a/Blog/PostsViewController.m +++ b/Blog/PostsViewController.m @@ -38,6 +38,7 @@ @property (nonatomic, copy) NSString *blogStatusText; @property (nonatomic, strong) NSDate *blogStatusDate; @property (nonatomic, strong) NSTimer *blogStatusTimer; +@property (nonatomic, strong) NSIndexPath *selectedIndexPath; @property (nonatomic, weak) NSLayoutConstraint *titleViewWidthConstraint; @property (nonatomic, weak) NSLayoutConstraint *titleViewHeightConstraint; @property (nonatomic, weak) NSLayoutConstraint *titleLabelTopConstraint; @@ -197,9 +198,13 @@ static const NSUInteger SectionPublished = 1; if (self.clearsSelectionOnViewWillAppear && self.tableView.indexPathForSelectedRow) { [self.tableView deselectRowAtIndexPath:self.tableView.indexPathForSelectedRow animated:YES]; } - if (!self.postCollections) { - [self requestPostsWithCaching:YES]; - } + PMKPromise *postP = self.postCollections ? [PMKPromise promiseWithValue:self.postCollections] : [self requestPostsWithCaching:YES]; + postP.then(^{ + if (self.selectedIndexPath && [self postForIndexPath:self.selectedIndexPath]) { + [self.tableView selectRowAtIndexPath:self.selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionMiddle]; + self.selectedIndexPath = nil; + } + }); } - (void)viewDidAppear:(BOOL)animated { @@ -265,11 +270,19 @@ static const NSUInteger SectionPublished = 1; } - (PostCollection *)postCollectionForSection:(NSInteger)section { - return [self collectionsForTableView][section]; + NSArray *collections = [self collectionsForTableView]; + if (section < collections.count) { + return collections[section]; + } + return nil; } - (Post *)postForIndexPath:(NSIndexPath *)indexPath { - return [self postCollectionForSection:indexPath.section].posts[indexPath.row]; + PostCollection *collection = [self postCollectionForSection:indexPath.section]; + if (indexPath.row < collection.posts.count) { + return collection.posts[indexPath.row]; + } + return nil; } - (NSMutableArray *)drafts { @@ -491,16 +504,19 @@ static const NSUInteger SectionPublished = 1; static NSString *const StateRestorationBlogStatusDateKey = @"blogStatusDate"; static NSString *const StateRestorationBlogStatusTextKey = @"blogStatusText"; +static NSString *const StateRestorationTableViewSelectedIndexPathKey = @"tableView.indexPathForSelectedRow"; - (void)encodeRestorableStateWithCoder:(NSCoder *)coder { [coder encodeObject:self.blogStatusDate forKey:StateRestorationBlogStatusDateKey]; [coder encodeObject:self.blogStatusText forKey:StateRestorationBlogStatusTextKey]; + [coder encodeObject:self.tableView.indexPathForSelectedRow forKey:StateRestorationTableViewSelectedIndexPathKey]; [super encodeRestorableStateWithCoder:coder]; } - (void)decodeRestorableStateWithCoder:(NSCoder *)coder { self.blogStatusDate = [coder decodeObjectForKey:StateRestorationBlogStatusDateKey]; self.blogStatusText = [coder decodeObjectForKey:StateRestorationBlogStatusTextKey]; + self.selectedIndexPath = [coder decodeObjectForKey:StateRestorationTableViewSelectedIndexPathKey]; [super decodeRestorableStateWithCoder:coder]; } From 4d20adec84579985b8c7096659cbfa0304bf78cb Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sun, 28 Jun 2015 13:43:02 -0700 Subject: [PATCH 13/22] fix back button on editor in compact horiz layout on iPad --- Blog/BlogSplitViewController.m | 2 ++ Blog/PostsViewController.m | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Blog/BlogSplitViewController.m b/Blog/BlogSplitViewController.m index cef8dc0..cc142fb 100644 --- a/Blog/BlogSplitViewController.m +++ b/Blog/BlogSplitViewController.m @@ -35,6 +35,8 @@ - (void)updateForNewTraitCollection:(UITraitCollection *)newCollection { BOOL isCompact = newCollection.horizontalSizeClass == UIUserInterfaceSizeClassCompact; self.postsViewController.clearsSelectionOnViewWillAppear = isCompact; + self.editorViewControllerForPad.navigationItem.leftBarButtonItem = self.displayModeButtonItem; + self.editorViewControllerForPad.navigationItem.leftItemsSupplementBackButton = YES; } - (UINavigationController *)masterNavigationController { diff --git a/Blog/PostsViewController.m b/Blog/PostsViewController.m index cc6a533..0ce1f7d 100644 --- a/Blog/PostsViewController.m +++ b/Blog/PostsViewController.m @@ -495,8 +495,6 @@ static const NSUInteger SectionPublished = 1; EditorViewController *controller = (EditorViewController *)[[segue destinationViewController] topViewController]; controller.blogController = self.blogController; [controller configureWithPost:post]; - controller.navigationItem.leftBarButtonItem = self.splitViewController.displayModeButtonItem; - controller.navigationItem.leftItemsSupplementBackButton = YES; } } From 1f549845424a3295343c7613ff9bc98b102417d6 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sun, 28 Jun 2015 13:53:44 -0700 Subject: [PATCH 14/22] improve post selection handling --- Blog/PostsViewController.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Blog/PostsViewController.m b/Blog/PostsViewController.m index 0ce1f7d..f1c91ce 100644 --- a/Blog/PostsViewController.m +++ b/Blog/PostsViewController.m @@ -195,15 +195,15 @@ static const NSUInteger SectionPublished = 1; - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [self requestStatusWithCaching:YES]; - if (self.clearsSelectionOnViewWillAppear && self.tableView.indexPathForSelectedRow) { - [self.tableView deselectRowAtIndexPath:self.tableView.indexPathForSelectedRow animated:YES]; - } PMKPromise *postP = self.postCollections ? [PMKPromise promiseWithValue:self.postCollections] : [self requestPostsWithCaching:YES]; postP.then(^{ if (self.selectedIndexPath && [self postForIndexPath:self.selectedIndexPath]) { [self.tableView selectRowAtIndexPath:self.selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionMiddle]; self.selectedIndexPath = nil; } + if (self.clearsSelectionOnViewWillAppear && self.tableView.indexPathForSelectedRow) { + [self.tableView deselectRowAtIndexPath:self.tableView.indexPathForSelectedRow animated:YES]; + } }); } From 3cc07aeb805d5d702eb11ba0fc3f8949f02ec34a Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sat, 4 Jul 2015 09:50:25 -0700 Subject: [PATCH 15/22] declare notifications once, instead of adding and removing each one explicitly --- Blog.xcodeproj/project.pbxproj | 6 +++++ Blog/EditorViewController.m | 41 +++++++++++++++++++------------- Blog/NotificationToSelectorMap.h | 19 +++++++++++++++ Blog/NotificationToSelectorMap.m | 36 ++++++++++++++++++++++++++++ 4 files changed, 86 insertions(+), 16 deletions(-) create mode 100644 Blog/NotificationToSelectorMap.h create mode 100644 Blog/NotificationToSelectorMap.m diff --git a/Blog.xcodeproj/project.pbxproj b/Blog.xcodeproj/project.pbxproj index ca238cf..6c54b11 100644 --- a/Blog.xcodeproj/project.pbxproj +++ b/Blog.xcodeproj/project.pbxproj @@ -55,6 +55,7 @@ 7B9E64421A22F3840072FF42 /* BlogService.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B9E64411A22F3840072FF42 /* BlogService.m */; }; 7B9E644C1A230B940072FF42 /* JSONHTTPClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B9E644B1A230B940072FF42 /* JSONHTTPClient.m */; }; 7B9E644F1A23129B0072FF42 /* BlogStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B9E644E1A23129B0072FF42 /* BlogStatus.m */; }; + 7BBA86971B4264AB00FD2320 /* NotificationToSelectorMap.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BBA86961B4264AB00FD2320 /* NotificationToSelectorMap.m */; }; 7BE3A0351AE461E700E45CCB /* PreviewViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BE3A0341AE461E700E45CCB /* PreviewViewController.m */; }; 7BF029331A27117200E42EDE /* ModelStore.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BF029321A27117200E42EDE /* ModelStore.m */; }; 7BF029381A280CB200E42EDE /* BlogController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BF029371A280CB200E42EDE /* BlogController.m */; }; @@ -166,6 +167,8 @@ 7B9E644B1A230B940072FF42 /* JSONHTTPClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSONHTTPClient.m; sourceTree = ""; }; 7B9E644D1A23129B0072FF42 /* BlogStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlogStatus.h; sourceTree = ""; }; 7B9E644E1A23129B0072FF42 /* BlogStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BlogStatus.m; sourceTree = ""; }; + 7BBA86951B4264AB00FD2320 /* NotificationToSelectorMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationToSelectorMap.h; sourceTree = ""; }; + 7BBA86961B4264AB00FD2320 /* NotificationToSelectorMap.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NotificationToSelectorMap.m; sourceTree = ""; }; 7BE3A0331AE461E700E45CCB /* PreviewViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PreviewViewController.h; sourceTree = ""; }; 7BE3A0341AE461E700E45CCB /* PreviewViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PreviewViewController.m; sourceTree = ""; }; 7BF029311A27117200E42EDE /* ModelStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModelStore.h; sourceTree = ""; }; @@ -321,6 +324,8 @@ 1BCFCA73B716677EFBCEC417 /* CommonUI.h */, 1BCFC1C7E02F4D1867A5D711 /* BlogSplitViewController.m */, 1BCFC63F2FE2EFBC1C513859 /* BlogSplitViewController.h */, + 7BBA86951B4264AB00FD2320 /* NotificationToSelectorMap.h */, + 7BBA86961B4264AB00FD2320 /* NotificationToSelectorMap.m */, ); path = Blog; sourceTree = ""; @@ -679,6 +684,7 @@ 7B9E642E1A227FA20072FF42 /* NSString+marshmallows.m in Sources */, 7B9E64421A22F3840072FF42 /* BlogService.m in Sources */, 7B5C4BDF19F2606900667D48 /* main.m in Sources */, + 7BBA86971B4264AB00FD2320 /* NotificationToSelectorMap.m in Sources */, 7BF029331A27117200E42EDE /* ModelStore.m in Sources */, 7B2B43511AED5BA500BAC4E2 /* Functions.m in Sources */, 7BF029381A280CB200E42EDE /* BlogController.m in Sources */, diff --git a/Blog/EditorViewController.m b/Blog/EditorViewController.m index 9707c89..d153b38 100644 --- a/Blog/EditorViewController.m +++ b/Blog/EditorViewController.m @@ -18,6 +18,7 @@ #import "UIColor+Hex.h" #import "MBProgressHUD.h" #import "CommonUI.h" +#import "NotificationToSelectorMap.h" @interface EditorViewController () @@ -34,6 +35,7 @@ @property (nonatomic, strong) Post *modifiedPost; @property (nonatomic, readonly, assign, getter=isDirty) BOOL dirty; @property (nonatomic, strong) PMKPromise *savePromise; +@property (nonatomic, strong) NotificationToSelectorMap *notificationMap; @end @@ -42,39 +44,46 @@ - (void)viewDidLoad { [super viewDidLoad]; [self setupFontAwesomeIcons]; + [self setupNotifications]; self.linkView.hidden = YES; } +- (void)setupNotifications { + NSDictionary *map = @{UIApplicationWillResignActiveNotification: NSStringFromSelector(@selector(applicationWillResignActive:)), + UIApplicationDidBecomeActiveNotification: NSStringFromSelector(@selector(applicationDidBecomeActive:)), + UIPasteboardChangedNotification: NSStringFromSelector(@selector(configureLinkView)), + UIKeyboardWillShowNotification: NSStringFromSelector(@selector(keyboardWillShow:)), + UIKeyboardWillHideNotification: NSStringFromSelector(@selector(keyboardWillHide:)), + DraftRemovedNotification: NSStringFromSelector(@selector(postDeleted:)), + PublishedPostRemovedNotification: NSStringFromSelector(@selector(postDeleted:)), + }; + self.notificationMap = [[NotificationToSelectorMap alloc] initWithNotificationMap:map]; +} + - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; NSAssert(self.blogController, @"blogController is required"); - NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; - [notificationCenter addObserver:self selector:@selector(applicationWillResignActive:) name:UIApplicationWillResignActiveNotification object:nil]; - [notificationCenter addObserver:self selector:@selector(applicationDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil]; - [notificationCenter addObserver:self selector:@selector(configureLinkView) name:UIPasteboardChangedNotification object:nil]; - [notificationCenter addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; - [notificationCenter addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; - [notificationCenter addObserver:self selector:@selector(postDeleted:) name:DraftRemovedNotification object:nil]; - [notificationCenter addObserver:self selector:@selector(postDeleted:) name:PublishedPostRemovedNotification object:nil]; [self configureView]; [self restoreScrollOffset]; } +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + [self.notificationMap addObserver:self]; +} + - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; - NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; - [notificationCenter removeObserver:self name:UIApplicationWillResignActiveNotification object:nil]; - [notificationCenter removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil]; - [notificationCenter removeObserver:self name:UIPasteboardChangedNotification object:nil]; - [notificationCenter removeObserver:self name:UIKeyboardWillShowNotification object:nil]; - [notificationCenter removeObserver:self name:UIKeyboardWillHideNotification object:nil]; - [notificationCenter removeObserver:self name:DraftRemovedNotification object:nil]; - [notificationCenter removeObserver:self name:PublishedPostRemovedNotification object:nil]; if (self.post) { [self savePostAndWaitForCompilation:NO]; } } +- (void)viewDidDisappear:(BOOL)animated { + [super viewDidDisappear:animated]; + [self.notificationMap removeObserver:self]; +} + - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { [super prepareForSegue:segue sender:sender]; if ([segue.identifier isEqualToString:@"showPreview"]) { diff --git a/Blog/NotificationToSelectorMap.h b/Blog/NotificationToSelectorMap.h new file mode 100644 index 0000000..b286516 --- /dev/null +++ b/Blog/NotificationToSelectorMap.h @@ -0,0 +1,19 @@ +// +// NotificationToSelectorMap.h +// Blog +// +// Created by Sami Samhuri on 2015-06-29. +// Copyright © 2015 Guru Logic Inc. All rights reserved. +// + +#import + +@interface NotificationToSelectorMap : NSObject + +@property (nonatomic, copy) NSDictionary *notificationNameToSelectorNameMap; + +- (instancetype)initWithNotificationMap:(nonnull NSDictionary *)notificationMap; +- (void)addObserver:(NSObject *)observer; +- (void)removeObserver:(NSObject *)observer; + +@end diff --git a/Blog/NotificationToSelectorMap.m b/Blog/NotificationToSelectorMap.m new file mode 100644 index 0000000..bfec403 --- /dev/null +++ b/Blog/NotificationToSelectorMap.m @@ -0,0 +1,36 @@ +// +// NotificationToSelectorMap.m +// Blog +// +// Created by Sami Samhuri on 2015-06-29. +// Copyright © 2015 Guru Logic Inc. All rights reserved. +// + +#import "NotificationToSelectorMap.h" + +@implementation NotificationToSelectorMap + +- (instancetype)initWithNotificationMap:(nonnull NSDictionary *)notificationMap { + self = [super init]; + if (self) { + _notificationNameToSelectorNameMap = notificationMap; + } + return self; +} + +- (void)addObserver:(NSObject *)observer { + NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; + for (NSString *notificationName in self.notificationNameToSelectorNameMap.allKeys) { + NSString *selectorName = self.notificationNameToSelectorNameMap[notificationName]; + [notificationCenter addObserver:observer selector:NSSelectorFromString(selectorName) name:notificationName object:nil]; + } +} + +- (void)removeObserver:(NSObject *)observer { + NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; + for (NSString *notificationName in self.notificationNameToSelectorNameMap.allKeys) { + [notificationCenter removeObserver:observer name:notificationName object:nil]; + } +} + +@end From 70f313a0b2e91cc974bc4fe1e4aa5fd1f59af916 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sat, 4 Jul 2015 09:52:46 -0700 Subject: [PATCH 16/22] move more stuff from AppDelegate to BlogSplitViewController --- Blog/AppDelegate.m | 18 ++++-------------- Blog/BlogSplitViewController.h | 12 ++++-------- Blog/BlogSplitViewController.m | 22 ++++++++-------------- 3 files changed, 16 insertions(+), 36 deletions(-) diff --git a/Blog/AppDelegate.m b/Blog/AppDelegate.m index e31d802..22261a4 100644 --- a/Blog/AppDelegate.m +++ b/Blog/AppDelegate.m @@ -16,24 +16,17 @@ @interface AppDelegate () -@property (nonatomic, readonly, strong) SamhuriNet *site; -@property (nonatomic, readonly, strong) PostsViewController *postsViewController; -@property (nonatomic, readonly, strong) EditorViewController *editorViewControllerForPhone; -@property (nonatomic, readonly, strong) EditorViewController *editorViewControllerForPad; - @end @implementation AppDelegate -@synthesize site = _site; - - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [self setupCodeInjection]; BlogSplitViewController *splitViewController = (BlogSplitViewController *)self.window.rootViewController; splitViewController.delegate = self; splitViewController.site = [SamhuriNet new]; - UINavigationController *navigationController = splitViewController.detailNavigationController; - navigationController.topViewController.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem; + splitViewController.editorViewController.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem; + splitViewController.editorViewController.navigationItem.leftItemsSupplementBackButton = YES; return YES; } @@ -93,11 +86,8 @@ #pragma mark - UISplitViewDelegate methods -- (BOOL)splitViewController:(UISplitViewController *)splitViewController collapseSecondaryViewController:(UIViewController *)secondaryViewController ontoPrimaryViewController:(UIViewController *)primaryViewController { - UINavigationController *navigationController = [secondaryViewController isKindOfClass:[UINavigationController class]] - ? (UINavigationController *)secondaryViewController - : nil; - EditorViewController *editorViewController = navigationController.topViewController ? safeCast(navigationController.topViewController, [EditorViewController class]) : nil; +- (BOOL)splitViewController:(BlogSplitViewController *)splitViewController collapseSecondaryViewController:(UIViewController *)secondaryViewController ontoPrimaryViewController:(UIViewController *)primaryViewController { + EditorViewController *editorViewController = splitViewController.editorViewController; if (!editorViewController.post) { // Return YES to indicate that we have handled the collapse by doing nothing; the secondary controller will be discarded. return YES; diff --git a/Blog/BlogSplitViewController.h b/Blog/BlogSplitViewController.h index ef546c4..0d451a5 100644 --- a/Blog/BlogSplitViewController.h +++ b/Blog/BlogSplitViewController.h @@ -4,18 +4,14 @@ // @import UIKit; -@class PostsViewController; -@class EditorViewController; @class SamhuriNet; +@class EditorViewController; @interface BlogSplitViewController : UISplitViewController @property (nonatomic, strong) SamhuriNet *site; - -- (UINavigationController *)masterNavigationController; -- (UINavigationController *)detailNavigationController; -- (PostsViewController *)postsViewController; -- (EditorViewController *)editorViewControllerForPhone; -- (EditorViewController *)editorViewControllerForPad; +@property (nonatomic, readonly, strong) UINavigationController *masterNavigationController; +@property (nonatomic, readonly, strong) UINavigationController *detailNavigationController; +@property (nonatomic, readonly, strong) EditorViewController *editorViewController; @end \ No newline at end of file diff --git a/Blog/BlogSplitViewController.m b/Blog/BlogSplitViewController.m index cc142fb..b0c0350 100644 --- a/Blog/BlogSplitViewController.m +++ b/Blog/BlogSplitViewController.m @@ -8,13 +8,18 @@ #import "EditorViewController.h" #import "SamhuriNet.h" +@interface BlogSplitViewController () + +@property (nonatomic, readonly, strong) PostsViewController *postsViewController; + +@end + @implementation BlogSplitViewController - (void)setSite:(SamhuriNet *)site { _site = site; self.postsViewController.blogController = self.site.blogController; - self.editorViewControllerForPhone.blogController = self.site.blogController; - self.editorViewControllerForPad.blogController = self.site.blogController; + self.editorViewController.blogController = self.site.blogController; } - (void)awakeFromNib { @@ -35,8 +40,6 @@ - (void)updateForNewTraitCollection:(UITraitCollection *)newCollection { BOOL isCompact = newCollection.horizontalSizeClass == UIUserInterfaceSizeClassCompact; self.postsViewController.clearsSelectionOnViewWillAppear = isCompact; - self.editorViewControllerForPad.navigationItem.leftBarButtonItem = self.displayModeButtonItem; - self.editorViewControllerForPad.navigationItem.leftItemsSupplementBackButton = YES; } - (UINavigationController *)masterNavigationController { @@ -51,16 +54,7 @@ return (PostsViewController *)self.masterNavigationController.viewControllers.firstObject; } -- (EditorViewController *)editorViewControllerForPhone { - UINavigationController *navigationController = self.masterNavigationController; - if (navigationController.viewControllers.count > 1) { - navigationController = navigationController.viewControllers.lastObject; - } - EditorViewController *editorViewController = (EditorViewController *)navigationController.viewControllers.firstObject; - return editorViewController; -} - -- (EditorViewController *)editorViewControllerForPad { +- (EditorViewController *)editorViewController { return (EditorViewController *)self.detailNavigationController.viewControllers.firstObject; } From 63cc9c43754d236fca8cde257849619c813b12c4 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sat, 4 Jul 2015 09:53:15 -0700 Subject: [PATCH 17/22] fix post status display bug --- Blog/EditorViewController.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Blog/EditorViewController.m b/Blog/EditorViewController.m index d153b38..39b0e15 100644 --- a/Blog/EditorViewController.m +++ b/Blog/EditorViewController.m @@ -129,7 +129,10 @@ } - (NSString *)statusText { - return self.modifiedPost.draft ? @"Draft" : self.modifiedPost.date; + if (self.post) { + return self.modifiedPost.draft ? @"Draft" : self.modifiedPost.date; + } + return @""; } - (void)configureLinkView { From c91dd2a2b2975a1d113b69e3dbb3c62aa19eb5ce Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sat, 4 Jul 2015 09:53:34 -0700 Subject: [PATCH 18/22] fix blog status display bug, and try to fix layout (still broken) --- Blog/PostsViewController.m | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/Blog/PostsViewController.m b/Blog/PostsViewController.m index f1c91ce..c1c4285 100644 --- a/Blog/PostsViewController.m +++ b/Blog/PostsViewController.m @@ -80,7 +80,7 @@ static const NSUInteger SectionPublished = 1; NSLayoutConstraint *widthConstraint = [NSLayoutConstraint constraintWithItem:titleView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:0]; [titleView addConstraint:widthConstraint]; self.titleViewWidthConstraint = widthConstraint; - NSLayoutConstraint *heightConstraint = [NSLayoutConstraint constraintWithItem:titleView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:0]; + NSLayoutConstraint *heightConstraint = [NSLayoutConstraint constraintWithItem:titleView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:8 + CGRectGetMaxY(self.navigationController.navigationBar.frame)]; [titleView addConstraint:heightConstraint]; self.titleViewHeightConstraint = heightConstraint; titleView.translatesAutoresizingMaskIntoConstraints = NO; @@ -96,9 +96,7 @@ static const NSUInteger SectionPublished = 1; titleLabel.text = self.navigationItem.title; [titleLabel sizeToFit]; [titleView addSubview:titleLabel]; - NSLayoutConstraint *topConstraint = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:titleView attribute:NSLayoutAttributeTop multiplier:1 constant:0]; - [titleView addConstraint:topConstraint]; - self.titleLabelTopConstraint = topConstraint; + [titleView addConstraint:[NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:titleView attribute:NSLayoutAttributeTop multiplier:1 constant:18]]; [titleView addConstraint:[NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:titleView attribute:NSLayoutAttributeCenterX multiplier:1 constant:0]]; self.titleLabel = titleLabel; UILabel *subtitleLabel = [[UILabel alloc] initWithFrame:CGRectZero]; @@ -107,26 +105,15 @@ static const NSUInteger SectionPublished = 1; subtitleLabel.textColor = [UIColor whiteColor]; [subtitleLabel sizeToFit]; [titleView addSubview:subtitleLabel]; - [titleView addConstraint:[NSLayoutConstraint constraintWithItem:subtitleLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:titleView attribute:NSLayoutAttributeBottom multiplier:1 constant:-9]]; + [titleView addConstraint:[NSLayoutConstraint constraintWithItem:subtitleLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:titleView attribute:NSLayoutAttributeBottom multiplier:1 constant:0]]; [titleView addConstraint:[NSLayoutConstraint constraintWithItem:subtitleLabel attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:titleView attribute:NSLayoutAttributeCenterX multiplier:1 constant:0]]; self.statusLabel = subtitleLabel; self.navigationItem.titleView = titleView; } -- (void)updateTitleViewConstraints; -{ +- (void)updateTitleViewConstraints { self.titleViewWidthConstraint.constant = CGRectGetWidth(self.view.bounds); - CGFloat height = CGRectGetHeight(self.navigationController.navigationBar.bounds); - CGFloat top = 5; - // This is more reliable than checking if it's portrait. - if (!UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation)) - { - // status bar - height += 20; - top += 15; - } - self.titleViewHeightConstraint.constant = height; - self.titleLabelTopConstraint.constant = top; + self.titleViewHeightConstraint.constant = 8 + CGRectGetHeight(self.navigationController.navigationBar.bounds); [self.titleLabel.superview setNeedsUpdateConstraints]; } @@ -185,11 +172,15 @@ static const NSUInteger SectionPublished = 1; } - (void)updateBlogStatus { - [self updateStatusLabel:[NSString stringWithFormat:@"%@ as of %@", self.blogStatusText, [self.blogStatusDate mm_relativeToNow]] animated:NO]; + [self updateBlogStatusAnimated:NO]; } - (void)updateBlogStatusAnimated:(BOOL)animated { - [self updateStatusLabel:[NSString stringWithFormat:@"%@ as of %@", self.blogStatusText, [self.blogStatusDate mm_relativeToNow]] animated:animated]; + if (!(self.blogStatusText && self.blogStatusDate)) { + return; + } + NSString *status = [NSString stringWithFormat:@"%@ as of %@", self.blogStatusText, [self.blogStatusDate mm_relativeToNow]]; + [self updateStatusLabel:status animated:animated]; } - (void)viewWillAppear:(BOOL)animated { From 8913110f9e34110f48f8cc6ab56a773c7b68aec1 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sat, 4 Jul 2015 09:54:03 -0700 Subject: [PATCH 19/22] fix a bug where master VC was returned instead of detail VC --- Blog/BlogSplitViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Blog/BlogSplitViewController.m b/Blog/BlogSplitViewController.m index b0c0350..e9623c7 100644 --- a/Blog/BlogSplitViewController.m +++ b/Blog/BlogSplitViewController.m @@ -47,7 +47,7 @@ } - (UINavigationController *)detailNavigationController { - return self.viewControllers.lastObject; + return self.viewControllers.count == 2 ? self.viewControllers.lastObject : nil; } - (PostsViewController *)postsViewController { From 39947a7a445b4d6fa74429ad6a005494e717df20 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sat, 4 Jul 2015 09:54:22 -0700 Subject: [PATCH 20/22] remove pointless code --- Blog/BlogSplitViewController.m | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Blog/BlogSplitViewController.m b/Blog/BlogSplitViewController.m index e9623c7..ddcd728 100644 --- a/Blog/BlogSplitViewController.m +++ b/Blog/BlogSplitViewController.m @@ -27,11 +27,6 @@ self.postsViewController.preferredContentSize = CGSizeMake(320, 600); } -- (void)viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - [self updateForNewTraitCollection:self.traitCollection]; -} - - (void)willTransitionToTraitCollection:(UITraitCollection *)newCollection withTransitionCoordinator:(id )coordinator { [super willTransitionToTraitCollection:newCollection withTransitionCoordinator:coordinator]; [self updateForNewTraitCollection:newCollection]; From 2cdb764cb5f2348dd1b0124034c8b6bdaf70adf1 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sat, 4 Jul 2015 09:54:34 -0700 Subject: [PATCH 21/22] rearrange project, and Xcode changed the font back again! --- Blog.xcodeproj/project.pbxproj | 4 ++-- Blog/Base.lproj/Main.storyboard | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Blog.xcodeproj/project.pbxproj b/Blog.xcodeproj/project.pbxproj index 6c54b11..516514e 100644 --- a/Blog.xcodeproj/project.pbxproj +++ b/Blog.xcodeproj/project.pbxproj @@ -301,6 +301,8 @@ 7BF029351A27119B00E42EDE /* Service */, 7B5C4BE019F2606900667D48 /* AppDelegate.h */, 7B5C4BE119F2606900667D48 /* AppDelegate.m */, + 1BCFC1C7E02F4D1867A5D711 /* BlogSplitViewController.m */, + 1BCFC63F2FE2EFBC1C513859 /* BlogSplitViewController.h */, 7B5C4BE319F2606900667D48 /* PostsViewController.h */, 7B5C4BE419F2606900667D48 /* PostsViewController.m */, 7B5C4BE619F2606900667D48 /* EditorViewController.h */, @@ -322,8 +324,6 @@ 7B2B43501AED5BA500BAC4E2 /* Functions.m */, 1BCFC32EC1E5AE196D194D21 /* CommonUI.m */, 1BCFCA73B716677EFBCEC417 /* CommonUI.h */, - 1BCFC1C7E02F4D1867A5D711 /* BlogSplitViewController.m */, - 1BCFC63F2FE2EFBC1C513859 /* BlogSplitViewController.h */, 7BBA86951B4264AB00FD2320 /* NotificationToSelectorMap.h */, 7BBA86961B4264AB00FD2320 /* NotificationToSelectorMap.m */, ); diff --git a/Blog/Base.lproj/Main.storyboard b/Blog/Base.lproj/Main.storyboard index 7164334..3e56570 100644 --- a/Blog/Base.lproj/Main.storyboard +++ b/Blog/Base.lproj/Main.storyboard @@ -7,7 +7,7 @@ - + FontAwesome FontAwesome From 6dfa05127a1de9da656def9c67cd27e25dacc15f Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sat, 4 Jul 2015 10:03:51 -0700 Subject: [PATCH 22/22] fix nullability warnings in NotificationToSelectorMap --- Blog/NotificationToSelectorMap.h | 8 ++++---- Blog/NotificationToSelectorMap.m | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Blog/NotificationToSelectorMap.h b/Blog/NotificationToSelectorMap.h index b286516..d43744f 100644 --- a/Blog/NotificationToSelectorMap.h +++ b/Blog/NotificationToSelectorMap.h @@ -10,10 +10,10 @@ @interface NotificationToSelectorMap : NSObject -@property (nonatomic, copy) NSDictionary *notificationNameToSelectorNameMap; +@property (nonatomic, copy, nonnull) NSDictionary *notificationNameToSelectorNameMap; -- (instancetype)initWithNotificationMap:(nonnull NSDictionary *)notificationMap; -- (void)addObserver:(NSObject *)observer; -- (void)removeObserver:(NSObject *)observer; +- (nonnull instancetype)initWithNotificationMap:(nonnull NSDictionary *)notificationMap; +- (void)addObserver:(nonnull NSObject *)observer; +- (void)removeObserver:(nonnull NSObject *)observer; @end diff --git a/Blog/NotificationToSelectorMap.m b/Blog/NotificationToSelectorMap.m index bfec403..4f64b7b 100644 --- a/Blog/NotificationToSelectorMap.m +++ b/Blog/NotificationToSelectorMap.m @@ -10,7 +10,7 @@ @implementation NotificationToSelectorMap -- (instancetype)initWithNotificationMap:(nonnull NSDictionary *)notificationMap { +- (nonnull instancetype)initWithNotificationMap:(nonnull NSDictionary *)notificationMap { self = [super init]; if (self) { _notificationNameToSelectorNameMap = notificationMap; @@ -18,7 +18,7 @@ return self; } -- (void)addObserver:(NSObject *)observer { +- (void)addObserver:(nonnull NSObject *)observer { NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; for (NSString *notificationName in self.notificationNameToSelectorNameMap.allKeys) { NSString *selectorName = self.notificationNameToSelectorNameMap[notificationName]; @@ -26,7 +26,7 @@ } } -- (void)removeObserver:(NSObject *)observer { +- (void)removeObserver:(nonnull NSObject *)observer { NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; for (NSString *notificationName in self.notificationNameToSelectorNameMap.allKeys) { [notificationCenter removeObserver:observer name:notificationName object:nil];