mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
17 lines
761 B
Swift
17 lines
761 B
Swift
|
|
extension Storage {
|
|
|
|
private static let receivedCallsCollection = "LokiReceivedCallsCollection"
|
|
|
|
public func getReceivedCalls(for publicKey: String, using transaction: Any) -> Set<String> {
|
|
var result: Set<String>?
|
|
guard let transaction = transaction as? YapDatabaseReadTransaction else { return [] }
|
|
result = transaction.object(forKey: publicKey, inCollection: Storage.receivedCallsCollection) as? Set<String>
|
|
return result ?? []
|
|
}
|
|
|
|
public func setReceivedCalls(to receivedCalls: Set<String>, for publicKey: String, using transaction: Any) {
|
|
(transaction as! YapDatabaseReadWriteTransaction).setObject(receivedCalls, forKey: publicKey, inCollection: Storage.receivedCallsCollection)
|
|
}
|
|
}
|