accounts and email
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
import Foundation
|
||||
import Security
|
||||
|
||||
public enum NewNoteAction: String, Codable, CaseIterable {
|
||||
case clipboard
|
||||
case editor
|
||||
}
|
||||
|
||||
public struct SyncConfig: Codable, Equatable {
|
||||
public var serverURL: String
|
||||
public var apiToken: String?
|
||||
public var syncFolder: String?
|
||||
public var defaultUploadFolder: String?
|
||||
public var newNoteAction: NewNoteAction?
|
||||
public var autoSync: Bool
|
||||
public var syncInterval: Int // seconds
|
||||
public var deviceId: String
|
||||
@@ -30,6 +36,7 @@ public struct SyncConfig: Codable, Equatable {
|
||||
apiToken: String? = nil,
|
||||
syncFolder: String? = nil,
|
||||
defaultUploadFolder: String? = nil,
|
||||
newNoteAction: NewNoteAction? = nil,
|
||||
autoSync: Bool = true,
|
||||
syncInterval: Int = 30,
|
||||
deviceId: String? = nil,
|
||||
@@ -39,6 +46,7 @@ public struct SyncConfig: Codable, Equatable {
|
||||
self.apiToken = apiToken
|
||||
self.syncFolder = syncFolder
|
||||
self.defaultUploadFolder = defaultUploadFolder
|
||||
self.newNoteAction = newNoteAction
|
||||
self.autoSync = autoSync
|
||||
self.syncInterval = syncInterval
|
||||
self.deviceId = deviceId ?? SyncConfig.generateDeviceId()
|
||||
@@ -57,6 +65,10 @@ public struct SyncConfig: Codable, Equatable {
|
||||
public var serverBaseURL: URL? {
|
||||
URL(string: serverURL)
|
||||
}
|
||||
|
||||
public var effectiveNewNoteAction: NewNoteAction {
|
||||
newNoteAction ?? .clipboard
|
||||
}
|
||||
}
|
||||
|
||||
public actor ConfigStore {
|
||||
|
||||
Reference in New Issue
Block a user