Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Verified Commit b520cef5 authored by Fahim M. Choudhury's avatar Fahim M. Choudhury
Browse files

refactor: improve readability on InstallButtonState

parent 5ae48f16
Loading
Loading
Loading
Loading
+7 −25
Original line number Diff line number Diff line
@@ -45,40 +45,25 @@ data class InstallButtonState(
    }
}

/*
 * UI label that can be backed by a string resource or a literal string (e.g., price).
 */
data class ButtonLabel(
    @StringRes val resId: Int? = null,
    val text: String? = null,
)

/*
 * Visual treatment tokens mapped to Compose theme in the UI layer.
 */
enum class InstallButtonStyle {
    AccentFill, // Accent background, white text (matches installed/updatable legacy state)
    AccentOutline, // Transparent background, accent stroke + text
    Disabled, // Light-grey stroke + text
    AccentFill,
    AccentOutline,
    Disabled,
}

/*
 * Intent describing the side-effect the UI host should execute on click.
 */
enum class InstallButtonAction {
    Install, CancelDownload, OpenAppOrPwa, UpdateSelfConfirm, ShowPaidDialog, ShowBlockedSnackbar, NoOp,
}

/*
 * Dialog variants initiated from the button state when action requires confirmation.
 */
enum class InstallDialogType {
    SelfUpdateConfirmation, PaidAppDialog,
}

/*
 * Lightweight status marker useful for tests and debugging to assert mapping branch taken.
 */
enum class StatusTag {
    Installed,
    Updatable,
@@ -92,12 +77,9 @@ enum class StatusTag {
    Unknown,
}

/*
 * Purchase resolution states, mirroring legacy branching.
 */
sealed class PurchaseState {
    object Unknown : PurchaseState()
    object Loading : PurchaseState()
    object Purchased : PurchaseState()
    object NotPurchased : PurchaseState()
    data object Unknown : PurchaseState()
    data object Loading : PurchaseState()
    data object Purchased : PurchaseState()
    data object NotPurchased : PurchaseState()
}