Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve #319: tapping the widget opens the app #334

Merged
merged 3 commits into from
Dec 25, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use MAIN_APP_BUNDLE_IDENTIFIER instead of hardcoding "Loop" as the UR…
…L scheme
  • Loading branch information
Bharat Mediratta committed Dec 23, 2016
commit bdb02ababc21a12e5a8e96ce6bd1dbbcd50b2833
2 changes: 1 addition & 1 deletion Loop Status Extension/StatusViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class StatusViewController: UIViewController, NCWidgetProviding {
}

@objc private func openLoopApp(_: Any) {
if let url = URL(string: "Loop://") {
if let url = Bundle.main.mainAppUrl {
self.extensionContext?.open(url)
}
}
Expand Down
8 changes: 8 additions & 0 deletions Loop/Extensions/NSBundle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,12 @@ extension Bundle {
var appGroupSuiteName: String {
return "group.\(mainAppBundleIdentifier!)"
}

var mainAppUrl: URL? {
if let mainAppBundleIdentifier = mainAppBundleIdentifier {
return URL(string: mainAppBundleIdentifier + "://")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"\(mainAppBundleIdentifier)://"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch. fixed.

} else {
return nil
}
}
}
2 changes: 1 addition & 1 deletion Loop/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>Loop</string>
<string>$(MAIN_APP_BUNDLE_IDENTIFIER)</string>
</array>
</dict>
</array>
Expand Down