Skip to content

Commit bdb02ab

Browse files
author
Bharat Mediratta
committed
Use MAIN_APP_BUNDLE_IDENTIFIER instead of hardcoding "Loop" as the URL scheme
1 parent 93111d5 commit bdb02ab

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

Loop Status Extension/StatusViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class StatusViewController: UIViewController, NCWidgetProviding {
3434
}
3535

3636
@objc private func openLoopApp(_: Any) {
37-
if let url = URL(string: "Loop://") {
37+
if let url = Bundle.main.mainAppUrl {
3838
self.extensionContext?.open(url)
3939
}
4040
}

Loop/Extensions/NSBundle.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,12 @@ extension Bundle {
2929
var appGroupSuiteName: String {
3030
return "group.\(mainAppBundleIdentifier!)"
3131
}
32+
33+
var mainAppUrl: URL? {
34+
if let mainAppBundleIdentifier = mainAppBundleIdentifier {
35+
return URL(string: mainAppBundleIdentifier + "://")
36+
} else {
37+
return nil
38+
}
39+
}
3240
}

Loop/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<dict>
88
<key>CFBundleURLSchemes</key>
99
<array>
10-
<string>Loop</string>
10+
<string>$(MAIN_APP_BUNDLE_IDENTIFIER)</string>
1111
</array>
1212
</dict>
1313
</array>

0 commit comments

Comments
 (0)