Skip to content

Commit d5ee301

Browse files
authored
Rename whitelist to allowlist (#3424)
<!-- Note: This checklist is a reminder of our shared engineering expectations. The items in Bold are required If your PR involves UI changes: 1. Upload screenshots or screencasts that illustrate the changes before / after 2. Add them under the UI changes section (feel free to add more columns if needed) If your PR does not involve UI changes, you can remove the **UI changes** section At a minimum, make sure your changes are tested in API 23 and one of the more recent API levels available. --> Task/Issue URL: https://app.asana.com/0/488551667048375/1205221243351454/f ### Description Rename whitelist to allowlist ### Steps to test this PR * Install an older version of the app * Add a site to the list of unprotected ones * Install this one * Check app starts normally and the unprotected sites list is unchanged ### UI changes No UI changes
1 parent 4166b8c commit d5ee301

69 files changed

Lines changed: 513 additions & 514 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/lint-baseline.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4063,8 +4063,8 @@
40634063

40644064
<issue
40654065
id="UnusedResources"
4066-
message="The resource `R.string.manageWhitelist` appears to be unused"
4067-
errorLine1=" &lt;string name=&quot;manageWhitelist&quot;>Unprotected Sites&lt;/string>"
4066+
message="The resource `R.string.manageAllowlist` appears to be unused"
4067+
errorLine1=" &lt;string name=&quot;manageAllowlist&quot;>Unprotected Sites&lt;/string>"
40684068
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~">
40694069
<location
40704070
file="src/main/res/values/strings.xml"
@@ -4096,8 +4096,8 @@
40964096

40974097
<issue
40984098
id="UnusedResources"
4099-
message="The resource `R.string.whitelistEntryOverflowContentDescription` appears to be unused"
4100-
errorLine1=" &lt;string name=&quot;whitelistEntryOverflowContentDescription&quot; instruction=&quot;Placeholder is a website&quot;>More options for unprotected site %1$s&lt;/string>"
4099+
message="The resource `R.string.allowlistEntryOverflowContentDescription` appears to be unused"
4100+
errorLine1=" &lt;string name=&quot;allowlistEntryOverflowContentDescription&quot; instruction=&quot;Placeholder is a website&quot;>More options for unprotected site %1$s&lt;/string>"
41014101
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
41024102
<location
41034103
file="src/main/res/values/strings.xml"
@@ -4338,11 +4338,11 @@
43384338

43394339
<issue
43404340
id="UnusedResources"
4341-
message="The resource `R.menu.whitelist_individual_overflow_menu` appears to be unused"
4341+
message="The resource `R.menu.allowlist_individual_overflow_menu` appears to be unused"
43424342
errorLine1="&lt;menu xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;>"
43434343
errorLine2="^">
43444344
<location
4345-
file="src/main/res/menu/whitelist_individual_overflow_menu.xml"
4345+
file="src/main/res/menu/allowlist_individual_overflow_menu.xml"
43464346
line="19"
43474347
column="1"/>
43484348
</issue>

app/src/androidTest/java/com/duckduckgo/app/browser/BrowserTabViewModelTest.kt

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ import com.duckduckgo.app.onboarding.store.OnboardingStore
103103
import com.duckduckgo.app.onboarding.store.UserStageStore
104104
import com.duckduckgo.app.pixels.AppPixelName
105105
import com.duckduckgo.app.privacy.db.NetworkLeaderboardDao
106+
import com.duckduckgo.app.privacy.db.UserAllowListDao
106107
import com.duckduckgo.app.privacy.db.UserAllowListRepository
107-
import com.duckduckgo.app.privacy.db.UserWhitelistDao
108108
import com.duckduckgo.app.privacy.model.TestEntity
109-
import com.duckduckgo.app.privacy.model.UserWhitelistedDomain
109+
import com.duckduckgo.app.privacy.model.UserAllowListedDomain
110110
import com.duckduckgo.app.settings.db.SettingsDataStore
111111
import com.duckduckgo.app.statistics.api.StatisticsUpdater
112112
import com.duckduckgo.app.statistics.pixels.Pixel
@@ -265,7 +265,7 @@ class BrowserTabViewModelTest {
265265
private lateinit var mockUserStageStore: UserStageStore
266266

267267
@Mock
268-
private lateinit var mockUserWhitelistDao: UserWhitelistDao
268+
private lateinit var mockUserAllowListDao: UserAllowListDao
269269

270270
@Mock
271271
private lateinit var mockContentBlocking: ContentBlocking
@@ -432,7 +432,7 @@ class BrowserTabViewModelTest {
432432
surveyDao = mockSurveyDao,
433433
widgetCapabilities = mockWidgetCapabilities,
434434
dismissedCtaDao = mockDismissedCtaDao,
435-
userWhitelistDao = mockUserWhitelistDao,
435+
userAllowListDao = mockUserAllowListDao,
436436
settingsDataStore = mockSettingsStore,
437437
onboardingStore = mockOnboardingStore,
438438
userStageStore = mockUserStageStore,
@@ -443,7 +443,7 @@ class BrowserTabViewModelTest {
443443
surveyRepository = mockSurveyRepository,
444444
)
445445

446-
val siteFactory = SiteFactoryImpl(mockEntityLookup, mockUserWhitelistDao, mockContentBlocking, TestScope())
446+
val siteFactory = SiteFactoryImpl(mockEntityLookup, mockUserAllowListDao, mockContentBlocking, TestScope())
447447

448448
accessibilitySettingsDataStore = AccessibilitySettingsSharedPreferences(context, coroutineRule.testDispatcherProvider, TestScope())
449449

@@ -453,7 +453,7 @@ class BrowserTabViewModelTest {
453453
whenever(mockTabRepository.retrieveSiteData(any())).thenReturn(MutableLiveData())
454454
whenever(mockTabRepository.childClosedTabs).thenReturn(childClosedTabsFlow)
455455
whenever(mockAppInstallStore.installTimestamp).thenReturn(System.currentTimeMillis() - TimeUnit.DAYS.toMillis(1))
456-
whenever(mockUserWhitelistDao.contains(anyString())).thenReturn(false)
456+
whenever(mockUserAllowListDao.contains(anyString())).thenReturn(false)
457457
whenever(mockContentBlocking.isAnException(anyString())).thenReturn(false)
458458
whenever(fireproofDialogsEventHandler.event).thenReturn(fireproofDialogsEventHandlerLiveData)
459459

@@ -463,7 +463,7 @@ class BrowserTabViewModelTest {
463463
duckDuckGoUrlDetector = DuckDuckGoUrlDetectorImpl(),
464464
siteFactory = siteFactory,
465465
tabRepository = mockTabRepository,
466-
userWhitelistDao = mockUserWhitelistDao,
466+
userAllowListDao = mockUserAllowListDao,
467467
networkLeaderboardDao = mockNetworkLeaderboardDao,
468468
autoComplete = mockAutoCompleteApi,
469469
appSettingsPreferencesStore = mockSettingsStore,
@@ -1636,18 +1636,18 @@ class BrowserTabViewModelTest {
16361636
}
16371637

16381638
@Test
1639-
fun whenPrivacyProtectionMenuClickedAndSiteNotInWhiteListThenSiteAddedToWhitelistAndPixelSentAndPageRefreshed() = runTest {
1640-
whenever(mockUserWhitelistDao.contains("www.example.com")).thenReturn(false)
1639+
fun whenPrivacyProtectionMenuClickedAndSiteNotInAllowListThenSiteAddedToAllowListAndPixelSentAndPageRefreshed() = runTest {
1640+
whenever(mockUserAllowListDao.contains("www.example.com")).thenReturn(false)
16411641
loadUrl("http://www.example.com/home.html")
16421642
testee.onPrivacyProtectionMenuClicked()
1643-
verify(mockUserWhitelistDao).insert(UserWhitelistedDomain("www.example.com"))
1644-
verify(mockPixel).fire(AppPixelName.BROWSER_MENU_WHITELIST_ADD)
1643+
verify(mockUserAllowListDao).insert(UserAllowListedDomain("www.example.com"))
1644+
verify(mockPixel).fire(AppPixelName.BROWSER_MENU_ALLOWLIST_ADD)
16451645
verify(mockCommandObserver).onChanged(NavigationCommand.Refresh)
16461646
}
16471647

16481648
@Test
1649-
fun whenPrivacyProtectionMenuClickedAndSiteNotInWhiteListThenShowDisabledConfirmationMessage() = runTest {
1650-
whenever(mockUserWhitelistDao.contains("www.example.com")).thenReturn(false)
1649+
fun whenPrivacyProtectionMenuClickedAndSiteNotInAllowListThenShowDisabledConfirmationMessage() = runTest {
1650+
whenever(mockUserAllowListDao.contains("www.example.com")).thenReturn(false)
16511651
loadUrl("http://www.example.com/home.html")
16521652
testee.onPrivacyProtectionMenuClicked()
16531653
assertCommandIssued<ShowPrivacyProtectionDisabledConfirmation> {
@@ -1656,18 +1656,18 @@ class BrowserTabViewModelTest {
16561656
}
16571657

16581658
@Test
1659-
fun whenPrivacyProtectionMenuClickedForWhiteListedSiteThenSiteRemovedFromWhitelistAndPixelSentAndPageRefreshed() = runTest {
1660-
whenever(mockUserWhitelistDao.contains("www.example.com")).thenReturn(true)
1659+
fun whenPrivacyProtectionMenuClickedForAllowListedSiteThenSiteRemovedFromAllowListAndPixelSentAndPageRefreshed() = runTest {
1660+
whenever(mockUserAllowListDao.contains("www.example.com")).thenReturn(true)
16611661
loadUrl("http://www.example.com/home.html")
16621662
testee.onPrivacyProtectionMenuClicked()
1663-
verify(mockUserWhitelistDao).delete(UserWhitelistedDomain("www.example.com"))
1664-
verify(mockPixel).fire(AppPixelName.BROWSER_MENU_WHITELIST_REMOVE)
1663+
verify(mockUserAllowListDao).delete(UserAllowListedDomain("www.example.com"))
1664+
verify(mockPixel).fire(AppPixelName.BROWSER_MENU_ALLOWLIST_REMOVE)
16651665
verify(mockCommandObserver).onChanged(NavigationCommand.Refresh)
16661666
}
16671667

16681668
@Test
1669-
fun whenPrivacyProtectionMenuClickedForWhiteListedSiteThenShowDisabledConfirmationMessage() = runTest {
1670-
whenever(mockUserWhitelistDao.contains("www.example.com")).thenReturn(true)
1669+
fun whenPrivacyProtectionMenuClickedForAllowListedSiteThenShowDisabledConfirmationMessage() = runTest {
1670+
whenever(mockUserAllowListDao.contains("www.example.com")).thenReturn(true)
16711671
loadUrl("http://www.example.com/home.html")
16721672
testee.onPrivacyProtectionMenuClicked()
16731673
assertCommandIssued<ShowPrivacyProtectionEnabledConfirmation> {
@@ -2502,7 +2502,7 @@ class BrowserTabViewModelTest {
25022502
}
25032503

25042504
@Test
2505-
fun whenUserBrowsingPressesBackThenCannotWhitelist() {
2505+
fun whenUserBrowsingPressesBackThenCannotAllowList() {
25062506
setupNavigation(skipHome = false, isBrowsing = true, canGoBack = false)
25072507
assertTrue(testee.onUserPressedBack())
25082508
assertFalse(browserViewState().canChangePrivacyProtection)
@@ -2546,7 +2546,7 @@ class BrowserTabViewModelTest {
25462546
}
25472547

25482548
@Test
2549-
fun whenUserBrowsingPressesBackAndForwardThenCanWhitelist() {
2549+
fun whenUserBrowsingPressesBackAndForwardThenCanAllowList() {
25502550
setupNavigation(skipHome = false, isBrowsing = true, canGoBack = false)
25512551
testee.onUserPressedBack()
25522552
testee.onUserPressedForward()
@@ -3697,7 +3697,7 @@ class BrowserTabViewModelTest {
36973697
}
36983698

36993699
@Test
3700-
fun whenLoadUrlAndUrlIsInContentBlockingExceptionsListThenIsWhitelistedIsTrue() {
3700+
fun whenLoadUrlAndUrlIsInContentBlockingExceptionsListThenIsAllowListedIsTrue() {
37013701
whenever(mockContentBlocking.isAnException("example.com")).thenReturn(true)
37023702
loadUrl("https://example.com")
37033703
assertTrue(browserViewState().isPrivacyProtectionEnabled)

app/src/androidTest/java/com/duckduckgo/app/cta/ui/CtaViewModelTest.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import com.duckduckgo.app.onboarding.store.AppStage
3535
import com.duckduckgo.app.onboarding.store.OnboardingStore
3636
import com.duckduckgo.app.onboarding.store.UserStageStore
3737
import com.duckduckgo.app.pixels.AppPixelName.*
38-
import com.duckduckgo.app.privacy.db.UserWhitelistDao
38+
import com.duckduckgo.app.privacy.db.UserAllowListDao
3939
import com.duckduckgo.app.privacy.model.HttpsStatus
4040
import com.duckduckgo.app.privacy.model.TestEntity
4141
import com.duckduckgo.app.settings.db.SettingsDataStore
@@ -109,7 +109,7 @@ class CtaViewModelTest {
109109
private lateinit var mockOnboardingStore: OnboardingStore
110110

111111
@Mock
112-
private lateinit var mockUserWhitelistDao: UserWhitelistDao
112+
private lateinit var mockUserAllowListDao: UserAllowListDao
113113

114114
@Mock
115115
private lateinit var mockUserStageStore: UserStageStore
@@ -144,7 +144,7 @@ class CtaViewModelTest {
144144
.build()
145145

146146
whenever(mockAppInstallStore.installTimestamp).thenReturn(System.currentTimeMillis() - TimeUnit.DAYS.toMillis(1))
147-
whenever(mockUserWhitelistDao.contains(any())).thenReturn(false)
147+
whenever(mockUserAllowListDao.contains(any())).thenReturn(false)
148148
whenever(mockDismissedCtaDao.dismissedCtas()).thenReturn(db.dismissedCtaDao().dismissedCtas())
149149
whenever(mockTabRepository.flowTabs).thenReturn(db.tabsDao().flowTabs())
150150

@@ -154,7 +154,7 @@ class CtaViewModelTest {
154154
surveyDao = mockSurveyDao,
155155
widgetCapabilities = mockWidgetCapabilities,
156156
dismissedCtaDao = mockDismissedCtaDao,
157-
userWhitelistDao = mockUserWhitelistDao,
157+
userAllowListDao = mockUserAllowListDao,
158158
settingsDataStore = mockSettingsDataStore,
159159
onboardingStore = mockOnboardingStore,
160160
userStageStore = mockUserStageStore,
@@ -339,7 +339,7 @@ class CtaViewModelTest {
339339
@Test
340340
fun whenRefreshCtaWhileBrowsingAndPrivacyOffForSiteThenReturnNull() = runTest {
341341
givenDaxOnboardingActive()
342-
whenever(mockUserWhitelistDao.contains(any())).thenReturn(true)
342+
whenever(mockUserAllowListDao.contains(any())).thenReturn(true)
343343
val site = site(url = "http://www.facebook.com", entity = TestEntity("Facebook", "Facebook", 9.0))
344344

345345
val value = testee.refreshCta(coroutineRule.testDispatcher, isBrowserShowing = true, site = site)

app/src/androidTest/java/com/duckduckgo/app/privacy/db/UserWhitelistDaoTest.kt renamed to app/src/androidTest/java/com/duckduckgo/app/privacy/db/UserAllowListDaoTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import org.junit.Before
3131
import org.junit.Rule
3232
import org.junit.Test
3333

34-
class UserWhitelistDaoTest {
34+
class UserAllowListDaoTest {
3535

3636
@get:Rule
3737
@Suppress("unused")
@@ -42,14 +42,14 @@ class UserWhitelistDaoTest {
4242
var coroutinesTestRule = CoroutineTestRule()
4343

4444
private lateinit var db: AppDatabase
45-
private lateinit var dao: UserWhitelistDao
45+
private lateinit var dao: UserAllowListDao
4646

4747
@Before
4848
fun before() {
4949
db = Room.inMemoryDatabaseBuilder(InstrumentationRegistry.getInstrumentation().targetContext, AppDatabase::class.java)
5050
.allowMainThreadQueries()
5151
.build()
52-
dao = db.userWhitelistDao()
52+
dao = db.userAllowListDao()
5353
}
5454

5555
@After

app/src/androidTest/java/com/duckduckgo/app/privacy/db/UserAllowListRepositoryTest.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class UserAllowListRepositoryTest {
4444
var instantTaskExecutorRule = InstantTaskExecutorRule()
4545

4646
private lateinit var db: AppDatabase
47-
private lateinit var dao: UserWhitelistDao
47+
private lateinit var dao: UserAllowListDao
4848
private lateinit var repository: UserAllowListRepository
4949

5050
@ExperimentalCoroutinesApi
@@ -54,7 +54,7 @@ class UserAllowListRepositoryTest {
5454
db = Room.inMemoryDatabaseBuilder(InstrumentationRegistry.getInstrumentation().targetContext, AppDatabase::class.java)
5555
.allowMainThreadQueries()
5656
.build()
57-
dao = db.userWhitelistDao()
57+
dao = db.userAllowListDao()
5858
repository = RealUserAllowListRepository(dao, TestScope(), coroutineRule.testDispatcherProvider)
5959
}
6060

@@ -64,21 +64,21 @@ class UserAllowListRepositoryTest {
6464
}
6565

6666
@Test
67-
fun whenDbContainsUserWhiteListedDomainsThenUpdateUserWhiteList() {
67+
fun whenDbContainsUserAllowListedDomainsThenUpdateUserAllowList() {
6868
assertEquals(0, repository.domainsInUserAllowList().size)
6969
dao.insert("example.com")
7070
assertEquals(1, repository.domainsInUserAllowList().size)
7171
assertEquals("example.com", repository.domainsInUserAllowList().first())
7272
}
7373

7474
@Test
75-
fun whenDbContainsUserWhiteListedDomainThenIsUrlInAllowListReturnsTrue() {
75+
fun whenDbContainsUserAllowListedDomainThenIsUrlInAllowListReturnsTrue() {
7676
dao.insert("example.com")
7777
assertTrue(repository.isUrlInUserAllowList("https://example.com"))
7878
}
7979

8080
@Test
81-
fun whenDbDoesNotContainUserWhiteListedDomainThenIsUrlInAllowListReturnsFalse() {
81+
fun whenDbDoesNotContainUserAllowListedDomainThenIsUrlInAllowListReturnsFalse() {
8282
dao.insert("example.com")
8383
assertFalse(repository.isUrlInUserAllowList("https://foo.com"))
8484
}

0 commit comments

Comments
 (0)