SecondViewModel
The MVVM androidx.lifecycle.ViewModel for the second screen in the MVVM with Process Death demo. Loads the image either from the com.grarcht.shuttle.framework.Shuttle warehouse or from the in-memory com.grarcht.shuttle.demo.processdeath.model.ImageCache, and exposes the result as a StateFlow of SecondImageState.
Functions
Returns the com.grarcht.shuttle.demo.core.image.ImageModel from the current SecondImageState.Success state, or null if the image has not been loaded successfully.
Loads the image from the in-memory com.grarcht.shuttle.demo.processdeath.model.ImageCache and updates imageState. Transitions to SecondImageState.LostToProcessDeath if the cache is empty, demonstrating that in-memory state does not survive process death.
Picks up cargo from the com.grarcht.shuttle.framework.Shuttle warehouse using cargoId and updates imageState with the result. Transitions to SecondImageState.LostToProcessDeath immediately when cargoId is empty, indicating that the cargo was not preserved.