mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-15 09:43:34 +01:00
More improvements and fixes (see commit description)
- put SwiftUI in an unstable feature - Add Reset adi.pb to SwiftUI settings - Add localizations to more things such as Error Log and Refresh Attempts - Move debug logging into Advanced Settings - Add padding to version text at the bottom of SwiftUI settings - Add some things to Unstable Features such as nesting the Feature enum in UnstableFeatures and allowing on enable/disable hooks - Don't use ObservableObject for UnstableFeatures as it's not needed - fix a bug with unstable features where the toggle would be reverted if you go into another tab and then back - Use SwiftUI advanced settings in UIKit
This commit is contained in:
@@ -31,13 +31,11 @@ struct SettingsView: View {
|
||||
@AppStorage("isDevModeEnabled")
|
||||
var isDevModeEnabled: Bool = false
|
||||
|
||||
@AppStorage("isDebugLoggingEnabled")
|
||||
var isDebugLoggingEnabled: Bool = false
|
||||
|
||||
@State var isShowingConnectAppleIDView = false
|
||||
@State var isShowingResetPairingFileConfirmation = false
|
||||
@State var isShowingDevModePrompt = false
|
||||
@State var isShowingDevModeMenu = false
|
||||
@State var isShowingResetAdiPbConfirmation = false
|
||||
|
||||
@State var externalURLToShow: URL?
|
||||
@State var quickLookURL: URL?
|
||||
@@ -104,7 +102,7 @@ struct SettingsView: View {
|
||||
}
|
||||
|
||||
Section {
|
||||
NavigationLink("Show Refresh Attempts") {
|
||||
NavigationLink(L10n.SettingsView.showRefreshAttempts) {
|
||||
RefreshAttemptsView()
|
||||
}
|
||||
|
||||
@@ -163,7 +161,7 @@ struct SettingsView: View {
|
||||
}
|
||||
|
||||
Section {
|
||||
NavigationLink("Show Error Log") {
|
||||
NavigationLink(L10n.SettingsView.showErrorLog) {
|
||||
ErrorLogView()
|
||||
}
|
||||
|
||||
@@ -171,12 +169,6 @@ struct SettingsView: View {
|
||||
AdvancedSettingsView()
|
||||
}
|
||||
|
||||
Toggle(L10n.SettingsView.debugLogging, isOn: self.$isDebugLoggingEnabled)
|
||||
.onChange(of: self.isDebugLoggingEnabled) { value in
|
||||
UserDefaults.shared.isDebugLoggingEnabled = value
|
||||
set_debug(value)
|
||||
}
|
||||
|
||||
AsyncFallibleButton(action: self.exportLogs, label: { execute in Text(L10n.SettingsView.exportLogs) })
|
||||
|
||||
if MailComposeView.canSendMail {
|
||||
@@ -191,18 +183,27 @@ struct SettingsView: View {
|
||||
}
|
||||
}
|
||||
|
||||
SwiftUI.Button(L10n.SettingsView.switchToUIKit, action: self.switchToUIKit)
|
||||
|
||||
SwiftUI.Button(L10n.SettingsView.resetImageCache, action: self.resetImageCache)
|
||||
.foregroundColor(.red)
|
||||
|
||||
SwiftUI.Button("Reset Pairing File") {
|
||||
SwiftUI.Button(L10n.SettingsView.resetPairingFile) {
|
||||
self.isShowingResetPairingFileConfirmation = true
|
||||
}
|
||||
.foregroundColor(.red)
|
||||
.actionSheet(isPresented: self.$isShowingResetPairingFileConfirmation) {
|
||||
ActionSheet(title: Text("Are you sure to reset the pairing file?"), message: Text("You can reset the pairing file when you cannot sideload apps or enable JIT. SideStore will close when the file has been deleted."), buttons: [
|
||||
.destructive(Text("Delete and Reset"), action: self.resetPairingFile),
|
||||
ActionSheet(title: Text(L10n.SettingsView.ResetPairingFile.title), message: Text(L10n.SettingsView.ResetPairingFile.description), buttons: [
|
||||
.destructive(Text(L10n.SettingsView.resetPairingFile), action: self.resetPairingFile),
|
||||
.cancel()
|
||||
])
|
||||
}
|
||||
|
||||
SwiftUI.Button(L10n.SettingsView.resetAdiPb) {
|
||||
self.isShowingResetAdiPbConfirmation = true
|
||||
}
|
||||
.foregroundColor(.red)
|
||||
.actionSheet(isPresented: self.$isShowingResetAdiPbConfirmation) {
|
||||
ActionSheet(title: Text(L10n.SettingsView.ResetAdiPb.title), message: Text(L10n.SettingsView.ResetAdiPb.description), buttons: [
|
||||
.destructive(Text(L10n.SettingsView.resetAdiPb), action: self.resetAdiPb),
|
||||
.cancel()
|
||||
])
|
||||
}
|
||||
@@ -225,13 +226,11 @@ struct SettingsView: View {
|
||||
}
|
||||
|
||||
|
||||
Section {
|
||||
|
||||
} footer: {
|
||||
Section {} footer: {
|
||||
Text("SideStore \(appVersion)")
|
||||
.multilineTextAlignment(.center)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
}.padding([.bottom], 32)
|
||||
}
|
||||
.listStyle(InsetGroupedListStyle())
|
||||
.navigationTitle(L10n.SettingsView.title)
|
||||
@@ -253,13 +252,10 @@ struct SettingsView: View {
|
||||
.enableInjection()
|
||||
}
|
||||
|
||||
|
||||
// var appleIDSection: some View {
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
func connectAppleID() {
|
||||
guard let rootViewController = UIApplication.shared.keyWindow?.rootViewController else {
|
||||
return
|
||||
@@ -293,13 +289,6 @@ struct SettingsView: View {
|
||||
}
|
||||
}
|
||||
|
||||
func switchToUIKit() {
|
||||
let storyboard = UIStoryboard(name: "Main", bundle: .main)
|
||||
let rootVC = storyboard.instantiateViewController(withIdentifier: "tabBarController") as! TabBarController
|
||||
|
||||
UIApplication.shared.keyWindow?.rootViewController = rootVC
|
||||
}
|
||||
|
||||
func resetImageCache() {
|
||||
do {
|
||||
let url = try FileManager.default.url(
|
||||
@@ -334,6 +323,13 @@ struct SettingsView: View {
|
||||
}
|
||||
}
|
||||
|
||||
func resetAdiPb() {
|
||||
if Keychain.shared.adiPb != nil {
|
||||
Keychain.shared.adiPb = nil
|
||||
print("Cleared adi.pb from keychain")
|
||||
}
|
||||
}
|
||||
|
||||
func exportLogs() throws {
|
||||
let path = FileManager.default.documentsDirectory.appendingPathComponent("sidestore.log")
|
||||
var text = LCManager.shared.currentText
|
||||
|
||||
Reference in New Issue
Block a user