35 lines
943 B
Swift
35 lines
943 B
Swift
//
|
|
// Copyright 2025 Signal Messenger, LLC
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
//
|
|
|
|
public class InactivePrimaryDeviceStore: NSObject {
|
|
private enum StoreKeys {
|
|
static let hasInactivePrimaryDeviceAlert: String = "hasInactivePrimaryDevice"
|
|
}
|
|
|
|
private let kvStore: KeyValueStore
|
|
|
|
override public init() {
|
|
self.kvStore = KeyValueStore(collection: "InactivePrimaryDeviceStore")
|
|
}
|
|
|
|
public func setValueForInactivePrimaryDeviceAlert(
|
|
value: Bool,
|
|
transaction: DBWriteTransaction,
|
|
) {
|
|
kvStore.setBool(
|
|
value,
|
|
key: StoreKeys.hasInactivePrimaryDeviceAlert,
|
|
transaction: transaction,
|
|
)
|
|
}
|
|
|
|
public func valueForInactivePrimaryDeviceAlert(transaction: DBReadTransaction) -> Bool {
|
|
return kvStore.getBool(
|
|
StoreKeys.hasInactivePrimaryDeviceAlert,
|
|
transaction: transaction,
|
|
) ?? false
|
|
}
|
|
}
|