@@ -15,18 +15,16 @@ import io.flutter.plugin.common.MethodChannel.MethodCallHandler
1515import io.flutter.plugin.common.MethodChannel.Result
1616import io.sentry.Breadcrumb
1717import io.sentry.DateUtils
18- import io.sentry.HubAdapter
18+ import io.sentry.ScopesAdapter
1919import io.sentry.Sentry
2020import io.sentry.android.core.InternalSentrySdk
21- import io.sentry.android.core.LoadClass
2221import io.sentry.android.core.SentryAndroid
2322import io.sentry.android.core.SentryAndroidOptions
2423import io.sentry.android.core.performance.AppStartMetrics
2524import io.sentry.android.core.performance.TimeSpan
2625import io.sentry.android.replay.ReplayIntegration
2726import io.sentry.android.replay.ScreenshotRecorderConfig
2827import io.sentry.protocol.DebugImage
29- import io.sentry.protocol.SentryId
3028import io.sentry.protocol.User
3129import io.sentry.transport.CurrentDateProvider
3230import org.json.JSONObject
@@ -289,7 +287,7 @@ class SentryFlutterPlugin :
289287 result : Result ,
290288 ) {
291289 if (user != null ) {
292- val options = HubAdapter .getInstance().options
290+ val options = ScopesAdapter .getInstance().options
293291 val userInstance = User .fromMap(user, options)
294292 Sentry .setUser(userInstance)
295293 } else {
@@ -303,7 +301,7 @@ class SentryFlutterPlugin :
303301 result : Result ,
304302 ) {
305303 if (breadcrumb != null ) {
306- val options = HubAdapter .getInstance().options
304+ val options = ScopesAdapter .getInstance().options
307305 val breadcrumbInstance = Breadcrumb .fromMap(breadcrumb, options)
308306 Sentry .addBreadcrumb(breadcrumbInstance)
309307 }
@@ -371,7 +369,7 @@ class SentryFlutterPlugin :
371369 }
372370
373371 private fun closeNativeSdk (result : Result ) {
374- HubAdapter .getInstance().close()
372+ ScopesAdapter .getInstance().close()
375373
376374 result.success(" " )
377375 }
@@ -385,15 +383,17 @@ class SentryFlutterPlugin :
385383
386384 private const val NATIVE_CRASH_WAIT_TIME = 500L
387385
386+ @Suppress(" unused" ) // Used by native/jni bindings
388387 @JvmStatic
389388 fun privateSentryGetReplayIntegration (): ReplayIntegration ? = replay
390389
391390 @JvmStatic
392391 fun getApplicationContext (): Context ? = applicationContext
393392
393+ @Suppress(" unused" ) // Used by native/jni bindings
394394 @JvmStatic
395395 fun loadContextsAsBytes (): ByteArray? {
396- val options = HubAdapter .getInstance().options
396+ val options = ScopesAdapter .getInstance().options
397397 val context = getApplicationContext()
398398 if (options !is SentryAndroidOptions || context == null ) {
399399 return null
@@ -409,9 +409,10 @@ class SentryFlutterPlugin :
409409 return json.toByteArray(Charsets .UTF_8 )
410410 }
411411
412+ @Suppress(" unused" ) // Used by native/jni bindings
412413 @JvmStatic
413414 fun loadDebugImagesAsBytes (addresses : Set <String >): ByteArray? {
414- val options = HubAdapter .getInstance().options as SentryAndroidOptions
415+ val options = ScopesAdapter .getInstance().options as SentryAndroidOptions
415416
416417 val debugImages =
417418 if (addresses.isEmpty()) {
@@ -447,7 +448,7 @@ class SentryFlutterPlugin :
447448 private fun crash () {
448449 val exception = RuntimeException (" FlutterSentry Native Integration: Sample RuntimeException" )
449450 val mainThread = Looper .getMainLooper().thread
450- mainThread.uncaughtExceptionHandler.uncaughtException(mainThread, exception)
451+ mainThread.uncaughtExceptionHandler? .uncaughtException(mainThread, exception)
451452 mainThread.join(NATIVE_CRASH_WAIT_TIME )
452453 }
453454
0 commit comments