mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-18 11:13:28 +01:00
feat: add debug logging toggle
This commit is contained in:
@@ -345,6 +345,8 @@ internal enum L10n {
|
|||||||
internal static let credits = L10n.tr("Localizable", "SettingsView.credits", fallback: "Credits")
|
internal static let credits = L10n.tr("Localizable", "SettingsView.credits", fallback: "Credits")
|
||||||
/// Debug
|
/// Debug
|
||||||
internal static let debug = L10n.tr("Localizable", "SettingsView.debug", fallback: "Debug")
|
internal static let debug = L10n.tr("Localizable", "SettingsView.debug", fallback: "Debug")
|
||||||
|
/// Debug Logging
|
||||||
|
internal static let debugLogging = L10n.tr("Localizable", "SettingsView.debugLogging", fallback: "Debug Logging")
|
||||||
/// Export Logs
|
/// Export Logs
|
||||||
internal static let exportLogs = L10n.tr("Localizable", "SettingsView.exportLogs", fallback: "Export Logs")
|
internal static let exportLogs = L10n.tr("Localizable", "SettingsView.exportLogs", fallback: "Export Logs")
|
||||||
/// Refreshing Apps
|
/// Refreshing Apps
|
||||||
|
|||||||
@@ -159,6 +159,7 @@ final class LaunchViewController: RSTLaunchViewController, UIDocumentPickerDeleg
|
|||||||
try! FileManager.default.removeItem(at: FileManager.default.documentsDirectory.appendingPathComponent("\(pairingFileName)"))
|
try! FileManager.default.removeItem(at: FileManager.default.documentsDirectory.appendingPathComponent("\(pairingFileName)"))
|
||||||
displayError("minimuxer failed to start, please restart SideStore. \(minimuxerToOperationError(error).failureReason ?? "UNKNOWN ERROR!!!!!! REPORT TO GITHUB ISSUES!")")
|
displayError("minimuxer failed to start, please restart SideStore. \(minimuxerToOperationError(error).failureReason ?? "UNKNOWN ERROR!!!!!! REPORT TO GITHUB ISSUES!")")
|
||||||
}
|
}
|
||||||
|
set_debug(UserDefaults.shared.isDebugLoggingEnabled)
|
||||||
start_auto_mounter(documentsDirectory)
|
start_auto_mounter(documentsDirectory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,7 @@
|
|||||||
"SettingsView.title" = "Settings";
|
"SettingsView.title" = "Settings";
|
||||||
"SettingsView.refreshingAppsFooter" = "Enable Background Refresh to automatically refresh apps in the background when connected to WiFi and with Wireguard active.";
|
"SettingsView.refreshingAppsFooter" = "Enable Background Refresh to automatically refresh apps in the background when connected to WiFi and with Wireguard active.";
|
||||||
"SettingsView.exportLogs" = "Export Logs";
|
"SettingsView.exportLogs" = "Export Logs";
|
||||||
|
"SettingsView.debugLogging" = "Debug Logging";
|
||||||
|
|
||||||
/* ConnectAppleIDView */
|
/* ConnectAppleIDView */
|
||||||
"ConnectAppleIDView.startWithSignIn" = "Sign in with your Apple ID to get started.";
|
"ConnectAppleIDView.startWithSignIn" = "Sign in with your Apple ID to get started.";
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import SFSafeSymbols
|
|||||||
import LocalConsole
|
import LocalConsole
|
||||||
import AltStoreCore
|
import AltStoreCore
|
||||||
import Intents
|
import Intents
|
||||||
|
import minimuxer
|
||||||
|
|
||||||
struct SettingsView: View {
|
struct SettingsView: View {
|
||||||
@ObservedObject private var iO = Inject.observer
|
@ObservedObject private var iO = Inject.observer
|
||||||
@@ -30,6 +31,9 @@ struct SettingsView: View {
|
|||||||
@AppStorage("isDevModeEnabled")
|
@AppStorage("isDevModeEnabled")
|
||||||
var isDevModeEnabled: Bool = false
|
var isDevModeEnabled: Bool = false
|
||||||
|
|
||||||
|
@AppStorage("isDebugLoggingEnabled")
|
||||||
|
var isDebugLoggingEnabled: Bool = false
|
||||||
|
|
||||||
@State var isShowingConnectAppleIDView = false
|
@State var isShowingConnectAppleIDView = false
|
||||||
@State var isShowingResetPairingFileConfirmation = false
|
@State var isShowingResetPairingFileConfirmation = false
|
||||||
@State var isShowingDevModePrompt = false
|
@State var isShowingDevModePrompt = false
|
||||||
@@ -167,6 +171,12 @@ struct SettingsView: View {
|
|||||||
AdvancedSettingsView()
|
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) })
|
AsyncFallibleButton(action: self.exportLogs, label: { execute in Text(L10n.SettingsView.exportLogs) })
|
||||||
|
|
||||||
if MailComposeView.canSendMail {
|
if MailComposeView.canSendMail {
|
||||||
@@ -325,10 +335,10 @@ struct SettingsView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func exportLogs() throws {
|
func exportLogs() throws {
|
||||||
guard let path = FileManager.default.altstoreSharedDirectory?.appendingPathComponent("logs.txt") else { throw NSError(domain: "Failed to get path.", code: 1) }
|
let path = FileManager.default.documentsDirectory.appendingPathComponent("sidestore.log")
|
||||||
var text = LCManager.shared.currentText
|
var text = LCManager.shared.currentText
|
||||||
|
|
||||||
// TODO: add more potentially sensitive info to this array like UDID
|
// TODO: add more potentially sensitive info to this array
|
||||||
var remove = [String]()
|
var remove = [String]()
|
||||||
if let connectedAppleID = connectedTeams.first {
|
if let connectedAppleID = connectedTeams.first {
|
||||||
remove.append(connectedAppleID.name)
|
remove.append(connectedAppleID.name)
|
||||||
@@ -339,6 +349,9 @@ struct SettingsView: View {
|
|||||||
remove.append(connectedAppleID.account.identifier)
|
remove.append(connectedAppleID.account.identifier)
|
||||||
remove.append(connectedAppleID.identifier)
|
remove.append(connectedAppleID.identifier)
|
||||||
}
|
}
|
||||||
|
if let udid = fetch_udid() {
|
||||||
|
remove.append(udid.toString())
|
||||||
|
}
|
||||||
|
|
||||||
for toRemove in remove {
|
for toRemove in remove {
|
||||||
text = text.replacingOccurrences(of: toRemove, with: "[removed]")
|
text = text.replacingOccurrences(of: toRemove, with: "[removed]")
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public extension UserDefaults
|
|||||||
|
|
||||||
@NSManaged var isDevModeEnabled: Bool
|
@NSManaged var isDevModeEnabled: Bool
|
||||||
@NSManaged var isConsoleEnabled: Bool
|
@NSManaged var isConsoleEnabled: Bool
|
||||||
|
@NSManaged var isDebugLoggingEnabled: Bool
|
||||||
|
|
||||||
@NSManaged var isBackgroundRefreshEnabled: Bool
|
@NSManaged var isBackgroundRefreshEnabled: Bool
|
||||||
@NSManaged var isDebugModeEnabled: Bool
|
@NSManaged var isDebugModeEnabled: Bool
|
||||||
@@ -75,6 +76,7 @@ public extension UserDefaults
|
|||||||
let defaults = [
|
let defaults = [
|
||||||
#keyPath(UserDefaults.isDevModeEnabled): false,
|
#keyPath(UserDefaults.isDevModeEnabled): false,
|
||||||
#keyPath(UserDefaults.isConsoleEnabled): false,
|
#keyPath(UserDefaults.isConsoleEnabled): false,
|
||||||
|
#keyPath(UserDefaults.isDebugLoggingEnabled): false,
|
||||||
#keyPath(UserDefaults.isBackgroundRefreshEnabled): true,
|
#keyPath(UserDefaults.isBackgroundRefreshEnabled): true,
|
||||||
#keyPath(UserDefaults.isLegacyDeactivationSupported): isLegacyDeactivationSupported,
|
#keyPath(UserDefaults.isLegacyDeactivationSupported): isLegacyDeactivationSupported,
|
||||||
#keyPath(UserDefaults.activeAppLimitIncludesExtensions): activeAppLimitIncludesExtensions,
|
#keyPath(UserDefaults.activeAppLimitIncludesExtensions): activeAppLimitIncludesExtensions,
|
||||||
|
|||||||
Reference in New Issue
Block a user