Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include and set ProGuard uuid in Flutter Options #1312

Merged
merged 6 commits into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Features

- Add proguard_uui property to SentryFlutterOptions to set proguard information at runtime ([#1312](https://github.com/getsentry/sentry-dart/pull/1312))

### Fixes

- Change podspec `EXCLUDED_ARCHS` value to allow podfiles to add more excluded architetures ([#1303](https://github.com/getsentry/sentry-dart/pull/1303))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
args.getIfNotNull<Boolean>("anrEnabled") { options.isAnrEnabled = it }
args.getIfNotNull<Boolean>("sendDefaultPii") { options.isSendDefaultPii = it }
args.getIfNotNull<Boolean>("enableNdkScopeSync") { options.isEnableScopeSync = it }
args.getIfNotNull<String>("proguardUuid") { options.proguardUuid = it }

val nativeCrashHandling = (args["enableNativeCrashHandling"] as? Boolean) ?: true
// nativeCrashHandling has priority over anrEnabled
Expand Down
1 change: 1 addition & 0 deletions flutter/config/detekt-bl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<ManuallySuppressedIssues></ManuallySuppressedIssues>
<CurrentIssues>
<ID>ComplexMethod:SentryFlutterPlugin.kt$SentryFlutterPlugin$override fun onMethodCall(call: MethodCall, result: Result)</ID>
<ID>LongMethod:SentryFlutterPlugin.kt$SentryFlutterPlugin$private fun initNativeSdk(call: MethodCall, result: Result)</ID>
<ID>MagicNumber:MainActivity.kt$MainActivity$6_000</ID>
<ID>TooGenericExceptionCaught:MainActivity.kt$MainActivity$e: Exception</ID>
<ID>TooGenericExceptionThrown:MainActivity.kt$MainActivity$throw Exception("Catch this java exception thrown from Kotlin thread!")</ID>
Expand Down
1 change: 1 addition & 0 deletions flutter/lib/src/integrations/native_sdk_integration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class NativeSdkIntegration extends Integration<SentryFlutterOptions> {
'enableNdkScopeSync': options.enableNdkScopeSync,
'enableAutoPerformanceTracking': options.enableAutoPerformanceTracking,
'sendClientReports': options.sendClientReports,
'proguardUuid': options.proguardUuid,
});

options.sdk.addIntegration('nativeSdkIntegration');
Expand Down
3 changes: 3 additions & 0 deletions flutter/lib/src/sentry_flutter_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ class SentryFlutterOptions extends SentryOptions {
/// runApp(SentryUserInteractionWidget(child: App()));
bool enableUserInteractionTracing = false;

/// Sets the Proguard uuid for Android platform.
String? proguardUuid;

@internal
late RendererWrapper rendererWrapper = RendererWrapper();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ void main() {
'enableOutOfMemoryTracking': true,
'enableNdkScopeSync': false,
'enableAutoPerformanceTracking': true,
'sendClientReports': true
'sendClientReports': true,
'proguardUuid': null
});
});

Expand Down Expand Up @@ -88,7 +89,8 @@ void main() {
..enableOutOfMemoryTracking = false
..enableNdkScopeSync = true
..enableAutoPerformanceTracking = false
..sendClientReports = false;
..sendClientReports = false
..proguardUuid = fakeProguardUuid;

options.sdk.addIntegration('foo');
options.sdk.addPackage('bar', '1');
Expand Down Expand Up @@ -124,7 +126,8 @@ void main() {
'enableOutOfMemoryTracking': false,
'enableNdkScopeSync': true,
'enableAutoPerformanceTracking': false,
'sendClientReports': false
'sendClientReports': false,
'proguardUuid': fakeProguardUuid
});
});

Expand Down
1 change: 1 addition & 0 deletions flutter/test/mocks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import 'mocks.mocks.dart';
import 'no_such_method_provider.dart';

const fakeDsn = 'https://abc@def.ingest.sentry.io/1234567';
const fakeProguardUuid = '3457d982-65ef-576d-a6ad-65b5f30f49a5';

// https://github.com/dart-lang/mockito/blob/master/NULL_SAFETY_README.md#fallback-generators
ISentrySpan startTransactionShim(
Expand Down