Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / shop / src / main / java / com / vayunmathur / shop / Route.kt
Route.kt54 lines · 1.8 KiBRaw
| 1 | package com.vayunmathur.shop |
| 2 | |
| 3 | import com.vayunmathur.library.util.NavKey |
| 4 | import kotlinx.serialization.Serializable |
| 5 | |
| 6 | // SCREENSHOT COVERAGE EXCEPTION: EmbeddedCheckout: merchant WebView checkout loads a secret-bearing live continue_url held only in in-memory ViewModel state; Layoutlib cannot render the merchant page |
| 7 | /** Contract for route. */ |
| 8 | @Serializable |
| 9 | sealed interface Route : NavKey { |
| 10 | /** |
| 11 | * First-run profile gate. The graph root while the saved profile is |
| 12 | * incomplete; replaced by [Search] via reset once it validates, so Back |
| 13 | * can never return to the gate. Later profile edits stay in the Profile |
| 14 | * tab inside [Search] and never use this route. |
| 15 | */ |
| 16 | @Serializable |
| 17 | data object ProfileSetup : Route |
| 18 | |
| 19 | /** Singleton holding search state and operations. */ |
| 20 | @Serializable |
| 21 | data object Search : Route |
| 22 | |
| 23 | /** Immutable value describing product detail. */ |
| 24 | @Serializable |
| 25 | data class ProductDetail( |
| 26 | val variantId: String, |
| 27 | val platformId: String, |
| 28 | val shopDomain: String, |
| 29 | ) : Route |
| 30 | |
| 31 | /** Singleton holding cart state and operations. */ |
| 32 | @Serializable |
| 33 | data object Cart : Route |
| 34 | |
| 35 | /** Singleton holding orders state and operations. */ |
| 36 | @Serializable |
| 37 | data object Orders : Route |
| 38 | |
| 39 | /** Singleton holding profile state and operations. */ |
| 40 | @Serializable |
| 41 | data object Profile : Route |
| 42 | |
| 43 | /** |
| 44 | * Merchant checkout for one store. The request (with its secret-bearing |
| 45 | * URL) lives in ShopViewModel, never in saved state; the route carries |
| 46 | * only the store identity so a restored entry can validate that the |
| 47 | * in-memory request is the checkout it names. |
| 48 | */ |
| 49 | @Serializable |
| 50 | data class EmbeddedCheckout( |
| 51 | val platformId: String, |
| 52 | val shopDomain: String, |
| 53 | ) : Route |
| 54 | } |