Skip to content

Commit

Permalink
Merge branch 'main' into feat/windows-native
Browse files Browse the repository at this point in the history
  • Loading branch information
vaind authored Sep 24, 2024
2 parents 4701791 + 48c3cf1 commit 5136aaa
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @krystofwoldrich @stefanosiano @buenaflor
* @krystofwoldrich @stefanosiano @buenaflor @martinhaintz
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Features

- Blocking app starts if "appLaunchedInForeground" is false. (Android only) ([#2291](https://github.com/getsentry/sentry-dart/pull/2291)
- Windows native error & obfuscation support ([#2286](https://github.com/getsentry/sentry-dart/pull/2286))

### Enhancements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class SentryFlutter(
}
data.getIfNotNull<String>("diagnosticLevel") {
if (options.isDebug) {
val sentryLevel = SentryLevel.valueOf(it.toUpperCase(Locale.ROOT))
val sentryLevel = SentryLevel.valueOf(it.uppercase(Locale.ROOT))
options.setDiagnosticLevel(sentryLevel)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +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

class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
private lateinit var channel: MethodChannel
Expand Down Expand Up @@ -171,6 +173,16 @@ class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {

val appStartMetrics = AppStartMetrics.getInstance()

if (!appStartMetrics.isAppLaunchedInForeground ||
appStartMetrics.appStartTimeSpan.durationMs > 1.toDuration(DurationUnit.MINUTES).inWholeMilliseconds
) {
Log.w(
"Sentry",
"Invalid app start data: app not launched in foreground or app start took too long (>60s)",
)
result.success(null)
}

val appStartTimeSpan = appStartMetrics.appStartTimeSpan
val appStartTime = appStartTimeSpan.startTimestamp
val isColdStart = appStartMetrics.appStartType == AppStartMetrics.AppStartType.COLD
Expand Down

0 comments on commit 5136aaa

Please sign in to comment.