Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f19a466

Browse files
Renamed binder to MauiSessionReplayMaskControlsOfTypeBinder
1 parent 54cda92 commit f19a466

File tree

4 files changed

+26
-24
lines changed

4 files changed

+26
-24
lines changed

samples/Sentry.Samples.Maui/MauiProgram.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,18 @@ public static MauiApp CreateMauiApp()
4545
options.AddCommunityToolkitIntegration();
4646

4747
#if __ANDROID__
48-
// Currently experimental support is only available on Android
48+
// Currently, experimental support is only available on Android
4949
options.Native.ExperimentalOptions.SessionReplay.OnErrorSampleRate = 1.0;
5050
options.Native.ExperimentalOptions.SessionReplay.SessionSampleRate = 1.0;
5151
// Mask all images and text by default. This can be overridden for individual view elements via the
5252
// sentry:SessionReplay.Mask XML attribute (see MainPage.xaml for an example)
5353
options.Native.ExperimentalOptions.SessionReplay.MaskAllImages = true;
5454
options.Native.ExperimentalOptions.SessionReplay.MaskAllText = true;
55-
// Alternatively the masking behaviour for entire classes of VisualElements can be configured here as
55+
// Alternatively, the masking behaviour for entire classes of VisualElements can be configured here as
5656
// an exception to the default behaviour.
57+
// WARNING: In apps with complex user interfaces, consisting of hundreds of visual controls on a single
58+
// page, this option may cause performance issues. In such cases, consider applying the
59+
// sentry:SessionReplay.Mask="Unmask" attribute to individual controls instead.
5760
options.Native.ExperimentalOptions.SessionReplay.UnmaskControlsOfType<Button>();
5861
#endif
5962

File renamed without changes.

src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public static MauiAppBuilder UseSentry(this MauiAppBuilder builder,
7474
configureOptions?.Invoke(options);
7575
#if __ANDROID__
7676
var replayOptions = options.Native.ExperimentalOptions.SessionReplay;
77-
if (replayOptions is { IsCustomMaskingEnabled: true, IsSessionReplayEnabled: true })
77+
if (replayOptions is { IsSessionReplayEnabled: true, IsTypeMaskingUsed: true })
7878
{
7979
services.AddSingleton<IMauiElementEventBinder, MauiCustomSessionReplayMaskBinder>();
8080
}

src/Sentry/Platforms/Android/NativeOptions.cs

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -276,40 +276,39 @@ public class NativeSentryReplayOptions
276276
internal HashSet<Type> MaskedControls { get; } = [];
277277
internal HashSet<Type> UnmaskedControls { get; } = [];
278278

279-
internal bool IsCustomMaskingEnabled { get; private set; }
280-
281279
internal bool IsSessionReplayEnabled => OnErrorSampleRate > 0.0 || SessionSampleRate > 0.0;
282280

281+
/// <summary>
282+
/// Allows you to mask all controls of a particular type for session replay recordings.
283+
/// </summary>
284+
/// <typeparam name="T">The Type of control that should be masked</typeparam>
285+
/// <remarks>
286+
/// WARNING: In apps with complex user interfaces, consisting of hundreds of visual controls on a single
287+
/// page, this option may cause performance issues. In such cases, consider applying SessionReplay.Mask
288+
/// attributes to individual controls instead:
289+
/// <code>sentry:SessionReplay.Mask="Mask"</code>
290+
/// </remarks>
283291
public void MaskControlsOfType<T>()
284292
{
285293
MaskedControls.Add(typeof(T));
286294
}
287295

288-
public void UnmaskControlsOfType<T>()
289-
{
290-
UnmaskedControls.Add(typeof(T));
291-
}
292-
293296
/// <summary>
294-
/// <para>
295-
/// The <see cref="MaskAllImages"/> and <see cref="MaskAllText"/> and <see cref="MaskControlsOfType"/>
296-
/// options allow you to set the default masking behaviour for all visual elements of certain types.
297-
/// </para>
298-
/// <para>
299-
/// This option enables the use of `sentry:SessionReplay.Mask` attributes to override the masking behaviour
300-
/// of specific visual elemennts (for example masking a specific image even though images more generally are
301-
/// not masked).
302-
/// </para>
297+
/// Allows you to unmask all controls of a particular type for session replay recordings.
298+
/// </summary>
299+
/// <typeparam name="T">The Type of control that should be unmasked</typeparam>
303300
/// <remarks>
304301
/// WARNING: In apps with complex user interfaces, consisting of hundreds of visual controls on a single
305-
/// page, enabling this option may cause performance issues.
302+
/// page, this option may cause performance issues. In such cases, consider applying SessionReplay.Mask
303+
/// attributes to individual controls instead:
304+
/// <code>sentry:SessionReplay.Mask="Unmask"</code>
306305
/// </remarks>
307-
/// </summary>
308-
public NativeSentryReplayOptions EnableCustomSessionReplayMasks()
306+
public void UnmaskControlsOfType<T>()
309307
{
310-
IsCustomMaskingEnabled = true;
311-
return this;
308+
UnmaskedControls.Add(typeof(T));
312309
}
310+
311+
internal bool IsTypeMaskingUsed => MaskedControls.Count > 0 || UnmaskedControls.Count > 0;
313312
}
314313

315314
/// <summary>

0 commit comments

Comments
 (0)