Skip to content

Commit

Permalink
Merge pull request #1612 from planetary-social/enable-account-deletion
Browse files Browse the repository at this point in the history
Remove account deletion feature flag
  • Loading branch information
joshuatbrown authored Oct 10, 2024
2 parents f2cc48d + 8577668 commit b0713e7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 43 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Removed image and video link text from notes. Now only the images and videos will appear, without the link. [#1487](https://github.com/planetary-social/nos/issues/1487)
- Added new translations for the app so you can use it in Korean, Chinese Simplified, Swedish, and more! Thanks to alternative, 안마리 (everyscreennetwork), Andypsl8, Dženan (Dzenan), ObjectifMoon, ra5pvt1n, and everyone else who contributed translations on Crowdin!
- Decreased the opacity on disabled buttons.
- Added a Delete Account button to the Settings screen. [#80](https://github.com/planetary-social/nos/issues/80)

### Internal Changes
- Moved the database cleanup routine into a background execution task. [#1426](https://github.com/planetary-social/nos/issues/1426)
Expand Down
4 changes: 0 additions & 4 deletions Nos/Service/FeatureFlags.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ enum FeatureFlag {
/// Whether the new moderation flow should be enabled or not.
/// - Note: See [#1489](https://github.com/planetary-social/nos/issues/1489) for details on the new moderation flow.
case newModerationFlow
/// Whether delete account UI is enabled or not.
/// - Note: See [#80](https://github.com/planetary-social/nos/issues/80) for details on deleting accounts.
case deleteAccount
}

/// The set of feature flags used by the app.
Expand All @@ -34,7 +31,6 @@ protocol FeatureFlags {
/// Feature flags and their values.
private var featureFlags: [FeatureFlag: Bool] = [
.newModerationFlow: false,
.deleteAccount: false
]

/// Returns true if the feature is enabled.
Expand Down
58 changes: 20 additions & 38 deletions Nos/Views/Settings/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -219,31 +219,27 @@ struct SettingsView: View {
}
.listRowGradientBackground()

#if STAGING || DEBUG
if isDeleteAccountEnabled.wrappedValue {
ActionButton(
title: .localizable.deleteMyAccount,
font: .clarityBold(.title3),
padding: EdgeInsets(top: 16, leading: 0, bottom: 16, trailing: 0),
depthEffectColor: .actionSecondaryDepthEffect,
backgroundGradient: .verticalAccentSecondary,
shouldFillHorizontalSpace: true
) {
alert = AlertState(
title: { TextState(String(localized: .localizable.deleteAccount)) },
actions: {
ButtonState(role: .destructive, action: .send(.deleteAccount)) {
TextState(String(localized: .localizable.delete))
}
},
message: { TextState(String(localized: .localizable.deleteAccountDescription)) }
)
}
.clipShape(Capsule())
.listRowBackground(Color.clear)
.listRowInsets(EdgeInsets())
ActionButton(
title: .localizable.deleteMyAccount,
font: .clarityBold(.title3),
padding: EdgeInsets(top: 16, leading: 0, bottom: 16, trailing: 0),
depthEffectColor: .actionSecondaryDepthEffect,
backgroundGradient: .verticalAccentSecondary,
shouldFillHorizontalSpace: true
) {
alert = AlertState(
title: { TextState(String(localized: .localizable.deleteAccount)) },
actions: {
ButtonState(role: .destructive, action: .send(.deleteAccount)) {
TextState(String(localized: .localizable.delete))
}
},
message: { TextState(String(localized: .localizable.deleteAccountDescription)) }
)
}
#endif
.clipShape(Capsule())
.listRowBackground(Color.clear)
.listRowInsets(EdgeInsets())
}
.scrollContentBackground(.hidden)
.background(Color.appBg)
Expand Down Expand Up @@ -288,19 +284,6 @@ extension SettingsView {
private var newModerationFlowToggle: some View {
NosToggle(isOn: isNewModerationFlowEnabled, labelText: .localizable.enableNewModerationFlow)
}

/// Whether account deletion is enabled.
private var isDeleteAccountEnabled: Binding<Bool> {
Binding<Bool>(
get: { featureFlags.isEnabled(.deleteAccount) },
set: { featureFlags.setFeature(.deleteAccount, enabled: $0) }
)
}

/// A toggle for account deletion that allows the user to turn the feature on or off.
private var deleteAccountToggle: some View {
NosToggle(isOn: isDeleteAccountEnabled, labelText: .localizable.enableAccountDeletion)
}
}
#endif

Expand All @@ -322,7 +305,6 @@ extension SettingsView {
@MainActor private var debugControls: some View {
Group {
newModerationFlowToggle
deleteAccountToggle
Text(.localizable.sampleDataInstructions)
.foregroundColor(.primaryTxt)
Button(String(localized: .localizable.loadSampleData)) {
Expand Down
1 change: 0 additions & 1 deletion NosTests/Service/MockFeatureFlags.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ class MockFeatureFlags: FeatureFlags {
/// Mock feature flags and their values.
private var featureFlags: [FeatureFlag: Bool] = [
.newModerationFlow: false,
.deleteAccount: false
]

func isEnabled(_ feature: FeatureFlag) -> Bool {
Expand Down

0 comments on commit b0713e7

Please sign in to comment.