2020-11-11 23:30:03 +01:00
|
|
|
|
2020-11-24 10:09:23 +01:00
|
|
|
// TODO: Since we now have YapDatabase as a dependency in all modules we can work with YapDatabaseTransactions directly
|
|
|
|
// rather than passing transactions around as Any everywhere.
|
|
|
|
|
2020-11-11 23:30:03 +01:00
|
|
|
extension Storage {
|
|
|
|
|
2020-11-24 10:09:23 +01:00
|
|
|
// TODO: This is essentially a duplicate of Storage.writeSync
|
2020-11-11 23:30:03 +01:00
|
|
|
public func with(_ work: @escaping (Any) -> Void) {
|
|
|
|
Storage.writeSync { work($0) }
|
|
|
|
}
|
|
|
|
|
2020-11-24 10:09:23 +01:00
|
|
|
// TODO: This is essentially a duplicate of Storage.write
|
2020-11-12 22:41:54 +01:00
|
|
|
public func withAsync(_ work: @escaping (Any) -> Void, completion: @escaping () -> Void) {
|
|
|
|
Storage.write(with: { work($0) }, completion: completion)
|
|
|
|
}
|
|
|
|
|
2020-11-11 23:30:03 +01:00
|
|
|
public func getUserPublicKey() -> String? {
|
2020-11-26 02:56:08 +01:00
|
|
|
return OWSIdentityManager.shared().identityKeyPair()?.hexEncodedPublicKey
|
2020-11-11 23:30:03 +01:00
|
|
|
}
|
2020-11-12 22:41:54 +01:00
|
|
|
|
|
|
|
public func getUserKeyPair() -> ECKeyPair? {
|
|
|
|
return OWSIdentityManager.shared().identityKeyPair()
|
|
|
|
}
|
|
|
|
|
2020-11-19 05:24:09 +01:00
|
|
|
public func getUserDisplayName() -> String? {
|
|
|
|
return SSKEnvironment.shared.profileManager.localProfileName()
|
|
|
|
}
|
2020-11-26 05:16:35 +01:00
|
|
|
|
|
|
|
public func getUserProfileKey() -> Data? {
|
|
|
|
return SSKEnvironment.shared.profileManager.localProfileKey().keyData
|
|
|
|
}
|
|
|
|
|
|
|
|
public func getUserProfilePictureURL() -> String? {
|
|
|
|
return SSKEnvironment.shared.profileManager.profilePictureURL()
|
|
|
|
}
|
2020-11-11 23:30:03 +01:00
|
|
|
}
|