Skip to content

Commit b77456b

Browse files
runningcodeclaude
andauthored
feat(distribution): Add isEnabled method to IDistributionApi (#4816)
Add a new isEnabled() method to the IDistributionApi interface to allow checking whether the distribution integration is active. The real DistributionIntegration returns true, while NoOpDistributionApi returns false. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
1 parent c1a5465 commit b77456b

File tree

5 files changed

+24
-0
lines changed

5 files changed

+24
-0
lines changed

sentry-android-distribution/api/sentry-android-distribution.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ public final class io/sentry/android/distribution/DistributionIntegration : io/s
33
public fun checkForUpdate (Lio/sentry/IDistributionApi$UpdateCallback;)V
44
public fun checkForUpdateBlocking ()Lio/sentry/UpdateStatus;
55
public fun downloadUpdate (Lio/sentry/UpdateInfo;)V
6+
public fun isEnabled ()Z
67
public fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V
78
}
89

sentry-android-distribution/src/main/java/io/sentry/android/distribution/DistributionIntegration.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,15 @@ public class DistributionIntegration(context: Context) : Integration, IDistribut
112112
}
113113
}
114114

115+
/**
116+
* Check if the distribution integration is enabled.
117+
*
118+
* @return true if the distribution integration is enabled
119+
*/
120+
public override fun isEnabled(): Boolean {
121+
return true
122+
}
123+
115124
private fun createUpdateCheckParams(): DistributionHttpClient.UpdateCheckParams {
116125
return try {
117126
val packageManager = context.packageManager

sentry/api/sentry.api

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,7 @@ public abstract interface class io/sentry/IDistributionApi {
779779
public abstract fun checkForUpdate (Lio/sentry/IDistributionApi$UpdateCallback;)V
780780
public abstract fun checkForUpdateBlocking ()Lio/sentry/UpdateStatus;
781781
public abstract fun downloadUpdate (Lio/sentry/UpdateInfo;)V
782+
public abstract fun isEnabled ()Z
782783
}
783784

784785
public abstract interface class io/sentry/IDistributionApi$UpdateCallback {
@@ -1497,6 +1498,7 @@ public final class io/sentry/NoOpDistributionApi : io/sentry/IDistributionApi {
14971498
public fun checkForUpdateBlocking ()Lio/sentry/UpdateStatus;
14981499
public fun downloadUpdate (Lio/sentry/UpdateInfo;)V
14991500
public static fun getInstance ()Lio/sentry/NoOpDistributionApi;
1501+
public fun isEnabled ()Z
15001502
}
15011503

15021504
public final class io/sentry/NoOpEnvelopeReader : io/sentry/IEnvelopeReader {

sentry/src/main/java/io/sentry/IDistributionApi.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ public interface IDistributionApi {
3737
*/
3838
void downloadUpdate(@NotNull UpdateInfo info);
3939

40+
/**
41+
* Check if the distribution integration is enabled.
42+
*
43+
* @return true if the distribution integration is enabled, false otherwise
44+
*/
45+
boolean isEnabled();
46+
4047
/** Callback interface for receiving async update check results. */
4148
interface UpdateCallback {
4249
void onResult(@NotNull UpdateStatus status);

sentry/src/main/java/io/sentry/NoOpDistributionApi.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,9 @@ public void checkForUpdate(@NotNull UpdateCallback onResult) {
2929
public void downloadUpdate(@NotNull UpdateInfo info) {
3030
// No-op implementation - do nothing
3131
}
32+
33+
@Override
34+
public boolean isEnabled() {
35+
return false;
36+
}
3237
}

0 commit comments

Comments
 (0)