Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ddba64cb authored by Yining Liu's avatar Yining Liu
Browse files

Simplify coroutine structure of NotificationViewFlipperBinder

Remove the redundant lifecycleScope, coroutineScope, and launch
from NotificationViewFlipperBinder.

Test: manual
Bug: 409112153
Flag: EXEMPT refactor
Change-Id: Ifa33f3029de84fa3d19c9e407262cc885598f25e
parent 799e09d8
Loading
Loading
Loading
Loading
+1 −9
Original line number Diff line number Diff line
@@ -17,12 +17,9 @@
package com.android.systemui.statusbar.notification.row.ui.viewbinder

import android.widget.ViewFlipper
import androidx.lifecycle.lifecycleScope
import com.android.app.tracing.coroutines.launchTraced as launch
import com.android.systemui.lifecycle.repeatWhenAttached
import com.android.systemui.statusbar.notification.row.ui.viewmodel.NotificationViewFlipperViewModel
import kotlinx.coroutines.DisposableHandle
import kotlinx.coroutines.coroutineScope

/** Binds a [NotificationViewFlipper] to its [view model][NotificationViewFlipperViewModel]. */
object NotificationViewFlipperBinder {
@@ -35,12 +32,7 @@ object NotificationViewFlipperBinder {
            return DisposableHandle {}
        }
        return viewFlipper.repeatWhenAttached {
            lifecycleScope.launch { bind(viewFlipper, viewModel) }
            viewModel.isPaused.collect { viewFlipper.setInhibited(it) }
        }
    }

    suspend fun bind(viewFlipper: ViewFlipper, viewModel: NotificationViewFlipperViewModel) =
        coroutineScope {
            launch { viewModel.isPaused.collect { viewFlipper.setInhibited(it) } }
        }
}