Skip to content

Commit f0c502f

Browse files
committed
Move hardcoded deep link schemes to AppConstant
1 parent e045bd8 commit f0c502f

File tree

3 files changed

+29
-12
lines changed

3 files changed

+29
-12
lines changed

WordPress/Classes/Utility/App Configuration/AppConstants.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ import WordPressAuthenticator
2727
#endif
2828
#endif
2929
#endif
30+
31+
/// Deep Link URL Scheme
32+
///
33+
/// Note: This needs to be manually in sync with Target > Build Settings > User-defined > `WPCOM_SCHEME`.
34+
///
35+
#if DEBUG
36+
static let deepLinkScheme = "wpdebug"
37+
#elseif INTERNAL_BUILD
38+
static let deepLinkScheme = "wpinternal"
39+
#elseif ALPHA_BUILD
40+
static let deepLinkScheme = "wpalpha"
41+
#else
42+
static let deepLinkScheme = "wordpress"
43+
#endif
3044
}
3145

3246
// MARK: - Tab bar order

WordPress/Classes/ViewRelated/Jetpack/Branding/Coordinator/JetpackBrandingCoordinator.swift

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,7 @@ class JetpackBrandingCoordinator {
66
static func presentOverlay(from viewController: UIViewController, redirectAction: (() -> Void)? = nil) {
77

88
let action = redirectAction ?? {
9-
#if DEBUG
10-
let jetpackScheme = "jpdebug"
11-
#elseif INTERNAL_BUILD
12-
let jetpackScheme = "jpinternal"
13-
#elseif ALPHA_BUILD
14-
let jetpackScheme = "jpalpha"
15-
#else
16-
let jetpackScheme = "jetpack"
17-
#endif
18-
19-
guard AppConfiguration.isWordPress,
20-
let jetpackDeepLinkURL = URL(string: "\(jetpackScheme)://app"),
9+
guard let jetpackDeepLinkURL = URL(string: "\(AppConstants.deepLinkScheme)://app"),
2110
let jetpackUniversalLinkURL = URL(string: "https://jetpack.com/app"),
2211
let jetpackAppStoreURL = URL(string: "https://apps.apple.com/app/jetpack-website-builder/id1565481562") else {
2312
return

WordPress/Jetpack/AppConstants.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ import WordPressKit
2727
#endif
2828
#endif
2929
#endif
30+
31+
/// Deep Link URL Scheme
32+
///
33+
/// Note: this needs to be in sync with Target > Build Settings > User-defined > `WPCOM_SCHEME` value.
34+
///
35+
#if DEBUG
36+
static let deepLinkScheme = "jpdebug"
37+
#elseif INTERNAL_BUILD
38+
static let deepLinkScheme = "jpinternal"
39+
#elseif ALPHA_BUILD
40+
static let deepLinkScheme = "jpalpha"
41+
#else
42+
static let deepLinkScheme = "jetpack"
43+
#endif
3044
}
3145

3246
// MARK: - Tab bar order

0 commit comments

Comments
 (0)