From 8c69a1bbab249d85763206bb079683186dcc2b4f Mon Sep 17 00:00:00 2001 From: Giancarlo Buenaflor Date: Fri, 8 Nov 2024 15:31:54 +0100 Subject: [PATCH] fix: android build error when compiling (#2397) * fix * update CHANGELOG * update * fix detekt --- CHANGELOG.md | 6 ++++++ .../src/main/kotlin/io/sentry/flutter/SentryFlutter.kt | 2 +- .../main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 495cb59fa1..f4a736708e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Fixes + +- Android build error when compiling ([#2397](https://github.com/getsentry/sentry-dart/pull/2397)) + ## 8.10.0 ### Features diff --git a/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutter.kt b/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutter.kt index b97ae707cc..e7964cefca 100644 --- a/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutter.kt +++ b/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutter.kt @@ -65,7 +65,7 @@ class SentryFlutter( } data.getIfNotNull("diagnosticLevel") { if (options.isDebug) { - val sentryLevel = SentryLevel.valueOf(it.uppercase(Locale.ROOT)) + val sentryLevel = SentryLevel.valueOf(it.toUpperCase(Locale.ROOT)) options.setDiagnosticLevel(sentryLevel) } } diff --git a/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt b/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt index a6d4516152..d3a03efb0c 100644 --- a/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt +++ b/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt @@ -34,8 +34,8 @@ import io.sentry.protocol.User import io.sentry.transport.CurrentDateProvider import java.io.File import java.lang.ref.WeakReference -import kotlin.time.DurationUnit -import kotlin.time.toDuration + +private const val APP_START_MAX_DURATION_MS = 60000 class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { private lateinit var channel: MethodChannel @@ -174,7 +174,7 @@ class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { val appStartMetrics = AppStartMetrics.getInstance() if (!appStartMetrics.isAppLaunchedInForeground || - appStartMetrics.appStartTimeSpan.durationMs > 1.toDuration(DurationUnit.MINUTES).inWholeMilliseconds + appStartMetrics.appStartTimeSpan.durationMs > APP_START_MAX_DURATION_MS ) { Log.w( "Sentry",