Ganfra's review: revert change

This commit is contained in:
Benoit Marty 2019-06-10 16:58:48 +02:00
parent fa297a7b6a
commit 9772bbe157
1 changed files with 8 additions and 13 deletions

View File

@ -35,20 +35,15 @@ class RealmQueryLatch<E : RealmObject>(private val realmConfiguration: RealmConf
val realm = Realm.getInstance(realmConfiguration)
val result = realmQueryBuilder(realm).findAllAsync()
if (result.isEmpty()) {
result.addChangeListener(object : RealmChangeListener<RealmResults<E>> {
override fun onChange(t: RealmResults<E>) {
if (t.isNotEmpty()) {
result.removeChangeListener(this)
realm.close()
latch.countDown()
}
result.addChangeListener(object : RealmChangeListener<RealmResults<E>> {
override fun onChange(t: RealmResults<E>) {
if (t.isNotEmpty()) {
result.removeChangeListener(this)
realm.close()
latch.countDown()
}
})
} else {
realm.close()
latch.countDown()
}
}
})
}
handler.post(runnable)
latch.await()