Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hoanghiephui/in-app-update
https://github.com/hoanghiephui/in-app-update
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hoanghiephui/in-app-update
- Owner: hoanghiephui
- License: mit
- Created: 2023-07-10T03:31:45.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-18T07:59:33.000Z (6 months ago)
- Last Synced: 2024-06-18T09:17:51.658Z (6 months ago)
- Language: Kotlin
- Size: 141 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/se.warting.in-app-update/in-app-update-compose/badge.png)](https://maven-badges.herokuapp.com/maven-central/se.warting.in-app-update/in-app-update-compose)
[![Crowdin](https://badges.crowdin.net/in-app-update-compose/localized.svg)](https://crowdin.com/project/in-app-update-compose)# 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)](https://img.shields.io/nexus/s/se.warting.in-app-update/in-app-update-compose?server=https%3A%2F%2Foss.sonatype.org)](https://oss.sonatype.org/content/repositories/snapshots/se/warting/in-app-update/in-app-update-compose/)
```groovy
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:")
}
```## How to use
All you need to do is to use `RequireLatestVersion`:
```
@Composable
fun MainView() {
RequireLatestVersion {
Welcome()
}
}
```
For a full implementation
see: [Full sample](app/src/main/java/se/warting/appupdatecompose/UiActivity.kt)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](app/src/main/java/se/warting/appupdatecompose/MainActivity.kt)