From b2e555284b88ccf3e65dd966d721e8bfe3195f7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20D=E2=80=99Aquino?= Date: Mon, 6 Nov 2023 18:36:44 +0000 Subject: [PATCH] Add "Always show onboarding suggestions" developer setting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds a new setting that can be used by developers to test onboarding suggestions without having to make local changes to code or reinstall the app. Testing ------- Device: iPhone 15 Pro (Simulator) iOS: 17.0.1 Damus: This commit Coverage: 1. Starting the existing app under the default setting does not show onboarding suggestions 2. Turning the setting ON causes the app to show onboarding suggestions on every app restart 3. Turning the setting back OFF causes the app to no longer show onboarding suggestions Changelog-Added: Add "Always show onboarding suggestions" developer setting Signed-off-by: Daniel D’Aquino Reviewed-by: William Casarin Signed-off-by: William Casarin --- damus/ContentView.swift | 2 +- damus/Models/UserSettingsStore.swift | 3 +++ damus/Views/Settings/DeveloperSettingsView.swift | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/damus/ContentView.swift b/damus/ContentView.swift index 79cce5c0..4d3e5b83 100644 --- a/damus/ContentView.swift +++ b/damus/ContentView.swift @@ -299,7 +299,7 @@ struct ContentView: View { self.connect() try? AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playback, mode: .default, options: .mixWithOthers) setup_notifications() - if !hasSeenOnboardingSuggestions { + if !hasSeenOnboardingSuggestions || damus_state!.settings.always_show_onboarding_suggestions { active_sheet = .onboardingSuggestions hasSeenOnboardingSuggestions = true } diff --git a/damus/Models/UserSettingsStore.swift b/damus/Models/UserSettingsStore.swift index a9137add..b95a9031 100644 --- a/damus/Models/UserSettingsStore.swift +++ b/damus/Models/UserSettingsStore.swift @@ -189,6 +189,9 @@ class UserSettingsStore: ObservableObject { @Setting(key: "developer_mode", default_value: false) var developer_mode: Bool + @Setting(key: "always_show_onboarding_suggestions", default_value: false) + var always_show_onboarding_suggestions: Bool + @Setting(key: "emoji_reactions", default_value: default_emoji_reactions) var emoji_reactions: [String] diff --git a/damus/Views/Settings/DeveloperSettingsView.swift b/damus/Views/Settings/DeveloperSettingsView.swift index 9f1b81e0..b65a29c7 100644 --- a/damus/Views/Settings/DeveloperSettingsView.swift +++ b/damus/Views/Settings/DeveloperSettingsView.swift @@ -16,6 +16,10 @@ struct DeveloperSettingsView: View { Section(footer: Text(NSLocalizedString("Developer Mode enables features and options that may help developers diagnose issues and improve this app. Most users will not need Developer Mode.", comment: "Section header for Developer Settings view"))) { Toggle(NSLocalizedString("Developer Mode", comment: "Setting to enable developer mode"), isOn: $settings.developer_mode) .toggleStyle(.switch) + if settings.developer_mode { + Toggle(NSLocalizedString("Always show onboarding", comment: "Setting to always show onboarding suggestions, for developers who need to test onboarding"), isOn: $settings.always_show_onboarding_suggestions) + .toggleStyle(.switch) + } } } .navigationTitle(NSLocalizedString("Developer", comment: "Navigation title for developer settings"))