mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
18 lines
624 B
Swift
18 lines
624 B
Swift
|
|
||
|
extension Storage {
|
||
|
|
||
|
static let volumeSamplesCollection = "LokiVolumeSamplesCollection"
|
||
|
|
||
|
static func getVolumeSamples(for attachment: String) -> [Float]? {
|
||
|
var result: [Float]?
|
||
|
read { transaction in
|
||
|
result = transaction.object(forKey: attachment, inCollection: volumeSamplesCollection) as? [Float]
|
||
|
}
|
||
|
return result
|
||
|
}
|
||
|
|
||
|
static func setVolumeSamples(for attachment: String, to volumeSamples: [Float], using transaction: YapDatabaseReadWriteTransaction) {
|
||
|
transaction.setObject(volumeSamples, forKey: attachment, inCollection: volumeSamplesCollection)
|
||
|
}
|
||
|
}
|