Skip to content

Commit 74eb694

Browse files
committed
Update impl
1 parent 6d1e35e commit 74eb694

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

flutter/lib/src/sentry_privacy_options.dart

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,20 @@ class SentryPrivacyOptions {
4141
mask: false,
4242
name: 'SentryUnmask',
4343
));
44+
// TODO: check for Flutter version and make this testable
45+
rules.add(SentryMaskingCustomRule<Widget>(
46+
callback: (Element element, Widget widget) {
47+
dynamic dynWidget = widget;
48+
try {
49+
final sensitivity = dynWidget.sensitivity;
50+
assert(sensitivity is Enum);
51+
return SentryMaskingDecision.mask;
52+
} catch (e) {
53+
return SentryMaskingDecision.continueProcessing;
54+
}
55+
},
56+
name: 'SensitiveContent',
57+
description: 'Mask SensitiveContent'));
4458

4559
// Then, we apply apply rules based on the configuration.
4660
if (maskAllImages) {
@@ -75,11 +89,6 @@ class SentryPrivacyOptions {
7589
));
7690
}
7791

78-
rules.add(const SentryMaskingConstantRule<SensitiveContent>(
79-
mask: true,
80-
name: 'SensitiveContent',
81-
));
82-
8392
// In Debug mode, check if users explicitly mask (or unmask) widgets that
8493
// look like they should be masked, e.g. Videos, WebViews, etc.
8594
if (runtimeChecker.isDebugMode()) {

0 commit comments

Comments
 (0)