~repos /only-bible-app
git clone
https://pyrossh.dev/repos/only-bible-app.git
The only bible app you will ever need. No ads. No in-app purchases. No distractions.
file:
composeApp/src/commonMain/kotlin/dev/pyrossh/onlyBible/utils/Navigation.kt
package utils
import androidx.compose.runtime.compositionLocalOfimport androidx.navigation.NavControllerimport dev.pyrossh.onlyBible.domain.BOOKS_COUNTimport dev.pyrossh.onlyBible.domain.chapterSizes
val LocalNavController = compositionLocalOf<NavController> { error("No NavController found!") }
fun getForwardPair(bookIndex: Int, chapterIndex: Int): Pair<Int, Int> { val sizes = chapterSizes[bookIndex] if (sizes > chapterIndex + 1) { return Pair(bookIndex, chapterIndex + 1) } if (bookIndex + 1 < BOOKS_COUNT) { return Pair(bookIndex + 1, 0) } return Pair(0, 0)}
fun getBackwardPair(bookIndex: Int, chapterIndex: Int): Pair<Int, Int> { if (chapterIndex - 1 >= 0) { return Pair(bookIndex, chapterIndex - 1) } if (bookIndex - 1 >= 0) { return Pair(bookIndex - 1, chapterSizes[bookIndex - 1] - 1) } return Pair(BOOKS_COUNT - 1, chapterSizes[BOOKS_COUNT - 1] - 1)}