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.
18 lines
666 B
Swift
18 lines
666 B
Swift
|
|
extension Storage {
|
|
|
|
private static let volumeSamplesCollection = "LokiVolumeSamplesCollection"
|
|
|
|
public func getVolumeSamples(for attachment: String) -> [Float]? {
|
|
var result: [Float]?
|
|
Storage.read { transaction in
|
|
result = transaction.object(forKey: attachment, inCollection: Storage.volumeSamplesCollection) as? [Float]
|
|
}
|
|
return result
|
|
}
|
|
|
|
public func setVolumeSamples(for attachment: String, to volumeSamples: [Float], using transaction: Any) {
|
|
(transaction as! YapDatabaseReadWriteTransaction).setObject(volumeSamples, forKey: attachment, inCollection: Storage.volumeSamplesCollection)
|
|
}
|
|
}
|