Skip to content

Commit 5596ef1

Browse files
Remove uoa experiment (#1241)
1 parent 30cd90c commit 5596ef1

Some content is hidden

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

46 files changed

+1010
-1703
lines changed

app/schemas/com.duckduckgo.app.global.db.AppDatabase/34.json

Lines changed: 866 additions & 0 deletions
Large diffs are not rendered by default.

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

Lines changed: 1 addition & 242 deletions
Original file line numberDiff line numberDiff line change
@@ -64,21 +64,15 @@ import com.duckduckgo.app.cta.ui.CtaViewModel
6464
import com.duckduckgo.app.cta.ui.DaxBubbleCta
6565
import com.duckduckgo.app.cta.ui.DaxDialogCta
6666
import com.duckduckgo.app.cta.ui.HomePanelCta
67-
import com.duckduckgo.app.cta.ui.UseOurAppCta
6867
import com.duckduckgo.app.email.EmailManager
6968
import com.duckduckgo.app.fire.fireproofwebsite.data.FireproofWebsiteDao
7069
import com.duckduckgo.app.fire.fireproofwebsite.data.FireproofWebsiteEntity
7170
import com.duckduckgo.app.fire.fireproofwebsite.data.FireproofWebsiteRepository
7271
import com.duckduckgo.app.global.db.AppDatabase
73-
import com.duckduckgo.app.global.events.db.UserEventEntity
74-
import com.duckduckgo.app.global.events.db.UserEventKey
7572
import com.duckduckgo.app.global.events.db.UserEventsStore
7673
import com.duckduckgo.app.global.install.AppInstallStore
7774
import com.duckduckgo.app.global.model.Site
7875
import com.duckduckgo.app.global.model.SiteFactory
79-
import com.duckduckgo.app.global.useourapp.UseOurAppDetector
80-
import com.duckduckgo.app.global.useourapp.UseOurAppDetector.Companion.USE_OUR_APP_DOMAIN
81-
import com.duckduckgo.app.global.useourapp.UseOurAppDetector.Companion.USE_OUR_APP_SHORTCUT_URL
8276
import com.duckduckgo.app.globalprivacycontrol.GlobalPrivacyControlManager
8377
import com.duckduckgo.app.globalprivacycontrol.GlobalPrivacyControlManager.Companion.GPC_HEADER
8478
import com.duckduckgo.app.globalprivacycontrol.GlobalPrivacyControlManager.Companion.GPC_HEADER_VALUE
@@ -88,7 +82,6 @@ import com.duckduckgo.app.location.data.LocationPermissionType
8882
import com.duckduckgo.app.location.data.LocationPermissionsDao
8983
import com.duckduckgo.app.location.data.LocationPermissionsRepository
9084
import com.duckduckgo.app.notification.db.NotificationDao
91-
import com.duckduckgo.app.notification.model.UseOurAppNotification
9285
import com.duckduckgo.app.onboarding.store.AppStage
9386
import com.duckduckgo.app.onboarding.store.OnboardingStore
9487
import com.duckduckgo.app.onboarding.store.UserStageStore
@@ -317,12 +310,9 @@ class BrowserTabViewModelTest {
317310
mockWidgetCapabilities,
318311
mockDismissedCtaDao,
319312
mockUserWhitelistDao,
320-
mockVariantManager,
321313
mockSettingsStore,
322314
mockOnboardingStore,
323315
mockUserStageStore,
324-
mockUserEventsStore,
325-
UseOurAppDetector(mockUserEventsStore),
326316
mockTabRepository,
327317
coroutineRule.testDispatcherProvider
328318
)
@@ -370,7 +360,6 @@ class BrowserTabViewModelTest {
370360
navigationAwareLoginDetector = mockNavigationAwareLoginDetector,
371361
userEventsStore = mockUserEventsStore,
372362
notificationDao = mockNotificationDao,
373-
useOurAppDetector = UseOurAppDetector(mockUserEventsStore),
374363
variantManager = mockVariantManager,
375364
fileDownloader = mockFileDownloader,
376365
globalPrivacyControl = GlobalPrivacyControlManager(mockSettingsStore),
@@ -427,25 +416,14 @@ class BrowserTabViewModelTest {
427416
}
428417

429418
@Test
430-
fun whenViewBecomesVisibleAndHomeShowingAndUserIsNotInUseOurAppOnboardingStageThenKeyboardShown() = coroutineRule.runBlocking {
431-
whenever(mockUserStageStore.getUserAppStage()).thenReturn(AppStage.ESTABLISHED)
419+
fun whenViewBecomesVisibleAndHomeShowingThenKeyboardShown() = coroutineRule.runBlocking {
432420
setBrowserShowing(false)
433421

434422
testee.onViewVisible()
435423
verify(mockCommandObserver, atLeastOnce()).onChanged(commandCaptor.capture())
436424
assertTrue(commandCaptor.allValues.contains(Command.ShowKeyboard))
437425
}
438426

439-
@Test
440-
fun whenViewBecomesVisibleAndHomeShowingAndUserIsInUseOurAppOnboardingStageThenKeyboardHidden() = coroutineRule.runBlocking {
441-
whenever(mockUserStageStore.getUserAppStage()).thenReturn(AppStage.USE_OUR_APP_ONBOARDING)
442-
setBrowserShowing(false)
443-
444-
testee.onViewVisible()
445-
verify(mockCommandObserver, atLeastOnce()).onChanged(commandCaptor.capture())
446-
assertTrue(commandCaptor.allValues.contains(Command.HideKeyboard))
447-
}
448-
449427
@Test
450428
fun whenViewBecomesVisibleAndHomeCtaPresentThenKeyboardHidden() = coroutineRule.runBlocking {
451429
givenExpectedCtaAddWidgetInstructions()
@@ -1890,16 +1868,6 @@ class BrowserTabViewModelTest {
18901868
assertCommandIssued<Command.LaunchLegacyAddWidget>()
18911869
}
18921870

1893-
@Test
1894-
fun whenUserClickedUseOurAppCtaOkButtonThenLaunchAddHomeShortcutAndNavigateCommand() {
1895-
whenever(mockOmnibarConverter.convertQueryToUrl(USE_OUR_APP_SHORTCUT_URL, null)).thenReturn(USE_OUR_APP_SHORTCUT_URL)
1896-
val cta = UseOurAppCta()
1897-
setCta(cta)
1898-
testee.onUserClickCtaOkButton()
1899-
assertCommandIssued<Command.AddHomeShortcut>()
1900-
assertCommandIssued<Navigate>()
1901-
}
1902-
19031871
@Test
19041872
fun whenSurveyCtaDismissedAndNoOtherCtaPossibleCtaIsNull() = coroutineRule.runBlocking {
19051873
givenShownCtas(CtaId.DAX_INTRO, CtaId.DAX_END)
@@ -1977,14 +1945,6 @@ class BrowserTabViewModelTest {
19771945
verify(mockSurveyDao).cancelScheduledSurveys()
19781946
}
19791947

1980-
@Test
1981-
fun whenUserClickedSecondaryCtaButtonInUseOurAppCtaThenLaunchShowKeyboardCommand() {
1982-
val cta = UseOurAppCta()
1983-
setCta(cta)
1984-
testee.onUserClickCtaSecondaryButton()
1985-
assertCommandIssued<Command.ShowKeyboard>()
1986-
}
1987-
19881948
@Test
19891949
fun whenSurrogateDetectedThenSiteUpdated() {
19901950
givenOneActiveTabSelected()
@@ -2177,30 +2137,6 @@ class BrowserTabViewModelTest {
21772137
}
21782138
}
21792139

2180-
@Test
2181-
fun whenLoginDetectedAndUrlIsUseOurAppThenRegisterUserEvent() = coroutineRule.runBlocking {
2182-
whenever(mockUserEventsStore.getUserEvent(UserEventKey.USE_OUR_APP_FIREPROOF_DIALOG_SEEN)).thenReturn(null)
2183-
loginEventLiveData.value = givenLoginDetected(USE_OUR_APP_SHORTCUT_URL)
2184-
2185-
verify(mockUserEventsStore).registerUserEvent(UserEventKey.USE_OUR_APP_FIREPROOF_DIALOG_SEEN)
2186-
}
2187-
2188-
@Test
2189-
fun whenLoginDetectedAndUrlIsNotUseOurAppThenDoNotRegisterUserEvent() = coroutineRule.runBlocking {
2190-
whenever(mockUserEventsStore.getUserEvent(UserEventKey.USE_OUR_APP_FIREPROOF_DIALOG_SEEN)).thenReturn(null)
2191-
loginEventLiveData.value = givenLoginDetected("example.com")
2192-
2193-
verify(mockUserEventsStore, never()).registerUserEvent(UserEventKey.USE_OUR_APP_FIREPROOF_DIALOG_SEEN)
2194-
}
2195-
2196-
@Test
2197-
fun whenLoginDetectedAndDialogAlreadySeenThenDoNotRegisterUserEvent() = coroutineRule.runBlocking {
2198-
whenever(mockUserEventsStore.getUserEvent(UserEventKey.USE_OUR_APP_FIREPROOF_DIALOG_SEEN)).thenReturn(UserEventEntity(UserEventKey.USE_OUR_APP_FIREPROOF_DIALOG_SEEN))
2199-
loginEventLiveData.value = givenLoginDetected(USE_OUR_APP_SHORTCUT_URL)
2200-
2201-
verify(mockUserEventsStore, never()).registerUserEvent(UserEventKey.USE_OUR_APP_FIREPROOF_DIALOG_SEEN)
2202-
}
2203-
22042140
@Test
22052141
fun whenUserBrowsingPressesBackThenCannotAddBookmark() {
22062142
setupNavigation(skipHome = false, isBrowsing = true, canGoBack = false)
@@ -2333,163 +2269,6 @@ class BrowserTabViewModelTest {
23332269
testee.onUserSubmittedQuery("about:blank")
23342270
}
23352271

2336-
@Test
2337-
fun whenViewReadyIfDomainSameAsUseOurAppAfterNotificationSeenThenPixelSent() = coroutineRule.runBlocking {
2338-
givenUseOurAppSiteSelected()
2339-
whenever(mockNotificationDao.exists(UseOurAppNotification.ID)).thenReturn(true)
2340-
2341-
testee.onViewReady()
2342-
2343-
verify(mockPixel).fire(AppPixelName.UOA_VISITED_AFTER_NOTIFICATION)
2344-
}
2345-
2346-
@Test
2347-
fun whenViewReadyIfDomainSameAsUseOurAppAfterShortcutAddedThenPixelSent() = coroutineRule.runBlocking {
2348-
givenUseOurAppSiteSelected()
2349-
whenever(mockUserEventsStore.getUserEvent(UserEventKey.USE_OUR_APP_SHORTCUT_ADDED)).thenReturn(UserEventEntity(UserEventKey.USE_OUR_APP_SHORTCUT_ADDED))
2350-
2351-
testee.onViewReady()
2352-
2353-
verify(mockPixel).fire(AppPixelName.UOA_VISITED_AFTER_SHORTCUT)
2354-
}
2355-
2356-
@Test
2357-
fun whenViewReadyIfDomainSameAsUseOurAppAfterDeleteCtaShownThenPixelSent() = coroutineRule.runBlocking {
2358-
givenUseOurAppSiteSelected()
2359-
whenever(mockDismissedCtaDao.exists(CtaId.USE_OUR_APP_DELETION)).thenReturn(true)
2360-
2361-
testee.onViewReady()
2362-
2363-
verify(mockPixel).fire(AppPixelName.UOA_VISITED_AFTER_DELETE_CTA)
2364-
}
2365-
2366-
@Test
2367-
fun whenViewReadyIfDomainSameAsUseOurAppThenPixelSent() = coroutineRule.runBlocking {
2368-
givenUseOurAppSiteSelected()
2369-
2370-
testee.onViewReady()
2371-
2372-
verify(mockPixel).fire(AppPixelName.UOA_VISITED)
2373-
}
2374-
2375-
@Test
2376-
fun whenViewReadyIfDomainIsNotTheSameAsUseOurAppAfterNotificationSeenThenPixelNotSent() = coroutineRule.runBlocking {
2377-
givenUseOurAppSiteIsNotSelected()
2378-
whenever(mockNotificationDao.exists(UseOurAppNotification.ID)).thenReturn(true)
2379-
2380-
testee.onViewReady()
2381-
2382-
verify(mockPixel, never()).fire(AppPixelName.UOA_VISITED_AFTER_NOTIFICATION)
2383-
}
2384-
2385-
@Test
2386-
fun whenViewReadyIfDomainIsNotTheSameAsUseOurAppAfterShortcutAddedThenPixelNotSent() = coroutineRule.runBlocking {
2387-
givenUseOurAppSiteIsNotSelected()
2388-
whenever(mockUserEventsStore.getUserEvent(UserEventKey.USE_OUR_APP_SHORTCUT_ADDED)).thenReturn(UserEventEntity(UserEventKey.USE_OUR_APP_SHORTCUT_ADDED))
2389-
2390-
testee.onViewReady()
2391-
2392-
verify(mockPixel, never()).fire(AppPixelName.UOA_VISITED_AFTER_SHORTCUT)
2393-
}
2394-
2395-
@Test
2396-
fun whenViewReadyIfDomainIsNotTheSameAsUseOurAppAfterDeleteCtaShownThenPixelNotSent() = coroutineRule.runBlocking {
2397-
givenUseOurAppSiteIsNotSelected()
2398-
whenever(mockDismissedCtaDao.exists(CtaId.USE_OUR_APP_DELETION)).thenReturn(true)
2399-
2400-
testee.onViewReady()
2401-
2402-
verify(mockPixel, never()).fire(AppPixelName.UOA_VISITED_AFTER_DELETE_CTA)
2403-
}
2404-
2405-
@Test
2406-
fun whenViewReadyIfDomainIsNotTheSameAsUseOurAppAThenPixelNotSent() = coroutineRule.runBlocking {
2407-
givenUseOurAppSiteIsNotSelected()
2408-
2409-
testee.onViewReady()
2410-
2411-
verify(mockPixel, never()).fire(AppPixelName.UOA_VISITED)
2412-
}
2413-
2414-
@Test
2415-
fun whenPageChangedIfPreviousOneWasNotUseOurAppSiteAfterNotificationSeenThenPixelSent() = coroutineRule.runBlocking {
2416-
givenUseOurAppSiteIsNotSelected()
2417-
whenever(mockNotificationDao.exists(UseOurAppNotification.ID)).thenReturn(true)
2418-
2419-
loadUrl(USE_OUR_APP_DOMAIN, isBrowserShowing = true)
2420-
2421-
verify(mockPixel).fire(AppPixelName.UOA_VISITED_AFTER_NOTIFICATION)
2422-
}
2423-
2424-
@Test
2425-
fun whenPageChangedIfPreviousOneWasNotUseOurAppSiteAfterShortcutAddedThenPixelSent() = coroutineRule.runBlocking {
2426-
givenUseOurAppSiteIsNotSelected()
2427-
whenever(mockUserEventsStore.getUserEvent(UserEventKey.USE_OUR_APP_SHORTCUT_ADDED)).thenReturn(UserEventEntity(UserEventKey.USE_OUR_APP_SHORTCUT_ADDED))
2428-
2429-
loadUrl(USE_OUR_APP_DOMAIN, isBrowserShowing = true)
2430-
2431-
verify(mockPixel).fire(AppPixelName.UOA_VISITED_AFTER_SHORTCUT)
2432-
}
2433-
2434-
@Test
2435-
fun whenPageChangedIfPreviousOneWasNotUseOurAppSiteAfterDeleteCtaShownThenPixelSent() = coroutineRule.runBlocking {
2436-
givenUseOurAppSiteIsNotSelected()
2437-
whenever(mockDismissedCtaDao.exists(CtaId.USE_OUR_APP_DELETION)).thenReturn(true)
2438-
2439-
loadUrl(USE_OUR_APP_DOMAIN, isBrowserShowing = true)
2440-
2441-
verify(mockPixel).fire(AppPixelName.UOA_VISITED_AFTER_DELETE_CTA)
2442-
}
2443-
2444-
@Test
2445-
fun whenPageChangedIfPreviousOneWasNotUseOurAppSiteThenPixelSent() = coroutineRule.runBlocking {
2446-
givenUseOurAppSiteIsNotSelected()
2447-
2448-
loadUrl(USE_OUR_APP_DOMAIN, isBrowserShowing = true)
2449-
2450-
verify(mockPixel).fire(AppPixelName.UOA_VISITED)
2451-
}
2452-
2453-
@Test
2454-
fun whenPageChangedIfPreviousOneWasUseOurAppSiteAfterNotificationSeenThenPixelNotSent() = coroutineRule.runBlocking {
2455-
givenUseOurAppSiteSelected()
2456-
whenever(mockNotificationDao.exists(UseOurAppNotification.ID)).thenReturn(true)
2457-
2458-
loadUrl(USE_OUR_APP_DOMAIN, isBrowserShowing = true)
2459-
2460-
verify(mockPixel, never()).fire(AppPixelName.UOA_VISITED_AFTER_NOTIFICATION)
2461-
}
2462-
2463-
@Test
2464-
fun whenPageChangedIfPreviousOneWasUseOurAppSiteAfterShortcutAddedThenPixelNotSent() = coroutineRule.runBlocking {
2465-
givenUseOurAppSiteSelected()
2466-
val timestampEntity = UserEventEntity(UserEventKey.USE_OUR_APP_SHORTCUT_ADDED)
2467-
whenever(mockUserEventsStore.getUserEvent(UserEventKey.USE_OUR_APP_SHORTCUT_ADDED)).thenReturn(timestampEntity)
2468-
2469-
loadUrl(USE_OUR_APP_DOMAIN, isBrowserShowing = true)
2470-
2471-
verify(mockPixel, never()).fire(AppPixelName.UOA_VISITED_AFTER_SHORTCUT)
2472-
}
2473-
2474-
@Test
2475-
fun whenPageChangedIfPreviousOneWasUseOurAppSiteThenAfterDeleteCtaShownPixelNotSent() = coroutineRule.runBlocking {
2476-
givenUseOurAppSiteSelected()
2477-
whenever(mockDismissedCtaDao.exists(CtaId.USE_OUR_APP_DELETION)).thenReturn(true)
2478-
2479-
loadUrl(USE_OUR_APP_DOMAIN, isBrowserShowing = true)
2480-
2481-
verify(mockPixel, never()).fire(AppPixelName.UOA_VISITED_AFTER_DELETE_CTA)
2482-
}
2483-
2484-
@Test
2485-
fun whenPageChangedIfPreviousOneWasUseOurAppSiteThenNotSent() = coroutineRule.runBlocking {
2486-
givenUseOurAppSiteSelected()
2487-
2488-
loadUrl(USE_OUR_APP_DOMAIN, isBrowserShowing = true)
2489-
2490-
verify(mockPixel, never()).fire(AppPixelName.UOA_VISITED)
2491-
}
2492-
24932272
@Test
24942273
fun whenDosAttackDetectedThenErrorIsShown() {
24952274
testee.dosAttackDetected()
@@ -3365,26 +3144,6 @@ class BrowserTabViewModelTest {
33653144
testee.loadData("TAB_ID", "https://example.com", false)
33663145
}
33673146

3368-
private fun givenUseOurAppSiteSelected() {
3369-
whenever(mockOmnibarConverter.convertQueryToUrl(USE_OUR_APP_DOMAIN, null)).thenReturn(USE_OUR_APP_DOMAIN)
3370-
val site: Site = mock()
3371-
whenever(site.url).thenReturn(USE_OUR_APP_DOMAIN)
3372-
val siteLiveData = MutableLiveData<Site>()
3373-
siteLiveData.value = site
3374-
whenever(mockTabRepository.retrieveSiteData("TAB_ID")).thenReturn(siteLiveData)
3375-
testee.loadData("TAB_ID", USE_OUR_APP_DOMAIN, false)
3376-
}
3377-
3378-
private fun givenUseOurAppSiteIsNotSelected() {
3379-
whenever(mockOmnibarConverter.convertQueryToUrl("example.com", null)).thenReturn("example.com")
3380-
val site: Site = mock()
3381-
whenever(site.url).thenReturn("example.com")
3382-
val siteLiveData = MutableLiveData<Site>()
3383-
siteLiveData.value = site
3384-
whenever(mockTabRepository.retrieveSiteData("TAB_ID")).thenReturn(siteLiveData)
3385-
testee.loadData("TAB_ID", "example.com", false)
3386-
}
3387-
33883147
private fun givenFireproofWebsiteDomain(vararg fireproofWebsitesDomain: String) {
33893148
fireproofWebsitesDomain.forEach {
33903149
fireproofWebsiteDao.insert(FireproofWebsiteEntity(domain = it))

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

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ import com.duckduckgo.app.global.rating.AppEnjoymentPromptEmitter
2828
import com.duckduckgo.app.global.rating.AppEnjoymentPromptOptions
2929
import com.duckduckgo.app.global.rating.AppEnjoymentUserEventRecorder
3030
import com.duckduckgo.app.global.rating.PromptCount
31-
import com.duckduckgo.app.global.useourapp.UseOurAppDetector
32-
import com.duckduckgo.app.global.useourapp.UseOurAppDetector.Companion.USE_OUR_APP_DOMAIN
3331
import com.duckduckgo.app.pixels.AppPixelName
3432
import com.duckduckgo.app.privacy.ui.PrivacyDashboardActivity
3533
import com.duckduckgo.app.runBlocking
@@ -101,7 +99,6 @@ class BrowserViewModelTest {
10199
dataClearer = mockAutomaticDataClearer,
102100
appEnjoymentPromptEmitter = mockAppEnjoymentPromptEmitter,
103101
appEnjoymentUserEventRecorder = mockAppEnjoymentUserEventRecorder,
104-
useOurAppDetector = UseOurAppDetector(mockUserEventsStore),
105102
dispatchers = coroutinesTestRule.testDispatcherProvider,
106103
pixel = mockPixel
107104
)
@@ -204,15 +201,7 @@ class BrowserViewModelTest {
204201
}
205202

206203
@Test
207-
fun whenOpenShortcutIfUrlIsUseOurAppDomainThenFirePixel() {
208-
val url = "http://m.$USE_OUR_APP_DOMAIN"
209-
whenever(mockOmnibarEntryConverter.convertQueryToUrl(url)).thenReturn(url)
210-
testee.onOpenShortcut(url)
211-
verify(mockPixel).fire(AppPixelName.USE_OUR_APP_SHORTCUT_OPENED)
212-
}
213-
214-
@Test
215-
fun whenOpenShortcutIfUrlIsNotUSeOurAppUrlThenFirePixel() {
204+
fun whenOpenShortcutThenFirePixel() {
216205
val url = "example.com"
217206
whenever(mockOmnibarEntryConverter.convertQueryToUrl(url)).thenReturn(url)
218207
testee.onOpenShortcut(url)

app/src/androidTest/java/com/duckduckgo/app/browser/logindetection/JsLoginDetectorTest.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ import androidx.test.annotation.UiThreadTest
2323
import androidx.test.platform.app.InstrumentationRegistry
2424
import com.duckduckgo.app.CoroutineTestRule
2525
import com.duckduckgo.app.browser.logindetection.LoginDetectionJavascriptInterface.Companion.JAVASCRIPT_INTERFACE_NAME
26-
import com.duckduckgo.app.global.events.db.UserEventsStore
27-
import com.duckduckgo.app.global.useourapp.UseOurAppDetector
2826
import com.duckduckgo.app.runBlocking
2927
import com.duckduckgo.app.settings.db.SettingsDataStore
3028
import com.nhaarman.mockitokotlin2.*
@@ -40,9 +38,7 @@ class JsLoginDetectorTest {
4038
var coroutinesTestRule = CoroutineTestRule()
4139

4240
private val settingsDataStore: SettingsDataStore = mock()
43-
private val userEventsStore: UserEventsStore = mock()
44-
45-
private val testee = JsLoginDetector(settingsDataStore, UseOurAppDetector(userEventsStore))
41+
private val testee = JsLoginDetector(settingsDataStore)
4642

4743
@UiThreadTest
4844
@Test

0 commit comments

Comments
 (0)