Commit ad2a648b authored by Kateryna Kostiuk's avatar Kateryna Kostiuk

fix: block contact

Change-Id: I977dff3066b5f6dfe1f682888f531e21500b8cbe
parent ceb6027c
......@@ -28,6 +28,7 @@ enum ContactServiceError: Error {
case vCardSerializationFailed
case loadVCardFailed
case saveVCardFailed
case removeContactFailed
}
class ContactsService {
......@@ -225,10 +226,14 @@ class ContactsService {
func removeContact(withUri uri: String, ban: Bool, withAccountId accountId: String) -> Observable<Void> {
return Observable.create { [unowned self] observable in
self.contactsAdapter.removeContact(withURI: uri, accountId: accountId, ban: ban)
if let hash = JamiURI.init(schema: URIType.ring, infoHach: uri).hash {
self.removeContactRequest(withRingId: hash)
guard let hash = JamiURI
.init(schema: URIType.ring,
infoHach: uri).hash else {
observable.on(.error(ContactServiceError.removeContactFailed))
return Disposables.create { }
}
self.contactsAdapter.removeContact(withURI: hash, accountId: accountId, ban: ban)
self.removeContactRequest(withRingId: hash)
observable.on(.completed)
return Disposables.create { }
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment