mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.5 KiB
Swift
45 lines
1.5 KiB
Swift
5 years ago
|
import PromiseKit
|
||
|
|
||
|
// A few notes about making changes in this file:
|
||
|
//
|
||
|
// • Don't use a database transaction if you can avoid it.
|
||
|
// • If you do need to use a database transaction, use a read transaction if possible.
|
||
|
// • Consider making it the caller's responsibility to manage the database transaction (this helps avoid nested or unnecessary transactions).
|
||
|
// • Think carefully about adding a function; there might already be one for what you need.
|
||
|
|
||
|
// TODO: Document the expected cases for everything and then express those cases in tests
|
||
|
|
||
5 years ago
|
@objc public final class SessionProtocol : NSObject {
|
||
5 years ago
|
|
||
|
private static var _lastDeviceLinkUpdate: [String:Date] = [:]
|
||
|
/// A mapping from hex encoded public key to date updated.
|
||
|
public static var lastDeviceLinkUpdate: [String:Date] {
|
||
|
get { LokiAPI.stateQueue.sync { _lastDeviceLinkUpdate } }
|
||
|
set { LokiAPI.stateQueue.sync { _lastDeviceLinkUpdate = newValue } }
|
||
|
}
|
||
|
|
||
|
// TODO: I don't think this stateQueue stuff actually helps avoid race conditions
|
||
|
|
||
5 years ago
|
internal static var storage: OWSPrimaryStorage { OWSPrimaryStorage.shared() }
|
||
5 years ago
|
|
||
|
|
||
|
|
||
|
// MARK: - Settings
|
||
|
public static let deviceLinkUpdateInterval: TimeInterval = 20
|
||
|
|
||
|
|
||
|
|
||
|
// MARK: - Multi Device Destination
|
||
|
public struct MultiDeviceDestination : Hashable {
|
||
|
public let hexEncodedPublicKey: String
|
||
|
public let kind: Kind
|
||
|
|
||
|
public enum Kind : String { case master, slave }
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
5 years ago
|
// MARK: - Initialization
|
||
|
private override init() { }
|
||
5 years ago
|
}
|