damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit b2e555284b88ccf3e65dd966d721e8bfe3195f7c
parent cc385d3c3ff51ae68c3cd91772cc7129858c0b81
Author: Daniel D’Aquino <daniel@daquino.me>
Date:   Mon,  6 Nov 2023 18:36:44 +0000

Add "Always show onboarding suggestions" developer setting

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 <daniel@daquino.me>
Reviewed-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mdamus/ContentView.swift | 2+-
Mdamus/Models/UserSettingsStore.swift | 3+++
Mdamus/Views/Settings/DeveloperSettingsView.swift | 4++++
3 files changed, 8 insertions(+), 1 deletion(-)

diff --git 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 @@ -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 @@ -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"))