From a448f36a3f5fd29e49c7108f0ceed6ebfe365b52 Mon Sep 17 00:00:00 2001 From: Hector Date: Thu, 19 Dec 2024 21:05:59 +0000 Subject: [PATCH] [distribution] Send version{Code,Name} when checking for updates --- .../distribution/internal/DistributionInternal.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/distribution/distribution/src/main/kotlin/com/emergetools/distribution/internal/DistributionInternal.kt b/distribution/distribution/src/main/kotlin/com/emergetools/distribution/internal/DistributionInternal.kt index 86836963..cbfa0c34 100644 --- a/distribution/distribution/src/main/kotlin/com/emergetools/distribution/internal/DistributionInternal.kt +++ b/distribution/distribution/src/main/kotlin/com/emergetools/distribution/internal/DistributionInternal.kt @@ -206,6 +206,10 @@ private suspend fun doCheckForUpdate(context: Context, state: State): UpdateStat return UpdateStatus.Error("No API key available") } + val info = context.packageManager.getPackageInfo(applicationId, 0) + val version = info.versionName + val build = info.versionCode + val url = HttpUrl.Builder().apply { scheme("https") host("api.emergetools.com") @@ -214,6 +218,8 @@ private suspend fun doCheckForUpdate(context: Context, state: State): UpdateStat addQueryParameter("apiKey", apiKey) addQueryParameter("tag", state.tag) addQueryParameter("appId", applicationId) + addQueryParameter("version", version) + addQueryParameter("build", build.toString()) addQueryParameter("platform", "android") }.build()