|
|
|
@ -36,21 +36,17 @@ extension Storage {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@objc public func getUser() -> Contact? {
|
|
|
|
|
return getUser(using: nil)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public func getUser(using transaction: Any?) -> Contact? {
|
|
|
|
|
guard let userPublicKey = getUserPublicKey() else { return nil }
|
|
|
|
|
var result: Contact?
|
|
|
|
|
|
|
|
|
|
if let transaction = transaction {
|
|
|
|
|
result = Storage.shared.getContact(with: userPublicKey, using: transaction)
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
Storage.read { transaction in
|
|
|
|
|
result = Storage.shared.getContact(with: userPublicKey, using: transaction)
|
|
|
|
|
}
|
|
|
|
|
Storage.read { transaction in
|
|
|
|
|
result = self.getUser(using: transaction)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public func getUser(using transaction: Any) -> Contact? {
|
|
|
|
|
guard let userPublicKey = getUserPublicKey() else { return nil }
|
|
|
|
|
return Storage.shared.getContact(with: userPublicKey, using: transaction)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|