Skip to content

Commit

Permalink
RUM-6219: Modify api naming
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanmos committed Oct 13, 2024
1 parent 9a60bdf commit 6475493
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions features/dd-sdk-android-session-replay/api/apiSurface
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ data class com.datadog.android.sessionreplay.MapperTypeWrapper<T: android.view.V
fun supportsView(android.view.View): Boolean
fun getUnsafeMapper(): com.datadog.android.sessionreplay.recorder.mapper.WireframeMapper<android.view.View>
fun android.view.View.setSessionReplayHidden(Boolean)
fun android.view.View.datadogSessionReplayImagePrivacy(ImagePrivacy?)
fun android.view.View.datadogSessionReplayTextAndInputPrivacy(TextAndInputPrivacy?)
fun android.view.View.setSessionReplayImagePrivacy(ImagePrivacy?)
fun android.view.View.setSessionReplayTextAndInputPrivacy(TextAndInputPrivacy?)
object com.datadog.android.sessionreplay.SessionReplay
fun enable(SessionReplayConfiguration, com.datadog.android.api.SdkCore = Datadog.getInstance())
fun startRecording(com.datadog.android.api.SdkCore = Datadog.getInstance())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public final class com/datadog/android/sessionreplay/MapperTypeWrapper {
}

public final class com/datadog/android/sessionreplay/PrivacyOverrideExtensionsKt {
public static final fun datadogSessionReplayImagePrivacy (Landroid/view/View;Lcom/datadog/android/sessionreplay/ImagePrivacy;)V
public static final fun datadogSessionReplayTextAndInputPrivacy (Landroid/view/View;Lcom/datadog/android/sessionreplay/TextAndInputPrivacy;)V
public static final fun setSessionReplayHidden (Landroid/view/View;Z)V
public static final fun setSessionReplayImagePrivacy (Landroid/view/View;Lcom/datadog/android/sessionreplay/ImagePrivacy;)V
public static final fun setSessionReplayTextAndInputPrivacy (Landroid/view/View;Lcom/datadog/android/sessionreplay/TextAndInputPrivacy;)V
}

public final class com/datadog/android/sessionreplay/SessionReplay {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fun View.setSessionReplayHidden(hide: Boolean) {
* @param privacy the new privacy level to use for the view
* or null to remove the override.
*/
fun View.datadogSessionReplayImagePrivacy(privacy: ImagePrivacy?) {
fun View.setSessionReplayImagePrivacy(privacy: ImagePrivacy?) {
if (privacy == null) {
this.setTag(R.id.datadog_image_privacy, null)
} else {
Expand All @@ -43,7 +43,7 @@ fun View.datadogSessionReplayImagePrivacy(privacy: ImagePrivacy?) {
* @param privacy the new privacy level to use for the view
* or null to remove the override.
*/
fun View.datadogSessionReplayTextAndInputPrivacy(privacy: TextAndInputPrivacy?) {
fun View.setSessionReplayTextAndInputPrivacy(privacy: TextAndInputPrivacy?) {
if (privacy == null) {
this.setTag(R.id.datadog_text_and_input_privacy, null)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,54 +55,54 @@ internal class PrivacyOverrideExtensionsTest {
}

@Test
fun `M set tag W datadogSessionReplayImagePrivacy() { with privacy }`(
fun `M set tag W setSessionReplayImagePrivacy() { with privacy }`(
forge: Forge
) {
// Given
val mockView = mock<View>()
val mockPrivacy = forge.aValueFrom(ImagePrivacy::class.java)

// When
mockView.datadogSessionReplayImagePrivacy(mockPrivacy)
mockView.setSessionReplayImagePrivacy(mockPrivacy)

// Then
verify(mockView).setTag(eq(R.id.datadog_image_privacy), eq(mockPrivacy.toString()))
}

@Test
fun `M set tag to null W datadogSessionReplayImagePrivacy() { privacy is null }`() {
fun `M set tag to null W setSessionReplayImagePrivacy() { privacy is null }`() {
// Given
val mockView = mock<View>()

// When
mockView.datadogSessionReplayImagePrivacy(null)
mockView.setSessionReplayImagePrivacy(null)

// Then
verify(mockView).setTag(eq(R.id.datadog_image_privacy), isNull())
}

@Test
fun `M set tag W datadogSessionReplayTextAndInputPrivacy() { with privacy }`(
fun `M set tag W setSessionReplayTextAndInputPrivacy() { with privacy }`(
forge: Forge
) {
// Given
val mockView = mock<View>()
val mockPrivacy = forge.aValueFrom(TextAndInputPrivacy::class.java)

// When
mockView.datadogSessionReplayTextAndInputPrivacy(mockPrivacy)
mockView.setSessionReplayTextAndInputPrivacy(mockPrivacy)

// Then
verify(mockView).setTag(eq(R.id.datadog_text_and_input_privacy), eq(mockPrivacy.toString()))
}

@Test
fun `M set tag to null W datadogSessionReplayTextAndInputPrivacy() { privacy is null }`() {
fun `M set tag to null W setSessionReplayTextAndInputPrivacy() { privacy is null }`() {
// Given
val mockView = mock<View>()

// When
mockView.datadogSessionReplayTextAndInputPrivacy(null)
mockView.setSessionReplayTextAndInputPrivacy(null)

// Then
verify(mockView).setTag(eq(R.id.datadog_text_and_input_privacy), isNull())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import com.datadog.android.api.InternalLogger
import com.datadog.android.sessionreplay.ImagePrivacy
import com.datadog.android.sessionreplay.R
import com.datadog.android.sessionreplay.TextAndInputPrivacy
import com.datadog.android.sessionreplay.datadogSessionReplayImagePrivacy
import com.datadog.android.sessionreplay.datadogSessionReplayTextAndInputPrivacy
import com.datadog.android.sessionreplay.forge.ForgeConfigurator
import com.datadog.android.sessionreplay.internal.async.RecordedDataQueueRefs
import com.datadog.android.sessionreplay.internal.recorder.SnapshotProducer.Companion.INVALID_PRIVACY_LEVEL_ERROR
import com.datadog.android.sessionreplay.model.MobileSegment
import com.datadog.android.sessionreplay.recorder.MappingContext
import com.datadog.android.sessionreplay.recorder.SystemInformation
import com.datadog.android.sessionreplay.setSessionReplayImagePrivacy
import com.datadog.android.sessionreplay.setSessionReplayTextAndInputPrivacy
import com.datadog.android.sessionreplay.utils.ImageWireframeHelper
import fr.xgouchet.elmyr.Forge
import fr.xgouchet.elmyr.annotation.Forgery
Expand Down Expand Up @@ -387,8 +387,8 @@ internal class SnapshotProducerTest {
}
val fakeImagePrivacy = forge.aValueFrom(ImagePrivacy::class.java)
val fakeTextAndInputPrivacy = forge.aValueFrom(TextAndInputPrivacy::class.java)
mockRoot.datadogSessionReplayImagePrivacy(fakeImagePrivacy)
mockRoot.datadogSessionReplayTextAndInputPrivacy(fakeTextAndInputPrivacy)
mockRoot.setSessionReplayImagePrivacy(fakeImagePrivacy)
mockRoot.setSessionReplayTextAndInputPrivacy(fakeTextAndInputPrivacy)
val fakeTraversedTreeView = TreeViewTraversal.TraversedTreeView(
fakeViewWireframes,
TraversalStrategy.TRAVERSE_ALL_CHILDREN
Expand Down

0 comments on commit 6475493

Please sign in to comment.