fun ComponentActivity.collectLatestLifecycleFlow(flow: Flow, collect: suspend (T) -> Unit) { lifecycleScope.launch { repeatOnLifecycle(Lifecycle.State.STARTED) { flow.collectLatest(collect) } } }