Skip to content

Commit

Permalink
Add support for Today Widget also on iOS 8
Browse files Browse the repository at this point in the history
  • Loading branch information
walokra committed Aug 25, 2016
1 parent f1ec681 commit 0808cb7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
17 changes: 12 additions & 5 deletions Haikara/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -71,6 +77,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}

return false

}

func setObservers() {
Expand Down
2 changes: 1 addition & 1 deletion Haikara/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<string>2</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
Expand Down
4 changes: 2 additions & 2 deletions Highkara.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion NewsWidget/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>2</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
Expand Down

0 comments on commit 0808cb7

Please sign in to comment.