Skip to content

warting/In-App-Update-Compose

Repository files navigation

Maven Central Crowdin

In-App update compose

A way to make in app updates in compose

How to include in your project

The library is available via MavenCentral:

allprojects {
    repositories {
        // ...
        mavenCentral()
    }
}
Snapshots of the development version are available in Sonatype's snapshots repository.

Sonatype Nexus (Snapshots)

allprojects {
    repositories {
        // ...
        maven {
            url 'https://oss.sonatype.org/content/repositories/snapshots/'
        }
    }
}

Add it to your module dependencies:

dependencies {
    implementation("se.warting.in-app-update:in-app-update-compose:<latest_version>")
}

How to use

All you need to do is to use RequireLatestVersion:

@Composable
fun MainView() {
    RequireLatestVersion {
        Welcome()
    }
}

For a full implementation see: Full sample

or if you want more granular control:

@Composable
fun InAppUpdate() {
    val updateState = rememberInAppUpdateState()
    when (val result = updateState.appUpdateResult) {
        is AppUpdateResult.NotAvailable -> NotAvailable()
        is AppUpdateResult.Available -> Available(result)
        is AppUpdateResult.InProgress -> InProgress(result)
        is AppUpdateResult.Downloaded -> Downloaded(result)
    }
}

For a full implementation see: Full sample