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 { ...@@ -28,6 +28,7 @@ enum ContactServiceError: Error {
case vCardSerializationFailed case vCardSerializationFailed
case loadVCardFailed case loadVCardFailed
case saveVCardFailed case saveVCardFailed
case removeContactFailed
} }
class ContactsService { class ContactsService {
...@@ -225,10 +226,14 @@ class ContactsService { ...@@ -225,10 +226,14 @@ class ContactsService {
func removeContact(withUri uri: String, ban: Bool, withAccountId accountId: String) -> Observable<Void> { func removeContact(withUri uri: String, ban: Bool, withAccountId accountId: String) -> Observable<Void> {
return Observable.create { [unowned self] observable in return Observable.create { [unowned self] observable in
self.contactsAdapter.removeContact(withURI: uri, accountId: accountId, ban: ban) guard let hash = JamiURI
if let hash = JamiURI.init(schema: URIType.ring, infoHach: uri).hash { .init(schema: URIType.ring,
self.removeContactRequest(withRingId: hash) 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) observable.on(.completed)
return Disposables.create { } 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