damus

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

commit ebcfe3c25ff857796c8efbf667551600cee450b7
parent 6dfda93ff932ed33bc411e00228987444c796b56
Author: Bryan Montz <bryanmontz@me.com>
Date:   Fri,  7 Jul 2023 07:07:00 -0500

add developer mode view and setting

Signed-off-by: Bryan Montz <bryanmontz@me.com>

Diffstat:
Mdamus.xcodeproj/project.pbxproj | 4++++
Mdamus/Models/UserSettingsStore.swift | 3+++
Mdamus/Util/Router.swift | 5+++++
Mdamus/Views/ConfigView.swift | 4++++
Adamus/Views/Settings/DeveloperSettingsView.swift | 23+++++++++++++++++++++++
5 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/damus.xcodeproj/project.pbxproj b/damus.xcodeproj/project.pbxproj @@ -293,6 +293,7 @@ 501F8C5A29FF70F5001AFC1D /* ProfileDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 501F8C5929FF70F5001AFC1D /* ProfileDatabase.swift */; }; 501F8C802A0220E1001AFC1D /* KeychainStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 501F8C7F2A0220E1001AFC1D /* KeychainStorage.swift */; }; 501F8C822A0224EB001AFC1D /* KeychainStorageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 501F8C812A0224EB001AFC1D /* KeychainStorageTests.swift */; }; + 5053ACA72A56DF3B00851AE3 /* DeveloperSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5053ACA62A56DF3B00851AE3 /* DeveloperSettingsView.swift */; }; 50A50A8D29A09E1C00C01BE7 /* RequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A50A8C29A09E1C00C01BE7 /* RequestTests.swift */; }; 50B5685329F97CB400A23243 /* CredentialHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50B5685229F97CB400A23243 /* CredentialHandler.swift */; }; 50DA11262A16A23F00236234 /* Launch.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 50DA11252A16A23F00236234 /* Launch.storyboard */; }; @@ -762,6 +763,7 @@ 501F8C5929FF70F5001AFC1D /* ProfileDatabase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileDatabase.swift; sourceTree = "<group>"; }; 501F8C7F2A0220E1001AFC1D /* KeychainStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeychainStorage.swift; sourceTree = "<group>"; }; 501F8C812A0224EB001AFC1D /* KeychainStorageTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeychainStorageTests.swift; sourceTree = "<group>"; }; + 5053ACA62A56DF3B00851AE3 /* DeveloperSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeveloperSettingsView.swift; sourceTree = "<group>"; }; 50A50A8C29A09E1C00C01BE7 /* RequestTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestTests.swift; sourceTree = "<group>"; }; 50B5685229F97CB400A23243 /* CredentialHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CredentialHandler.swift; sourceTree = "<group>"; }; 50DA11252A16A23F00236234 /* Launch.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Launch.storyboard; sourceTree = "<group>"; }; @@ -1012,6 +1014,7 @@ 4C1A9A2429DDDF2600516EAC /* ZapSettingsView.swift */, 4C1A9A2629DDE31900516EAC /* TranslationSettingsView.swift */, E4FA1C022A24BB7F00482697 /* SearchSettingsView.swift */, + 5053ACA62A56DF3B00851AE3 /* DeveloperSettingsView.swift */, ); path = Settings; sourceTree = "<group>"; @@ -1906,6 +1909,7 @@ 4C363A8828236948006E126D /* BlocksView.swift in Sources */, 4C06670628FCB08600038D2A /* ImageCarousel.swift in Sources */, 3A23838E2A297DD200E5AA2E /* ZapButtonModel.swift in Sources */, + 5053ACA72A56DF3B00851AE3 /* DeveloperSettingsView.swift in Sources */, F79C7FAD29D5E9620000F946 /* EditProfilePictureControl.swift in Sources */, 4C9F18E229AA9B6C008C55EC /* CustomizeZapView.swift in Sources */, 4C2859602A12A2BE004746F7 /* SupporterBadge.swift in Sources */, diff --git a/damus/Models/UserSettingsStore.swift b/damus/Models/UserSettingsStore.swift @@ -157,6 +157,9 @@ class UserSettingsStore: ObservableObject { @Setting(key: "donation_percent", default_value: 0) var donation_percent: Int + + @Setting(key: "developer_mode", default_value: false) + var developer_mode: Bool // Helper for inverse of disable_animation. // disable_animation was introduced as a setting first, but it's more natural for the settings UI to show the inverse. diff --git a/damus/Util/Router.swift b/damus/Util/Router.swift @@ -28,6 +28,7 @@ enum Route: Hashable { case ZapSettings(settings: UserSettingsStore) case TranslationSettings(settings: UserSettingsStore) case SearchSettings(settings: UserSettingsStore) + case DeveloperSettings(settings: UserSettingsStore) case Thread(thread: ThreadModel) case Reposts(reposts: RepostsModel) case Reactions(reactions: ReactionsModel) @@ -82,6 +83,8 @@ enum Route: Hashable { TranslationSettingsView(settings: settings) case .SearchSettings(let settings): SearchSettingsView(settings: settings) + case .DeveloperSettings(let settings): + DeveloperSettingsView(settings: settings) case .Thread(let thread): ThreadView(state: damusState, thread: thread) case .Reposts(let reposts): @@ -230,6 +233,8 @@ enum Route: Hashable { hasher.combine("translationSettings") case .SearchSettings(_): hasher.combine("searchSettings") + case .DeveloperSettings: + hasher.combine("developerSettings") case .Thread(let threadModel): hasher.combine("thread") hasher.combine(threadModel.event.id) diff --git a/damus/Views/ConfigView.swift b/damus/Views/ConfigView.swift @@ -59,6 +59,10 @@ struct ConfigView: View { NavigationLink(value: Route.TranslationSettings(settings: settings)) { IconLabel(NSLocalizedString("Translation", comment: "Section header for text and appearance settings"), img_name: "globe", color: .green) } + + NavigationLink(value: Route.DeveloperSettings(settings: settings)) { + IconLabel(NSLocalizedString("Developer", comment: "Section header for developer settings"), img_name: "magic-stick2.fill", color: .black) + } } Section(NSLocalizedString("Sign Out", comment: "Section title for signing out")) { diff --git a/damus/Views/Settings/DeveloperSettingsView.swift b/damus/Views/Settings/DeveloperSettingsView.swift @@ -0,0 +1,23 @@ +// +// DeveloperSettingsView.swift +// damus +// +// Created by Bryan Montz on 7/6/23. +// + +import Foundation +import SwiftUI + +struct DeveloperSettingsView: View { + @ObservedObject var settings: UserSettingsStore + + var body: some View { + Form { + Section { + Toggle(NSLocalizedString("Developer Mode", comment: "Setting to enable developer mode"), isOn: $settings.developer_mode) + .toggleStyle(.switch) + } + } + .navigationTitle(NSLocalizedString("Developer", comment: "Navigation title for developer settings")) + } +}