Reverting change and fixing a force-cast crash
This commit is contained in:
parent
6205e72eab
commit
f8dfbd4244
|
@ -36,17 +36,21 @@ extension Storage {
|
|||
}
|
||||
|
||||
@objc public func getUser() -> Contact? {
|
||||
var result: Contact?
|
||||
|
||||
Storage.read { transaction in
|
||||
result = self.getUser(using: transaction)
|
||||
}
|
||||
|
||||
return result
|
||||
return getUser(using: nil)
|
||||
}
|
||||
|
||||
public func getUser(using transaction: Any) -> Contact? {
|
||||
public func getUser(using transaction: YapDatabaseReadTransaction?) -> Contact? {
|
||||
guard let userPublicKey = getUserPublicKey() else { return nil }
|
||||
return Storage.shared.getContact(with: userPublicKey, using: transaction)
|
||||
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)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ public protocol SessionMessagingKitStorageProtocol {
|
|||
func getUserKeyPair() -> ECKeyPair?
|
||||
func getUserED25519KeyPair() -> Box.KeyPair?
|
||||
func getUser() -> Contact?
|
||||
func getUser(using transaction: Any) -> Contact?
|
||||
func getUser(using transaction: YapDatabaseReadTransaction?) -> Contact?
|
||||
func getAllContacts() -> Set<Contact>
|
||||
func getAllContacts(with transaction: YapDatabaseReadTransaction) -> Set<Contact>
|
||||
|
||||
|
|
Loading…
Reference in New Issue