From 0808cb75caa1c6ee1172be30a8d44b64df687eb0 Mon Sep 17 00:00:00 2001 From: Marko Wallin Date: Fri, 26 Aug 2016 00:11:29 +0300 Subject: [PATCH] Add support for Today Widget also on iOS 8 --- Haikara/AppDelegate.swift | 17 ++++++++++++----- Haikara/Info.plist | 2 +- Highkara.xcodeproj/project.pbxproj | 4 ++-- NewsWidget/Info.plist | 2 +- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Haikara/AppDelegate.swift b/Haikara/AppDelegate.swift index 7222273..568522d 100644 --- a/Haikara/AppDelegate.swift +++ b/Haikara/AppDelegate.swift @@ -44,19 +44,25 @@ class AppDelegate: UIResponder, UIApplicationDelegate { return true } + // iOS 8 + func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool { + return parseAndOpenUrl(url) + } + + // iOS 9 func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool { - let url = url.standardizedURL + return parseAndOpenUrl(url) + } + + func parseAndOpenUrl(url: NSURL) -> Bool { + let url = url.standardizedURL let urlString = url!.absoluteString let host = url!.host -// let query = url!.query -// let openUrlPath = url!.path #if DEBUG print("openURL, url=\(url)") print("openURL, urlString=\(urlString)") print("openURL, host=\(host)") -// print("openURL, openUrlPath=\(openUrlPath)") -// print("openURL, query=\(query)") #endif if host!.rangeOfString("article") != nil { @@ -71,6 +77,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } return false + } func setObservers() { diff --git a/Haikara/Info.plist b/Haikara/Info.plist index 9739c88..c03d638 100644 --- a/Haikara/Info.plist +++ b/Haikara/Info.plist @@ -30,7 +30,7 @@ CFBundleVersion - 1 + 2 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/Highkara.xcodeproj/project.pbxproj b/Highkara.xcodeproj/project.pbxproj index be37d8c..cd27032 100644 --- a/Highkara.xcodeproj/project.pbxproj +++ b/Highkara.xcodeproj/project.pbxproj @@ -899,7 +899,7 @@ ); GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; INFOPLIST_FILE = NewsWidget/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; OTHER_SWIFT_FLAGS = "-D DEBUG $(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = com.ruleoftech.highkara.Today; @@ -926,7 +926,7 @@ "$(PROJECT_DIR)/Build/Products/Release-iphoneos/Alamofire", ); INFOPLIST_FILE = NewsWidget/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; OTHER_SWIFT_FLAGS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = com.ruleoftech.highkara.Today; diff --git a/NewsWidget/Info.plist b/NewsWidget/Info.plist index d94a25e..f05d5e5 100644 --- a/NewsWidget/Info.plist +++ b/NewsWidget/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 1 + 2 NSAppTransportSecurity NSExceptionDomains