Vlad
03/27/2024, 2:35 PM@Environment(\.scenePhase) var scenePhase
...
ContentView()
.ignoresSafeArea(.all)
.onChange(of: scenePhase) { phase in
switch phase {
case .active:
appLifecycle.start()
case .background:
appLifecycle.stop()
default:
break
}
The thing it when the scene reports .background - seems like observing a state and/or recompositions already stopped?!
So basically when .background happens I want to do LaunchEffect.
I wonder if it is how it should be or it is a compose bug?
The DisposableEffect's onDispose is not triggered. The composable tree is still there, but seems like val lifecycleState by viewModel.currentState._collectAsState_()
is stopped.Vlad
03/27/2024, 3:05 PMVlad
03/27/2024, 3:32 PM