From 5a2e59e122fbf4798218f963d2a73d07317cc781 Mon Sep 17 00:00:00 2001 From: Marco Saia Date: Tue, 19 Nov 2024 13:04:53 +0100 Subject: [PATCH] Warning logs for unknown SR privacy levels --- .../SessionReplayPrivacySettings.kt | 21 +++++++++++++++---- .../DdSessionReplayImplementation.swift | 6 +++--- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/packages/react-native-session-replay/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/SessionReplayPrivacySettings.kt b/packages/react-native-session-replay/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/SessionReplayPrivacySettings.kt index ef4975a05..5af4819fe 100644 --- a/packages/react-native-session-replay/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/SessionReplayPrivacySettings.kt +++ b/packages/react-native-session-replay/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/SessionReplayPrivacySettings.kt @@ -6,6 +6,7 @@ package com.datadog.reactnative.sessionreplay +import android.util.Log import com.datadog.android.sessionreplay.ImagePrivacy import com.datadog.android.sessionreplay.TextAndInputPrivacy import com.datadog.android.sessionreplay.TouchPrivacy @@ -45,7 +46,11 @@ class SessionReplayPrivacySettings( "MASK_ALL" -> ImagePrivacy.MASK_ALL "MASK_NONE" -> ImagePrivacy.MASK_NONE else -> { - // TODO: Log wrong usage / mapping. + Log.w( + SessionReplayPrivacySettings::class.java.canonicalName, + "Unknown Session Replay Image Privacy Level given: $imagePrivacyLevel, " + + "using ${ImagePrivacy.MASK_ALL} as default" + ) ImagePrivacy.MASK_ALL } } @@ -56,7 +61,11 @@ class SessionReplayPrivacySettings( "SHOW" -> TouchPrivacy.SHOW "HIDE" -> TouchPrivacy.HIDE else -> { - // TODO: Log wrong usage / mapping. + Log.w( + SessionReplayPrivacySettings::class.java.canonicalName, + "Unknown Session Replay Touch Privacy Level given: $touchPrivacyLevel, " + + "using ${TouchPrivacy.HIDE} as default" + ) TouchPrivacy.HIDE } } @@ -68,10 +77,14 @@ class SessionReplayPrivacySettings( "MASK_ALL_INPUTS" -> TextAndInputPrivacy.MASK_ALL_INPUTS "MASK_ALL" -> TextAndInputPrivacy.MASK_ALL else -> { - // TODO: Log wrong usage / mapping + Log.w( + SessionReplayPrivacySettings::class.java.canonicalName, + "Unknown Session Replay Text And Input Privacy Level given: $textAndInputPrivacyLevel, " + + "using ${TextAndInputPrivacy.MASK_ALL} as default" + ) TextAndInputPrivacy.MASK_ALL } } } } -} \ No newline at end of file +} diff --git a/packages/react-native-session-replay/ios/Sources/DdSessionReplayImplementation.swift b/packages/react-native-session-replay/ios/Sources/DdSessionReplayImplementation.swift index a4f040645..ffa627d79 100644 --- a/packages/react-native-session-replay/ios/Sources/DdSessionReplayImplementation.swift +++ b/packages/react-native-session-replay/ios/Sources/DdSessionReplayImplementation.swift @@ -98,7 +98,7 @@ public class DdSessionReplayImplementation: NSObject { case "MASK_NONE": return .maskNone default: - // TODO: Log wrong usage / mapping + consolePrint("Unknown Session Replay Image Privacy Level given: \(imagePrivacy), using .maskAll as default.", .warn) return .maskAll } } @@ -110,7 +110,7 @@ public class DdSessionReplayImplementation: NSObject { case "HIDE": return .hide default: - // TODO: Log wrong usage / mapping + consolePrint("Unknown Session Replay Touch Privacy Level given: \(touchPrivacy), using .hide as default.", .warn) return .hide } } @@ -124,7 +124,7 @@ public class DdSessionReplayImplementation: NSObject { case "MASK_ALL": return .maskAll default: - // TODO: Log wrong usage / mapping + consolePrint("Unknown Session Replay Text and Input Privacy Level given: \(textAndInputPrivacy), using .maskAll as default.", .warn) return .maskAll } }