Skip to content

Commit b265a87

Browse files
committed
Add debug logs for CSS messages
1 parent 7f798d0 commit b265a87

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

app/src/main/java/com/duckduckgo/app/browser/BrowserTabViewModel.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3639,6 +3639,7 @@ class BrowserTabViewModel @Inject constructor(
36393639
isActiveCustomTab: Boolean = false,
36403640
getWebViewUrl: () -> String?,
36413641
) {
3642+
logcat("Cris") { "processJsCallbackMessage featureName: $featureName, method: $method, data: $data" }
36423643
when (method) {
36433644
"webShare" -> if (id != null && data != null) {
36443645
webShare(featureName, method, id, data)

app/src/main/java/com/duckduckgo/app/browser/duckplayer/DuckPlayerJSHelper.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import com.duckduckgo.app.browser.commands.Command.SendResponseToJs
2727
import com.duckduckgo.app.browser.commands.Command.SendSubscriptions
2828
import com.duckduckgo.app.browser.commands.NavigationCommand.Navigate
2929
import com.duckduckgo.app.pixels.AppPixelName
30+
import com.duckduckgo.app.pixels.AppPixelName.DUCK_PLAYER_JS_ERROR
3031
import com.duckduckgo.app.pixels.AppPixelName.DUCK_PLAYER_SETTING_ALWAYS_DUCK_PLAYER
3132
import com.duckduckgo.app.pixels.AppPixelName.DUCK_PLAYER_SETTING_ALWAYS_OVERLAY_YOUTUBE
3233
import com.duckduckgo.app.pixels.AppPixelName.DUCK_PLAYER_SETTING_ALWAYS_SERP
@@ -191,6 +192,7 @@ class DuckPlayerJSHelper @Inject constructor(
191192
tabId: String,
192193
isActiveCustomTab: Boolean,
193194
): Command? {
195+
logcat("Cris") { "DuckPlayerJSHelper method: $method, data: $data" }
194196
when (method) {
195197
"getUserValues" -> if (id != null) {
196198
return SendResponseToJs(getUserPreferences(featureName, method, id))
@@ -291,7 +293,15 @@ class DuckPlayerJSHelper @Inject constructor(
291293
pixel.fire(impressionPixelName)
292294
pixel.fire(dailyPixelName, emptyMap(), emptyMap(), Daily())
293295
}
296+
"reportMetric" -> {
297+
val message = data?.getString("message")
298+
val kind = data?.getString("kind")
299+
if (message != null && kind != null) {
300+
pixel.fire(DUCK_PLAYER_JS_ERROR, mapOf("message" to message, "kind" to kind))
301+
}
302+
}
294303
else -> {
304+
logcat("Cris") { "Unhandled method: $method, data: $data" }
295305
return null
296306
}
297307
}

0 commit comments

Comments
 (0)