From e2d89fc73b84c81801b638f4be7c488d53b7960d Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Mon, 27 Mar 2023 10:37:49 +0200 Subject: [PATCH] Add missing props (#1354) --- CHANGELOG.md | 4 +++ .../io/sentry/flutter/SentryFlutterPlugin.kt | 2 ++ .../Classes/SentryFlutterPluginApple.swift | 26 ++++++++++++------- .../integrations/native_sdk_integration.dart | 7 +++-- flutter/lib/src/sentry_flutter_options.dart | 5 ++++ .../init_native_sdk_integration_test.dart | 23 ++++++++-------- min_version_test/lib/main.dart | 1 + 7 files changed, 43 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ae4aa0928..a221e31ca6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ - [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#832) - [diff](https://github.com/getsentry/sentry-cocoa/compare/8.3.1...8.3.2) +## Fixes + +- Sync missing properties to the Native SDKs ([#1354](https://github.com/getsentry/sentry-dart/pull/1354)) + ## 7.2.0 ### Features 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 01e5b2f479..ac931193f2 100644 --- a/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt +++ b/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt @@ -166,6 +166,8 @@ class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { args.getIfNotNull("sendClientReports") { options.isSendClientReports = it } + args.getIfNotNull("maxAttachmentSize") { options.maxAttachmentSize = it } + val name = "sentry.java.android.flutter" var sdkVersion = options.sdkVersion diff --git a/flutter/ios/Classes/SentryFlutterPluginApple.swift b/flutter/ios/Classes/SentryFlutterPluginApple.swift index 7eb9cefdcd..a0d2a802e8 100644 --- a/flutter/ios/Classes/SentryFlutterPluginApple.swift +++ b/flutter/ios/Classes/SentryFlutterPluginApple.swift @@ -313,18 +313,12 @@ public class SentryFlutterPluginApple: NSObject, FlutterPlugin { options.dist = dist } - if let enableAutoNativeBreadcrumbs = arguments["enableAutoNativeBreadcrumbs"] as? Bool, - enableAutoNativeBreadcrumbs == false { - options.integrations = options.integrations?.filter { (name) -> Bool in - name != "SentryAutoBreadcrumbTrackingIntegration" - } + if let enableAutoNativeBreadcrumbs = arguments["enableAutoNativeBreadcrumbs"] as? Bool { + options.enableAutoBreadcrumbTracking = false } - if let enableNativeCrashHandling = arguments["enableNativeCrashHandling"] as? Bool, - enableNativeCrashHandling == false { - options.integrations = options.integrations?.filter { (name) -> Bool in - name != "SentryCrashIntegration" - } + if let enableNativeCrashHandling = arguments["enableNativeCrashHandling"] as? Bool { + options.enableCrashHandler = false } if let maxBreadcrumbs = arguments["maxBreadcrumbs"] as? UInt { @@ -346,6 +340,18 @@ public class SentryFlutterPluginApple: NSObject, FlutterPlugin { if let sendClientReports = arguments["sendClientReports"] as? Bool { options.sendClientReports = sendClientReports } + + if let maxAttachmentSize = arguments["maxAttachmentSize"] as? UInt { + options.maxAttachmentSize = maxAttachmentSize + } + + if let captureFailedRequests = arguments["captureFailedRequests"] as? Bool { + options.enableCaptureFailedRequests = captureFailedRequests + } + + if let enableAppHangTracking = arguments["enableAppHangTracking"] as? Bool { + options.enableAppHangTracking = enableAppHangTracking + } } private func logLevelFrom(diagnosticLevel: String) -> SentryLevel { diff --git a/flutter/lib/src/integrations/native_sdk_integration.dart b/flutter/lib/src/integrations/native_sdk_integration.dart index a8a15a297a..b003391680 100644 --- a/flutter/lib/src/integrations/native_sdk_integration.dart +++ b/flutter/lib/src/integrations/native_sdk_integration.dart @@ -45,11 +45,10 @@ class NativeSdkIntegration extends Integration { 'enableNdkScopeSync': options.enableNdkScopeSync, 'enableAutoPerformanceTracing': options.enableAutoPerformanceTracing, 'sendClientReports': options.sendClientReports, - 'sdk': { - 'name': options.sdk.name, - 'version': options.sdk.version, - }, 'proguardUuid': options.proguardUuid, + 'maxAttachmentSize': options.maxAttachmentSize, + 'captureFailedRequests': options.captureFailedRequests, + 'enableAppHangTracking': options.enableAppHangTracking, }); options.sdk.addIntegration('nativeSdkIntegration'); diff --git a/flutter/lib/src/sentry_flutter_options.dart b/flutter/lib/src/sentry_flutter_options.dart index b61bef2f6e..811bf16781 100644 --- a/flutter/lib/src/sentry_flutter_options.dart +++ b/flutter/lib/src/sentry_flutter_options.dart @@ -194,6 +194,11 @@ class SentryFlutterOptions extends SentryOptions { @experimental bool attachViewHierarchy = false; + /// When enabled, the SDK tracks when the application stops responding for a + /// specific amount of time (default 2s). + /// Only available on iOS and macOS. + bool enableAppHangTracking = true; + /// By using this, you are disabling native [Breadcrumb] tracking and instead /// you are just tracking [Breadcrumb]s which result from events available /// in the current Flutter environment. diff --git a/flutter/test/integrations/init_native_sdk_integration_test.dart b/flutter/test/integrations/init_native_sdk_integration_test.dart index b3c93738a3..9140e7cc5b 100644 --- a/flutter/test/integrations/init_native_sdk_integration_test.dart +++ b/flutter/test/integrations/init_native_sdk_integration_test.dart @@ -56,11 +56,10 @@ void main() { 'enableNdkScopeSync': true, 'enableAutoPerformanceTracing': true, 'sendClientReports': true, - 'sdk': { - 'name': 'sentry.dart.flutter', - 'version': sdkVersion, - }, - 'proguardUuid': null + 'proguardUuid': null, + 'maxAttachmentSize': 20 * 1024 * 1024, + 'captureFailedRequests': true, + 'enableAppHangTracking': true, }); }); @@ -94,7 +93,10 @@ void main() { ..enableAutoPerformanceTracing = false ..sendClientReports = false ..enableNdkScopeSync = true - ..proguardUuid = fakeProguardUuid; + ..proguardUuid = fakeProguardUuid + ..maxAttachmentSize = 10 + ..captureFailedRequests = false + ..enableAppHangTracking = false; options.sdk.addIntegration('foo'); options.sdk.addPackage('bar', '1'); @@ -131,11 +133,10 @@ void main() { 'enableNdkScopeSync': true, 'enableAutoPerformanceTracing': false, 'sendClientReports': false, - 'sdk': { - 'name': 'sentry.dart.flutter', - 'version': sdkVersion, - }, - 'proguardUuid': fakeProguardUuid + 'proguardUuid': fakeProguardUuid, + 'maxAttachmentSize': 10, + 'captureFailedRequests': false, + 'enableAppHangTracking': false, }); }); diff --git a/min_version_test/lib/main.dart b/min_version_test/lib/main.dart index 3c4067d86f..98c440374e 100644 --- a/min_version_test/lib/main.dart +++ b/min_version_test/lib/main.dart @@ -163,6 +163,7 @@ class _MyHomePageState extends State { ), Text( '$_counter', + // ignore: deprecated_member_use style: Theme.of(context).textTheme.headline4, ), ],