Skip to content

Commit 546f6e5

Browse files
committed
Remove ~= operation for BuildConfiguration
1 parent 616ba66 commit 546f6e5

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

Modules/Sources/BuildSettingsKit/BuildConfiguration.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ public enum BuildConfiguration: String, Sendable {
1313
BuildSettings.current.configuration
1414
}
1515

16-
public static func ~=(a: BuildConfiguration, b: Set<BuildConfiguration>) -> Bool {
17-
return b.contains(a)
18-
}
19-
16+
/// Returns `true` if the build is intented only for internal use.
2017
public var isInternal: Bool {
21-
self ~= [.debug, .alpha]
18+
switch self {
19+
case .debug, .alpha: true
20+
case .appStore: false
21+
}
2222
}
2323
}

WordPress/Classes/Services/Page Layouts/PageLayoutService.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class PageLayoutService {
6666
}
6767

6868
private static let supportedBlocks: String = {
69-
let isDevMode = BuildConfiguration.current ~= [.debug, .alpha]
69+
let isDevMode = BuildConfiguration.current.isInternal
7070
return Gutenberg.supportedBlocks(isDev: isDevMode).joined(separator: ",")
7171
}()
7272

@@ -75,7 +75,7 @@ class PageLayoutService {
7575
private static let type = "mobile"
7676

7777
// Return "true" or "false" for isBeta that gets passed into the endpoint.
78-
private static let isBeta = String(BuildConfiguration.current ~= [.debug, .alpha])
78+
private static let isBeta = String(BuildConfiguration.current.isInternal)
7979

8080
}
8181

WordPress/Classes/System/WordPressAppDelegate.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ extension WordPressAppDelegate {
548548
/// Otherwise an anonymous remote will be used
549549
func updateFeatureFlags(authToken: String? = nil, completion: (() -> Void)? = nil) {
550550
// Enable certain feature flags on test builds.
551-
if BuildConfiguration.current ~= [.alpha, .debug] {
551+
if BuildConfiguration.current.isInternal {
552552
FeatureFlagOverrideStore().override(RemoteFeatureFlag.dotComWebLogin, withValue: true)
553553
}
554554

WordPress/Classes/Utility/BuildInformation/FeatureFlag.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ enum FeatureFlag: Int, CaseIterable {
6464
case .googleDomainsCard:
6565
return false
6666
case .voiceToContent:
67-
return AppConfiguration.isJetpack && BuildConfiguration.current ~= [.debug, .alpha]
67+
return AppConfiguration.isJetpack && BuildConfiguration.current.isInternal
6868
case .authenticateUsingApplicationPassword:
6969
return false
7070
case .newGutenberg:

WordPress/Classes/Utility/BuildInformation/RemoteFeatureFlag.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ enum RemoteFeatureFlag: Int, CaseIterable {
8484
case .inAppUpdates:
8585
return false
8686
case .gravatarQuickEditor:
87-
return BuildConfiguration.current ~= [.debug, .alpha]
87+
return BuildConfiguration.current.isInternal
8888
case .dotComWebLogin:
8989
return false
9090
}

WordPress/Classes/ViewRelated/NUX/Helpers/WordPressAuthenticationManager.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ extension WordPressAuthenticationManager {
6060
private func authenticatorConfiguation() -> WordPressAuthenticatorConfiguration {
6161
// SIWA can not be enabled for internal builds
6262
// Ref https://github.com/wordpress-mobile/WordPress-iOS/pull/12332#issuecomment-521994963
63-
let enableSignInWithApple = !(BuildConfiguration.current ~= [.alpha])
63+
let enableSignInWithApple = BuildConfiguration.current != .alpha
6464

6565
return WordPressAuthenticatorConfiguration(
6666
wpcomClientId: ApiCredentials.client,

0 commit comments

Comments
 (0)