From f69ad9830aa5f3a261085a054402abebe25b985b Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Thu, 1 Jun 2023 07:26:30 -0700 Subject: [PATCH] improve: put dev mode in better sections --- .../Resources/en.lproj/Localizable.strings | 11 +++++ .../SwiftUI/Views/Settings/DevModeView.swift | 43 +++++++++++++------ 2 files changed, 41 insertions(+), 13 deletions(-) diff --git a/AltStore/Resources/en.lproj/Localizable.strings b/AltStore/Resources/en.lproj/Localizable.strings index 236b4bad..d6129a37 100644 --- a/AltStore/Resources/en.lproj/Localizable.strings +++ b/AltStore/Resources/en.lproj/Localizable.strings @@ -197,6 +197,17 @@ You should only enable Developer Mode if you meet one of the following requireme "DevModeView.skipResign" = "Skip Resign"; "DevModeView.footer" = "Skip Resign should only be used when you have an IPA that you have self signed. Otherwise, it will break things, and might make SideStore crash (there is absolutely no error handling and everything is expected to work)."; "DevModeView.minimuxer" = "minimuxer debug actions"; +"DevModeView.General.header" = "General"; +"DevModeView.General.console" = "Console"; +"DevModeView.General.unstableFeaturesNightlyOnly" = "Unstable Features are only available on nightly builds, PR builds and debug builds."; +"DevModeView.General.disableDevMode" = "Disable Developer Mode"; +"DevModeView.Files.header" = "Files"; +"DevModeView.Files.dataExplorer" = "Data File Explorer"; +"DevModeView.Files.tmpExplorer" = "Temporary File Explorer"; +"DevModeView.Signing.header" = "Signing"; +"DevModeView.Signing.skipResign" = "Skip Resign"; +"DevModeView.Signing.footer" = "Skip Resign should only be used when you have an IPA that you have self signed. Otherwise, it will break things, and might make SideStore crash (there is absolutely no error handling and everything is expected to work)."; +"DevModeView.Minimuxer.header" = "minimuxer debug actions"; "DevModeView.Minimuxer.dumpProfiles" = "Dump provisioning profiles to Documents directory"; "DevModeView.Minimuxer.afcExplorer" = "AFC File Explorer (check footer for notes)"; "DevModeView.Minimuxer.footer" = "Notes on AFC File Explorer: diff --git a/AltStore/SwiftUI/Views/Settings/DevModeView.swift b/AltStore/SwiftUI/Views/Settings/DevModeView.swift index 90099d32..701e5c53 100644 --- a/AltStore/SwiftUI/Views/Settings/DevModeView.swift +++ b/AltStore/SwiftUI/Views/Settings/DevModeView.swift @@ -35,7 +35,7 @@ struct DevModePrompt: View { Text(countdown <= 0 ? L10n.Action.enable + " " + L10n.DevModeView.title : L10n.DevModeView.read + " (\(countdown))") .foregroundColor(.red) } - .buttonStyle(FilledButtonStyle()) // TODO: set tintColor so text is more readable + .buttonStyle(FilledButtonStyle(tintColor: Color.gray.opacity(0.5))) .disabled(countdown > 0) } @@ -128,6 +128,9 @@ struct DevModeMenu: View { @AppStorage("isConsoleEnabled") var isConsoleEnabled: Bool = false + @AppStorage("isDevModeEnabled") + var isDevModeEnabled: Bool = false + #if !UNSTABLE @State var isUnstableAlertShowing = false #endif @@ -135,7 +138,7 @@ struct DevModeMenu: View { var body: some View { List { Section { - Toggle(L10n.DevModeView.console, isOn: self.$isConsoleEnabled) + Toggle(L10n.DevModeView.General.console, isOn: self.$isConsoleEnabled) .onChange(of: self.isConsoleEnabled) { value in LCManager.shared.isVisible = value } @@ -148,25 +151,30 @@ struct DevModeMenu: View { #if !UNSTABLE .disabled(true) .alert(isPresented: $isUnstableAlertShowing) { - Alert(title: Text(L10n.DevModeView.unstableFeaturesNightlyOnly)) + Alert(title: Text(L10n.DevModeView.General.unstableFeaturesNightlyOnly)) } .onTapGesture { isUnstableAlertShowing = true } #endif - NavigationLink(L10n.DevModeView.dataExplorer) { + SwiftUI.Button(action: { + isDevModeEnabled = false + }, label: { Text(L10n.DevModeView.General.disableDevMode) }).foregroundColor(.red) + } header: { + Text(L10n.DevModeView.General.header) + } + + Section { + NavigationLink(L10n.DevModeView.Files.dataExplorer) { FileExplorer.normal(url: FileManager.default.altstoreSharedDirectory) - .navigationTitle(L10n.DevModeView.dataExplorer) + .navigationTitle(L10n.DevModeView.Files.dataExplorer) }.foregroundColor(.red) - NavigationLink(L10n.DevModeView.tmpExplorer) { + NavigationLink(L10n.DevModeView.Files.tmpExplorer) { FileExplorer.normal(url: FileManager.default.temporaryDirectory) - .navigationTitle(L10n.DevModeView.tmpExplorer) + .navigationTitle(L10n.DevModeView.Files.tmpExplorer) }.foregroundColor(.red) - - Toggle(L10n.DevModeView.skipResign, isOn: ResignAppOperation.skipResignBinding) - .foregroundColor(.red) - } footer: { - Text(L10n.DevModeView.footer) + } header: { + Text(L10n.DevModeView.Files.header) } Section { @@ -184,10 +192,19 @@ struct DevModeMenu: View { .navigationTitle(L10n.DevModeView.Minimuxer.afcExplorer) }.foregroundColor(.red) } header: { - Text(L10n.DevModeView.minimuxer) + Text(L10n.DevModeView.Minimuxer.header) } footer: { Text(L10n.DevModeView.Minimuxer.footer) } + + Section { + Toggle(L10n.DevModeView.Signing.skipResign, isOn: ResignAppOperation.skipResignBinding) + .foregroundColor(.red) + } header: { + Text(L10n.DevModeView.Signing.header) + } footer: { + Text(L10n.DevModeView.Signing.footer) + } } .navigationTitle(L10n.DevModeView.title) .enableInjection()