mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-09-11 09:16:37 +00:00
ios: save debug profile, event log buttons (#3899)
This commit is contained in:
@@ -22,7 +22,7 @@ struct SimpleXApp: App {
|
||||
|
||||
init() {
|
||||
DispatchQueue.global(qos: .background).sync {
|
||||
haskell_init()
|
||||
haskell_init(getAppEventLogPath().path, getAppDebugProfilePath().path)
|
||||
// hs_init(0, nil)
|
||||
}
|
||||
UserDefaults.standard.register(defaults: appDefaults)
|
||||
|
||||
@@ -45,6 +45,11 @@ struct DeveloperView: View {
|
||||
}
|
||||
|
||||
if developerTools {
|
||||
Section {
|
||||
exportDebugProfileButton()
|
||||
exportEventLogButton()
|
||||
}
|
||||
|
||||
Section {
|
||||
settingsRow("key") {
|
||||
Toggle("Post-quantum E2EE", isOn: $pqExperimentalEnabled)
|
||||
@@ -62,6 +67,24 @@ struct DeveloperView: View {
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder private func exportDebugProfileButton() -> some View {
|
||||
let url = getAppDebugProfilePath()
|
||||
settingsRow("square.and.arrow.up") {
|
||||
Button("Export debugging profile") {
|
||||
showShareSheet(items: [url])
|
||||
}
|
||||
}.disabled(!FileManager.default.fileExists(atPath: url.path))
|
||||
}
|
||||
|
||||
@ViewBuilder private func exportEventLogButton() -> some View {
|
||||
let url = getAppEventLogPath()
|
||||
settingsRow("square.and.arrow.up") {
|
||||
Button("Export event log") {
|
||||
showShareSheet(items: [url])
|
||||
}
|
||||
}.disabled(!FileManager.default.fileExists(atPath: url.path))
|
||||
}
|
||||
|
||||
private func setPQExperimentalEnabled(_ enable: Bool) {
|
||||
do {
|
||||
try apiSetPQEncryption(enable)
|
||||
|
||||
@@ -192,6 +192,14 @@ public func getAppFilesDirectory() -> URL {
|
||||
getAppDirectory().appendingPathComponent("app_files", isDirectory: true)
|
||||
}
|
||||
|
||||
public func getAppDebugProfilePath() -> URL {
|
||||
getAppDirectory().appendingPathComponent("simplex_debug_profile", isDirectory: false)
|
||||
}
|
||||
|
||||
public func getAppEventLogPath() -> URL {
|
||||
getAppDirectory().appendingPathComponent("simplex_event_log", isDirectory: false)
|
||||
}
|
||||
|
||||
public func getAppFilePath(_ fileName: String) -> URL {
|
||||
getAppFilesDirectory().appendingPathComponent(fileName)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user