From 9e6b5ed8f4048030e8e47179de52b55ca9b7c898 Mon Sep 17 00:00:00 2001 From: uiel Date: Wed, 5 Jun 2024 10:05:34 +0900 Subject: [PATCH 1/4] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20::=20=EC=9D=B8=20?= =?UTF-8?q?=EC=95=B1=20=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8=20=EC=9D=98?= =?UTF-8?q?=EC=A1=B4=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 2 ++ gradle/libs.versions.toml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 6faca4d95..c86233b8d 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -121,4 +121,6 @@ dependencies { testImplementation(libs.androidx.junit) androidTestImplementation(libs.androidx.junit) + + implementation(libs.app.update.ktx) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3863c9049..3f2c3ce6e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -4,6 +4,7 @@ accompanist = "0.34.0" androidx-window = "1.3.0-alpha02" activity = "1.8.2" appcompat = "1.6.1" +appUpdateKtx = "2.1.0" core = "1.12.0" datastorePreferences = "1.0.0" espresso = "3.5.1" @@ -58,6 +59,7 @@ androidx-compose-material = { group = "androidx.compose.material3", name = "mate androidx-compose-material-window = { group = "androidx.compose.material3", name = "material3-window-size-class-android", version.ref = "materialCompose" } androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigation" } androidx-hilt-navigation-compose = { module = "androidx.hilt:hilt-navigation-compose", version.ref = "hiltNavigation" } +app-update-ktx = { module = "com.google.android.play:app-update-ktx", version.ref = "appUpdateKtx" } composeDestinations = { group = "io.github.raamcosta.compose-destinations", name = "animations-core", version.ref = "composeDestination" } composeDestinations-ksp = { group = "io.github.raamcosta.compose-destinations", name = "ksp", version.ref = "composeDestination" } javax-inject = { module = "javax.inject:javax.inject", version.ref = "javaxInject" } From 7d539fc2924941d51e92eea909037b6d7b76e680 Mon Sep 17 00:00:00 2001 From: uiel Date: Wed, 5 Jun 2024 10:06:12 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20::=20=EC=9D=B8=20?= =?UTF-8?q?=EC=95=B1=20=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aliens/dms/android/app/MainActivity.kt | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/src/main/java/team/aliens/dms/android/app/MainActivity.kt b/app/src/main/java/team/aliens/dms/android/app/MainActivity.kt index 06dd942d5..90d69ce6d 100644 --- a/app/src/main/java/team/aliens/dms/android/app/MainActivity.kt +++ b/app/src/main/java/team/aliens/dms/android/app/MainActivity.kt @@ -8,6 +8,9 @@ import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSiz import androidx.compose.material3.windowsizeclass.calculateWindowSizeClass import androidx.core.view.WindowCompat import com.google.accompanist.adaptive.calculateDisplayFeatures +import com.google.android.play.core.appupdate.AppUpdateManagerFactory +import com.google.android.play.core.install.model.AppUpdateType +import com.google.android.play.core.install.model.UpdateAvailability import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.flow.StateFlow import team.aliens.dms.android.core.designsystem.DmsTheme @@ -30,6 +33,7 @@ class MainActivity : ComponentActivity() { WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, ) + checkAppUpdate() setContent { val windowSizeClass = calculateWindowSizeClass(activity = this) val displayFeatures = calculateDisplayFeatures(activity = this) @@ -43,4 +47,23 @@ class MainActivity : ComponentActivity() { } } } + + private fun checkAppUpdate() { + val appUpdateManager = AppUpdateManagerFactory.create(this) + val appUpdateInfoTask = appUpdateManager.appUpdateInfo + + appUpdateInfoTask.addOnSuccessListener { appUpdateInfo -> + val isUpdateAvailable = + appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE + + if (isUpdateAvailable && appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)) { + appUpdateManager.startUpdateFlowForResult( + appUpdateInfo, + AppUpdateType.IMMEDIATE, + this, + 0, + ) + } + } + } } From a9889227a4943450f9f0298f457079ceb866d2a7 Mon Sep 17 00:00:00 2001 From: uiel Date: Sat, 8 Jun 2024 17:12:35 +0900 Subject: [PATCH 3/4] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20::=20=EB=9D=BC?= =?UTF-8?q?=EC=9D=B4=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle/libs.versions.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3f2c3ce6e..efd848904 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -4,7 +4,7 @@ accompanist = "0.34.0" androidx-window = "1.3.0-alpha02" activity = "1.8.2" appcompat = "1.6.1" -appUpdateKtx = "2.1.0" +appUpdate = "2.1.0" core = "1.12.0" datastorePreferences = "1.0.0" espresso = "3.5.1" @@ -59,7 +59,7 @@ androidx-compose-material = { group = "androidx.compose.material3", name = "mate androidx-compose-material-window = { group = "androidx.compose.material3", name = "material3-window-size-class-android", version.ref = "materialCompose" } androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigation" } androidx-hilt-navigation-compose = { module = "androidx.hilt:hilt-navigation-compose", version.ref = "hiltNavigation" } -app-update-ktx = { module = "com.google.android.play:app-update-ktx", version.ref = "appUpdateKtx" } +app-update-ktx = { module = "com.google.android.play:app-update", version.ref = "appUpdate" } composeDestinations = { group = "io.github.raamcosta.compose-destinations", name = "animations-core", version.ref = "composeDestination" } composeDestinations-ksp = { group = "io.github.raamcosta.compose-destinations", name = "ksp", version.ref = "composeDestination" } javax-inject = { module = "javax.inject:javax.inject", version.ref = "javaxInject" } From e272a177a689e82faa357a2320e072092acb4d27 Mon Sep 17 00:00:00 2001 From: uiel Date: Mon, 10 Jun 2024 08:41:39 +0900 Subject: [PATCH 4/4] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20::=20=EB=9D=BC?= =?UTF-8?q?=EC=9D=B4=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 2 +- gradle/libs.versions.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index c86233b8d..d317d8683 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -122,5 +122,5 @@ dependencies { testImplementation(libs.androidx.junit) androidTestImplementation(libs.androidx.junit) - implementation(libs.app.update.ktx) + implementation(libs.app.update) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index efd848904..1d7124e6f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -59,7 +59,7 @@ androidx-compose-material = { group = "androidx.compose.material3", name = "mate androidx-compose-material-window = { group = "androidx.compose.material3", name = "material3-window-size-class-android", version.ref = "materialCompose" } androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigation" } androidx-hilt-navigation-compose = { module = "androidx.hilt:hilt-navigation-compose", version.ref = "hiltNavigation" } -app-update-ktx = { module = "com.google.android.play:app-update", version.ref = "appUpdate" } +app-update = { module = "com.google.android.play:app-update-ktx", version.ref = "appUpdate" } composeDestinations = { group = "io.github.raamcosta.compose-destinations", name = "animations-core", version.ref = "composeDestination" } composeDestinations-ksp = { group = "io.github.raamcosta.compose-destinations", name = "ksp", version.ref = "composeDestination" } javax-inject = { module = "javax.inject:javax.inject", version.ref = "javaxInject" }