PeachNav.kt

2.8 KB · raw

1package com.peachpasswords.ui23/**4 * Every navigation destination in the app. [route] is the concrete route used5 * with `navController.navigate(...)`; parameterized destinations expose a6 * `ROUTE` pattern (with `{arg}` placeholders) for registration in the graph.7 */8sealed class PeachNav(val route: String) {9    data object Onboarding : PeachNav("onboarding")10    data object Lock : PeachNav("lock")11    data object VaultList : PeachNav("vault")1213    /** The notes surface itself — [NotesMode]'s table of contents, with no note14     * open yet. Reached from the entry-deck chrome's "Notes" action. */15    data object Notes : PeachNav("notes")1617    data class EntryDetail(val id: String) : PeachNav("entry/$id") {18        companion object {19            const val ROUTE = "entry/{id}"20            fun of(id: String) = "entry/$id"21        }22    }2324    data class NotesMode(val id: String) : PeachNav("notes/$id") {25        companion object {26            const val ROUTE = "notes/{id}"27            fun of(id: String) = "notes/$id"28        }29    }3031    data class EntryEdit(32        val id: String?,33        val prefillUrl: String? = null,34        val prefillUsername: String? = null,35        val prefillEmail: String? = null,36    ) : PeachNav(37        "edit?id=${id ?: ""}" +38            "&prefillUrl=${prefillUrl ?: ""}" +39            "&prefillUsername=${prefillUsername ?: ""}" +40            "&prefillEmail=${prefillEmail ?: ""}",41    ) {42        companion object {43            const val ROUTE = "edit?id={id}&prefillUrl={prefillUrl}&prefillUsername={prefillUsername}&prefillEmail={prefillEmail}"44            fun of(45                id: String?,46                prefillUrl: String? = null,47                prefillUsername: String? = null,48                prefillEmail: String? = null,49            ) = "edit?id=${id ?: ""}" +50                "&prefillUrl=${prefillUrl ?: ""}" +51                "&prefillUsername=${prefillUsername ?: ""}" +52                "&prefillEmail=${prefillEmail ?: ""}"53        }54    }5556    data object Settings : PeachNav("settings")57    data object CodexGenerate : PeachNav("codex/generate")58    data object CodexRestore : PeachNav("codex/restore")59    data object CodePair : PeachNav("pair/code")60    data object AdoptVault : PeachNav("adopt-vault")61    data object Health : PeachNav("health")62    data object Trash : PeachNav("trash")63    data object Import : PeachNav("import")64    data object Export : PeachNav("export")65    data object Panic : PeachNav("panic")66    data object RecoverySetup : PeachNav("recovery/setup")67    data object RecoveryView : PeachNav("recovery/view")68    data object RecoveryEntry : PeachNav("recovery/entry")6970    /** Check / download / install a newer release from Kepr. */71    data object Update : PeachNav("update")7273    /** Post-update changelog for the version now running, shown once. */74    data object WhatsNew : PeachNav("whatsnew")75}