From e91bab30dc7ca9326d06b3c88634ffea4a8f0690 Mon Sep 17 00:00:00 2001 From: Kenny Yi Date: Wed, 13 Sep 2023 10:34:42 -0700 Subject: [PATCH] remove force unwrap --- src/main/java/com/statsig/androidsdk/ErrorBoundary.kt | 2 +- .../com/statsig/androidsdk/AsyncInitVsUpdateTest.kt | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/statsig/androidsdk/ErrorBoundary.kt b/src/main/java/com/statsig/androidsdk/ErrorBoundary.kt index 22fe857..6b0429b 100644 --- a/src/main/java/com/statsig/androidsdk/ErrorBoundary.kt +++ b/src/main/java/com/statsig/androidsdk/ErrorBoundary.kt @@ -111,7 +111,7 @@ internal class ErrorBoundary() { val clientBuilder = OkHttpClient.Builder() - clientBuilder.addInterceptor(RequestHeaderInterceptor(apiKey!!)) + clientBuilder.addInterceptor(RequestHeaderInterceptor(apiKey ?: "")) clientBuilder.addInterceptor(ResponseInterceptor()) val httpClient = clientBuilder.build() diff --git a/src/test/java/com/statsig/androidsdk/AsyncInitVsUpdateTest.kt b/src/test/java/com/statsig/androidsdk/AsyncInitVsUpdateTest.kt index 834953e..96e1be4 100644 --- a/src/test/java/com/statsig/androidsdk/AsyncInitVsUpdateTest.kt +++ b/src/test/java/com/statsig/androidsdk/AsyncInitVsUpdateTest.kt @@ -90,14 +90,8 @@ class AsyncInitVsUpdateTest { } } - var elapsed = kotlin.system.measureTimeMillis { - Statsig.initializeAsync(app, "client-key", userA, callback) - } - print("initializeAsync $elapsed") - elapsed = kotlin.system.measureTimeMillis { - Statsig.updateUserAsync(userB, callback) - } - print("updateUserAsync $elapsed") + Statsig.initializeAsync(app, "client-key", userA, callback) + Statsig.updateUserAsync(userB, callback) // Since updateUserAsync has been called, we void values for user_a var config = Statsig.getConfig("a_config")