ios: save debug profile, event log buttons (#3899)

This commit is contained in:
spaced4ndy
2024-03-12 19:06:25 +04:00
committed by GitHub
parent 53d8a85b8c
commit df619d540b
3 changed files with 32 additions and 1 deletions
+1 -1
View File
@@ -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)
+8
View File
@@ -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)
}