Skip to content
Merged
Prev Previous commit
Next Next commit
Fix CI compilation errors in DistributionHttpClient
- Update UpdateCheckParams constructor to use separate versionCode and versionName parameters
- Replace Android Uri with string building for better compatibility
- Remove unused Android Uri import
- Update URL construction to use build_number and build_version query parameters

This fixes the CI compilation errors where the old constructor expected a single 'version' parameter.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
  • Loading branch information
runningcode and claude committed Sep 29, 2025
commit b7da7e409e9e201214ebb9ea5c3a63cc0fe7bceb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.sentry.android.distribution

import android.net.Uri
import io.sentry.SentryLevel
import io.sentry.SentryOptions
import java.io.BufferedReader
Expand All @@ -25,7 +24,8 @@ internal class DistributionHttpClient(private val options: SentryOptions) {
val mainBinaryIdentifier: String,
val appId: String,
val platform: String = "android",
val version: String,
val versionCode: Int,
val versionName: String,
)

/**
Expand All @@ -47,22 +47,16 @@ internal class DistributionHttpClient(private val options: SentryOptions) {
)
}

val uri =
Uri.parse(baseUrl)
.buildUpon()
.appendPath("api")
.appendPath("0")
.appendPath("projects")
.appendPath(orgSlug)
.appendPath(projectSlug)
.appendPath("preprodartifacts")
.appendPath("check-for-updates")
.appendQueryParameter("main_binary_identifier", params.mainBinaryIdentifier)
.appendQueryParameter("app_id", params.appId)
.appendQueryParameter("platform", params.platform)
.appendQueryParameter("version", params.version)
.build()
val url = URL(uri.toString())
val urlString = buildString {
append(baseUrl.trimEnd('/'))
append("/api/0/projects/$orgSlug/$projectSlug/preprodartifacts/check-for-updates/")
append("?main_binary_identifier=${params.mainBinaryIdentifier}")
append("&app_id=${params.appId}")
append("&platform=${params.platform}")
append("&build_number=${params.versionCode}")
append("&build_version=${params.versionName}")
}
val url = URL(urlString)

return try {
makeRequest(url, authToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class DistributionHttpClientTest {
DistributionHttpClient.UpdateCheckParams(
mainBinaryIdentifier = "com.emergetools.hackernews",
appId = "com.emergetools.hackernews",
platform = "android",
version = "1.0.0",
versionName = "1.0.0",
versionCode = 5,
)

val response = httpClient.checkForUpdates(params)
Expand Down
7 changes: 4 additions & 3 deletions sentry/src/main/java/io/sentry/UpdateInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/** Information about an available app update. */
@ApiStatus.Experimental
Expand All @@ -11,15 +12,15 @@ public final class UpdateInfo {
private final int buildNumber;
private final @NotNull String downloadUrl;
private final @NotNull String appName;
private final @NotNull String createdDate;
private final @Nullable String createdDate;

public UpdateInfo(
final @NotNull String id,
final @NotNull String buildVersion,
final int buildNumber,
final @NotNull String downloadUrl,
final @NotNull String appName,
final @NotNull String createdDate) {
final @Nullable String createdDate) {
this.id = id;
this.buildVersion = buildVersion;
this.buildNumber = buildNumber;
Expand Down Expand Up @@ -48,7 +49,7 @@ public int getBuildNumber() {
return appName;
}

public @NotNull String getCreatedDate() {
public @Nullable String getCreatedDate() {
return createdDate;
}
}