mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-22 21:58:53 +01:00
Fix crash when multiple changes made to contact
This commit is contained in:
@@ -25,7 +25,6 @@ import android.os.Handler
|
|||||||
import android.provider.ContactsContract
|
import android.provider.ContactsContract
|
||||||
import com.moez.QKSMS.repository.SyncRepository
|
import com.moez.QKSMS.repository.SyncRepository
|
||||||
import io.reactivex.Observable
|
import io.reactivex.Observable
|
||||||
import io.reactivex.Single
|
|
||||||
import io.reactivex.subjects.PublishSubject
|
import io.reactivex.subjects.PublishSubject
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@@ -43,11 +42,9 @@ class ContactAddedListenerImpl @Inject constructor(
|
|||||||
private val URI = ContactsContract.CommonDataKinds.Phone.CONTENT_URI
|
private val URI = ContactsContract.CommonDataKinds.Phone.CONTENT_URI
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun listen(address: String): Single<*> {
|
override fun listen(address: String): Observable<*> {
|
||||||
val observable = ContactContentObserver(context).observable
|
return ContactContentObserver(context).observable
|
||||||
.filter { syncRepo.syncContact(address) }
|
.filter { syncRepo.syncContact(address) }
|
||||||
|
|
||||||
return Single.fromObservable(observable)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ContactContentObserver(context: Context) : ContentObserver(Handler()) {
|
private class ContactContentObserver(context: Context) : ContentObserver(Handler()) {
|
||||||
|
|||||||
@@ -18,10 +18,10 @@
|
|||||||
*/
|
*/
|
||||||
package com.moez.QKSMS.listener
|
package com.moez.QKSMS.listener
|
||||||
|
|
||||||
import io.reactivex.Single
|
import io.reactivex.Observable
|
||||||
|
|
||||||
interface ContactAddedListener {
|
interface ContactAddedListener {
|
||||||
|
|
||||||
fun listen(address: String): Single<*>
|
fun listen(address: String): Observable<*>
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user