Skip to content

Commit 2d51616

Browse files
authored
Merge pull request #4302 from anyproto/ios-5520-fix-toggles-architecture
IOS-5520 fix default value for debug toggles
2 parents d3f51c8 + 6dbb0ed commit 2d51616

File tree

3 files changed

+14
-32
lines changed

3 files changed

+14
-32
lines changed

Anytype/Sources/PresentationLayer/Debug/FeatureFlags/FeatureFlagView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct FeatureFlagView: View {
3333
Button {
3434
showDefaultValues.toggle()
3535
} label: {
36-
Text("Default values")
36+
Text("> Default values")
3737
.font(AnytypeFontBuilder.font(anytypeFont: .previewTitle2Medium))
3838
.foregroundColor(.Text.secondary)
3939
}

Modules/AnytypeCore/AnytypeCore/Utils/FeatureFlags/FeatureDescription+Flags.swift

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ public extension FeatureDescription {
4848
static let fullInlineSetImpl = FeatureDescription(
4949
title: "Full inline set impl (IOS-790)",
5050
type: .feature(author: "[email protected]", releaseVersion: "?"),
51-
defaultValue: false,
52-
debugValue: false
51+
defaultValue: false
5352
)
5453

5554
static let dndOnCollectionsAndSets = FeatureDescription(
@@ -63,8 +62,7 @@ public extension FeatureDescription {
6362
static let rainbowViews = FeatureDescription(
6463
title: "Paint editor views 🌈",
6564
type: .debug,
66-
defaultValue: false,
67-
debugValue: false
65+
defaultValue: false
6866
)
6967

7068
static let showAlertOnAssert = FeatureDescription(
@@ -76,15 +74,13 @@ public extension FeatureDescription {
7674
static let analytics = FeatureDescription(
7775
title: "Analytics - send events to Amplitude (only for test builds)",
7876
type: .debug,
79-
defaultValue: false,
80-
debugValue: false
77+
defaultValue: false
8178
)
8279

8380
static let analyticsAlerts = FeatureDescription(
8481
title: "Analytics - show alerts",
8582
type: .debug,
86-
defaultValue: false,
87-
debugValue: false
83+
defaultValue: false
8884
)
8985

9086
static let nonfatalAlerts = FeatureDescription(
@@ -97,15 +93,13 @@ public extension FeatureDescription {
9793
static let resetTips = FeatureDescription(
9894
title: "Tips 💭 - reset on launch",
9995
type: .debug,
100-
defaultValue: false,
101-
debugValue: false
96+
defaultValue: false
10297
)
10398

10499
static let showAllTips = FeatureDescription(
105100
title: "Tips 💭 - show immediate (ignore time rules)",
106101
type: .debug,
107-
defaultValue: false,
108-
debugValue: false
102+
defaultValue: false
109103
)
110104

111105
static let sharingExtensionShowContentTypes = FeatureDescription(
@@ -125,24 +119,21 @@ public extension FeatureDescription {
125119
static let failReceiptValidation = FeatureDescription(
126120
title: "Fail receipt validaton of Memebership",
127121
type: .debug,
128-
defaultValue: false,
129-
debugValue: false
122+
defaultValue: false
130123
)
131124

132125
static let showGlobalSearchScore = FeatureDescription(
133126
title: "Show global search score",
134127
type: .debug,
135-
defaultValue: false,
136-
debugValue: false
128+
defaultValue: false
137129
)
138130

139131
// Pulse handles URLSession on main thread.
140132
// Enable only if you needs to handle session requests.
141133
static let networkHTTPSRequestsLogger = FeatureDescription(
142134
title: "Enable network requests logger for images and other https requests",
143135
type: .debug,
144-
defaultValue: false,
145-
debugValue: false
136+
defaultValue: false
146137
)
147138

148139
static let logMiddlewareRequests = FeatureDescription(
@@ -155,8 +146,7 @@ public extension FeatureDescription {
155146
static let showPushMessagesInForeground = FeatureDescription(
156147
title: "Show push messages in foreground",
157148
type: .debug,
158-
defaultValue: false,
159-
debugValue: false
149+
defaultValue: false
160150
)
161151

162152
static let skipOnboardingEmailCollection = FeatureDescription(
@@ -174,7 +164,6 @@ public extension FeatureDescription {
174164
static let showHangedObjects = FeatureDescription(
175165
title: "Show hanged objects",
176166
type: .debug,
177-
defaultValue: false,
178-
debugValue: true
167+
defaultValue: false
179168
)
180169
}

Modules/AnytypeCore/AnytypeCore/Utils/FeatureFlags/FeatureDescription.swift

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,10 @@ public struct FeatureDescription: Sendable {
2929
public let releaseAnytypeValue: Bool
3030
public let debugValue: Bool
3131

32-
init(title: String, type: FeatureType, releaseAnytypeValue: Bool, debugValue: Bool = true) {
33-
self.title = title
34-
self.type = type
35-
self.releaseAnytypeValue = releaseAnytypeValue
36-
self.debugValue = debugValue
37-
}
38-
39-
init(title: String, type: FeatureType, defaultValue: Bool, debugValue: Bool = true) {
32+
init(title: String, type: FeatureType, defaultValue: Bool, debugValue: Bool? = nil) {
4033
self.title = title
4134
self.type = type
4235
self.releaseAnytypeValue = defaultValue
43-
self.debugValue = debugValue
36+
self.debugValue = debugValue ?? defaultValue
4437
}
4538
}

0 commit comments

Comments
 (0)