Making sure scopes are cancelled for accountViewModel notification dot updates.
This commit is contained in:
+2
-2
@@ -1181,7 +1181,7 @@ class AccountViewModel(
|
|||||||
|
|
||||||
private var collectorJob: Job? = null
|
private var collectorJob: Job? = null
|
||||||
val notificationDots = HasNotificationDot(bottomNavigationItems)
|
val notificationDots = HasNotificationDot(bottomNavigationItems)
|
||||||
private val bundlerInsert = BundledInsert<Set<Note>>(3000, Dispatchers.IO)
|
private val bundlerInsert = BundledInsert<Set<Note>>(3000, Dispatchers.Default)
|
||||||
|
|
||||||
fun invalidateInsertData(newItems: Set<Note>) {
|
fun invalidateInsertData(newItems: Set<Note>) {
|
||||||
bundlerInsert.invalidateList(newItems) { updateNotificationDots(it.flatten().toSet()) }
|
bundlerInsert.invalidateList(newItems) { updateNotificationDots(it.flatten().toSet()) }
|
||||||
@@ -1201,7 +1201,6 @@ class AccountViewModel(
|
|||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.Default) {
|
||||||
feedStates.init()
|
feedStates.init()
|
||||||
// awaits for init to finish before starting to capture new events.
|
// awaits for init to finish before starting to capture new events.
|
||||||
|
|
||||||
LocalCache.live.newEventBundles.collect { newNotes ->
|
LocalCache.live.newEventBundles.collect { newNotes ->
|
||||||
Log.d(
|
Log.d(
|
||||||
"Rendering Metrics",
|
"Rendering Metrics",
|
||||||
@@ -1217,6 +1216,7 @@ class AccountViewModel(
|
|||||||
override fun onCleared() {
|
override fun onCleared() {
|
||||||
Log.d("Init", "AccountViewModel onCleared")
|
Log.d("Init", "AccountViewModel onCleared")
|
||||||
feedStates.destroy()
|
feedStates.destroy()
|
||||||
|
bundlerInsert.cancel()
|
||||||
collectorJob?.cancel()
|
collectorJob?.cancel()
|
||||||
super.onCleared()
|
super.onCleared()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user