Skip to content

Commit 4ee2cb9

Browse files
committed
fixing lint issues
1 parent 7dca480 commit 4ee2cb9

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

app/src/androidTest/java/com/duckduckgo/app/email/EmailInjectorJsTest.kt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.duckduckgo.app.email
1818

19+
import android.annotation.SuppressLint
1920
import android.webkit.WebView
2021
import androidx.test.annotation.UiThreadTest
2122
import androidx.test.filters.SdkSuppress
@@ -59,25 +60,27 @@ class EmailInjectorJsTest {
5960
whenever(mockAutofill.isAnException(any())).thenReturn(false)
6061
}
6162

63+
@SuppressLint("DenyListedApi")
6264
@UiThreadTest
6365
@Test
6466
@SdkSuppress(minSdkVersion = 24)
6567
fun whenInjectAddressThenInjectJsCodeReplacingTheAlias() {
6668
val address = "address"
6769
val jsToEvaluate = getAliasJsToEvaluate().replace("%s", address)
6870
val webView = spy(WebView(InstrumentationRegistry.getInstrumentation().targetContext))
69-
autofillFeature.self().setEnabled(Toggle.State(enable = true))
71+
autofillFeature.self().setRawStoredState(Toggle.State(enable = true))
7072

7173
testee.injectAddressInEmailField(webView, address, "https://example.com")
7274

7375
verify(webView).evaluateJavascript(jsToEvaluate, null)
7476
}
7577

78+
@SuppressLint("DenyListedApi")
7679
@UiThreadTest
7780
@Test
7881
@SdkSuppress(minSdkVersion = 24)
7982
fun whenInjectAddressAndFeatureIsDisabledThenJsCodeNotInjected() {
80-
autofillFeature.self().setEnabled(Toggle.State(enable = true))
83+
autofillFeature.self().setRawStoredState(Toggle.State(enable = true))
8184

8285
val address = "address"
8386
val webView = spy(WebView(InstrumentationRegistry.getInstrumentation().targetContext))
@@ -127,12 +130,13 @@ class EmailInjectorJsTest {
127130
verify(webView, never()).evaluateJavascript(jsToEvaluate, null)
128131
}
129132

133+
@SuppressLint("DenyListedApi")
130134
@UiThreadTest
131135
@Test
132136
@SdkSuppress(minSdkVersion = 24)
133137
fun whenNotifyWebAppSignEventAndUrlIsFromDuckDuckGoAndFeatureIsDisabledAndEmailIsNotSignedInThenDoNotEvaluateJsCode() {
134138
whenever(mockEmailManager.isSignedIn()).thenReturn(false)
135-
autofillFeature.self().setEnabled(Toggle.State(enable = false))
139+
autofillFeature.self().setRawStoredState(Toggle.State(enable = false))
136140

137141
val jsToEvaluate = getNotifySignOutJsToEvaluate()
138142
val webView = spy(WebView(InstrumentationRegistry.getInstrumentation().targetContext))
@@ -142,12 +146,13 @@ class EmailInjectorJsTest {
142146
verify(webView, never()).evaluateJavascript(jsToEvaluate, null)
143147
}
144148

149+
@SuppressLint("DenyListedApi")
145150
@UiThreadTest
146151
@Test
147152
@SdkSuppress(minSdkVersion = 24)
148153
fun whenNotifyWebAppSignEventAndUrlIsFromDuckDuckGoAndFeatureIsEnabledAndEmailIsNotSignedInThenEvaluateJsCode() {
149154
whenever(mockEmailManager.isSignedIn()).thenReturn(false)
150-
autofillFeature.self().setEnabled(Toggle.State(enable = true))
155+
autofillFeature.self().setRawStoredState(Toggle.State(enable = true))
151156

152157
val jsToEvaluate = getNotifySignOutJsToEvaluate()
153158
val webView = spy(WebView(InstrumentationRegistry.getInstrumentation().targetContext))

autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/email/ResultHandlerEmailProtectionChooseEmail.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class ResultHandlerEmailProtectionChooseEmail @Inject constructor(
133133
@Suppress("DEPRECATION")
134134
@SuppressLint("NewApi")
135135
private inline fun <reified T : Parcelable> Bundle.safeGetParcelable(key: String) =
136-
if (appBuildConfig.sdkInt >= Build.VERSION_CODES.TIRAMISU) {
136+
if (appBuildConfig.sdkInt >= 33) {
137137
getParcelable(key, T::class.java)
138138
} else {
139139
getParcelable(key)

autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/email/incontext/ResultHandlerInContextEmailProtectionPrompt.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class ResultHandlerInContextEmailProtectionPrompt @Inject constructor(
9090
@Suppress("DEPRECATION")
9191
@SuppressLint("NewApi")
9292
private inline fun <reified T : Parcelable> Bundle.safeGetParcelable(key: String) =
93-
if (appBuildConfig.sdkInt >= Build.VERSION_CODES.TIRAMISU) {
93+
if (appBuildConfig.sdkInt >= 33) {
9494
getParcelable(key, T::class.java)
9595
} else {
9696
getParcelable(key)

autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/ui/credential/saving/ResultHandlerSaveLoginCredentials.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class ResultHandlerSaveLoginCredentials @Inject constructor(
8080
@Suppress("DEPRECATION")
8181
@SuppressLint("NewApi")
8282
private inline fun <reified T : Parcelable> Bundle.safeGetParcelable(key: String) =
83-
if (appBuildConfig.sdkInt >= Build.VERSION_CODES.TIRAMISU) {
83+
if (appBuildConfig.sdkInt >= 33) {
8484
getParcelable(key, T::class.java)
8585
} else {
8686
getParcelable(key)

autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/ui/credential/selecting/ResultHandlerCredentialSelection.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class ResultHandlerCredentialSelection @Inject constructor(
138138
@Suppress("DEPRECATION")
139139
@SuppressLint("NewApi")
140140
private inline fun <reified T : Parcelable> Bundle.safeGetParcelable(key: String) =
141-
if (appBuildConfig.sdkInt >= Build.VERSION_CODES.TIRAMISU) {
141+
if (appBuildConfig.sdkInt >= 33) {
142142
getParcelable(key, T::class.java)
143143
} else {
144144
getParcelable(key)

autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/ui/credential/updating/ResultHandlerUpdateLoginCredentials.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class ResultHandlerUpdateLoginCredentials @Inject constructor(
7878
@Suppress("DEPRECATION")
7979
@SuppressLint("NewApi")
8080
private inline fun <reified T : Parcelable> Bundle.safeGetParcelable(key: String) =
81-
if (appBuildConfig.sdkInt >= Build.VERSION_CODES.TIRAMISU) {
81+
if (appBuildConfig.sdkInt >= 33) {
8282
getParcelable(key, T::class.java)
8383
} else {
8484
getParcelable(key)

0 commit comments

Comments
 (0)