diff --git a/Meshtastic/Views/Settings/AppLog.swift b/Meshtastic/Views/Settings/AppLog.swift index 08c09664..709d3fa9 100644 --- a/Meshtastic/Views/Settings/AppLog.swift +++ b/Meshtastic/Views/Settings/AppLog.swift @@ -21,9 +21,15 @@ struct AppLog: View { @State private var levels: Set = [] @State var isExporting = false @State var exportString = "" + @State var exportFilename = "Meshtastic Application Logs" @State var isEditingFilters = false private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom } + private static let logFileDateFormatter: DateFormatter = { + let f = DateFormatter() + f.dateFormat = "yyyy-MM-dd_HHmmss" + return f + }() private let dateFormatStyle = Date.FormatStyle() .hour(.twoDigits(amPM: .omitted)) .minute() @@ -171,7 +177,7 @@ struct AppLog: View { isPresented: $isExporting, document: CsvDocument(emptyCsv: exportString), contentType: .commaSeparatedText, - defaultFilename: String("Meshtastic Application Logs"), + defaultFilename: exportFilename, onCompletion: { result in switch result { case .success: @@ -200,6 +206,7 @@ struct AppLog: View { ToolbarItem(placement: .navigationBarTrailing) { Button(action: { exportString = logToCsvFile(log: logs) + exportFilename = "Meshtastic Application Logs \(Self.logFileDateFormatter.string(from: .now))" isExporting = true }) { Image(systemName: "square.and.arrow.down")