Skip to content

Commit b182ed4

Browse files
committed
Use distinctUntilChanged
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
1 parent e77ce0d commit b182ed4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/src/main/java/at/bitfire/icsdroid/model/AddSubscriptionModel.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import dagger.hilt.android.lifecycle.HiltViewModel
2929
import dagger.hilt.android.qualifiers.ApplicationContext
3030
import kotlinx.coroutines.Dispatchers
3131
import kotlinx.coroutines.flow.distinctUntilChanged
32-
import kotlinx.coroutines.flow.distinctUntilChangedBy
3332
import kotlinx.coroutines.flow.filter
3433
import kotlinx.coroutines.launch
3534
import kotlinx.coroutines.withContext
@@ -119,7 +118,9 @@ class AddSubscriptionModel @AssistedInject constructor(
119118
viewModelScope.launch {
120119
snapshotFlow { uiState }
121120
// Only react to changes in verificationResult
122-
.distinctUntilChangedBy { it.verificationResult.hashCode() }
121+
.distinctUntilChanged { old, new ->
122+
old.verificationResult == new.verificationResult
123+
}
123124
// only react when verificationResult is not null
124125
.filter { it.verificationResult != null }
125126
.collect { state ->

0 commit comments

Comments
 (0)