@@ -36,6 +36,7 @@ import com.google.android.play.core.install.model.UpdateAvailability
3636import com.hereliesaz.aznavrail.AzButton
3737import com.hereliesaz.aznavrail.model.AzButtonShape
3838import com.hereliesaz.logkitty.services.LogKittyOverlayService
39+ import com.hereliesaz.logkitty.ui.AdBannerSlot
3940import com.hereliesaz.logkitty.ui.GitHubScreen
4041import com.hereliesaz.logkitty.ui.SettingsScreen
4142import com.hereliesaz.logkitty.ui.theme.LogKittyTheme
@@ -128,39 +129,47 @@ class MainActivity : ComponentActivity() {
128129
129130 Surface (modifier = Modifier .fillMaxSize(), color = MaterialTheme .colorScheme.background) {
130131 val viewModel = (application as MainApplication ).mainViewModel
131- when {
132- showSettings ->
133- // Show the Settings Screen (Full Page).
134- SettingsScreen (
135- onBack = { showSettings = false },
136- viewModel = viewModel
137- )
138- showGitHub ->
139- // Full-screen GitHub Actions (same panel the overlay tab hosts).
140- GitHubScreen (
141- viewModel = viewModel,
142- onBack = { showGitHub = false },
143- // Keep showGitHub=true: the when checks showSettings first, so Settings
144- // shows on top and backing out of it returns here, not the dashboard.
145- onConfigure = { showSettings = true },
146- )
147- else -> {
148- // Show the Main Dashboard / Permission Wizard.
149- val isRootEnabled by viewModel.isRootEnabled.collectAsState()
150-
151- MainScreenContent (
152- isOverlayGranted = isOverlayGranted,
153- isReadLogsGranted = isReadLogsGranted,
154- isRootEnabled = isRootEnabled,
155- isServiceRunning = isServiceRunning,
156- updateReadyToInstall = updateReadyToInstall,
157- onCompleteUpdate = { appUpdateManager.completeUpdate() },
158- onGrantOverlay = { requestOverlayPermission() },
159- onToggleService = { toggleOverlayService() },
160- onOpenSettings = { showSettings = true },
161- onOpenGitHub = { showGitHub = true }
162- )
132+ // One persistent banner anchored to the bottom of every in-app screen. Composed
133+ // once here, outside the navigation `when`, so the same AdView instance survives
134+ // dashboard <-> Settings <-> GitHub navigation instead of reloading per screen.
135+ Column (modifier = Modifier .fillMaxSize()) {
136+ Box (modifier = Modifier .weight(1f )) {
137+ when {
138+ showSettings ->
139+ // Show the Settings Screen (Full Page).
140+ SettingsScreen (
141+ onBack = { showSettings = false },
142+ viewModel = viewModel
143+ )
144+ showGitHub ->
145+ // Full-screen GitHub Actions (same panel the overlay tab hosts).
146+ GitHubScreen (
147+ viewModel = viewModel,
148+ onBack = { showGitHub = false },
149+ // Keep showGitHub=true: the when checks showSettings first, so Settings
150+ // shows on top and backing out of it returns here, not the dashboard.
151+ onConfigure = { showSettings = true },
152+ )
153+ else -> {
154+ // Show the Main Dashboard / Permission Wizard.
155+ val isRootEnabled by viewModel.isRootEnabled.collectAsState()
156+
157+ MainScreenContent (
158+ isOverlayGranted = isOverlayGranted,
159+ isReadLogsGranted = isReadLogsGranted,
160+ isRootEnabled = isRootEnabled,
161+ isServiceRunning = isServiceRunning,
162+ updateReadyToInstall = updateReadyToInstall,
163+ onCompleteUpdate = { appUpdateManager.completeUpdate() },
164+ onGrantOverlay = { requestOverlayPermission() },
165+ onToggleService = { toggleOverlayService() },
166+ onOpenSettings = { showSettings = true },
167+ onOpenGitHub = { showGitHub = true }
168+ )
169+ }
170+ }
163171 }
172+ AdBannerSlot (modifier = Modifier .fillMaxWidth(), showTopDivider = true )
164173 }
165174 }
166175 }
0 commit comments