@@ -4,7 +4,6 @@ import android.content.Context
44import android.content.Intent
55import android.net.Uri
66import io.sentry.android.distribution.internal.DistributionInternal
7- import java.util.concurrent.CompletableFuture
87
98/* *
109 * The public Android SDK for Sentry Build Distribution.
@@ -14,13 +13,25 @@ import java.util.concurrent.CompletableFuture
1413 */
1514public object Distribution {
1615 /* *
17- * Initialize build distribution with the provided options. This should be called once per
16+ * Initialize build distribution with default options. This should be called once per process,
17+ * typically in Application.onCreate().
18+ *
19+ * @param context Android context
20+ */
21+ public fun init (context : Context ) {
22+ init (context) {}
23+ }
24+
25+ /* *
26+ * Initialize build distribution with the provided configuration. This should be called once per
1827 * process, typically in Application.onCreate().
1928 *
2029 * @param context Android context
21- * @param options Configuration options for build distribution
30+ * @param configuration Configuration handler for build distribution options
2231 */
23- public fun init (context : Context , options : DistributionOptions ) {
32+ public fun init (context : Context , configuration : (DistributionOptions ) -> Unit ) {
33+ val options = DistributionOptions ()
34+ configuration(options)
2435 DistributionInternal .init (context, options)
2536 }
2637
@@ -35,24 +46,24 @@ public object Distribution {
3546
3647 /* *
3748 * Check for available updates synchronously (blocking call). This method will block the calling
38- * thread while making the network request. Consider using checkForUpdateCompletableFuture for
49+ * thread while making the network request. Consider using checkForUpdate with callback for
3950 * non-blocking behavior.
4051 *
4152 * @param context Android context
4253 * @return UpdateStatus indicating if an update is available, up to date, or error
4354 */
44- public fun checkForUpdate (context : Context ): UpdateStatus {
55+ public fun checkForUpdateBlocking (context : Context ): UpdateStatus {
4556 return DistributionInternal .checkForUpdate(context)
4657 }
4758
4859 /* *
49- * Check for available updates using CompletableFuture for Java compatibility .
60+ * Check for available updates asynchronously using a callback .
5061 *
5162 * @param context Android context
52- * @return CompletableFuture with UpdateStatus result
63+ * @param onResult Callback that will be called with the UpdateStatus result
5364 */
54- public fun checkForUpdateCompletableFuture (context : Context ): CompletableFuture < UpdateStatus > {
55- return DistributionInternal .checkForUpdateCompletableFuture (context)
65+ public fun checkForUpdate (context : Context , onResult : ( UpdateStatus ) -> Unit ) {
66+ DistributionInternal .checkForUpdateAsync (context, onResult )
5667 }
5768
5869 /* *
0 commit comments