-
Notifications
You must be signed in to change notification settings - Fork 949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duck Player custom error #5698
base: develop
Are you sure you want to change the base?
Duck Player custom error #5698
Conversation
fa757fd
to
6a43c68
Compare
13f1ebd
to
9d36ba9
Compare
@@ -247,6 +271,24 @@ class DuckPlayerJSHelper @Inject constructor( | |||
else -> null | |||
} | |||
} | |||
"reportYouTubeError" -> { | |||
val impressionPixelName: DuckPlayerPixelName = when (data?.getString("error")) { | |||
"age-restricted" -> DUCK_PLAYER_YOUTUBE_ERROR_AGE_RESTRICTED_IMPRESSION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Extract to constants
@@ -127,6 +137,9 @@ class DuckPlayerJSHelper @Inject constructor( | |||
jsonObject.put("platform", JSONObject("""{ name: "android" }""")) | |||
jsonObject.put("locale", java.util.Locale.getDefault().language) | |||
jsonObject.put("env", if (appBuildConfig.isDebug) "development" else "production") | |||
|
|||
// Custom Error Settings | |||
jsonObject.getJSONObject("settings").put("customError", getCustomErrorSettings()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't pass this from native when CSS already has access to the RC JSON. See DuckPlayerContentScopeConfigPlugin
* | ||
* @return True if should show a custom error view, false otherwise. | ||
*/ | ||
fun shouldShowCustomError(): Boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to what I said above, we shouldn't expose this on the public API, but rather rely on CSS to get this values internally from the RC JSON
@@ -33,4 +33,12 @@ enum class DuckPlayerPixelName(override val pixelName: String) : Pixel.PixelName | |||
DUCK_PLAYER_SETTINGS_PRESSED("duckplayer_setting_pressed"), | |||
DUCK_PLAYER_NEWTAB_SETTING_ON("duckplayer_newtab_setting-on"), | |||
DUCK_PLAYER_NEWTAB_SETTING_OFF("duckplayer_newtab_setting-off"), | |||
DUCK_PLAYER_YOUTUBE_ERROR_SIGN_IN_REQUIRED_IMPRESSION("duckplayer_youtube-signin-error_impression"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since these pixels are fired from the app module, they should be moved to AppPixelName. Other modules should never access the impl directly
Task/Issue URL: https://app.asana.com/0/72649045549333/1209459625347014
Description
Shows a custom error screen when Duck Player detects an error message in the YouTube embed
Steps to test this PR
UI changes