diff --git a/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/base/BaseScreen.kt b/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/base/BaseScreen.kt new file mode 100644 index 000000000..713fab898 --- /dev/null +++ b/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/base/BaseScreen.kt @@ -0,0 +1,13 @@ +package co.nimblehq.template.compose.ui.base + +import androidx.compose.runtime.Composable + +@Composable +fun BaseScreen( + // TODO Base parameters to request on all screens here + content: @Composable () -> Unit, +) { + // TODO Base logic for all screens here + + content() +} diff --git a/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/screens/main/home/HomeScreen.kt b/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/screens/main/home/HomeScreen.kt index 5ad7fe7d1..66e46c10b 100644 --- a/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/screens/main/home/HomeScreen.kt +++ b/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/screens/main/home/HomeScreen.kt @@ -14,6 +14,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import co.nimblehq.template.compose.R import co.nimblehq.template.compose.extensions.collectAsEffect import co.nimblehq.template.compose.ui.AppDestination +import co.nimblehq.template.compose.ui.base.BaseScreen import co.nimblehq.template.compose.ui.models.UiModel import co.nimblehq.template.compose.ui.showToast import co.nimblehq.template.compose.ui.theme.AppTheme.dimensions @@ -23,8 +24,8 @@ import timber.log.Timber @Composable fun HomeScreen( viewModel: HomeViewModel = hiltViewModel(), - navigator: (destination: AppDestination) -> Unit -) { + navigator: (destination: AppDestination) -> Unit, +) = BaseScreen { val context = LocalContext.current viewModel.error.collectAsEffect { e -> e.showToast(context) } viewModel.navigator.collectAsEffect { destination -> navigator(destination) }