Skip to content

Commit

Permalink
Merge pull request #1597 from DataDog/feature/base64-jmoskovich
Browse files Browse the repository at this point in the history
Base64 feature branch integration
  • Loading branch information
jonathanmos authored Sep 5, 2023
2 parents 1dfff18 + fb8e426 commit aa1c2e1
Show file tree
Hide file tree
Showing 46 changed files with 3,656 additions and 365 deletions.
8 changes: 8 additions & 0 deletions detekt_custom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@ datadog:
- "android.view.Window.Callback.onMenuItemSelected(kotlin.Int, android.view.MenuItem)"
- "android.view.View.getChildAt(kotlin.Int)"
- "android.view.View.hashCode()"
- "androidx.collection.LruCache.size()"
- "androidx.collection.LruCache.maxSize()"
# endregion
# region Android Webview APIs
- "android.webkit.ConsoleMessage.MessageLevel.toLogLevel()"
Expand All @@ -361,6 +363,7 @@ datadog:
- "android.webkit.WebViewClient.onReceivedSslError(android.webkit.WebView, android.webkit.SslErrorHandler, android.net.http.SslError)"
# endregion
# region Android View APIs
- "android.widget.ImageView.getScaleType()"
- "android.widget.FrameLayout.LayoutParams.constructor(kotlin.Int, kotlin.Int)"
- "android.widget.FrameLayout.removeView(android.view.View)"
- "android.widget.LinearLayout.constructor(android.content.Context)"
Expand Down Expand Up @@ -590,6 +593,7 @@ datadog:
- "java.lang.Object.constructor()"
- "java.lang.Runtime.availableProcessors()"
- "java.lang.Runtime.getRuntime()"
- "java.lang.Runtime.maxMemory()"
- "java.lang.System.currentTimeMillis()"
- "java.lang.System.getProperty(kotlin.String)"
- "java.lang.System.identityHashCode(kotlin.Any)"
Expand Down Expand Up @@ -735,6 +739,7 @@ datadog:
- "kotlin.collections.MutableList.add(com.datadog.android.plugin.DatadogPlugin)"
- "kotlin.collections.MutableList.add(com.datadog.android.sessionreplay.internal.processor.MutationResolver.Entry)"
- "kotlin.collections.MutableList.add(com.datadog.android.sessionreplay.model.MobileSegment.Add)"
- "kotlin.collections.MutableList.add(com.datadog.android.sessionreplay.model.MobileSegment.Wireframe)"
- "kotlin.collections.MutableList.add(com.datadog.android.sessionreplay.model.MobileSegment.WireframeUpdateMutation)"
- "kotlin.collections.MutableList.add(com.datadog.android.rum.internal.domain.scope.RumScope)"
- "kotlin.collections.MutableList.add(com.datadog.android.rum.model.ActionEvent.Type)"
Expand Down Expand Up @@ -847,6 +852,7 @@ datadog:
- "kotlin.Float.toFloat()"
- "kotlin.Int.inv()"
- "kotlin.Int.toChar()"
- "kotlin.Int.toDouble()"
- "kotlin.Int.toFloat()"
- "kotlin.Int.toLong()"
- "kotlin.Int.and(kotlin.Int)"
Expand All @@ -866,6 +872,8 @@ datadog:
- "kotlin.Pair.constructor(com.datadog.android.sessionreplay.internal.utils.SessionReplayRumContext, com.google.gson.JsonArray)"
- "kotlin.Pair.constructor(com.datadog.android.sessionreplay.model.MobileSegment, com.google.gson.JsonObject)"
- "kotlin.Pair.constructor(com.google.gson.JsonObject, kotlin.Long)"
- "kotlin.Pair.constructor(kotlin.Int, kotlin.Int)"
- "kotlin.Pair.constructor(kotlin.Long, kotlin.Long)"
- "kotlin.Triple.constructor(kotlin.String, kotlin.String, kotlin.String)"
- "kotlin.Triple.constructor(kotlin.Nothing?, kotlin.Nothing?, kotlin.Nothing?)"
# endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ import com.datadog.android.sessionreplay.utils.ViewUtils
internal class MaskInputTabWireframeMapper(
viewUtils: ViewUtils = ViewUtils,
uniqueIdentifierGenerator: UniqueIdentifierGenerator = UniqueIdentifierGenerator,
textViewMapper: WireframeMapper<TextView, MobileSegment.Wireframe.TextWireframe> =
textViewMapper: WireframeMapper<TextView, MobileSegment.Wireframe> =
MaskInputTextViewMapper()
) : TabWireframeMapper(viewUtils, uniqueIdentifierGenerator, textViewMapper)
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ import com.datadog.android.sessionreplay.utils.ViewUtils
internal class MaskTabWireframeMapper(
viewUtils: ViewUtils = ViewUtils,
uniqueIdentifierGenerator: UniqueIdentifierGenerator = UniqueIdentifierGenerator,
textViewMapper: WireframeMapper<TextView, MobileSegment.Wireframe.TextWireframe> =
textViewMapper: WireframeMapper<TextView, MobileSegment.Wireframe> =
MaskTextViewMapper()
) : TabWireframeMapper(viewUtils, uniqueIdentifierGenerator, textViewMapper)
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import com.datadog.android.sessionreplay.internal.recorder.mapper.TextViewMapper
import com.datadog.android.sessionreplay.internal.recorder.mapper.WireframeMapper
import com.datadog.android.sessionreplay.material.internal.densityNormalized
import com.datadog.android.sessionreplay.model.MobileSegment
import com.datadog.android.sessionreplay.model.MobileSegment.Wireframe.TextWireframe
import com.datadog.android.sessionreplay.utils.UniqueIdentifierGenerator
import com.datadog.android.sessionreplay.utils.ViewUtils
import com.google.android.material.tabs.TabLayout
Expand All @@ -23,7 +22,7 @@ internal open class TabWireframeMapper(
private val viewUtils: ViewUtils = ViewUtils,
private val uniqueIdentifierGenerator: UniqueIdentifierGenerator =
UniqueIdentifierGenerator,
internal val textViewMapper: WireframeMapper<TextView, TextWireframe> = TextViewMapper()
internal val textViewMapper: WireframeMapper<TextView, MobileSegment.Wireframe> = TextViewMapper()
) : WireframeMapper<TabLayout.TabView, MobileSegment.Wireframe> {

override fun map(
Expand All @@ -47,7 +46,7 @@ internal open class TabWireframeMapper(
protected open fun resolveTabIndicatorWireframe(
view: TabView,
systemInformation: SystemInformation,
textWireframe: TextWireframe?
wireframe: MobileSegment.Wireframe?
): MobileSegment.Wireframe? {
val selectorId = uniqueIdentifierGenerator.resolveChildUniqueIdentifier(
view,
Expand All @@ -62,8 +61,11 @@ internal open class TabWireframeMapper(
val selectionIndicatorXPos = viewBounds.x + paddingStart
val selectionIndicatorYPos = viewBounds.y + viewBounds.height - selectionIndicatorHeight
val selectionIndicatorWidth = viewBounds.width - paddingStart - paddingEnd
val selectionIndicatorColor = textWireframe?.textStyle?.color
?: SELECTED_TAB_INDICATOR_DEFAULT_COLOR
val selectionIndicatorColor = if (wireframe is MobileSegment.Wireframe.TextWireframe) {
wireframe.textStyle.color
} else {
SELECTED_TAB_INDICATOR_DEFAULT_COLOR
}
val selectionIndicatorShapeStyle = MobileSegment.ShapeStyle(
backgroundColor = selectionIndicatorColor,
opacity = view.alpha
Expand All @@ -79,7 +81,7 @@ internal open class TabWireframeMapper(
}

private fun findAndResolveLabelWireframes(view: TabView, mappingContext: MappingContext):
List<TextWireframe> {
List<MobileSegment.Wireframe> {
for (i in 0 until view.childCount) {
val viewChild = view.getChildAt(i) ?: continue
if (TextView::class.java.isAssignableFrom(viewChild::class.java)) {
Expand Down
20 changes: 5 additions & 15 deletions features/dd-sdk-android-session-replay/api/apiSurface
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,23 @@ interface com.datadog.android.sessionreplay.internal.recorder.OptionSelectorDete
fun isOptionSelector(android.view.ViewGroup): Boolean
data class com.datadog.android.sessionreplay.internal.recorder.SystemInformation
constructor(GlobalBounds, Int = Configuration.ORIENTATION_UNDEFINED, Float, String? = null)
class com.datadog.android.sessionreplay.internal.recorder.base64.Base64Serializer
interface com.datadog.android.sessionreplay.internal.recorder.base64.ImageCompression
fun getMimeType(): String?
fun compressBitmapToStream(android.graphics.Bitmap): java.io.ByteArrayOutputStream
class com.datadog.android.sessionreplay.internal.recorder.base64.WebPImageCompression : ImageCompression
override fun getMimeType(): String?
override fun compressBitmapToStream(android.graphics.Bitmap): java.io.ByteArrayOutputStream
companion object
abstract class com.datadog.android.sessionreplay.internal.recorder.mapper.BaseWireframeMapper<T: android.view.View, S: com.datadog.android.sessionreplay.model.MobileSegment.Wireframe> : WireframeMapper<T, S>, com.datadog.android.sessionreplay.internal.AsyncImageProcessingCallback
constructor(com.datadog.android.sessionreplay.utils.StringUtils = StringUtils, com.datadog.android.sessionreplay.utils.ViewUtils = ViewUtils, com.datadog.android.sessionreplay.internal.recorder.base64.ImageCompression = WebPImageCompression(), com.datadog.android.sessionreplay.utils.UniqueIdentifierGenerator = UniqueIdentifierGenerator, com.datadog.android.sessionreplay.internal.recorder.base64.Base64Serializer = Base64Serializer.Builder().build())
abstract class com.datadog.android.sessionreplay.internal.recorder.mapper.BaseWireframeMapper<T: android.view.View, S: com.datadog.android.sessionreplay.model.MobileSegment.Wireframe> : WireframeMapper<T, com.datadog.android.sessionreplay.model.MobileSegment.Wireframe>, com.datadog.android.sessionreplay.internal.AsyncImageProcessingCallback
constructor(com.datadog.android.sessionreplay.utils.StringUtils = StringUtils, com.datadog.android.sessionreplay.utils.ViewUtils = ViewUtils)
override fun map(T, com.datadog.android.sessionreplay.internal.recorder.MappingContext): List<com.datadog.android.sessionreplay.model.MobileSegment.Wireframe>
protected fun resolveViewId(android.view.View): Long
protected fun colorAndAlphaAsStringHexa(Int, Int): String
protected fun resolveViewGlobalBounds(android.view.View, Float): com.datadog.android.sessionreplay.internal.recorder.GlobalBounds
protected fun android.graphics.drawable.Drawable.resolveShapeStyleAndBorder(Float): Pair<com.datadog.android.sessionreplay.model.MobileSegment.ShapeStyle?, com.datadog.android.sessionreplay.model.MobileSegment.ShapeBorder?>?
protected fun resolveChildDrawableUniqueIdentifier(android.view.View): Long?
protected fun getWebPMimeType(): String?
protected fun handleBitmap(android.util.DisplayMetrics, android.graphics.drawable.Drawable, com.datadog.android.sessionreplay.model.MobileSegment.Wireframe.ImageWireframe)
override fun startProcessingImage()
override fun finishProcessingImage()
companion object
class com.datadog.android.sessionreplay.internal.recorder.mapper.MaskInputTextViewMapper : TextViewMapper
constructor()
class com.datadog.android.sessionreplay.internal.recorder.mapper.MaskTextViewMapper : TextViewMapper
constructor()
open class com.datadog.android.sessionreplay.internal.recorder.mapper.TextViewMapper : BaseWireframeMapper<android.widget.TextView, com.datadog.android.sessionreplay.model.MobileSegment.Wireframe.TextWireframe>
open class com.datadog.android.sessionreplay.internal.recorder.mapper.TextViewMapper : BaseWireframeMapper<android.widget.TextView, com.datadog.android.sessionreplay.model.MobileSegment.Wireframe>
constructor()
override fun map(android.widget.TextView, com.datadog.android.sessionreplay.internal.recorder.MappingContext): List<com.datadog.android.sessionreplay.model.MobileSegment.Wireframe.TextWireframe>
override fun map(android.widget.TextView, com.datadog.android.sessionreplay.internal.recorder.MappingContext): List<com.datadog.android.sessionreplay.model.MobileSegment.Wireframe>
interface com.datadog.android.sessionreplay.internal.recorder.mapper.WireframeMapper<T: android.view.View, S: com.datadog.android.sessionreplay.model.MobileSegment.Wireframe>
fun map(T, com.datadog.android.sessionreplay.internal.recorder.MappingContext): List<S>
object com.datadog.android.sessionreplay.utils.StringUtils
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,34 +87,14 @@ public final class com/datadog/android/sessionreplay/internal/recorder/SystemInf
public fun toString ()Ljava/lang/String;
}

public final class com/datadog/android/sessionreplay/internal/recorder/base64/Base64Serializer {
public synthetic fun <init> (Ljava/util/concurrent/ExecutorService;Lcom/datadog/android/sessionreplay/internal/utils/DrawableUtils;Lcom/datadog/android/sessionreplay/internal/utils/Base64Utils;Lcom/datadog/android/sessionreplay/internal/recorder/base64/ImageCompression;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
}

public abstract interface class com/datadog/android/sessionreplay/internal/recorder/base64/ImageCompression {
public abstract fun compressBitmapToStream (Landroid/graphics/Bitmap;)Ljava/io/ByteArrayOutputStream;
public abstract fun getMimeType ()Ljava/lang/String;
}

public final class com/datadog/android/sessionreplay/internal/recorder/base64/WebPImageCompression : com/datadog/android/sessionreplay/internal/recorder/base64/ImageCompression {
public static final field Companion Lcom/datadog/android/sessionreplay/internal/recorder/base64/WebPImageCompression$Companion;
public fun compressBitmapToStream (Landroid/graphics/Bitmap;)Ljava/io/ByteArrayOutputStream;
public fun getMimeType ()Ljava/lang/String;
}

public final class com/datadog/android/sessionreplay/internal/recorder/base64/WebPImageCompression$Companion {
}

public abstract class com/datadog/android/sessionreplay/internal/recorder/mapper/BaseWireframeMapper : com/datadog/android/sessionreplay/internal/AsyncImageProcessingCallback, com/datadog/android/sessionreplay/internal/recorder/mapper/WireframeMapper {
public static final field Companion Lcom/datadog/android/sessionreplay/internal/recorder/mapper/BaseWireframeMapper$Companion;
public fun <init> ()V
public fun <init> (Lcom/datadog/android/sessionreplay/utils/StringUtils;Lcom/datadog/android/sessionreplay/utils/ViewUtils;Lcom/datadog/android/sessionreplay/internal/recorder/base64/ImageCompression;Lcom/datadog/android/sessionreplay/utils/UniqueIdentifierGenerator;Lcom/datadog/android/sessionreplay/internal/recorder/base64/Base64Serializer;)V
public synthetic fun <init> (Lcom/datadog/android/sessionreplay/utils/StringUtils;Lcom/datadog/android/sessionreplay/utils/ViewUtils;Lcom/datadog/android/sessionreplay/internal/recorder/base64/ImageCompression;Lcom/datadog/android/sessionreplay/utils/UniqueIdentifierGenerator;Lcom/datadog/android/sessionreplay/internal/recorder/base64/Base64Serializer;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Lcom/datadog/android/sessionreplay/utils/StringUtils;Lcom/datadog/android/sessionreplay/utils/ViewUtils;)V
public synthetic fun <init> (Lcom/datadog/android/sessionreplay/utils/StringUtils;Lcom/datadog/android/sessionreplay/utils/ViewUtils;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
protected final fun colorAndAlphaAsStringHexa (II)Ljava/lang/String;
public fun finishProcessingImage ()V
protected final fun getWebPMimeType ()Ljava/lang/String;
protected final fun handleBitmap (Landroid/util/DisplayMetrics;Landroid/graphics/drawable/Drawable;Lcom/datadog/android/sessionreplay/model/MobileSegment$Wireframe$ImageWireframe;)V
protected final fun resolveChildDrawableUniqueIdentifier (Landroid/view/View;)Ljava/lang/Long;
public fun map (Landroid/view/View;Lcom/datadog/android/sessionreplay/internal/recorder/MappingContext;)Ljava/util/List;
protected final fun resolveShapeStyleAndBorder (Landroid/graphics/drawable/Drawable;F)Lkotlin/Pair;
protected final fun resolveViewGlobalBounds (Landroid/view/View;F)Lcom/datadog/android/sessionreplay/internal/recorder/GlobalBounds;
protected final fun resolveViewId (Landroid/view/View;)J
Expand Down
Loading

0 comments on commit aa1c2e1

Please sign in to comment.