diff --git a/app/src/androidTest/java/com/duckduckgo/app/notification/AndroidNotificationSchedulerTest.kt b/app/src/androidTest/java/com/duckduckgo/app/notification/AndroidNotificationSchedulerTest.kt index 54f8a3f383ea..fb94257e2a13 100644 --- a/app/src/androidTest/java/com/duckduckgo/app/notification/AndroidNotificationSchedulerTest.kt +++ b/app/src/androidTest/java/com/duckduckgo/app/notification/AndroidNotificationSchedulerTest.kt @@ -24,7 +24,6 @@ import androidx.work.WorkManager import com.duckduckgo.app.CoroutineTestRule import com.duckduckgo.app.notification.NotificationScheduler.* import com.duckduckgo.app.notification.model.SchedulableNotification -import com.duckduckgo.app.notification.model.SearchNotification import com.duckduckgo.app.statistics.VariantManager import com.duckduckgo.app.statistics.VariantManager.Companion.DEFAULT_VARIANT import com.nhaarman.mockitokotlin2.any @@ -48,7 +47,6 @@ class AndroidNotificationSchedulerTest { private val variantManager: VariantManager = mock() private val clearNotification: SchedulableNotification = mock() private val privacyNotification: SchedulableNotification = mock() - private val searchPromptNotification: SearchNotification = mock() private val context = InstrumentationRegistry.getInstrumentation().targetContext private var workManager = WorkManager.getInstance(context) @@ -60,125 +58,54 @@ class AndroidNotificationSchedulerTest { testee = NotificationScheduler( workManager, clearNotification, - privacyNotification, - searchPromptNotification + privacyNotification ) } - @After - fun resetWorkers() { - workManager.cancelAllWorkByTag(NotificationScheduler.CONTINUOUS_APP_USE_REQUEST_TAG) - } - - @Test - fun whenPrivacyNotificationClearDataAndSearchPromptCanShowThenBothAreScheduled() = runBlocking { - whenever(privacyNotification.canShow()).thenReturn(true) - whenever(clearNotification.canShow()).thenReturn(true) - whenever(searchPromptNotification.canShow()).thenReturn(true) - testee.scheduleNextNotification() - - assertUnusedAppNotificationScheduled(PrivacyNotificationWorker::class.jvmName) - assertContinuousAppUseNotificationScheduled(SearchPromptNotificationWorker::class.jvmName) - } - @Test - fun whenPrivacyNotificationClearDataAndSearchPromptCanShowThenPrivacyNotificationScheduled() = runBlocking { + fun whenPrivacyNotificationClearDataCanShowThenPrivacyNotificationIsScheduled() = runBlocking { whenever(privacyNotification.canShow()).thenReturn(true) whenever(clearNotification.canShow()).thenReturn(true) - whenever(searchPromptNotification.canShow()).thenReturn(false) testee.scheduleNextNotification() assertUnusedAppNotificationScheduled(PrivacyNotificationWorker::class.jvmName) - assertNoContinuousAppNotificationScheduled() } @Test - fun whenPrivacyNotificationAndSearchPromptCanShowButClearDataCannotThenThenBothAreScheduled() = runBlocking { + fun whenPrivacyNotificationCanShowButClearDataCannotThenPrivacyNotificationIsScheduled() = runBlocking { whenever(privacyNotification.canShow()).thenReturn(true) whenever(clearNotification.canShow()).thenReturn(false) - whenever(searchPromptNotification.canShow()).thenReturn(true) testee.scheduleNextNotification() assertUnusedAppNotificationScheduled(PrivacyNotificationWorker::class.jvmName) - assertContinuousAppUseNotificationScheduled(SearchPromptNotificationWorker::class.jvmName) } @Test - fun whenPrivacyNotificationCanShowButClearDataAndSearchPromptCannotThenPrivacyNotificationScheduled() = runBlocking { - whenever(privacyNotification.canShow()).thenReturn(true) - whenever(clearNotification.canShow()).thenReturn(false) - whenever(searchPromptNotification.canShow()).thenReturn(false) - testee.scheduleNextNotification() - - assertUnusedAppNotificationScheduled(PrivacyNotificationWorker::class.jvmName) - assertNoContinuousAppNotificationScheduled() - } - - @Test - fun whenPrivacyNotificationAndSearchPromptCannotShowAndClearNotificationCanShowThenBothAreScheduled() = runBlocking { + fun whenPrivacyNotificationCannotShowAndClearNotificationCanShowThenClearNotificationIsScheduled() = runBlocking { whenever(privacyNotification.canShow()).thenReturn(false) whenever(clearNotification.canShow()).thenReturn(true) - whenever(searchPromptNotification.canShow()).thenReturn(true) testee.scheduleNextNotification() assertUnusedAppNotificationScheduled(ClearDataNotificationWorker::class.jvmName) - assertContinuousAppUseNotificationScheduled(SearchPromptNotificationWorker::class.jvmName) } @Test - fun whenPrivacyNotificationAndClearNotificationCannotShowButSearchPromptCanShowThenNotificationScheduled() = runBlocking { + fun whenPrivacyNotificationAndClearNotificationCannotShowThenNoNotificationScheduled() = runBlocking { whenever(privacyNotification.canShow()).thenReturn(false) whenever(clearNotification.canShow()).thenReturn(false) - whenever(searchPromptNotification.canShow()).thenReturn(true) testee.scheduleNextNotification() - assertContinuousAppUseNotificationScheduled(SearchPromptNotificationWorker::class.jvmName) assertNoUnusedAppNotificationScheduled() } - @Test - fun whenPrivacyNotificationAndClearNotificationCannotShowButSearchPromptCanThenSearchPromptNotificationScheduled() = runBlocking { - whenever(privacyNotification.canShow()).thenReturn(false) - whenever(clearNotification.canShow()).thenReturn(false) - whenever(searchPromptNotification.canShow()).thenReturn(true) - - testee.scheduleNextNotification() - - assertContinuousAppUseNotificationScheduled(SearchPromptNotificationWorker::class.jvmName) - assertNoUnusedAppNotificationScheduled() - } - - @Test - fun whenNoNotificationCanShowThenNoNotificationScheduled() = runBlocking { - whenever(privacyNotification.canShow()).thenReturn(false) - whenever(clearNotification.canShow()).thenReturn(false) - whenever(searchPromptNotification.canShow()).thenReturn(false) - testee.scheduleNextNotification() - - assertNoNotificationScheduled() - } - private fun assertUnusedAppNotificationScheduled(workerName: String) { assertTrue(getUnusedAppScheduledWorkers().any { it.tags.contains(workerName) }) } - private fun assertContinuousAppUseNotificationScheduled(workerName: String) { - assertTrue(getContinuousAppUseScheduledWorkers().any { it.tags.contains(workerName) }) - } - private fun assertNoUnusedAppNotificationScheduled() { assertTrue(getUnusedAppScheduledWorkers().isEmpty()) } - private fun assertNoContinuousAppNotificationScheduled() { - assertTrue(getContinuousAppUseScheduledWorkers().isEmpty()) - } - - private fun assertNoNotificationScheduled() { - assertTrue(getUnusedAppScheduledWorkers().isEmpty()) - assertTrue(getContinuousAppUseScheduledWorkers().isEmpty()) - } - private fun getUnusedAppScheduledWorkers(): List { return workManager .getWorkInfosByTag(NotificationScheduler.UNUSED_APP_WORK_REQUEST_TAG) @@ -186,10 +113,4 @@ class AndroidNotificationSchedulerTest { .filter { it.state == WorkInfo.State.ENQUEUED } } - private fun getContinuousAppUseScheduledWorkers(): List { - return workManager - .getWorkInfosByTag(NotificationScheduler.CONTINUOUS_APP_USE_REQUEST_TAG) - .get() - .filter { it.state == WorkInfo.State.ENQUEUED } - } } \ No newline at end of file diff --git a/app/src/androidTest/java/com/duckduckgo/app/settings/SettingsViewModelTest.kt b/app/src/androidTest/java/com/duckduckgo/app/settings/SettingsViewModelTest.kt index 48a624d41884..29fd8de57796 100644 --- a/app/src/androidTest/java/com/duckduckgo/app/settings/SettingsViewModelTest.kt +++ b/app/src/androidTest/java/com/duckduckgo/app/settings/SettingsViewModelTest.kt @@ -67,9 +67,6 @@ class SettingsViewModelTest { @Mock private lateinit var mockVariantManager: VariantManager - @Mock - private lateinit var notificationScheduler: AndroidNotificationScheduler - @Mock private lateinit var mockPixel: Pixel @@ -82,7 +79,7 @@ class SettingsViewModelTest { context = InstrumentationRegistry.getInstrumentation().targetContext commandCaptor = argumentCaptor() - testee = SettingsViewModel(mockAppSettingsDataStore, mockDefaultBrowserDetector, mockVariantManager, mockPixel, notificationScheduler) + testee = SettingsViewModel(mockAppSettingsDataStore, mockDefaultBrowserDetector, mockVariantManager, mockPixel) testee.command.observeForever(commandObserver) whenever(mockAppSettingsDataStore.automaticallyClearWhenOption).thenReturn(APP_EXIT_ONLY) @@ -230,32 +227,5 @@ class SettingsViewModelTest { assertEquals(Command.LaunchAppIcon, commandCaptor.firstValue) } - @Test - fun whenSearchNotificationWasPreviouslyEnabledThenViewStateIndicatesIt() { - whenever(mockAppSettingsDataStore.searchNotificationEnabled).thenReturn(true) - testee.start() - assertTrue(latestViewState().searchNotificationEnabled) - } - - @Test - fun whenSearchNotificationToggledOnThenDataStoreIsUpdatedAndNotificationShown() { - testee.onSearchNotificationSettingChanged(true) - verify(mockAppSettingsDataStore).searchNotificationEnabled = true - verify(notificationScheduler).launchStickySearchNotification() - verify(mockPixel).fire(Pixel.PixelName.QUICK_SEARCH_NOTIFICATION_ENABLED) - - assertTrue(latestViewState().searchNotificationEnabled) - } - - @Test - fun whenSearchNotificationToggledOffThenDataStoreIsUpdatedAndNotificationRemoved() { - testee.onSearchNotificationSettingChanged(false) - verify(mockAppSettingsDataStore).searchNotificationEnabled = false - verify(notificationScheduler).dismissStickySearchNotification() - verify(mockPixel).fire(Pixel.PixelName.QUICK_SEARCH_NOTIFICATION_DISABLED) - - assertFalse(latestViewState().searchNotificationEnabled) - } - private fun latestViewState() = testee.viewState.value!! } \ No newline at end of file diff --git a/app/src/androidTest/java/com/duckduckgo/app/statistics/VariantManagerTest.kt b/app/src/androidTest/java/com/duckduckgo/app/statistics/VariantManagerTest.kt index 9ac5addd6799..bcf11ae1f75e 100644 --- a/app/src/androidTest/java/com/duckduckgo/app/statistics/VariantManagerTest.kt +++ b/app/src/androidTest/java/com/duckduckgo/app/statistics/VariantManagerTest.kt @@ -43,23 +43,6 @@ class VariantManagerTest { assertEquals(0, variant.features.size) } - // Search Notification Experiment - - @Test - fun searchNotificationControlVariantIsActiveAndHasNoFeatures() { - val variant = variants.first { it.key == "mf" } - assertEqualsDouble(1.0, variant.weight) - assertEquals(0, variant.features.size) - } - - @Test - fun searchNotificationVariantIsActiveAndHasStickySearchNotificationFeature() { - val variant = variants.first { it.key == "mg" } - assertEqualsDouble(1.0, variant.weight) - assertEquals(1, variant.features.size) - assertTrue(variant.hasFeature(StickySearchNotification)) - } - @Test fun verifyNoDuplicateVariantNames() { val existingNames = mutableSetOf() diff --git a/app/src/main/java/com/duckduckgo/app/di/DaggerWorkerFactory.kt b/app/src/main/java/com/duckduckgo/app/di/DaggerWorkerFactory.kt index ba28774a8498..e7866f1130a2 100644 --- a/app/src/main/java/com/duckduckgo/app/di/DaggerWorkerFactory.kt +++ b/app/src/main/java/com/duckduckgo/app/di/DaggerWorkerFactory.kt @@ -25,15 +25,10 @@ import com.duckduckgo.app.fire.DataClearingWorker import com.duckduckgo.app.global.view.ClearDataAction import com.duckduckgo.app.notification.NotificationScheduler.ClearDataNotificationWorker import com.duckduckgo.app.notification.NotificationScheduler.PrivacyNotificationWorker -import com.duckduckgo.app.notification.NotificationScheduler.SearchPromptNotificationWorker -import com.duckduckgo.app.notification.NotificationScheduler.StickySearchNotificationWorker -import com.duckduckgo.app.notification.NotificationScheduler.DismissSearchNotificationWorker import com.duckduckgo.app.notification.NotificationFactory import com.duckduckgo.app.notification.db.NotificationDao import com.duckduckgo.app.notification.model.ClearDataNotification import com.duckduckgo.app.notification.model.PrivacyProtectionNotification -import com.duckduckgo.app.notification.model.SearchPromptNotification -import com.duckduckgo.app.notification.model.StickySearchNotification import com.duckduckgo.app.settings.db.SettingsDataStore import com.duckduckgo.app.statistics.api.OfflinePixelScheduler import com.duckduckgo.app.statistics.api.OfflinePixelSender @@ -49,8 +44,6 @@ class DaggerWorkerFactory( private val notificationFactory: NotificationFactory, private val clearDataNotification: ClearDataNotification, private val privacyProtectionNotification: PrivacyProtectionNotification, - private val stickySearchPromptNotification: SearchPromptNotification, - private val stickySearchNotification: StickySearchNotification, private val pixel: Pixel ) : WorkerFactory() { @@ -66,9 +59,6 @@ class DaggerWorkerFactory( is DataClearingWorker -> injectDataClearWorker(instance) is ClearDataNotificationWorker -> injectClearDataNotificationWorker(instance) is PrivacyNotificationWorker -> injectPrivacyNotificationWorker(instance) - is SearchPromptNotificationWorker -> injectSearchPromptNotificationWorker(instance) - is StickySearchNotificationWorker -> injectStickySearchNotificationWorker(instance) - is DismissSearchNotificationWorker -> injectDismissSearchNotificationWorker(instance) else -> Timber.i("No injection required for worker $workerClassName") } @@ -105,25 +95,4 @@ class DaggerWorkerFactory( worker.notification = privacyProtectionNotification } - private fun injectSearchPromptNotificationWorker(worker: SearchPromptNotificationWorker) { - worker.manager = notificationManager - worker.notificationDao = notificationDao - worker.factory = notificationFactory - worker.pixel = pixel - worker.notification = stickySearchPromptNotification - } - - private fun injectStickySearchNotificationWorker(worker: StickySearchNotificationWorker) { - worker.manager = notificationManager - worker.notificationDao = notificationDao - worker.factory = notificationFactory - worker.pixel = pixel - worker.notification = stickySearchNotification - } - - private fun injectDismissSearchNotificationWorker(worker: DismissSearchNotificationWorker) { - worker.manager = notificationManager - worker.notificationDao = notificationDao - worker.notification = stickySearchNotification - } } \ No newline at end of file diff --git a/app/src/main/java/com/duckduckgo/app/di/NotificationModule.kt b/app/src/main/java/com/duckduckgo/app/di/NotificationModule.kt index 2040ece068d7..dc1758152973 100644 --- a/app/src/main/java/com/duckduckgo/app/di/NotificationModule.kt +++ b/app/src/main/java/com/duckduckgo/app/di/NotificationModule.kt @@ -27,11 +27,8 @@ import com.duckduckgo.app.notification.AndroidNotificationScheduler import com.duckduckgo.app.notification.db.NotificationDao import com.duckduckgo.app.notification.model.ClearDataNotification import com.duckduckgo.app.notification.model.PrivacyProtectionNotification -import com.duckduckgo.app.notification.model.SearchPromptNotification -import com.duckduckgo.app.notification.model.StickySearchNotification import com.duckduckgo.app.privacy.db.PrivacyProtectionCountDao import com.duckduckgo.app.settings.db.SettingsDataStore -import com.duckduckgo.app.statistics.VariantManager import dagger.Module import dagger.Provides import javax.inject.Singleton @@ -75,37 +72,17 @@ class NotificationModule { return PrivacyProtectionNotification(context, notificationDao, privacyProtectionCountDao) } - @Provides - fun provideStickySearchNotification( - context: Context, - notificationDao: NotificationDao - ): StickySearchNotification { - return StickySearchNotification(context, notificationDao) - } - - @Provides - fun provideSearchPromptNotification( - context: Context, - notificationDao: NotificationDao, - variantManager: VariantManager, - settingsDataStore: SettingsDataStore - ): SearchPromptNotification { - return SearchPromptNotification(context, notificationDao, variantManager, settingsDataStore) - } - @Provides @Singleton fun providesNotificationScheduler( workManager: WorkManager, clearDataNotification: ClearDataNotification, - privacyProtectionNotification: PrivacyProtectionNotification, - stickySearchNotification: StickySearchNotification + privacyProtectionNotification: PrivacyProtectionNotification ): AndroidNotificationScheduler { return NotificationScheduler( workManager, clearDataNotification, - privacyProtectionNotification, - stickySearchNotification + privacyProtectionNotification ) } diff --git a/app/src/main/java/com/duckduckgo/app/di/WorkerModule.kt b/app/src/main/java/com/duckduckgo/app/di/WorkerModule.kt index 64d1683bf102..9f7445d6945c 100644 --- a/app/src/main/java/com/duckduckgo/app/di/WorkerModule.kt +++ b/app/src/main/java/com/duckduckgo/app/di/WorkerModule.kt @@ -26,8 +26,6 @@ import com.duckduckgo.app.notification.NotificationFactory import com.duckduckgo.app.notification.db.NotificationDao import com.duckduckgo.app.notification.model.ClearDataNotification import com.duckduckgo.app.notification.model.PrivacyProtectionNotification -import com.duckduckgo.app.notification.model.SearchPromptNotification -import com.duckduckgo.app.notification.model.StickySearchNotification import com.duckduckgo.app.settings.db.SettingsDataStore import com.duckduckgo.app.statistics.api.OfflinePixelSender import com.duckduckgo.app.statistics.pixels.Pixel @@ -59,8 +57,6 @@ class WorkerModule { notificationFactory: NotificationFactory, clearDataNotification: ClearDataNotification, privacyProtectionNotification: PrivacyProtectionNotification, - stickySearchNotification: StickySearchNotification, - stickySearchPromptNotification: SearchPromptNotification, pixel: Pixel ): WorkerFactory { return DaggerWorkerFactory( @@ -72,8 +68,6 @@ class WorkerModule { notificationFactory, clearDataNotification, privacyProtectionNotification, - stickySearchPromptNotification, - stickySearchNotification, pixel ) } diff --git a/app/src/main/java/com/duckduckgo/app/global/ViewModelFactory.kt b/app/src/main/java/com/duckduckgo/app/global/ViewModelFactory.kt index f7469feac01d..2a91633b3017 100644 --- a/app/src/main/java/com/duckduckgo/app/global/ViewModelFactory.kt +++ b/app/src/main/java/com/duckduckgo/app/global/ViewModelFactory.kt @@ -157,8 +157,7 @@ class ViewModelFactory @Inject constructor( appSettingsPreferencesStore, defaultBrowserDetector, variantManager, - pixel, - notificationScheduler + pixel ) } diff --git a/app/src/main/java/com/duckduckgo/app/notification/AndroidNotificationScheduler.kt b/app/src/main/java/com/duckduckgo/app/notification/AndroidNotificationScheduler.kt index 889b35e90b44..d4e4053d526c 100644 --- a/app/src/main/java/com/duckduckgo/app/notification/AndroidNotificationScheduler.kt +++ b/app/src/main/java/com/duckduckgo/app/notification/AndroidNotificationScheduler.kt @@ -27,39 +27,26 @@ import androidx.work.WorkerParameters import com.duckduckgo.app.notification.db.NotificationDao import com.duckduckgo.app.notification.model.Notification import com.duckduckgo.app.notification.model.SchedulableNotification -import com.duckduckgo.app.notification.model.SearchNotification import com.duckduckgo.app.statistics.pixels.Pixel import com.duckduckgo.app.statistics.pixels.Pixel.PixelName.NOTIFICATION_SHOWN import timber.log.Timber import java.util.concurrent.TimeUnit - // Please don't rename any Worker class name or class path // More information: https://craigrussell.io/2019/04/a-workmanager-pitfall-modifying-a-scheduled-worker/ @WorkerThread interface AndroidNotificationScheduler { suspend fun scheduleNextNotification() - fun launchStickySearchNotification() - fun dismissStickySearchNotification() - fun launchSearchPromptNotification() } class NotificationScheduler( private val workManager: WorkManager, private val clearDataNotification: SchedulableNotification, - private val privacyNotification: SchedulableNotification, - private val searchPromptNotification: SearchNotification + private val privacyNotification: SchedulableNotification ) : AndroidNotificationScheduler { override suspend fun scheduleNextNotification() { scheduleInactiveUserNotifications() - scheduleActiveUserNotifications() - } - - private suspend fun scheduleActiveUserNotifications() { - if (searchPromptNotification.canShow()) { - scheduleNotification(OneTimeWorkRequestBuilder(), 2, TimeUnit.DAYS, CONTINUOUS_APP_USE_REQUEST_TAG) - } } private suspend fun scheduleInactiveUserNotifications() { @@ -76,33 +63,6 @@ class NotificationScheduler( } } - override fun launchStickySearchNotification() { - Timber.v("Posting sticky notification") - val request = OneTimeWorkRequestBuilder() - .addTag(STICKY_REQUEST_TAG) - .build() - - workManager.enqueue(request) - } - - override fun dismissStickySearchNotification() { - Timber.v("Dismissing sticky notification") - val request = OneTimeWorkRequestBuilder() - .addTag(STICKY_REQUEST_TAG) - .build() - - workManager.enqueue(request) - } - - override fun launchSearchPromptNotification() { - Timber.v("Posting sticky search prompt notification") - val request = OneTimeWorkRequestBuilder() - .addTag(STICKY_PROMPT_REQUEST_TAG) - .build() - - workManager.enqueue(request) - } - private fun scheduleNotification(builder: OneTimeWorkRequest.Builder, duration: Long, unit: TimeUnit, tag: String) { Timber.v("Scheduling notification") val request = builder @@ -147,86 +107,7 @@ class NotificationScheduler( } } - class SearchPromptNotificationWorker(val context: Context, val params: WorkerParameters) : CoroutineWorker(context, params) { - lateinit var manager: NotificationManagerCompat - lateinit var factory: NotificationFactory - lateinit var notificationDao: NotificationDao - lateinit var notification: SearchNotification - lateinit var pixel: Pixel - - override suspend fun doWork(): Result { - - if (!notification.canShow()) { - Timber.v("Notification no longer showable") - return Result.success() - } - - val specification = notification.buildSpecification() - - val launchIntent = NotificationHandlerService.pendingNotificationHandlerIntent(context, notification.launchIntent, specification) - val cancelIntent = NotificationHandlerService.pendingNotificationHandlerIntent(context, notification.cancelIntent, specification) - val pressIntent = NotificationHandlerService.pendingNotificationHandlerIntent(context, notification.pressIntent, specification) - - val systemNotification = - factory.createSearchNotificationPrompt( - specification, - launchIntent, - cancelIntent, - pressIntent, - notification.layoutId, - specification.channel.priority - ) - - notificationDao.insert(Notification(notification.id)) - manager.notify(NotificationRegistrar.NotificationId.StickySearch, systemNotification) - - pixel.fire(Pixel.PixelName.QUICK_SEARCH_PROMPT_NOTIFICATION_SHOWN) - return Result.success() - } - } - - class StickySearchNotificationWorker(val context: Context, params: WorkerParameters) : CoroutineWorker(context, params) { - - lateinit var manager: NotificationManagerCompat - lateinit var factory: NotificationFactory - lateinit var notificationDao: NotificationDao - lateinit var notification: SearchNotification - lateinit var pixel: Pixel - - override suspend fun doWork(): Result { - - val specification = notification.buildSpecification() - - val launchIntent = NotificationHandlerService.pendingNotificationHandlerIntent(context, notification.launchIntent, specification) - val cancelIntent = NotificationHandlerService.pendingNotificationHandlerIntent(context, notification.cancelIntent, specification) - - val systemNotification = - factory.createSearchNotification(specification, launchIntent, cancelIntent, notification.layoutId, specification.channel.priority) - - notificationDao.insert(Notification(notification.id)) - manager.notify(NotificationRegistrar.NotificationId.StickySearch, systemNotification) - - return Result.success() - } - } - - class DismissSearchNotificationWorker(val context: Context, params: WorkerParameters) : CoroutineWorker(context, params) { - - lateinit var manager: NotificationManagerCompat - lateinit var notificationDao: NotificationDao - lateinit var notification: SearchNotification - - override suspend fun doWork(): Result { - val specification = notification.buildSpecification() - manager.cancel(specification.systemId) - return Result.success() - } - } - companion object { const val UNUSED_APP_WORK_REQUEST_TAG = "com.duckduckgo.notification.schedule" - const val CONTINUOUS_APP_USE_REQUEST_TAG = "com.duckduckgo.notification.schedule.continuous" - const val STICKY_REQUEST_TAG = "com.duckduckgo.notification.sticky" - const val STICKY_PROMPT_REQUEST_TAG = "com.duckduckgo.notification.sticky.prompt" } } \ No newline at end of file diff --git a/app/src/main/java/com/duckduckgo/app/notification/NotificationHandlerService.kt b/app/src/main/java/com/duckduckgo/app/notification/NotificationHandlerService.kt index 704f392acd0c..abc19d34acc8 100644 --- a/app/src/main/java/com/duckduckgo/app/notification/NotificationHandlerService.kt +++ b/app/src/main/java/com/duckduckgo/app/notification/NotificationHandlerService.kt @@ -27,17 +27,12 @@ import com.duckduckgo.app.browser.BrowserActivity import com.duckduckgo.app.notification.NotificationHandlerService.NotificationEvent.APP_LAUNCH import com.duckduckgo.app.notification.NotificationHandlerService.NotificationEvent.CANCEL import com.duckduckgo.app.notification.NotificationHandlerService.NotificationEvent.CLEAR_DATA_LAUNCH -import com.duckduckgo.app.notification.NotificationHandlerService.NotificationEvent.QUICK_SEARCH_LAUNCH -import com.duckduckgo.app.notification.NotificationHandlerService.NotificationEvent.QUICK_SEARCH_KEEP -import com.duckduckgo.app.notification.NotificationHandlerService.NotificationEvent.QUICK_SEARCH_PROMPT_LAUNCH -import com.duckduckgo.app.notification.NotificationHandlerService.NotificationEvent.QUICK_SEARCH_REMOVE import com.duckduckgo.app.notification.model.NotificationSpec import com.duckduckgo.app.settings.SettingsActivity import com.duckduckgo.app.settings.db.SettingsDataStore import com.duckduckgo.app.statistics.pixels.Pixel import com.duckduckgo.app.statistics.pixels.Pixel.PixelName.NOTIFICATION_CANCELLED import com.duckduckgo.app.statistics.pixels.Pixel.PixelName.NOTIFICATION_LAUNCHED -import com.duckduckgo.app.systemsearch.SystemSearchActivity import dagger.android.AndroidInjection import timber.log.Timber import javax.inject.Inject @@ -71,10 +66,6 @@ class NotificationHandlerService : IntentService("NotificationHandlerService") { APP_LAUNCH -> onAppLaunched(pixelSuffix) CLEAR_DATA_LAUNCH -> onClearDataLaunched(pixelSuffix) CANCEL -> onCancelled(pixelSuffix) - QUICK_SEARCH_PROMPT_LAUNCH -> onQuickSearchPromptRequest() - QUICK_SEARCH_REMOVE -> onQuickSearchNotificationRemove(intent) - QUICK_SEARCH_KEEP -> onQuickSearchNotificationKeep(intent) - QUICK_SEARCH_LAUNCH -> onQuickSearchRequest() } if (intent.getBooleanExtra(NOTIFICATION_AUTO_CANCEL, true)) { @@ -105,40 +96,6 @@ class NotificationHandlerService : IntentService("NotificationHandlerService") { pixel.fire("${NOTIFICATION_CANCELLED.pixelName}_$pixelSuffix") } - private fun onQuickSearchNotificationKeep(intent: Intent) { - Timber.i("Sticky Search Notification Requested!") - settingsDataStore.searchNotificationEnabled = true - notificationScheduler.launchStickySearchNotification() - pixel.fire(Pixel.PixelName.QUICK_SEARCH_PROMPT_NOTIFICATION_KEEP) - } - - private fun onQuickSearchNotificationRemove(intent: Intent) { - Timber.i("Sticky Search Notification Dismissed!") - val notificationId = intent.getIntExtra(NOTIFICATION_SYSTEM_ID_EXTRA, 0) - pixel.fire(Pixel.PixelName.QUICK_SEARCH_PROMPT_NOTIFICATION_REMOVE) - settingsDataStore.searchNotificationEnabled = false - clearNotification(notificationId) - closeNotificationPanel() - } - - private fun onQuickSearchPromptRequest() { - Timber.i("Search from Prompt Notification Requested!") - val searchIntent = SystemSearchActivity.fromNotification(context) - TaskStackBuilder.create(context) - .addNextIntentWithParentStack(searchIntent) - .startActivities() - pixel.fire(Pixel.PixelName.QUICK_SEARCH_PROMPT_NOTIFICATION_LAUNCHED) - } - - private fun onQuickSearchRequest() { - Timber.i("Search from Notification Requested!") - val searchIntent = SystemSearchActivity.fromNotification(context) - TaskStackBuilder.create(context) - .addNextIntentWithParentStack(searchIntent) - .startActivities() - pixel.fire(Pixel.PixelName.QUICK_SEARCH_NOTIFICATION_LAUNCHED) - } - private fun clearNotification(notificationId: Int) { notificationManager.cancel(notificationId) } @@ -152,10 +109,6 @@ class NotificationHandlerService : IntentService("NotificationHandlerService") { const val APP_LAUNCH = "com.duckduckgo.notification.launch.app" const val CLEAR_DATA_LAUNCH = "com.duckduckgo.notification.launch.clearData" const val CANCEL = "com.duckduckgo.notification.cancel" - const val QUICK_SEARCH_PROMPT_LAUNCH = "com.duckduckgo.notification.search.launch" - const val QUICK_SEARCH_KEEP = "com.duckduckgo.notification.search.keep" - const val QUICK_SEARCH_REMOVE = "com.duckduckgo.notification.search.remove" - const val QUICK_SEARCH_LAUNCH = "com.duckduckgo.notification.search" } companion object { diff --git a/app/src/main/java/com/duckduckgo/app/notification/NotificationRegistrar.kt b/app/src/main/java/com/duckduckgo/app/notification/NotificationRegistrar.kt index da369a2d6d24..cb9e238d34c3 100644 --- a/app/src/main/java/com/duckduckgo/app/notification/NotificationRegistrar.kt +++ b/app/src/main/java/com/duckduckgo/app/notification/NotificationRegistrar.kt @@ -48,7 +48,6 @@ class NotificationRegistrar @Inject constructor( object NotificationId { const val ClearData = 100 const val PrivacyProtection = 101 - const val StickySearch = 102 } object ChannelType { @@ -67,18 +66,12 @@ class NotificationRegistrar @Inject constructor( R.string.notificationChannelTutorials, NotificationManagerCompat.IMPORTANCE_DEFAULT ) - val SEARCH = Channel( - "com.duckduckgo.search", - R.string.notificationChannelSearch, - NotificationManagerCompat.IMPORTANCE_DEFAULT - ) } private val channels = (listOf( ChannelType.FILE_DOWNLOADING, ChannelType.FILE_DOWNLOADED, - ChannelType.TUTORIALS, - ChannelType.SEARCH + ChannelType.TUTORIALS )) fun registerApp() { diff --git a/app/src/main/java/com/duckduckgo/app/notification/model/SchedulableNotification.kt b/app/src/main/java/com/duckduckgo/app/notification/model/SchedulableNotification.kt index d427c8fb2eb9..fd3c78a5563c 100644 --- a/app/src/main/java/com/duckduckgo/app/notification/model/SchedulableNotification.kt +++ b/app/src/main/java/com/duckduckgo/app/notification/model/SchedulableNotification.kt @@ -26,16 +26,6 @@ interface SchedulableNotification { suspend fun buildSpecification(): NotificationSpec } -interface SearchNotification { - val id: String - val layoutId: Int - val pressIntent: String - val launchIntent: String - val cancelIntent: String - suspend fun canShow(): Boolean - suspend fun buildSpecification(): NotificationSpec -} - interface NotificationSpec { val channel: NotificationRegistrar.Channel val systemId: Int diff --git a/app/src/main/java/com/duckduckgo/app/notification/model/SearchPromptNotification.kt b/app/src/main/java/com/duckduckgo/app/notification/model/SearchPromptNotification.kt deleted file mode 100644 index 4b37c6f52798..000000000000 --- a/app/src/main/java/com/duckduckgo/app/notification/model/SearchPromptNotification.kt +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2020 DuckDuckGo - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.duckduckgo.app.notification.model - -import android.content.Context -import androidx.core.app.NotificationManagerCompat -import com.duckduckgo.app.browser.R -import com.duckduckgo.app.notification.NotificationHandlerService -import com.duckduckgo.app.notification.NotificationRegistrar -import com.duckduckgo.app.notification.db.NotificationDao -import com.duckduckgo.app.settings.db.SettingsDataStore -import com.duckduckgo.app.statistics.VariantManager -import timber.log.Timber - -class SearchPromptNotification( - private val context: Context, - private val notificationDao: NotificationDao, - private val variantManager: VariantManager, - private val settingsDataStore: SettingsDataStore -) : SearchNotification { - - override val id = "com.duckduckgo.privacy.search.stickyPrompt" - - override val pressIntent = NotificationHandlerService.NotificationEvent.QUICK_SEARCH_PROMPT_LAUNCH - - override val launchIntent = NotificationHandlerService.NotificationEvent.QUICK_SEARCH_KEEP - - override val cancelIntent = NotificationHandlerService.NotificationEvent.QUICK_SEARCH_REMOVE - - override val layoutId = R.layout.search_notification_prompt - - override suspend fun canShow(): Boolean { - - val variant = variantManager.getVariant() - if (!variant.hasFeature(VariantManager.VariantFeature.StickySearchNotification)){ - Timber.v("Notification Variant is not enabled ") - return false - } - - if (notificationDao.exists(id)) { - Timber.v("Notification already seen") - return false - } - - if (settingsDataStore.searchNotificationEnabled) { - Timber.v("Notification is already enabled") - return false - } - - return true - } - - override suspend fun buildSpecification(): NotificationSpec { - return StickySearchPromptSpecification(context) - } -} - -class StickySearchPromptSpecification(context: Context) : NotificationSpec { - override val channel = NotificationRegistrar.ChannelType.SEARCH - override val systemId = NotificationRegistrar.NotificationId.StickySearch - override val name = "Add sticky search notification" - override val icon = R.drawable.notification_logo - override val title: String = context.getString(R.string.stickySearchPromptNotificationTitle) - override val description: String = context.getString(R.string.stickySearchPromptNotificationTitle) - override val launchButton: String = context.getString(R.string.stickySearchPromptKeep) - override val closeButton: String = context.getString(R.string.stickySearchPromptRemove) - override val pixelSuffix = "" - override val autoCancel = false -} - diff --git a/app/src/main/java/com/duckduckgo/app/notification/model/StickySearchNotification.kt b/app/src/main/java/com/duckduckgo/app/notification/model/StickySearchNotification.kt deleted file mode 100644 index 3e400ae5082a..000000000000 --- a/app/src/main/java/com/duckduckgo/app/notification/model/StickySearchNotification.kt +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2020 DuckDuckGo - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.duckduckgo.app.notification.model - -import android.content.Context -import androidx.core.app.NotificationManagerCompat -import com.duckduckgo.app.browser.R -import com.duckduckgo.app.notification.NotificationHandlerService.NotificationEvent.QUICK_SEARCH_LAUNCH -import com.duckduckgo.app.notification.NotificationRegistrar -import com.duckduckgo.app.notification.db.NotificationDao -import timber.log.Timber - -class StickySearchNotification( - private val context: Context, - private val notificationDao: NotificationDao -) : SearchNotification { - - override val id = "com.duckduckgo.privacy.search.sticky" - - override val pressIntent = QUICK_SEARCH_LAUNCH - - override val launchIntent = QUICK_SEARCH_LAUNCH - - override val cancelIntent = QUICK_SEARCH_LAUNCH - - override val layoutId = R.layout.search_notification - - override suspend fun canShow(): Boolean { - - if (notificationDao.exists(id)) { - Timber.v("Notification already seen") - return false - } - - return true - } - - override suspend fun buildSpecification(): NotificationSpec { - return StickySearchNotificationSpecification(context) - } -} - -class StickySearchNotificationSpecification(context: Context) : NotificationSpec { - - override val channel = NotificationRegistrar.ChannelType.SEARCH - override val systemId = NotificationRegistrar.NotificationId.StickySearch - override val name = context.getString(R.string.stickySearchNotification) - override val icon = R.drawable.notification_logo - override val launchButton: String? = null - override val closeButton: String? = null - override val title: String = "" - override val description: String = "" - override val pixelSuffix: String = "" - override val autoCancel = false -} \ No newline at end of file diff --git a/app/src/main/java/com/duckduckgo/app/settings/SettingsActivity.kt b/app/src/main/java/com/duckduckgo/app/settings/SettingsActivity.kt index 076907a68b51..a778cc0b48e9 100644 --- a/app/src/main/java/com/duckduckgo/app/settings/SettingsActivity.kt +++ b/app/src/main/java/com/duckduckgo/app/settings/SettingsActivity.kt @@ -33,10 +33,8 @@ import com.duckduckgo.app.browser.R import com.duckduckgo.app.feedback.ui.common.FeedbackActivity import com.duckduckgo.app.global.DuckDuckGoActivity import com.duckduckgo.app.global.sendThemeChangedBroadcast -import com.duckduckgo.app.global.view.gone import com.duckduckgo.app.global.view.launchDefaultAppActivity import com.duckduckgo.app.icon.ui.ChangeIconActivity -import com.duckduckgo.app.global.view.show import com.duckduckgo.app.settings.SettingsViewModel.AutomaticallyClearData import com.duckduckgo.app.settings.SettingsViewModel.Command import com.duckduckgo.app.settings.clear.ClearWhatOption @@ -54,16 +52,6 @@ import kotlinx.android.synthetic.main.content_settings_other.version import kotlinx.android.synthetic.main.content_settings_privacy.automaticallyClearWhatSetting import kotlinx.android.synthetic.main.content_settings_privacy.automaticallyClearWhenSetting import kotlinx.android.synthetic.main.include_toolbar.toolbar -import kotlinx.android.synthetic.main.content_settings_general.autocompleteToggle -import kotlinx.android.synthetic.main.content_settings_general.lightThemeToggle -import kotlinx.android.synthetic.main.content_settings_general.searchNotificationToggle -import kotlinx.android.synthetic.main.content_settings_general.setAsDefaultBrowserSetting -import kotlinx.android.synthetic.main.content_settings_other.about -import kotlinx.android.synthetic.main.content_settings_other.provideFeedback -import kotlinx.android.synthetic.main.content_settings_other.version -import kotlinx.android.synthetic.main.content_settings_privacy.automaticallyClearWhatSetting -import kotlinx.android.synthetic.main.content_settings_privacy.automaticallyClearWhenSetting -import kotlinx.android.synthetic.main.include_toolbar.toolbar import javax.inject.Inject class SettingsActivity : DuckDuckGoActivity(), SettingsAutomaticallyClearWhatFragment.Listener, SettingsAutomaticallyClearWhenFragment.Listener { @@ -83,10 +71,6 @@ class SettingsActivity : DuckDuckGoActivity(), SettingsAutomaticallyClearWhatFra viewModel.onAutocompleteSettingChanged(isChecked) } - private val searchNotificationToggleListener = OnCheckedChangeListener { _, isChecked -> - viewModel.onSearchNotificationSettingChanged(isChecked) - } - override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_settings) @@ -119,11 +103,9 @@ class SettingsActivity : DuckDuckGoActivity(), SettingsAutomaticallyClearWhatFra version.setSubtitle(it.version) lightThemeToggle.quietlySetIsChecked(it.lightThemeEnabled, lightThemeToggleListener) autocompleteToggle.quietlySetIsChecked(it.autoCompleteSuggestionsEnabled, autocompleteToggleListener) - searchNotificationToggle.quietlySetIsChecked(it.searchNotificationEnabled, searchNotificationToggleListener) updateDefaultBrowserViewVisibility(it) updateAutomaticClearDataOptions(it.automaticallyClearData) changeAppIcon.setImageResource(it.appIcon.icon) - showSearchNotification(it.showSearchNotificationToggle) } }) @@ -143,14 +125,6 @@ class SettingsActivity : DuckDuckGoActivity(), SettingsAutomaticallyClearWhatFra automaticallyClearWhenSetting.isEnabled = whenOptionEnabled } - private fun showSearchNotification(enabled: Boolean) { - if (enabled) { - searchNotificationToggle.show() - } else { - searchNotificationToggle.gone() - } - } - private fun launchAutomaticallyClearWhatDialog() { val dialog = SettingsAutomaticallyClearWhatFragment.create(viewModel.viewState.value?.automaticallyClearData?.clearWhatOption) dialog.show(supportFragmentManager, CLEAR_WHAT_DIALOG_TAG) diff --git a/app/src/main/java/com/duckduckgo/app/settings/SettingsViewModel.kt b/app/src/main/java/com/duckduckgo/app/settings/SettingsViewModel.kt index 5b94bb3fea72..5f46f8c51c77 100644 --- a/app/src/main/java/com/duckduckgo/app/settings/SettingsViewModel.kt +++ b/app/src/main/java/com/duckduckgo/app/settings/SettingsViewModel.kt @@ -23,11 +23,9 @@ import com.duckduckgo.app.browser.defaultbrowsing.DefaultBrowserDetector import com.duckduckgo.app.global.DuckDuckGoTheme import com.duckduckgo.app.global.SingleLiveEvent import com.duckduckgo.app.icon.api.AppIcon -import com.duckduckgo.app.notification.AndroidNotificationScheduler import com.duckduckgo.app.settings.clear.ClearWhatOption import com.duckduckgo.app.settings.clear.ClearWhenOption import com.duckduckgo.app.settings.db.SettingsDataStore -import com.duckduckgo.app.statistics.Variant import com.duckduckgo.app.statistics.VariantManager import com.duckduckgo.app.statistics.pixels.Pixel import com.duckduckgo.app.statistics.pixels.Pixel.PixelName @@ -39,8 +37,7 @@ class SettingsViewModel @Inject constructor( private val settingsDataStore: SettingsDataStore, private val defaultWebBrowserCapability: DefaultBrowserDetector, private val variantManager: VariantManager, - private val pixel: Pixel, - private val notificationScheduler: AndroidNotificationScheduler + private val pixel: Pixel ) : ViewModel() { data class ViewState( @@ -48,8 +45,6 @@ class SettingsViewModel @Inject constructor( val version: String = "", val lightThemeEnabled: Boolean = false, val autoCompleteSuggestionsEnabled: Boolean = true, - val showSearchNotificationToggle: Boolean = false, - val searchNotificationEnabled: Boolean = false, val showDefaultBrowserSetting: Boolean = false, val isAppDefaultBrowser: Boolean = false, val automaticallyClearData: AutomaticallyClearData = AutomaticallyClearData(ClearWhatOption.CLEAR_NONE, ClearWhenOption.APP_EXIT_ONLY), @@ -62,7 +57,6 @@ class SettingsViewModel @Inject constructor( val clearWhenOptionEnabled: Boolean = true ) - sealed class Command { object LaunchFeedback : Command() object LaunchAppIcon : Command() @@ -91,8 +85,6 @@ class SettingsViewModel @Inject constructor( loading = false, lightThemeEnabled = isLightTheme, autoCompleteSuggestionsEnabled = settingsDataStore.autoCompleteSuggestionsEnabled, - showSearchNotificationToggle = isSearchNotificationFeatureEnabled(variant), - searchNotificationEnabled = settingsDataStore.searchNotificationEnabled, isAppDefaultBrowser = defaultBrowserAlready, showDefaultBrowserSetting = defaultWebBrowserCapability.deviceSupportsDefaultBrowserConfiguration(), version = obtainVersion(variant.key), @@ -125,20 +117,6 @@ class SettingsViewModel @Inject constructor( viewState.value = currentViewState().copy(autoCompleteSuggestionsEnabled = enabled) } - fun onSearchNotificationSettingChanged(enabled: Boolean) { - Timber.i("User changed search notification setting, is now enabled: $enabled") - settingsDataStore.searchNotificationEnabled = enabled - if (enabled){ - notificationScheduler.launchStickySearchNotification() - pixel.fire(QUICK_SEARCH_NOTIFICATION_ENABLED) - - } else { - notificationScheduler.dismissStickySearchNotification() - pixel.fire(QUICK_SEARCH_NOTIFICATION_DISABLED) - } - viewState.value = currentViewState().copy(searchNotificationEnabled = enabled) - } - private fun obtainVersion(variantKey: String): String { val formattedVariantKey = if (variantKey.isBlank()) " " else " $variantKey " return "${BuildConfig.VERSION_NAME}$formattedVariantKey(${BuildConfig.VERSION_CODE})" @@ -208,9 +186,4 @@ class SettingsViewModel @Inject constructor( else -> null } } - - private fun isSearchNotificationFeatureEnabled(variant: Variant): Boolean { - return variant.hasFeature(VariantManager.VariantFeature.StickySearchNotification) - } - } \ No newline at end of file diff --git a/app/src/main/java/com/duckduckgo/app/settings/db/SettingsDataStore.kt b/app/src/main/java/com/duckduckgo/app/settings/db/SettingsDataStore.kt index 01ffd7800afa..fbac9bfc2d11 100644 --- a/app/src/main/java/com/duckduckgo/app/settings/db/SettingsDataStore.kt +++ b/app/src/main/java/com/duckduckgo/app/settings/db/SettingsDataStore.kt @@ -32,7 +32,6 @@ interface SettingsDataStore { var theme: DuckDuckGoTheme? var hideTips: Boolean var autoCompleteSuggestionsEnabled: Boolean - var searchNotificationEnabled: Boolean var appIcon: AppIcon var appIconChanged: Boolean @@ -94,10 +93,6 @@ class SettingsSharedPreferences @Inject constructor(private val context: Context get() = preferences.getBoolean(KEY_APP_ICON_CHANGED, false) set(enabled) = preferences.edit(commit = true) { putBoolean(KEY_APP_ICON_CHANGED, enabled) } - override var searchNotificationEnabled: Boolean - get() = preferences.getBoolean(KEY_SEARCH_NOTIFICATION, false) - set(enabled) = preferences.edit { putBoolean(KEY_SEARCH_NOTIFICATION, enabled) } - override var appUsedSinceLastClear: Boolean get() = preferences.getBoolean(KEY_APP_USED_SINCE_LAST_CLEAR, true) set(enabled) = preferences.edit(commit = true) { putBoolean(KEY_APP_USED_SINCE_LAST_CLEAR, enabled) } diff --git a/app/src/main/java/com/duckduckgo/app/statistics/VariantManager.kt b/app/src/main/java/com/duckduckgo/app/statistics/VariantManager.kt index 28dc99bf17c5..b4815e9b9dfd 100644 --- a/app/src/main/java/com/duckduckgo/app/statistics/VariantManager.kt +++ b/app/src/main/java/com/duckduckgo/app/statistics/VariantManager.kt @@ -28,9 +28,7 @@ import java.util.Locale interface VariantManager { // variant-dependant features listed here - sealed class VariantFeature { - object StickySearchNotification : VariantFeature() - } + sealed class VariantFeature companion object { @@ -43,19 +41,7 @@ interface VariantManager { // SERP variants. "sc" may also be used as a shared control for mobile experiments in // the future if we can filter by app version Variant(key = "sc", weight = 1.0, features = emptyList(), filterBy = { noFilter() }), - Variant(key = "se", weight = 1.0, features = emptyList(), filterBy = { noFilter() }), - - // Quick Search Notification Experiment - Variant( - key = "mf", - weight = 1.0, - features = emptyList(), - filterBy = { isEnglishLocale() }), - Variant( - key = "mg", - weight = 1.0, - features = listOf(StickySearchNotification), - filterBy = { isEnglishLocale() }) + Variant(key = "se", weight = 1.0, features = emptyList(), filterBy = { noFilter() }) // All groups in an experiment (control and variants) MUST use the same filters ) diff --git a/app/src/main/java/com/duckduckgo/app/statistics/pixels/Pixel.kt b/app/src/main/java/com/duckduckgo/app/statistics/pixels/Pixel.kt index 0d191bc9f626..9ae7270ad083 100644 --- a/app/src/main/java/com/duckduckgo/app/statistics/pixels/Pixel.kt +++ b/app/src/main/java/com/duckduckgo/app/statistics/pixels/Pixel.kt @@ -163,14 +163,6 @@ interface Pixel { AUTOCOMPLETE_SEARCH_SELECTION("m_aut_s_s"), CHANGE_APP_ICON_OPENED("m_ic"), - - QUICK_SEARCH_PROMPT_NOTIFICATION_SHOWN("m_qs_pn_s"), - QUICK_SEARCH_PROMPT_NOTIFICATION_LAUNCHED("m_qs_pn_l"), - QUICK_SEARCH_PROMPT_NOTIFICATION_KEEP("m_qs_pn_k"), - QUICK_SEARCH_PROMPT_NOTIFICATION_REMOVE("m_qs_pn_r"), - QUICK_SEARCH_NOTIFICATION_ENABLED("m_qs_sn_e"), - QUICK_SEARCH_NOTIFICATION_DISABLED("m_qs_sn_d"), - QUICK_SEARCH_NOTIFICATION_LAUNCHED("m_qs_sn_l") } object PixelParameter { diff --git a/app/src/main/res/drawable/search_notification_background.xml b/app/src/main/res/drawable/search_notification_background.xml deleted file mode 100644 index 559e2fe6f518..000000000000 --- a/app/src/main/res/drawable/search_notification_background.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/search_notification_prompt_background.xml b/app/src/main/res/drawable/search_notification_prompt_background.xml deleted file mode 100644 index 21cdc7b131ef..000000000000 --- a/app/src/main/res/drawable/search_notification_prompt_background.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - diff --git a/app/src/main/res/layout/content_settings_general.xml b/app/src/main/res/layout/content_settings_general.xml index 4d3aad88f168..ec465b80f293 100644 --- a/app/src/main/res/layout/content_settings_general.xml +++ b/app/src/main/res/layout/content_settings_general.xml @@ -57,15 +57,6 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/autocompleteToggle" /> - - + app:layout_constraintTop_toBottomOf="@id/setAsDefaultBrowserSetting" /> - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/search_notification_prompt.xml b/app/src/main/res/layout/search_notification_prompt.xml deleted file mode 100644 index f11c7fe1d36b..000000000000 --- a/app/src/main/res/layout/search_notification_prompt.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/values/string-untranslated.xml b/app/src/main/res/values/string-untranslated.xml index 2e8d295fcf27..dd63faa8d0c7 100644 --- a/app/src/main/res/values/string-untranslated.xml +++ b/app/src/main/res/values/string-untranslated.xml @@ -32,12 +32,4 @@ Apply New Icon? The app may close to apply changes. Come on back after you\'ve admired your handsome new icon. - - Quick Search - Sticky Search - Quick Search in Notifications - Keep - Remove - Search -