Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[distribution] Send version{Code,Name} when checking for updates #319

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading