A way to make in app updates in compose
The library is available via MavenCentral:
allprojects {
repositories {
// ...
mavenCentral()
}
}
Snapshots of the development version are available in Sonatype's snapshots repository.
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>")
}
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