I have a BaseActivity which extends ComponentActivity and has abstract method SetComposable. Each Activity now extend BaseActivity and overrides SetComposable which shows Composable screen. InAppUpdates is integrated in application of type Flexible for updating application. Once user has downloaded the update, the requirement is to show Snackbar on Composable screen which can be any screen as user has flexibility to keep using app when update is downloading. How to handle this condition as placing Snackbar inside each composable is not a good option but it needs to be shown when update is downloaded.
The code for BaseActivity is
abstract class BaseActivity : ComponentActivity() {
@Inject
lateinit var appUpdate: AppUpdate
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
appUpdate.setUpdateType(AppUpdateTypes.IMMEDIATE)
appUpdate.launchImmediateUpdate(this)
setContent {
MyAppTheme {
SetComposable()
}
}
}
/**
* Set the composable content for the screen
*/
@Composable
abstract fun SetComposable()
}.
The code for other Activities look like
@AndroidEntryPoint
class HomeActivity : BaseActivity() {
private lateinit var navController: NavController
@Composable
override fun SetComposable() {
}
}.
How to solve this use case ?