fix(ui): Wire system back gesture to in-app navigation
Add PlatformBackHandler (expect/actual) to intercept the back gesture on Android via BackHandler, and enable OnBackInvokedCallback in the manifest so the swipe-back gesture triggers onBack instead of exiting the app. Fixes the back gesture exiting to home from the event detail screen.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// MyIce Kotlin Multiplatform — schedule/convocation viewer
|
||||
// Copyright (C) 2026 parano.ch
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
package ch.parano.myice.ui
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
|
||||
@Composable
|
||||
expect fun PlatformBackHandler(enabled: Boolean = true, onBack: () -> Unit)
|
||||
@@ -43,6 +43,7 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import ch.parano.myice.ui.PlatformBackHandler
|
||||
import ch.parano.myice.ui.components.LoadingIndicator
|
||||
import ch.parano.myice.util.formatEventDate
|
||||
import ch.parano.myice.util.formatEventTimeRange
|
||||
@@ -60,6 +61,8 @@ fun EventDetailScreen(
|
||||
onBack: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
PlatformBackHandler { onBack() }
|
||||
|
||||
LaunchedEffect(gameId, account) {
|
||||
viewModel.loadEventDetail(gameId, account)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user