Backups in Ferrite archive a user's bookmarks, history, source lists, and source names. Sources are not archived due to the size of the backup increasing exponentially. These files use the .feb format to avoid JSON conflicts when opening the file in Ferrite. The backup file can be renamed to JSON for editing at any time. Add the Backport namespace to be used for ported features rather than making a file for every iOS 14 adaptation. Move history and bookmark creation to the PersistenceController rather than individual functions. Signed-off-by: kingbri <bdashore3@proton.me>
42 lines
819 B
Swift
42 lines
819 B
Swift
//
|
|
// BackupModels.swift
|
|
// Ferrite
|
|
//
|
|
// Created by Brian Dashore on 9/17/22.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct Backup: Codable {
|
|
var bookmarks: [BookmarkJson]?
|
|
var history: [HistoryJson]?
|
|
var sourceNames: [String]?
|
|
var sourceLists: [SourceListBackupJson]?
|
|
}
|
|
|
|
// MARK: - CoreData translation
|
|
|
|
typealias BookmarkJson = SearchResult
|
|
|
|
// Date is an epoch timestamp
|
|
struct HistoryJson: Codable {
|
|
let dateString: String?
|
|
let date: Double
|
|
let entries: [HistoryEntryJson]
|
|
}
|
|
|
|
struct HistoryEntryJson: Codable {
|
|
let name: String
|
|
let subName: String?
|
|
let url: String
|
|
let timeStamp: Double?
|
|
let source: String?
|
|
}
|
|
|
|
// Differs from SourceListJson
|
|
struct SourceListBackupJson: Codable {
|
|
let name: String
|
|
let author: String
|
|
let id: String
|
|
let urlString: String
|
|
}
|