diff options
| author | Fuwn <[email protected]> | 2025-03-03 03:18:55 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-03-03 03:18:55 -0800 |
| commit | 47a81105b96cb65938c63edcf87738f12598ca96 (patch) | |
| tree | cdfe7b0d490afddf8b5286859accbb8119186583 /Sora/Views/Settings | |
| parent | feat: Development commit (diff) | |
| download | sora-testing-47a81105b96cb65938c63edcf87738f12598ca96.tar.xz sora-testing-47a81105b96cb65938c63edcf87738f12598ca96.zip | |
feat: Development commit
Diffstat (limited to 'Sora/Views/Settings')
| -rw-r--r-- | Sora/Views/Settings/Section/SettingsImportExportView.swift | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Sora/Views/Settings/Section/SettingsImportExportView.swift b/Sora/Views/Settings/Section/SettingsImportExportView.swift index 983b175..1abf457 100644 --- a/Sora/Views/Settings/Section/SettingsImportExportView.swift +++ b/Sora/Views/Settings/Section/SettingsImportExportView.swift @@ -7,6 +7,11 @@ struct SettingsImportExportView: View { @State private var isFileImporterPresented = false @State private var exportError: Error? @State private var importError: Error? + private let dateFormatter: DateFormatter = { + let formatter = DateFormatter() + formatter.dateFormat = "yyyy-MM-dd_HH-mm-ss" + return formatter + }() var body: some View { Group { @@ -68,14 +73,15 @@ struct SettingsImportExportView: View { private func exportBookmarksToFile() { do { + let data = try settings.exportBookmarks() + let timestamp = dateFormatter.string(from: Date()) + #if os(macOS) - _ = try settings.exportBookmarks() + _ = data isFileExporterPresented = true - #elseif os(iOS) - let data = try settings.exportBookmarks() let temporaryURL = FileManager.default.temporaryDirectory - .appendingPathComponent("sora_bookmarks.json") + .appendingPathComponent("sora_bookmarks_\(timestamp).json") try data.write(to: temporaryURL) |