Commit a9bfbb9
refactor(distribution): Use interface pattern for distribution API (#4731)
* refactor(distribution): Use interface pattern for distribution API
Address PR feedback from #4712:
- Refactor Sentry.distribution() to follow existing replay() pattern
- Create IDistributionApi interface with core methods (checkForUpdateBlocking, checkForUpdate, downloadUpdate)
- Add distributionController to SentryOptions with NoOp default
- Use getCurrentScopes().getScope().getOptions().getDistributionController() access pattern
- Remove reflection-based implementation for type safety
- Provide NoOpDistributionApi fallback when module not available
This follows the established architecture pattern used by replay API,
allowing distribution integrations to register real implementations
via options.setDistributionController() during integration registration.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* feat(distribution): Complete distribution module implementation
- Update AndroidOptionsInitializer to use new DistributionIntegration constructor
- Refactor DistributionIntegration to implement IDistributionApi methods directly
- Remove internal package structure and DistributionInternal dependency
- Update class names from Distribution to DistributionIntegration for clarity
- Convert data classes to regular classes to match API requirements
- Rename organizationSlug to orgSlug for consistency
- Implement downloadUpdate using Android Intent system
- Remove completed Distribution singleton approach
This completes the distribution module implementation to work with
the new interface-based API pattern from the previous commit.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* feat(distribution): Move UpdateStatus and UpdateInfo to core sentry module
- Move UpdateStatus and UpdateInfo from distribution module to core sentry module
- Update IDistributionApi to use proper types instead of Object
- Add UpdateCallback interface for type-safe async callbacks
- Rename UpdateStatus.Error to UpdateError to avoid java.lang.Error clash
- Update DistributionIntegration to implement IDistributionApi with proper types
- Remove duplicate classes from distribution module
- Regenerate API files with proper type signatures
This provides full type safety for the distribution API while keeping
the types accessible to all modules that might need them.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* fix(distribution): Update ProGuard rules for new DistributionIntegration class path
- Update ProGuard rules from `internal.DistributionIntegration` to `DistributionIntegration`
- Fixes R8 missing class error in release builds
- Ensures DistributionIntegration class is properly kept during code shrinking
This addresses the build failure in Android integration tests where R8 was
removing the DistributionIntegration class that is referenced by AndroidOptionsInitializer.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* chore(distribution): Update API dump to reflect interface refactor
- Update distribution module API file after refactoring to use interface pattern
- Class renamed from Distribution to DistributionIntegration
- Now implements IDistributionApi interface with proper method signatures
- Removed UpdateInfo and UpdateStatus classes (moved to core sentry module)
- Constructor now takes Context parameter
- Method signatures use proper types instead of Object parameters
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* refactor(distribution): Move DistributionOptions to SentryOptions to resolve circular dependency
- Move DistributionOptions from SentryAndroidOptions to SentryOptions to resolve circular dependency between sentry-android-core and sentry-android-distribution modules
- Simplify DistributionIntegration.register() to work with SentryOptions directly instead of requiring SentryAndroidOptions
- Remove separate DistributionOptions.kt file
- Update API dumps
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* fix(distribution): Correct DistributionIntegration class name reference in SentryAndroid
---------
Co-authored-by: Claude <[email protected]>1 parent ce0a49e commit a9bfbb9
File tree
19 files changed
+361
-279
lines changed- sentry-android-core
- src/main/java/io/sentry/android/core
- sentry-android-distribution
- api
- src/main
- java/io/sentry/android/distribution
- internal
- sentry
- api
- src/main/java/io/sentry
19 files changed
+361
-279
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
84 | | - | |
| 83 | + | |
| 84 | + | |
85 | 85 | | |
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
394 | 394 | | |
395 | 395 | | |
396 | 396 | | |
397 | | - | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
398 | 400 | | |
399 | 401 | | |
400 | 402 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
Lines changed: 5 additions & 76 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
77 | 6 | | |
78 | 7 | | |
79 | 8 | | |
This file was deleted.
Lines changed: 0 additions & 87 deletions
This file was deleted.
Lines changed: 76 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 0 additions & 13 deletions
This file was deleted.
0 commit comments