Skip to content

Commit

Permalink
[distribution] Send version{Code,Name} when checking for updates (#319)
Browse files Browse the repository at this point in the history
  • Loading branch information
chromy authored Dec 19, 2024
1 parent 633badc commit f8f7dd3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions distribution/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to build distribution will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

- Add version{Code,Name} when checking for updates. This prevents suggesting the current build as an update. [#319](https://github.com/EmergeTools/emerge-android/pull/319)

## 0.0.2 - 2024-12-12

- Relax API response constraints [#310](https://github.com/EmergeTools/emerge-android/pull/310)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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()

Expand Down

0 comments on commit f8f7dd3

Please sign in to comment.