Skip to content

Commit 3acaa58

Browse files
CrisBarreirolaghee
andauthored
Integrate privacy dashboard (#5624)
Task/Issue URL: https://app.asana.com/0/0/1209363619593648/f ### Description Update privacy dashboard to 8.4.0 and add support for sending malicious status to privacy dashboard ### Steps to test this PR _Feature 1_ - [ ] Visit https://privacy-test-pages.site/security/badware/phishing.html - [ ] Accept the risk and visit site - [ ] Click on Privacy Shield - [ ] Check a modified version of privacy dashboard is shown reflecting the malicious site status _Feature 1_ - [ ] Visit wikipedia.org - [ ] Click on Privacy Shield - [ ] Check privacy dashboard is shown normally --------- Co-authored-by: laghee <[email protected]>
1 parent 637202a commit 3acaa58

File tree

18 files changed

+72
-30
lines changed

18 files changed

+72
-30
lines changed

app/src/androidTest/java/com/duckduckgo/app/browser/omnibar/animations/LottiePrivacyShieldAnimationHelperTest.kt

+9-9
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ package com.duckduckgo.app.browser.omnibar.animations
1818

1919
import com.airbnb.lottie.LottieAnimationView
2020
import com.duckduckgo.app.browser.R
21+
import com.duckduckgo.app.global.model.PrivacyShield.MALICIOUS
2122
import com.duckduckgo.app.global.model.PrivacyShield.PROTECTED
2223
import com.duckduckgo.app.global.model.PrivacyShield.UNPROTECTED
23-
import com.duckduckgo.app.global.model.PrivacyShield.WARNING
2424
import com.duckduckgo.common.ui.store.AppTheme
2525
import org.junit.Test
2626
import org.mockito.kotlin.mock
@@ -80,28 +80,28 @@ class LottiePrivacyShieldAnimationHelperTest {
8080
}
8181

8282
@Test
83-
fun whenLightModeAndPrivacyShieldWarningThenUseLightAnimation() {
83+
fun whenLightModeAndPrivacyShieldMaliciousThenUseLightAnimation() {
8484
val holder: LottieAnimationView = mock()
8585
val appTheme: AppTheme = mock()
8686
whenever(appTheme.isLightModeEnabled()).thenReturn(true)
8787
val testee = LottiePrivacyShieldAnimationHelper(appTheme)
8888

89-
testee.setAnimationView(holder, WARNING)
89+
testee.setAnimationView(holder, MALICIOUS)
9090

91-
verify(holder).setAnimation(R.raw.unprotected_shield)
92-
verify(holder).progress = 1.0f
91+
verify(holder).setAnimation(R.raw.alert_red)
92+
verify(holder).progress = 0.0f
9393
}
9494

9595
@Test
96-
fun whenDarkModeAndPrivacyShieldWarningThenUseDarkAnimation() {
96+
fun whenDarkModeAndPrivacyShieldMaliciousThenUseDarkAnimation() {
9797
val holder: LottieAnimationView = mock()
9898
val appTheme: AppTheme = mock()
9999
whenever(appTheme.isLightModeEnabled()).thenReturn(false)
100100
val testee = LottiePrivacyShieldAnimationHelper(appTheme)
101101

102-
testee.setAnimationView(holder, WARNING)
102+
testee.setAnimationView(holder, MALICIOUS)
103103

104-
verify(holder).setAnimation(R.raw.dark_unprotected_shield)
105-
verify(holder).progress = 1.0f
104+
verify(holder).setAnimation(R.raw.alert_red_dark)
105+
verify(holder).progress = 0.0f
106106
}
107107
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -3953,7 +3953,7 @@ class BrowserTabFragment :
39533953
hideNewTab()
39543954
}
39553955

3956-
viewState.daxOnboardingComplete -> {
3956+
viewState.daxOnboardingComplete && !viewState.isErrorShowing -> {
39573957
hideDaxBubbleCta()
39583958
showNewTab()
39593959
}

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ class BrowserTabViewModel @Inject constructor(
835835
setAdClickActiveTabData(url)
836836

837837
// we expect refreshCta to be called when a site is fully loaded if browsingShowing -trackers data available-.
838-
if (!currentBrowserViewState().browserShowing) {
838+
if (!currentBrowserViewState().browserShowing && !currentBrowserViewState().maliciousSiteDetected) {
839839
viewModelScope.launch {
840840
val cta = refreshCta()
841841
showOrHideKeyboard(cta) // we hide the keyboard when showing a DialogCta and HomeCta type in the home screen otherwise we show it
@@ -2676,6 +2676,7 @@ class BrowserTabViewModel @Inject constructor(
26762676
suspend fun refreshCta(): Cta? {
26772677
if (currentGlobalLayoutState() is Browser) {
26782678
val isBrowserShowing = currentBrowserViewState().browserShowing
2679+
val isErrorShowing = currentBrowserViewState().maliciousSiteDetected
26792680
if (hasCtaBeenShownForCurrentPage.get() && isBrowserShowing) return null
26802681
val cta = withContext(dispatchers.io()) {
26812682
ctaViewModel.refreshCta(
@@ -2692,6 +2693,7 @@ class BrowserTabViewModel @Inject constructor(
26922693
cta = cta,
26932694
daxOnboardingComplete = isOnboardingComplete,
26942695
isBrowserShowing = isBrowserShowing,
2696+
isErrorShowing = isErrorShowing,
26952697
)
26962698
ctaChangedTicker.emit(System.currentTimeMillis().toString())
26972699
return cta
@@ -3212,6 +3214,7 @@ class BrowserTabViewModel @Inject constructor(
32123214
}
32133215

32143216
override fun onReceivedMaliciousSiteWarning(url: Uri, feed: Feed, exempted: Boolean, clientSideHit: Boolean) {
3217+
site = siteFactory.buildSite(url = url.toString(), tabId = tabId)
32153218
site?.maliciousSiteStatus = when (feed) {
32163219
MALWARE -> MaliciousSiteStatus.MALWARE
32173220
PHISHING -> MaliciousSiteStatus.PHISHING

app/src/main/java/com/duckduckgo/app/browser/omnibar/OmnibarLayoutViewModel.kt

+3
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,9 @@ class OmnibarLayoutViewModel @Inject constructor(
565565

566566
fun onAnimationStarted(decoration: LaunchTrackersAnimation) {
567567
Timber.d("Omnibar: LaunchTrackersAnimation")
568+
if (_viewState.value.viewMode == MaliciousSiteWarning) {
569+
return
570+
}
568571
if (!decoration.entities.isNullOrEmpty()) {
569572
val hasFocus = _viewState.value.hasFocus
570573
if (!hasFocus) {

app/src/main/java/com/duckduckgo/app/browser/omnibar/animations/LottiePrivacyShieldAnimationHelper.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ package com.duckduckgo.app.browser.omnibar.animations
1919
import com.airbnb.lottie.LottieAnimationView
2020
import com.duckduckgo.app.browser.R
2121
import com.duckduckgo.app.global.model.PrivacyShield
22+
import com.duckduckgo.app.global.model.PrivacyShield.MALICIOUS
2223
import com.duckduckgo.app.global.model.PrivacyShield.PROTECTED
2324
import com.duckduckgo.app.global.model.PrivacyShield.UNKNOWN
2425
import com.duckduckgo.app.global.model.PrivacyShield.UNPROTECTED
25-
import com.duckduckgo.app.global.model.PrivacyShield.WARNING
2626
import com.duckduckgo.common.ui.store.AppTheme
2727
import com.duckduckgo.di.scopes.AppScope
2828
import com.squareup.anvil.annotations.ContributesBinding
@@ -54,10 +54,10 @@ class LottiePrivacyShieldAnimationHelper @Inject constructor(val appTheme: AppTh
5454
UNKNOWN -> {
5555
Timber.i("Shield: UNKNOWN")
5656
}
57-
WARNING -> {
58-
val res = if (appTheme.isLightModeEnabled()) R.raw.unprotected_shield else R.raw.dark_unprotected_shield
57+
MALICIOUS -> {
58+
val res = if (appTheme.isLightModeEnabled()) R.raw.alert_red else R.raw.alert_red_dark
5959
holder.setAnimation(res)
60-
holder.progress = 1.0f
60+
holder.progress = 0.0f
6161
Timber.i("Shield: WARNING")
6262
}
6363
}

app/src/main/java/com/duckduckgo/app/browser/viewstate/CtaViewState.kt

+1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ data class CtaViewState(
2222
val cta: Cta? = null,
2323
val daxOnboardingComplete: Boolean = false,
2424
val isBrowserShowing: Boolean = true,
25+
val isErrorShowing: Boolean = false,
2526
)

app/src/main/java/com/duckduckgo/app/global/model/SiteMonitor.kt

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import androidx.annotation.WorkerThread
2222
import androidx.core.net.toUri
2323
import com.duckduckgo.app.browser.UriString
2424
import com.duckduckgo.app.browser.certificates.BypassedSSLCertificatesRepository
25+
import com.duckduckgo.app.global.model.PrivacyShield.MALICIOUS
2526
import com.duckduckgo.app.global.model.PrivacyShield.PROTECTED
2627
import com.duckduckgo.app.global.model.PrivacyShield.UNKNOWN
2728
import com.duckduckgo.app.global.model.PrivacyShield.UNPROTECTED
@@ -167,6 +168,7 @@ class SiteMonitor(
167168
userAllowList = domain?.let { isAllowListed(it) } ?: false
168169
if (duckPlayer.isDuckPlayerUri(url)) return UNKNOWN
169170
if (userAllowList || !isHttps) return UNPROTECTED
171+
if (maliciousSiteStatus != null) return MALICIOUS
170172

171173
if (!fullSiteDetailsAvailable) {
172174
Timber.i("Shield: not fullSiteDetailsAvailable for $domain")

app/src/main/res/raw/alert_red.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"v":"5.7.12","fr":24,"ip":0,"op":24,"w":130,"h":40,"nm":"error @40px_light","ddd":0,"assets":[{"id":"comp_0","nm":"Alert_Red","layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Exclamation Mark","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[12,12,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[-1.016,0],[0.108,-1.01],[0,0],[0.46,0],[0.049,0.457]],"o":[[-0.108,-1.01],[1.016,0],[0,0],[-0.049,0.457],[-0.46,0],[0,0]],"v":[[-1.699,-5.459],[0,-7.35],[1.699,-5.459],[0.895,2.046],[0,2.85],[-0.895,2.046]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":5,"nm":"Merge Paths 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ind":2,"ty":"sh","ix":3,"ks":{"a":0,"k":{"i":[[0,-0.828],[0.828,0],[0,0.828],[-0.828,0]],"o":[[0,0.828],[-0.828,0],[0,-0.828],[0.828,0]],"v":[[1.5,5.85],[0,7.35],[-1.5,5.85],[0,4.35]],"c":true},"ix":2},"nm":"Path 2","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":5,"nm":"Merge Paths 2","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape","np":5,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":96,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Circle","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[12,12,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-6.075,0],[0,6.075],[6.075,0],[0,-6.075]],"o":[[6.075,0],[0,-6.075],[-6.075,0],[0,6.075]],"v":[[0,11],[11,0],[0,-11],[-11,0]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.933333337307,0.06274510175,0.145098045468,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":96,"st":0,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"Alert_Red","refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[22,20,0],"ix":2,"l":2},"a":{"a":0,"k":[12,12,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"w":24,"h":24,"ip":0,"op":96,"st":0,"bm":0}],"markers":[{"tm":0,"cm":"","dr":0},{"tm":80,"cm":"","dr":0}]}
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"v":"5.7.12","fr":24,"ip":0,"op":24,"w":130,"h":40,"nm":"error @40px_dark","ddd":0,"assets":[{"id":"comp_0","nm":"Alert_Red_Dark","layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Exclamation Mark","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[12,12,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[-1.016,0],[0.108,-1.01],[0,0],[0.46,0],[0.049,0.457]],"o":[[-0.108,-1.01],[1.016,0],[0,0],[-0.049,0.457],[-0.46,0],[0,0]],"v":[[-1.699,-5.459],[0,-7.35],[1.699,-5.459],[0.895,2.046],[0,2.85],[-0.895,2.046]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":5,"nm":"Merge Paths 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ind":2,"ty":"sh","ix":3,"ks":{"a":0,"k":{"i":[[0,-0.828],[0.828,0],[0,0.828],[-0.828,0]],"o":[[0,0.828],[-0.828,0],[0,-0.828],[0.828,0]],"v":[[1.5,5.85],[0,7.35],[-1.5,5.85],[0,4.35]],"c":true},"ix":2},"nm":"Path 2","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":5,"nm":"Merge Paths 2","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape","np":5,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":96,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Circle","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[12,12,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-6.075,0],[0,6.075],[6.075,0],[0,-6.075]],"o":[[6.075,0],[0,-6.075],[-6.075,0],[0,6.075]],"v":[[0,11],[11,0],[0,-11],[-11,0]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0.329411764706,0.352941176471,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":96,"st":0,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"Alert_Red_Dark","refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[22,20,0],"ix":2,"l":2},"a":{"a":0,"k":[12,12,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"w":24,"h":24,"ip":0,"op":96,"st":0,"bm":0}],"markers":[{"tm":32,"cm":"","dr":0},{"tm":45,"cm":"","dr":0}]}

app/src/test/java/com/duckduckgo/app/browser/omnibar/OmnibarLayoutViewModelTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ class OmnibarLayoutViewModelTest {
423423

424424
@Test
425425
fun whenPrivacyShieldChangedToWarningThenViewStateCorrect() = runTest {
426-
val privacyShield = PrivacyShield.WARNING
426+
val privacyShield = PrivacyShield.MALICIOUS
427427
testee.onPrivacyShieldChanged(privacyShield)
428428

429429
testee.viewState.test {

browser-api/src/main/java/com/duckduckgo/app/global/model/PrivacyShield.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ package com.duckduckgo.app.global.model
1919
enum class PrivacyShield {
2020
PROTECTED,
2121
UNPROTECTED,
22-
WARNING,
22+
MALICIOUS,
2323
UNKNOWN,
2424
}

node_modules/@duckduckgo/privacy-dashboard/build/app/public/css/popup.css

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@duckduckgo/privacy-dashboard/build/app/public/js/base.js

+27-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"@duckduckgo/autoconsent": "^12.9.0",
1717
"@duckduckgo/autofill": "github:duckduckgo/duckduckgo-autofill#16.2.1",
1818
"@duckduckgo/content-scope-scripts": "github:duckduckgo/content-scope-scripts#7.17.0",
19-
"@duckduckgo/privacy-dashboard": "github:duckduckgo/privacy-dashboard#8.1.0",
19+
"@duckduckgo/privacy-dashboard": "github:duckduckgo/privacy-dashboard#8.4.0",
2020
"@duckduckgo/privacy-reference-tests": "github:duckduckgo/privacy-reference-tests#1738159777"
2121
}
2222
}

privacy-dashboard/privacy-dashboard-impl/src/main/java/com/duckduckgo/privacy/dashboard/impl/ui/PrivacyDashboardHybridViewModel.kt

+2
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ class PrivacyDashboardHybridViewModel @Inject constructor(
117117
val protectionStatus: ProtectionStatusViewState,
118118
val cookiePromptManagementStatus: CookiePromptManagementState,
119119
val remoteFeatureSettings: RemoteFeatureSettingsViewState,
120+
val maliciousSiteStatus: String? = null,
120121
)
121122

122123
data class ProtectionStatusViewState(
@@ -289,6 +290,7 @@ class PrivacyDashboardHybridViewModel @Inject constructor(
289290
protectionStatus = protectionStatusViewStateMapper.mapFromSite(site),
290291
cookiePromptManagementStatus = autoconsentStatusViewStateMapper.mapFromSite(site),
291292
remoteFeatureSettings = createRemoteFeatureSettings(),
293+
maliciousSiteStatus = site.maliciousSiteStatus?.name?.lowercase(),
292294
),
293295
)
294296
}

privacy-dashboard/privacy-dashboard-impl/src/main/java/com/duckduckgo/privacy/dashboard/impl/ui/PrivacyDashboardRenderer.kt

+3
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ class PrivacyDashboardRenderer(
8787
val cookiePromptManagementStatusJson = cookiePromptManagementStatusAdapter.toJson(viewState.cookiePromptManagementStatus)
8888
webView.evaluateJavascript("javascript:onChangeConsentManaged($cookiePromptManagementStatusJson);", null)
8989

90+
val maliciousStateJson = """{"kind": ${viewState.maliciousSiteStatus?.let { "\"$it\"" } ?: "null"}}"""
91+
webView.evaluateJavascript("javascript:onChangeMaliciousSiteStatus($maliciousStateJson);", null)
92+
9093
// remote feature settings
9194
val remoteFeatureSettingsAdapter = moshi.adapter(RemoteFeatureSettingsViewState::class.java)
9295
val remoteFeatureSettingsJson = remoteFeatureSettingsAdapter.toJson(viewState.remoteFeatureSettings)

privacy-dashboard/privacy-dashboard-impl/src/test/java/com/duckduckgo/privacy/dashboard/impl/ui/PrivacyDashboardRendererTest.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class PrivacyDashboardRendererTest {
113113

114114
testee.render(aViewState())
115115

116-
verify(spyWebView, times(8)).evaluateJavascript(captor.capture(), eq(null))
116+
verify(spyWebView, times(9)).evaluateJavascript(captor.capture(), eq(null))
117117

118118
assertNotNull(captor.allValues.find { it.startsWith("javascript:onChangeLocale") })
119119
assertNotNull(captor.allValues.find { it.startsWith("javascript:onChangeFeatureSettings") })
@@ -123,6 +123,7 @@ class PrivacyDashboardRendererTest {
123123
assertNotNull(captor.allValues.find { it.startsWith("javascript:onChangeUpgradedHttps") })
124124
assertNotNull(captor.allValues.find { it.startsWith("javascript:onChangeRequestData") })
125125
assertNotNull(captor.allValues.find { it.startsWith("javascript:onChangeConsentManaged") })
126+
assertNotNull(captor.allValues.find { it.startsWith("javascript:onChangeMaliciousSiteStatus") })
126127
}
127128

128129
fun aViewState() = ViewState(

0 commit comments

Comments
 (0)