/*
 * Book's Story — free and open-source Material You eBook reader.
 * Copyright (C) 2024-2026 Acclorite
 * SPDX-License-Identifier: GPL-3.0-only
 */

package org.dueattendant149.bookshelf.ui.reader

import androidx.activity.compose.BackHandler
import androidx.compose.runtime.Composable
import org.dueattendant149.bookshelf.presentation.reader.ReaderEvent

@Composable
fun ReaderBackHandler(
    leave: (ReaderEvent.OnLeave) -> Unit,
    navigateBack: (ReaderEvent.OnNavigateBack) -> Unit
) {
    BackHandler {
        leave(
            ReaderEvent.OnLeave(
                navigate = {
                    navigateBack(ReaderEvent.OnNavigateBack)
                }
            )
        )
    }
}