From cf5c2a103bc0dcffd29f84a5d0bfc808391d5833 Mon Sep 17 00:00:00 2001 From: Karl Dimla Date: Mon, 11 Dec 2023 15:00:07 +0100 Subject: [PATCH] Some NetP cleanup (#3980) Task/Issue URL: https://app.asana.com/0/488551667048375/1206101327273496/f ### Description https://app.asana.com/0/488551667048375/1206101327273496/f ### Steps to test this PR QA-optional, as long the build successfully builds. Smoke test NetP --- .../ui/AppTrackingProtectionScreens.kt | 30 +-- .../ui/alwayson/AlwaysOnLockDownDetector.kt | 4 +- .../ui/onboarding/VpnOnboardingActivity.kt | 2 +- .../AppTPCompanyTrackersActivity.kt | 2 +- .../DeviceShieldTrackerActivity.kt | 2 +- .../app/about/AboutDuckDuckGoActivity.kt | 2 +- .../app/browser/BrowserTabFragment.kt | 2 +- .../app/settings/SettingsActivity.kt | 4 +- .../api/NetworkProtectionScreens.kt | 37 +-- .../impl/about/NetPTermsActivity.kt | 1 + .../impl/about/NetpAboutVpnActivity.kt | 1 + .../impl/about/NetpFaqActivity.kt | 1 + .../about/NetworkProtectionAboutScreens.kt | 26 +- .../alerts/NetPAlertNotificationBuilder.kt | 112 --------- .../reconnect/NetPReconnectNotifications.kt | 26 -- .../RealNetPReconnectNotifications.kt | 56 ----- .../ui/NetpAppExclusionListActivity.kt | 2 +- .../NetworkProtectionManagementActivity.kt | 10 +- .../NetworkProtectionManagementViewModel.kt | 8 +- .../NetPDisabledNotificationBuilder.kt | 8 +- .../NetPEnabledNotificationContentPlugin.kt | 2 +- .../pixels/NetworkProtectionPixelNames.kt | 4 - .../impl/pixels/NetworkProtectionPixels.kt | 24 -- .../impl/waitlist/NetPWaitlistActivity.kt | 2 +- .../waitlist/NetPWaitlistInvitedActivity.kt | 6 +- .../waitlist/NetworkProtectionWaitlistImpl.kt | 4 +- .../res/drawable/background_code_frame.xml | 20 -- .../res/drawable/background_code_text.xml | 20 -- .../src/main/res/drawable/ic_dragon.xml | 230 ------------------ .../src/main/res/drawable/ic_join_24.xml | 25 -- .../src/main/res/drawable/ic_news.xml | 61 ----- .../src/main/res/drawable/ic_timer_24.xml | 28 --- .../layout/notification_reconnect_failed.xml | 33 --- .../layout/notification_reconnect_success.xml | 33 --- .../res/layout/notification_reconnecting.xml | 33 --- .../src/main/res/values/donottranslate.xml | 3 - ...etworkProtectionManagementViewModelTest.kt | 16 -- .../pixels/RealNetworkProtectionPixelTest.kt | 18 -- .../waitlist/NetworkProtectionWaitlistTest.kt | 4 +- .../NetworkProtectionAccessState.kt | 4 +- .../ui/NetpVerifySubscriptionActivity.kt | 2 +- .../ui/SubscriptionWebViewViewModelTest.kt | 2 +- 42 files changed, 87 insertions(+), 823 deletions(-) delete mode 100644 network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/alerts/NetPAlertNotificationBuilder.kt delete mode 100644 network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/alerts/reconnect/NetPReconnectNotifications.kt delete mode 100644 network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/alerts/reconnect/RealNetPReconnectNotifications.kt delete mode 100644 network-protection/network-protection-impl/src/main/res/drawable/background_code_frame.xml delete mode 100644 network-protection/network-protection-impl/src/main/res/drawable/background_code_text.xml delete mode 100644 network-protection/network-protection-impl/src/main/res/drawable/ic_dragon.xml delete mode 100644 network-protection/network-protection-impl/src/main/res/drawable/ic_join_24.xml delete mode 100644 network-protection/network-protection-impl/src/main/res/drawable/ic_news.xml delete mode 100644 network-protection/network-protection-impl/src/main/res/drawable/ic_timer_24.xml delete mode 100644 network-protection/network-protection-impl/src/main/res/layout/notification_reconnect_failed.xml delete mode 100644 network-protection/network-protection-impl/src/main/res/layout/notification_reconnect_success.xml delete mode 100644 network-protection/network-protection-impl/src/main/res/layout/notification_reconnecting.xml diff --git a/app-tracking-protection/app-tracking-api/src/main/java/com/duckduckgo/mobile/android/app/tracking/ui/AppTrackingProtectionScreens.kt b/app-tracking-protection/app-tracking-api/src/main/java/com/duckduckgo/mobile/android/app/tracking/ui/AppTrackingProtectionScreens.kt index 691267fef5cb..4a7817668f1e 100644 --- a/app-tracking-protection/app-tracking-api/src/main/java/com/duckduckgo/mobile/android/app/tracking/ui/AppTrackingProtectionScreens.kt +++ b/app-tracking-protection/app-tracking-api/src/main/java/com/duckduckgo/mobile/android/app/tracking/ui/AppTrackingProtectionScreens.kt @@ -18,18 +18,20 @@ package com.duckduckgo.mobile.android.app.tracking.ui import com.duckduckgo.navigation.api.GlobalActivityStarter -/** - * Use this class to launch the AppTP Tracker Activity Screen - * ```kotlin - * globalActivityStarter.start(context, DeviceShieldTrackerActivityWithEmptyParams) - * ``` - */ -object AppTrackerActivityWithEmptyParams : GlobalActivityStarter.ActivityParams +sealed class AppTrackingProtectionScreens { + /** + * Use this class to launch the AppTP Tracker Activity Screen + * ```kotlin + * globalActivityStarter.start(context, DeviceShieldTrackerActivityWithEmptyParams) + * ``` + */ + object AppTrackerActivityWithEmptyParams : GlobalActivityStarter.ActivityParams -/** - * Use this class to launch the AppTP onboarding screen - * ```kotlin - * globalActivityStarter.start(context, AppTrackerOnboardingActivityWithEmptyParamsParams) - * ``` - */ -object AppTrackerOnboardingActivityWithEmptyParamsParams : GlobalActivityStarter.ActivityParams + /** + * Use this class to launch the AppTP onboarding screen + * ```kotlin + * globalActivityStarter.start(context, AppTrackerOnboardingActivityWithEmptyParamsParams) + * ``` + */ + object AppTrackerOnboardingActivityWithEmptyParamsParams : GlobalActivityStarter.ActivityParams +} diff --git a/app-tracking-protection/vpn-impl/src/main/java/com/duckduckgo/mobile/android/vpn/ui/alwayson/AlwaysOnLockDownDetector.kt b/app-tracking-protection/vpn-impl/src/main/java/com/duckduckgo/mobile/android/vpn/ui/alwayson/AlwaysOnLockDownDetector.kt index 99f14144f984..200333b75728 100644 --- a/app-tracking-protection/vpn-impl/src/main/java/com/duckduckgo/mobile/android/vpn/ui/alwayson/AlwaysOnLockDownDetector.kt +++ b/app-tracking-protection/vpn-impl/src/main/java/com/duckduckgo/mobile/android/vpn/ui/alwayson/AlwaysOnLockDownDetector.kt @@ -24,7 +24,7 @@ import com.duckduckgo.common.utils.ConflatedJob import com.duckduckgo.common.utils.DispatcherProvider import com.duckduckgo.di.scopes.VpnScope import com.duckduckgo.mobile.android.app.tracking.AppTrackingProtection -import com.duckduckgo.mobile.android.app.tracking.ui.AppTrackerActivityWithEmptyParams +import com.duckduckgo.mobile.android.app.tracking.ui.AppTrackingProtectionScreens.AppTrackerActivityWithEmptyParams import com.duckduckgo.mobile.android.vpn.R import com.duckduckgo.mobile.android.vpn.dao.VpnServiceStateStatsDao import com.duckduckgo.mobile.android.vpn.service.VpnServiceCallbacks @@ -32,7 +32,7 @@ import com.duckduckgo.mobile.android.vpn.state.VpnStateMonitor import com.duckduckgo.mobile.android.vpn.ui.notification.DeviceShieldAlertNotificationBuilder import com.duckduckgo.mobile.android.vpn.ui.notification.DeviceShieldNotificationFactory import com.duckduckgo.navigation.api.GlobalActivityStarter -import com.duckduckgo.networkprotection.api.NetworkProtectionManagementScreenNoParams +import com.duckduckgo.networkprotection.api.NetworkProtectionScreens.NetworkProtectionManagementScreenNoParams import com.duckduckgo.networkprotection.api.NetworkProtectionState import com.squareup.anvil.annotations.ContributesMultibinding import dagger.SingleInstanceIn diff --git a/app-tracking-protection/vpn-impl/src/main/java/com/duckduckgo/mobile/android/vpn/ui/onboarding/VpnOnboardingActivity.kt b/app-tracking-protection/vpn-impl/src/main/java/com/duckduckgo/mobile/android/vpn/ui/onboarding/VpnOnboardingActivity.kt index aa37970db432..49a458e6c4b8 100644 --- a/app-tracking-protection/vpn-impl/src/main/java/com/duckduckgo/mobile/android/vpn/ui/onboarding/VpnOnboardingActivity.kt +++ b/app-tracking-protection/vpn-impl/src/main/java/com/duckduckgo/mobile/android/vpn/ui/onboarding/VpnOnboardingActivity.kt @@ -35,7 +35,7 @@ import com.duckduckgo.common.ui.viewbinding.viewBinding import com.duckduckgo.common.utils.DispatcherProvider import com.duckduckgo.common.utils.extensions.launchAlwaysOnSystemSettings import com.duckduckgo.di.scopes.ActivityScope -import com.duckduckgo.mobile.android.app.tracking.ui.AppTrackerOnboardingActivityWithEmptyParamsParams +import com.duckduckgo.mobile.android.app.tracking.ui.AppTrackingProtectionScreens.AppTrackerOnboardingActivityWithEmptyParamsParams import com.duckduckgo.mobile.android.vpn.AppTpVpnFeature import com.duckduckgo.mobile.android.vpn.R import com.duckduckgo.mobile.android.vpn.R.string diff --git a/app-tracking-protection/vpn-impl/src/main/java/com/duckduckgo/mobile/android/vpn/ui/tracker_activity/AppTPCompanyTrackersActivity.kt b/app-tracking-protection/vpn-impl/src/main/java/com/duckduckgo/mobile/android/vpn/ui/tracker_activity/AppTPCompanyTrackersActivity.kt index 2ca2131180a3..1f7acf142f14 100644 --- a/app-tracking-protection/vpn-impl/src/main/java/com/duckduckgo/mobile/android/vpn/ui/tracker_activity/AppTPCompanyTrackersActivity.kt +++ b/app-tracking-protection/vpn-impl/src/main/java/com/duckduckgo/mobile/android/vpn/ui/tracker_activity/AppTPCompanyTrackersActivity.kt @@ -62,7 +62,7 @@ import com.duckduckgo.mobile.android.vpn.ui.tracker_activity.AppTPCompanyTracker import com.duckduckgo.mobile.android.vpn.ui.tracker_activity.AppTPCompanyTrackersViewModel.ViewState import com.duckduckgo.mobile.android.vpn.ui.util.TextDrawable import com.duckduckgo.navigation.api.GlobalActivityStarter -import com.duckduckgo.networkprotection.api.NetPAppExclusionListNoParams +import com.duckduckgo.networkprotection.api.NetworkProtectionScreens.NetPAppExclusionListNoParams import com.google.android.material.snackbar.Snackbar import javax.inject.Inject import javax.inject.Provider diff --git a/app-tracking-protection/vpn-impl/src/main/java/com/duckduckgo/mobile/android/vpn/ui/tracker_activity/DeviceShieldTrackerActivity.kt b/app-tracking-protection/vpn-impl/src/main/java/com/duckduckgo/mobile/android/vpn/ui/tracker_activity/DeviceShieldTrackerActivity.kt index a35d331da111..3ce4c65ea66d 100644 --- a/app-tracking-protection/vpn-impl/src/main/java/com/duckduckgo/mobile/android/vpn/ui/tracker_activity/DeviceShieldTrackerActivity.kt +++ b/app-tracking-protection/vpn-impl/src/main/java/com/duckduckgo/mobile/android/vpn/ui/tracker_activity/DeviceShieldTrackerActivity.kt @@ -48,7 +48,7 @@ import com.duckduckgo.common.ui.viewbinding.viewBinding import com.duckduckgo.common.utils.DispatcherProvider import com.duckduckgo.common.utils.extensions.launchAlwaysOnSystemSettings import com.duckduckgo.di.scopes.ActivityScope -import com.duckduckgo.mobile.android.app.tracking.ui.AppTrackerActivityWithEmptyParams +import com.duckduckgo.mobile.android.app.tracking.ui.AppTrackingProtectionScreens.AppTrackerActivityWithEmptyParams import com.duckduckgo.mobile.android.vpn.AppTpVpnFeature import com.duckduckgo.mobile.android.vpn.R import com.duckduckgo.mobile.android.vpn.VpnFeaturesRegistry diff --git a/app/src/main/java/com/duckduckgo/app/about/AboutDuckDuckGoActivity.kt b/app/src/main/java/com/duckduckgo/app/about/AboutDuckDuckGoActivity.kt index 8763b9c4425e..3a47daa84a78 100644 --- a/app/src/main/java/com/duckduckgo/app/about/AboutDuckDuckGoActivity.kt +++ b/app/src/main/java/com/duckduckgo/app/about/AboutDuckDuckGoActivity.kt @@ -43,7 +43,7 @@ import com.duckduckgo.common.utils.AppUrl.Url import com.duckduckgo.di.scopes.ActivityScope import com.duckduckgo.mobile.android.R.attr import com.duckduckgo.navigation.api.GlobalActivityStarter -import com.duckduckgo.networkprotection.api.NetPWaitlistInvitedScreenNoParams +import com.duckduckgo.networkprotection.api.NetworkProtectionScreens.NetPWaitlistInvitedScreenNoParams import com.google.android.material.snackbar.Snackbar import javax.inject.Inject import kotlinx.coroutines.flow.launchIn diff --git a/app/src/main/java/com/duckduckgo/app/browser/BrowserTabFragment.kt b/app/src/main/java/com/duckduckgo/app/browser/BrowserTabFragment.kt index 7619541d5d2b..f8bc5316c07e 100644 --- a/app/src/main/java/com/duckduckgo/app/browser/BrowserTabFragment.kt +++ b/app/src/main/java/com/duckduckgo/app/browser/BrowserTabFragment.kt @@ -235,7 +235,7 @@ import com.duckduckgo.js.messaging.api.JsCallbackData import com.duckduckgo.js.messaging.api.JsMessageCallback import com.duckduckgo.js.messaging.api.JsMessageHelper import com.duckduckgo.js.messaging.api.JsMessaging -import com.duckduckgo.mobile.android.app.tracking.ui.AppTrackerOnboardingActivityWithEmptyParamsParams +import com.duckduckgo.mobile.android.app.tracking.ui.AppTrackingProtectionScreens.AppTrackerOnboardingActivityWithEmptyParamsParams import com.duckduckgo.navigation.api.GlobalActivityStarter import com.duckduckgo.remote.messaging.api.RemoteMessage import com.duckduckgo.savedsites.api.models.SavedSite 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 d3e7f5577f59..4b88497478e3 100644 --- a/app/src/main/java/com/duckduckgo/app/settings/SettingsActivity.kt +++ b/app/src/main/java/com/duckduckgo/app/settings/SettingsActivity.kt @@ -61,8 +61,8 @@ import com.duckduckgo.di.DaggerMap import com.duckduckgo.di.scopes.ActivityScope import com.duckduckgo.internal.features.api.InternalFeaturePlugin import com.duckduckgo.macos.api.MacOsScreenWithEmptyParams -import com.duckduckgo.mobile.android.app.tracking.ui.AppTrackerActivityWithEmptyParams -import com.duckduckgo.mobile.android.app.tracking.ui.AppTrackerOnboardingActivityWithEmptyParamsParams +import com.duckduckgo.mobile.android.app.tracking.ui.AppTrackingProtectionScreens.AppTrackerActivityWithEmptyParams +import com.duckduckgo.mobile.android.app.tracking.ui.AppTrackingProtectionScreens.AppTrackerOnboardingActivityWithEmptyParamsParams import com.duckduckgo.navigation.api.GlobalActivityStarter import com.duckduckgo.navigation.api.GlobalActivityStarter.ActivityParams import com.duckduckgo.settings.api.ProSettingsPlugin diff --git a/network-protection/network-protection-api/src/main/java/com/duckduckgo/networkprotection/api/NetworkProtectionScreens.kt b/network-protection/network-protection-api/src/main/java/com/duckduckgo/networkprotection/api/NetworkProtectionScreens.kt index 750102214cb2..4f773603dce5 100644 --- a/network-protection/network-protection-api/src/main/java/com/duckduckgo/networkprotection/api/NetworkProtectionScreens.kt +++ b/network-protection/network-protection-api/src/main/java/com/duckduckgo/networkprotection/api/NetworkProtectionScreens.kt @@ -17,24 +17,25 @@ package com.duckduckgo.networkprotection.api import com.duckduckgo.navigation.api.GlobalActivityStarter.ActivityParams +sealed class NetworkProtectionScreens { + /** + * Use this model to launch the NetworkProtectionManagement screen + */ + object NetworkProtectionManagementScreenNoParams : ActivityParams -/** - * Use this model to launch the NetworkProtectionManagement screen - */ -object NetworkProtectionManagementScreenNoParams : ActivityParams + /** + * Use this model to launch the NetworkProtectionManagement screen + * @param enable `true` if you want to both open the screen and enable NetP in case it's not yet enabled. + */ + data class NetworkProtectionManagementScreenAndEnable(val enable: Boolean) : ActivityParams -/** - * Use this model to launch the NetworkProtectionManagement screen - * @param enable `true` if you want to both open the screen and enable NetP in case it's not yet enabled. - */ -data class NetworkProtectionManagementScreenAndEnable(val enable: Boolean) : ActivityParams + /** + * Use this model to launch the NetPWaitlist screen + */ + object NetPWaitlistInvitedScreenNoParams : ActivityParams -/** - * Use this model to launch the NetPWaitlist screen - */ -object NetPWaitlistInvitedScreenNoParams : ActivityParams - -/** - * Use this model to launch the NetP app exclusion list screen - */ -object NetPAppExclusionListNoParams : ActivityParams + /** + * Use this model to launch the NetP app exclusion list screen + */ + object NetPAppExclusionListNoParams : ActivityParams +} diff --git a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/about/NetPTermsActivity.kt b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/about/NetPTermsActivity.kt index a0186f415c8c..6e96c356e9d6 100644 --- a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/about/NetPTermsActivity.kt +++ b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/about/NetPTermsActivity.kt @@ -22,6 +22,7 @@ import com.duckduckgo.anvil.annotations.InjectWith import com.duckduckgo.common.ui.DuckDuckGoActivity import com.duckduckgo.common.ui.viewbinding.viewBinding import com.duckduckgo.di.scopes.ActivityScope +import com.duckduckgo.networkprotection.impl.about.NetworkProtectionAboutScreens.NetPTermsScreenNoParams import com.duckduckgo.networkprotection.impl.databinding.ActivityNetpTermsBinding import com.duckduckgo.networkprotection.impl.pixels.NetworkProtectionPixels import javax.inject.Inject diff --git a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/about/NetpAboutVpnActivity.kt b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/about/NetpAboutVpnActivity.kt index 17d4bd2dca0f..e81f00f7e444 100644 --- a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/about/NetpAboutVpnActivity.kt +++ b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/about/NetpAboutVpnActivity.kt @@ -22,6 +22,7 @@ import com.duckduckgo.anvil.annotations.InjectWith import com.duckduckgo.common.ui.DuckDuckGoActivity import com.duckduckgo.common.ui.viewbinding.viewBinding import com.duckduckgo.di.scopes.ActivityScope +import com.duckduckgo.networkprotection.impl.about.NetworkProtectionAboutScreens.NetPAboutVPNScreenNoParams import com.duckduckgo.networkprotection.impl.databinding.ActivityNetpInfoVpnBinding import com.duckduckgo.networkprotection.impl.pixels.NetworkProtectionPixels import javax.inject.Inject diff --git a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/about/NetpFaqActivity.kt b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/about/NetpFaqActivity.kt index b3e0bc2a8f38..6d50d9f82e76 100644 --- a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/about/NetpFaqActivity.kt +++ b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/about/NetpFaqActivity.kt @@ -22,6 +22,7 @@ import com.duckduckgo.anvil.annotations.InjectWith import com.duckduckgo.common.ui.DuckDuckGoActivity import com.duckduckgo.common.ui.viewbinding.viewBinding import com.duckduckgo.di.scopes.ActivityScope +import com.duckduckgo.networkprotection.impl.about.NetworkProtectionAboutScreens.NetPFaqsScreenNoParams import com.duckduckgo.networkprotection.impl.databinding.ActivityNetpFaqsBinding import com.duckduckgo.networkprotection.impl.pixels.NetworkProtectionPixels import javax.inject.Inject diff --git a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/about/NetworkProtectionAboutScreens.kt b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/about/NetworkProtectionAboutScreens.kt index 3c6b5ffdc3a5..47b21ac1de95 100644 --- a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/about/NetworkProtectionAboutScreens.kt +++ b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/about/NetworkProtectionAboutScreens.kt @@ -18,17 +18,19 @@ package com.duckduckgo.networkprotection.impl.about import com.duckduckgo.navigation.api.GlobalActivityStarter.ActivityParams -/** - * Use this model to launch the "What is a VPN" screen - */ -object NetPAboutVPNScreenNoParams : ActivityParams +sealed class NetworkProtectionAboutScreens { + /** + * Use this model to launch the "What is a VPN" screen + */ + object NetPAboutVPNScreenNoParams : ActivityParams -/** - * Use this model to launch the "Network Protection FAQs" screen - */ -object NetPFaqsScreenNoParams : ActivityParams + /** + * Use this model to launch the "Network Protection FAQs" screen + */ + object NetPFaqsScreenNoParams : ActivityParams -/** - * Use this model to launch the "Network Protection" terms and conditions screen - */ -object NetPTermsScreenNoParams : ActivityParams + /** + * Use this model to launch the "Network Protection" terms and conditions screen + */ + object NetPTermsScreenNoParams : ActivityParams +} diff --git a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/alerts/NetPAlertNotificationBuilder.kt b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/alerts/NetPAlertNotificationBuilder.kt deleted file mode 100644 index 51d815c50ccf..000000000000 --- a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/alerts/NetPAlertNotificationBuilder.kt +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2023 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.networkprotection.impl.alerts - -import android.app.Notification -import android.app.NotificationChannel -import android.app.NotificationManager -import android.app.PendingIntent -import android.content.Context -import android.content.Intent -import android.os.Build -import android.widget.RemoteViews -import androidx.core.app.NotificationCompat -import androidx.core.app.TaskStackBuilder -import com.duckduckgo.appbuildconfig.api.AppBuildConfig -import com.duckduckgo.di.scopes.AppScope -import com.duckduckgo.networkprotection.impl.R -import com.squareup.anvil.annotations.ContributesBinding -import javax.inject.Inject - -interface NetPAlertNotiticationBuilder { - fun buildReconnectingNotification(context: Context): Notification - fun buildReconnectedNotification(context: Context): Notification - fun buildReconnectionFailedNotification(context: Context): Notification -} - -@ContributesBinding(AppScope::class) -class RealNetPAlertNotiticationBuilder @Inject constructor( - private val appBuildConfig: AppBuildConfig, -) : NetPAlertNotiticationBuilder { - - @Suppress("NewApi") // we use appBuildConfig - private fun registerChannel(context: Context) { - if (appBuildConfig.sdkInt >= Build.VERSION_CODES.O) { - val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager - if (notificationManager.getNotificationChannel(NETP_ALERTS_CHANNEL_ID) == null) { - val channel = NotificationChannel(NETP_ALERTS_CHANNEL_ID, NETP_ALERTS_CHANNEL_NAME, NotificationManager.IMPORTANCE_DEFAULT) - channel.description = NETP_ALERTS_CHANNEL_DESCRIPTION - notificationManager.createNotificationChannel(channel) - notificationManager.isNotificationPolicyAccessGranted - } - } - } - - override fun buildReconnectingNotification(context: Context): Notification { - registerChannel(context) - - return NotificationCompat.Builder(context, NETP_ALERTS_CHANNEL_ID) - .setSmallIcon(com.duckduckgo.mobile.android.R.drawable.notification_logo) - .setStyle(NotificationCompat.DecoratedCustomViewStyle()) - .setContentIntent(getPendingIntent(context)) - .setCustomContentView(RemoteViews(context.packageName, R.layout.notification_reconnecting)) - .setPriority(NotificationCompat.PRIORITY_DEFAULT) - .setCategory(NotificationCompat.CATEGORY_STATUS) - .build() - } - - override fun buildReconnectedNotification(context: Context): Notification { - registerChannel(context) - return NotificationCompat.Builder(context, NETP_ALERTS_CHANNEL_ID) - .setSmallIcon(com.duckduckgo.mobile.android.R.drawable.notification_logo) - .setStyle(NotificationCompat.DecoratedCustomViewStyle()) - .setContentIntent(getPendingIntent(context)) - .setCustomContentView(RemoteViews(context.packageName, R.layout.notification_reconnect_success)) - .setPriority(NotificationCompat.PRIORITY_DEFAULT) - .setCategory(NotificationCompat.CATEGORY_STATUS) - .build() - } - - override fun buildReconnectionFailedNotification(context: Context): Notification { - registerChannel(context) - - return NotificationCompat.Builder(context, NETP_ALERTS_CHANNEL_ID) - .setSmallIcon(com.duckduckgo.mobile.android.R.drawable.notification_logo) - .setStyle(NotificationCompat.DecoratedCustomViewStyle()) - .setContentIntent(getPendingIntent(context)) - .setCustomContentView(RemoteViews(context.packageName, R.layout.notification_reconnect_failed)) - .setPriority(NotificationCompat.PRIORITY_DEFAULT) - .setCategory(NotificationCompat.CATEGORY_STATUS) - .build() - } - - private fun getPendingIntent(context: Context): PendingIntent? = TaskStackBuilder.create(context).run { - addNextIntentWithParentStack( - Intent( - context, - Class.forName("com.duckduckgo.networkprotection.impl.management.NetworkProtectionManagementActivity"), - ), - ) - getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE) - } - - companion object { - const val NETP_ALERTS_CHANNEL_ID = "com.duckduckgo.networkprotection.impl.alerts" - const val NETP_ALERTS_CHANNEL_NAME = "Network Protection Alerts" - const val NETP_ALERTS_CHANNEL_DESCRIPTION = "Alerts from Network Protection" - } -} diff --git a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/alerts/reconnect/NetPReconnectNotifications.kt b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/alerts/reconnect/NetPReconnectNotifications.kt deleted file mode 100644 index 7f1582da11d9..000000000000 --- a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/alerts/reconnect/NetPReconnectNotifications.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2023 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.networkprotection.impl.alerts.reconnect - -import android.content.Context - -interface NetPReconnectNotifications { - fun clearNotifications() - fun launchReconnectingNotification(context: Context) - fun launchReconnectedNotification(context: Context) - fun launchReconnectionFailedNotification(context: Context) -} diff --git a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/alerts/reconnect/RealNetPReconnectNotifications.kt b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/alerts/reconnect/RealNetPReconnectNotifications.kt deleted file mode 100644 index 6cfad6737070..000000000000 --- a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/alerts/reconnect/RealNetPReconnectNotifications.kt +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2023 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.networkprotection.impl.alerts.reconnect - -import android.content.Context -import androidx.core.app.NotificationManagerCompat -import com.duckduckgo.di.scopes.AppScope -import com.duckduckgo.networkprotection.impl.alerts.NetPAlertNotiticationBuilder -import com.squareup.anvil.annotations.ContributesBinding -import javax.inject.Inject - -@ContributesBinding(AppScope::class) -class RealNetPReconnectNotifications @Inject constructor( - private val netPAlertNotiticationBuilder: NetPAlertNotiticationBuilder, - private val notificationManager: NotificationManagerCompat, -) : NetPReconnectNotifications { - override fun clearNotifications() { - notificationManager.cancel(NETP_RECONNECT_NOTIFICATION_ID) - } - - override fun launchReconnectingNotification(context: Context) { - netPAlertNotiticationBuilder.buildReconnectingNotification(context).also { - notificationManager.notify(NETP_RECONNECT_NOTIFICATION_ID, it) - } - } - - override fun launchReconnectedNotification(context: Context) { - netPAlertNotiticationBuilder.buildReconnectedNotification(context).also { - notificationManager.notify(NETP_RECONNECT_NOTIFICATION_ID, it) - } - } - - override fun launchReconnectionFailedNotification(context: Context) { - netPAlertNotiticationBuilder.buildReconnectionFailedNotification(context).also { - notificationManager.notify(NETP_RECONNECT_NOTIFICATION_ID, it) - } - } - - companion object { - const val NETP_RECONNECT_NOTIFICATION_ID = 9991 - } -} diff --git a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/exclusion/ui/NetpAppExclusionListActivity.kt b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/exclusion/ui/NetpAppExclusionListActivity.kt index 68e0b7d874cd..6dbf93d75906 100644 --- a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/exclusion/ui/NetpAppExclusionListActivity.kt +++ b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/exclusion/ui/NetpAppExclusionListActivity.kt @@ -34,7 +34,7 @@ import com.duckduckgo.common.utils.DispatcherProvider import com.duckduckgo.di.scopes.ActivityScope import com.duckduckgo.mobile.android.vpn.VpnFeaturesRegistry import com.duckduckgo.navigation.api.GlobalActivityStarter -import com.duckduckgo.networkprotection.api.NetPAppExclusionListNoParams +import com.duckduckgo.networkprotection.api.NetworkProtectionScreens.NetPAppExclusionListNoParams import com.duckduckgo.networkprotection.impl.NetPVpnFeature import com.duckduckgo.networkprotection.impl.R import com.duckduckgo.networkprotection.impl.R.layout diff --git a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/management/NetworkProtectionManagementActivity.kt b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/management/NetworkProtectionManagementActivity.kt index a9ceea828ddf..daeafc846eb9 100644 --- a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/management/NetworkProtectionManagementActivity.kt +++ b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/management/NetworkProtectionManagementActivity.kt @@ -39,12 +39,12 @@ import com.duckduckgo.common.utils.extensions.launchAlwaysOnSystemSettings import com.duckduckgo.di.scopes.ActivityScope import com.duckduckgo.navigation.api.GlobalActivityStarter import com.duckduckgo.navigation.api.getActivityParams -import com.duckduckgo.networkprotection.api.NetPAppExclusionListNoParams -import com.duckduckgo.networkprotection.api.NetworkProtectionManagementScreenAndEnable -import com.duckduckgo.networkprotection.api.NetworkProtectionManagementScreenNoParams +import com.duckduckgo.networkprotection.api.NetworkProtectionScreens.NetPAppExclusionListNoParams +import com.duckduckgo.networkprotection.api.NetworkProtectionScreens.NetworkProtectionManagementScreenAndEnable +import com.duckduckgo.networkprotection.api.NetworkProtectionScreens.NetworkProtectionManagementScreenNoParams import com.duckduckgo.networkprotection.impl.R -import com.duckduckgo.networkprotection.impl.about.NetPAboutVPNScreenNoParams -import com.duckduckgo.networkprotection.impl.about.NetPFaqsScreenNoParams +import com.duckduckgo.networkprotection.impl.about.NetworkProtectionAboutScreens.NetPAboutVPNScreenNoParams +import com.duckduckgo.networkprotection.impl.about.NetworkProtectionAboutScreens.NetPFaqsScreenNoParams import com.duckduckgo.networkprotection.impl.databinding.ActivityNetpManagementBinding import com.duckduckgo.networkprotection.impl.management.NetworkProtectionManagementViewModel.AlertState.None import com.duckduckgo.networkprotection.impl.management.NetworkProtectionManagementViewModel.AlertState.ShowAlwaysOnLockdownEnabled diff --git a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/management/NetworkProtectionManagementViewModel.kt b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/management/NetworkProtectionManagementViewModel.kt index fd26fe99d380..5dba86eda11f 100644 --- a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/management/NetworkProtectionManagementViewModel.kt +++ b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/management/NetworkProtectionManagementViewModel.kt @@ -42,7 +42,6 @@ import com.duckduckgo.mobile.android.vpn.state.VpnStateMonitor.VpnStopReason.REV import com.duckduckgo.mobile.android.vpn.ui.AppBreakageCategory import com.duckduckgo.mobile.android.vpn.ui.OpenVpnBreakageCategoryWithBrokenApp import com.duckduckgo.networkprotection.impl.NetPVpnFeature -import com.duckduckgo.networkprotection.impl.alerts.reconnect.NetPReconnectNotifications import com.duckduckgo.networkprotection.impl.di.NetpBreakageCategories import com.duckduckgo.networkprotection.impl.management.NetworkProtectionManagementViewModel.AlertState.None import com.duckduckgo.networkprotection.impl.management.NetworkProtectionManagementViewModel.AlertState.ShowAlwaysOnLockdownEnabled @@ -79,7 +78,6 @@ class NetworkProtectionManagementViewModel @Inject constructor( private val featuresRegistry: VpnFeaturesRegistry, private val networkProtectionRepository: NetworkProtectionRepository, private val dispatcherProvider: DispatcherProvider, - private val reconnectNotifications: NetPReconnectNotifications, private val externalVpnDetector: ExternalVpnDetector, private val networkProtectionPixels: NetworkProtectionPixels, @NetpBreakageCategories private val netpBreakageCategories: List, @@ -174,12 +172,12 @@ class NetworkProtectionManagementViewModel @Inject constructor( this?.let { serverDetails -> connectionDetailsFlow.value = if (connectionDetailsFlow.value == null) { ConnectionDetails( - location = serverDetails.location ?: "Los Angeles, United States", + location = serverDetails.location, ipAddress = serverDetails.ipAddress, ) } else { connectionDetailsFlow.value!!.copy( - location = serverDetails.location ?: "Los Angeles, United States", + location = serverDetails.location, ipAddress = serverDetails.ipAddress, ) } @@ -262,7 +260,6 @@ class NetworkProtectionManagementViewModel @Inject constructor( // TODO find a better place to reset values when manually starting or stopping NetP. networkProtectionRepository.reconnectStatus = NotReconnecting networkProtectionRepository.enabledTimeInMillis = -1L - reconnectNotifications.clearNotifications() forceUpdateRunningState() tryShowAlwaysOnPromotion() } @@ -310,7 +307,6 @@ class NetworkProtectionManagementViewModel @Inject constructor( private fun onStopVpn() { viewModelScope.launch(dispatcherProvider.io()) { featuresRegistry.unregisterFeature(NetPVpnFeature.NETP_VPN) - reconnectNotifications.clearNotifications() forceUpdateRunningState() } } diff --git a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/notification/NetPDisabledNotificationBuilder.kt b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/notification/NetPDisabledNotificationBuilder.kt index e547b68ca26a..1ab2ab2cb027 100644 --- a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/notification/NetPDisabledNotificationBuilder.kt +++ b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/notification/NetPDisabledNotificationBuilder.kt @@ -29,9 +29,6 @@ import androidx.core.app.NotificationManagerCompat import androidx.core.app.TaskStackBuilder import com.duckduckgo.di.scopes.VpnScope import com.duckduckgo.networkprotection.impl.R -import com.duckduckgo.networkprotection.impl.alerts.RealNetPAlertNotiticationBuilder.Companion.NETP_ALERTS_CHANNEL_DESCRIPTION -import com.duckduckgo.networkprotection.impl.alerts.RealNetPAlertNotiticationBuilder.Companion.NETP_ALERTS_CHANNEL_ID -import com.duckduckgo.networkprotection.impl.alerts.RealNetPAlertNotiticationBuilder.Companion.NETP_ALERTS_CHANNEL_NAME import com.squareup.anvil.annotations.ContributesBinding import java.text.DateFormat import java.text.SimpleDateFormat @@ -154,4 +151,9 @@ class RealNetPDisabledNotificationBuilder @Inject constructor( ) getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE) } + companion object { + const val NETP_ALERTS_CHANNEL_ID = "com.duckduckgo.networkprotection.impl.alerts" + const val NETP_ALERTS_CHANNEL_NAME = "Network Protection Alerts" + const val NETP_ALERTS_CHANNEL_DESCRIPTION = "Alerts from Network Protection" + } } diff --git a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/notification/NetPEnabledNotificationContentPlugin.kt b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/notification/NetPEnabledNotificationContentPlugin.kt index a192d41347f6..78e12fe883e3 100644 --- a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/notification/NetPEnabledNotificationContentPlugin.kt +++ b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/notification/NetPEnabledNotificationContentPlugin.kt @@ -30,7 +30,7 @@ import com.duckduckgo.mobile.android.vpn.service.VpnEnabledNotificationContentPl import com.duckduckgo.mobile.android.vpn.service.VpnEnabledNotificationContentPlugin.VpnEnabledNotificationContent import com.duckduckgo.mobile.android.vpn.service.VpnEnabledNotificationContentPlugin.VpnEnabledNotificationPriority import com.duckduckgo.navigation.api.GlobalActivityStarter -import com.duckduckgo.networkprotection.api.NetworkProtectionManagementScreenNoParams +import com.duckduckgo.networkprotection.api.NetworkProtectionScreens.NetworkProtectionManagementScreenNoParams import com.duckduckgo.networkprotection.api.NetworkProtectionState import com.duckduckgo.networkprotection.impl.R import com.squareup.anvil.annotations.ContributesBinding diff --git a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/pixels/NetworkProtectionPixelNames.kt b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/pixels/NetworkProtectionPixelNames.kt index d4a8619860f1..a3198d8e1a07 100644 --- a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/pixels/NetworkProtectionPixelNames.kt +++ b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/pixels/NetworkProtectionPixelNames.kt @@ -39,10 +39,6 @@ enum class NetworkProtectionPixelNames( NETP_DISABLE_DAILY("m_netp_ev_disabled_d"), NETP_BACKEND_API_ERROR_DEVICE_REGISTRATION_FAILED("m_netp_ev_backend_api_error_device_registration_failed_c", enqueue = true), NETP_BACKEND_API_ERROR_DEVICE_REGISTRATION_FAILED_DAILY("m_netp_ev_backend_api_error_device_registration_failed_d", enqueue = true), - NETP_VPN_CONNECTIVITY_LOST("m_netp_ev_vpn_connectivity_lost_c", enqueue = true), - NETP_VPN_CONNECTIVITY_LOST_DAILY("m_netp_ev_vpn_connectivity_lost_d", enqueue = true), - NETP_VPN_RECONNECT_FAILED("m_netp_ev_vpn_reconnect_failed_c", enqueue = true), - NETP_VPN_RECONNECT_FAILED_DAILY("m_netp_ev_vpn_reconnect_failed_d", enqueue = true), NETP_WG_ERROR_INVALID_STATE("m_netp_ev_wireguard_error_invalid_state_c", enqueue = true), NETP_WG_ERROR_INVALID_STATE_DAILY("m_netp_ev_wireguard_error_invalid_state_d", enqueue = true), NETP_WG_ERROR_CANT_START_WG_BACKEND("m_netp_ev_wireguard_error_cannot_start_wireguard_backend_c", enqueue = true), diff --git a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/pixels/NetworkProtectionPixels.kt b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/pixels/NetworkProtectionPixels.kt index 7fee9e91f5eb..10e19856727a 100644 --- a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/pixels/NetworkProtectionPixels.kt +++ b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/pixels/NetworkProtectionPixels.kt @@ -61,20 +61,6 @@ interface NetworkProtectionPixels { /** This pixel will be unique on a given day, no matter how many times we call this fun */ fun reportDisabled() - /** - * This fun will fire two pixels - * daily -> fire only once a day no matter how many times we call this fun - * count -> fire a pixel on every call - */ - fun reportVpnConnectivityLoss() - - /** - * This fun will fire two pixels - * daily -> fire only once a day no matter how many times we call this fun - * count -> fire a pixel on every call - */ - fun reportVpnReconnectFailed() - /** * This fun will fire two pixels * daily -> fire only once a day no matter how many times we call this fun @@ -360,16 +346,6 @@ class RealNetworkProtectionPixel @Inject constructor( tryToFireDailyPixel(NETP_DISABLE_DAILY) } - override fun reportVpnConnectivityLoss() { - tryToFireDailyPixel(NETP_VPN_CONNECTIVITY_LOST_DAILY) - firePixel(NETP_VPN_CONNECTIVITY_LOST) - } - - override fun reportVpnReconnectFailed() { - tryToFireDailyPixel(NETP_VPN_RECONNECT_FAILED_DAILY) - firePixel(NETP_VPN_RECONNECT_FAILED) - } - override fun reportWireguardLibraryLoadFailed() { tryToFireDailyPixel(NETP_WG_ERROR_FAILED_TO_LOAD_WG_LIBRARY_DAILY) firePixel(NETP_WG_ERROR_FAILED_TO_LOAD_WG_LIBRARY) diff --git a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/waitlist/NetPWaitlistActivity.kt b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/waitlist/NetPWaitlistActivity.kt index b4bc1e163f6e..b3e15861179a 100644 --- a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/waitlist/NetPWaitlistActivity.kt +++ b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/waitlist/NetPWaitlistActivity.kt @@ -34,7 +34,7 @@ import com.duckduckgo.common.ui.viewbinding.viewBinding import com.duckduckgo.di.scopes.ActivityScope import com.duckduckgo.navigation.api.GlobalActivityStarter import com.duckduckgo.navigation.api.GlobalActivityStarter.ActivityParams -import com.duckduckgo.networkprotection.api.NetPWaitlistInvitedScreenNoParams +import com.duckduckgo.networkprotection.api.NetworkProtectionScreens.NetPWaitlistInvitedScreenNoParams import com.duckduckgo.networkprotection.api.NetworkProtectionWaitlist.NetPWaitlistState.InBeta import com.duckduckgo.networkprotection.api.NetworkProtectionWaitlist.NetPWaitlistState.JoinedWaitlist import com.duckduckgo.networkprotection.api.NetworkProtectionWaitlist.NetPWaitlistState.NotUnlocked diff --git a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/waitlist/NetPWaitlistInvitedActivity.kt b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/waitlist/NetPWaitlistInvitedActivity.kt index 28d6604b68d7..3b60a2732dd9 100644 --- a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/waitlist/NetPWaitlistInvitedActivity.kt +++ b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/waitlist/NetPWaitlistInvitedActivity.kt @@ -33,15 +33,15 @@ import com.duckduckgo.di.scopes.ActivityScope import com.duckduckgo.navigation.api.GlobalActivityStarter import com.duckduckgo.navigation.api.GlobalActivityStarter.ActivityParams import com.duckduckgo.navigation.api.getActivityParams -import com.duckduckgo.networkprotection.api.NetPWaitlistInvitedScreenNoParams -import com.duckduckgo.networkprotection.api.NetworkProtectionManagementScreenAndEnable +import com.duckduckgo.networkprotection.api.NetworkProtectionScreens.NetPWaitlistInvitedScreenNoParams +import com.duckduckgo.networkprotection.api.NetworkProtectionScreens.NetworkProtectionManagementScreenAndEnable import com.duckduckgo.networkprotection.api.NetworkProtectionWaitlist.NetPWaitlistState.InBeta import com.duckduckgo.networkprotection.api.NetworkProtectionWaitlist.NetPWaitlistState.JoinedWaitlist import com.duckduckgo.networkprotection.api.NetworkProtectionWaitlist.NetPWaitlistState.NotUnlocked import com.duckduckgo.networkprotection.api.NetworkProtectionWaitlist.NetPWaitlistState.PendingInviteCode import com.duckduckgo.networkprotection.api.NetworkProtectionWaitlist.NetPWaitlistState.VerifySubscription import com.duckduckgo.networkprotection.impl.R -import com.duckduckgo.networkprotection.impl.about.NetPTermsScreenNoParams +import com.duckduckgo.networkprotection.impl.about.NetworkProtectionAboutScreens.NetPTermsScreenNoParams import com.duckduckgo.networkprotection.impl.databinding.ActivityNetpWaitlistInvitedBinding import com.duckduckgo.networkprotection.impl.waitlist.NetPInviteCodeViewModel.Command import com.duckduckgo.networkprotection.impl.waitlist.NetPInviteCodeViewModel.Command.EnterInviteCode diff --git a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/waitlist/NetworkProtectionWaitlistImpl.kt b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/waitlist/NetworkProtectionWaitlistImpl.kt index 0a76dc2c6043..396e46b10be8 100644 --- a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/waitlist/NetworkProtectionWaitlistImpl.kt +++ b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/waitlist/NetworkProtectionWaitlistImpl.kt @@ -22,8 +22,8 @@ import com.duckduckgo.appbuildconfig.api.isInternalBuild import com.duckduckgo.common.utils.DispatcherProvider import com.duckduckgo.di.scopes.AppScope import com.duckduckgo.navigation.api.GlobalActivityStarter.ActivityParams -import com.duckduckgo.networkprotection.api.NetPWaitlistInvitedScreenNoParams -import com.duckduckgo.networkprotection.api.NetworkProtectionManagementScreenNoParams +import com.duckduckgo.networkprotection.api.NetworkProtectionScreens.NetPWaitlistInvitedScreenNoParams +import com.duckduckgo.networkprotection.api.NetworkProtectionScreens.NetworkProtectionManagementScreenNoParams import com.duckduckgo.networkprotection.api.NetworkProtectionState import com.duckduckgo.networkprotection.api.NetworkProtectionWaitlist import com.duckduckgo.networkprotection.api.NetworkProtectionWaitlist.NetPWaitlistState diff --git a/network-protection/network-protection-impl/src/main/res/drawable/background_code_frame.xml b/network-protection/network-protection-impl/src/main/res/drawable/background_code_frame.xml deleted file mode 100644 index f724c0b4f1a4..000000000000 --- a/network-protection/network-protection-impl/src/main/res/drawable/background_code_frame.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - \ No newline at end of file diff --git a/network-protection/network-protection-impl/src/main/res/drawable/background_code_text.xml b/network-protection/network-protection-impl/src/main/res/drawable/background_code_text.xml deleted file mode 100644 index 838a4421afbe..000000000000 --- a/network-protection/network-protection-impl/src/main/res/drawable/background_code_text.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - diff --git a/network-protection/network-protection-impl/src/main/res/drawable/ic_dragon.xml b/network-protection/network-protection-impl/src/main/res/drawable/ic_dragon.xml deleted file mode 100644 index c4e0ac7a361f..000000000000 --- a/network-protection/network-protection-impl/src/main/res/drawable/ic_dragon.xml +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/network-protection/network-protection-impl/src/main/res/drawable/ic_join_24.xml b/network-protection/network-protection-impl/src/main/res/drawable/ic_join_24.xml deleted file mode 100644 index ca8723a596d4..000000000000 --- a/network-protection/network-protection-impl/src/main/res/drawable/ic_join_24.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - diff --git a/network-protection/network-protection-impl/src/main/res/drawable/ic_news.xml b/network-protection/network-protection-impl/src/main/res/drawable/ic_news.xml deleted file mode 100644 index db2e65148b58..000000000000 --- a/network-protection/network-protection-impl/src/main/res/drawable/ic_news.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/network-protection/network-protection-impl/src/main/res/drawable/ic_timer_24.xml b/network-protection/network-protection-impl/src/main/res/drawable/ic_timer_24.xml deleted file mode 100644 index 2a32164cd682..000000000000 --- a/network-protection/network-protection-impl/src/main/res/drawable/ic_timer_24.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - diff --git a/network-protection/network-protection-impl/src/main/res/layout/notification_reconnect_failed.xml b/network-protection/network-protection-impl/src/main/res/layout/notification_reconnect_failed.xml deleted file mode 100644 index 09dd14a33117..000000000000 --- a/network-protection/network-protection-impl/src/main/res/layout/notification_reconnect_failed.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/network-protection/network-protection-impl/src/main/res/layout/notification_reconnect_success.xml b/network-protection/network-protection-impl/src/main/res/layout/notification_reconnect_success.xml deleted file mode 100644 index 16203b6752e5..000000000000 --- a/network-protection/network-protection-impl/src/main/res/layout/notification_reconnect_success.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/network-protection/network-protection-impl/src/main/res/layout/notification_reconnecting.xml b/network-protection/network-protection-impl/src/main/res/layout/notification_reconnecting.xml deleted file mode 100644 index e7cb7a0b3222..000000000000 --- a/network-protection/network-protection-impl/src/main/res/layout/notification_reconnecting.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/network-protection/network-protection-impl/src/main/res/values/donottranslate.xml b/network-protection/network-protection-impl/src/main/res/values/donottranslate.xml index 61d2d2455382..9a946a51f4fd 100644 --- a/network-protection/network-protection-impl/src/main/res/values/donottranslate.xml +++ b/network-protection/network-protection-impl/src/main/res/values/donottranslate.xml @@ -35,9 +35,6 @@ Network Protection is connected and routing device traffic through <b>%1$s</b>. - Network Protection interrupted. Attempting to reconnect now… - Network Protection failed to connect. Please try again later. - Network Protection is ON. Your location and online activity are protected. Connection interrupted. Attempting to reconnect now… Failed to connect. Please try again later. diff --git a/network-protection/network-protection-impl/src/test/java/com/duckduckgo/networkprotection/impl/management/NetworkProtectionManagementViewModelTest.kt b/network-protection/network-protection-impl/src/test/java/com/duckduckgo/networkprotection/impl/management/NetworkProtectionManagementViewModelTest.kt index d5f869de90ed..da9c2acc3993 100644 --- a/network-protection/network-protection-impl/src/test/java/com/duckduckgo/networkprotection/impl/management/NetworkProtectionManagementViewModelTest.kt +++ b/network-protection/network-protection-impl/src/test/java/com/duckduckgo/networkprotection/impl/management/NetworkProtectionManagementViewModelTest.kt @@ -33,7 +33,6 @@ import com.duckduckgo.mobile.android.vpn.state.VpnStateMonitor.VpnStopReason.UNK import com.duckduckgo.mobile.android.vpn.ui.AppBreakageCategory import com.duckduckgo.mobile.android.vpn.ui.OpenVpnBreakageCategoryWithBrokenApp import com.duckduckgo.networkprotection.impl.NetPVpnFeature -import com.duckduckgo.networkprotection.impl.alerts.reconnect.NetPReconnectNotifications import com.duckduckgo.networkprotection.impl.management.NetworkProtectionManagementViewModel.AlertState.None import com.duckduckgo.networkprotection.impl.management.NetworkProtectionManagementViewModel.AlertState.ShowAlwaysOnLockdownEnabled import com.duckduckgo.networkprotection.impl.management.NetworkProtectionManagementViewModel.AlertState.ShowReconnecting @@ -86,9 +85,6 @@ class NetworkProtectionManagementViewModelTest { @Mock private lateinit var networkProtectionRepository: NetworkProtectionRepository - @Mock - private lateinit var reconnectNotifications: NetPReconnectNotifications - @Mock private lateinit var externalVpnDetector: ExternalVpnDetector @@ -113,7 +109,6 @@ class NetworkProtectionManagementViewModelTest { vpnFeaturesRegistry, networkProtectionRepository, coroutineRule.testDispatcherProvider, - reconnectNotifications, externalVpnDetector, networkProtectionPixels, testbreakageCategories, @@ -325,7 +320,6 @@ class NetworkProtectionManagementViewModelTest { vpnFeaturesRegistry, networkProtectionRepository, coroutineRule.testDispatcherProvider, - reconnectNotifications, externalVpnDetector, networkProtectionPixels, testbreakageCategories, @@ -361,7 +355,6 @@ class NetworkProtectionManagementViewModelTest { vpnFeaturesRegistry, networkProtectionRepository, coroutineRule.testDispatcherProvider, - reconnectNotifications, externalVpnDetector, networkProtectionPixels, testbreakageCategories, @@ -397,7 +390,6 @@ class NetworkProtectionManagementViewModelTest { vpnFeaturesRegistry, networkProtectionRepository, coroutineRule.testDispatcherProvider, - reconnectNotifications, externalVpnDetector, networkProtectionPixels, testbreakageCategories, @@ -428,18 +420,10 @@ class NetworkProtectionManagementViewModelTest { fun whenOnStartVpnThenResetValuesInRepository() { testee.onStartVpn() - verify(reconnectNotifications).clearNotifications() verify(networkProtectionRepository).reconnectStatus = NotReconnecting verify(networkProtectionRepository).enabledTimeInMillis = -1L } - @Test - fun whenOnNetpToggleClickedToDisabledThenResetReconnectState() { - testee.onNetpToggleClicked(false) - - verify(reconnectNotifications).clearNotifications() - } - @Test fun whenVpnStateIsDisabledAndReconnectingThenAlertStateIsShowReconnectingFailed() { assertEquals(ShowReconnectingFailed, testee.getAlertState(DISABLED, Reconnecting, null, AlwaysOnState.DEFAULT)) diff --git a/network-protection/network-protection-impl/src/test/java/com/duckduckgo/networkprotection/impl/pixels/RealNetworkProtectionPixelTest.kt b/network-protection/network-protection-impl/src/test/java/com/duckduckgo/networkprotection/impl/pixels/RealNetworkProtectionPixelTest.kt index 787c1a885654..ec4f2e13414b 100644 --- a/network-protection/network-protection-impl/src/test/java/com/duckduckgo/networkprotection/impl/pixels/RealNetworkProtectionPixelTest.kt +++ b/network-protection/network-protection-impl/src/test/java/com/duckduckgo/networkprotection/impl/pixels/RealNetworkProtectionPixelTest.kt @@ -114,24 +114,6 @@ class RealNetworkProtectionPixelTest { verify(pixel).fire("m_netp_ev_disabled_d") } - @Test - fun whenReportVpnConnectivityLossCalledTwiceThenFireCountPixelTwiceAndDailyPixelOnce() { - testee.reportVpnConnectivityLoss() - testee.reportVpnConnectivityLoss() - - verify(pixel).enqueueFire("m_netp_ev_vpn_connectivity_lost_d", mapOf("ts" to "2000-01-01")) - verify(pixel, times(2)).enqueueFire("m_netp_ev_vpn_connectivity_lost_c", mapOf("ts" to "2000-01-01")) - } - - @Test - fun whenReportVpnReconnectFailedCalledTwiceThenFireCountPixelTwiceAndDailyPixelOnce() { - testee.reportVpnReconnectFailed() - testee.reportVpnReconnectFailed() - - verify(pixel).enqueueFire("m_netp_ev_vpn_reconnect_failed_d", mapOf("ts" to "2000-01-01")) - verify(pixel, times(2)).enqueueFire("m_netp_ev_vpn_reconnect_failed_c", mapOf("ts" to "2000-01-01")) - } - @Test fun whenReportWireguardLibraryLoadFailedCalledTwiceThenFireCountPixelTwiceAndDailyPixelOnce() { testee.reportWireguardLibraryLoadFailed() diff --git a/network-protection/network-protection-impl/src/test/java/com/duckduckgo/networkprotection/impl/waitlist/NetworkProtectionWaitlistTest.kt b/network-protection/network-protection-impl/src/test/java/com/duckduckgo/networkprotection/impl/waitlist/NetworkProtectionWaitlistTest.kt index ccd994f8f3dd..25a567480f75 100644 --- a/network-protection/network-protection-impl/src/test/java/com/duckduckgo/networkprotection/impl/waitlist/NetworkProtectionWaitlistTest.kt +++ b/network-protection/network-protection-impl/src/test/java/com/duckduckgo/networkprotection/impl/waitlist/NetworkProtectionWaitlistTest.kt @@ -5,8 +5,8 @@ import com.duckduckgo.appbuildconfig.api.BuildFlavor.INTERNAL import com.duckduckgo.appbuildconfig.api.BuildFlavor.PLAY import com.duckduckgo.common.test.CoroutineTestRule import com.duckduckgo.feature.toggles.api.Toggle -import com.duckduckgo.networkprotection.api.NetPWaitlistInvitedScreenNoParams -import com.duckduckgo.networkprotection.api.NetworkProtectionManagementScreenNoParams +import com.duckduckgo.networkprotection.api.NetworkProtectionScreens.NetPWaitlistInvitedScreenNoParams +import com.duckduckgo.networkprotection.api.NetworkProtectionScreens.NetworkProtectionManagementScreenNoParams import com.duckduckgo.networkprotection.api.NetworkProtectionState import com.duckduckgo.networkprotection.api.NetworkProtectionWaitlist import com.duckduckgo.networkprotection.api.NetworkProtectionWaitlist.NetPWaitlistState.InBeta diff --git a/network-protection/network-protection-subscription-internal/src/main/java/com/duckduckgo/networkprotection/subscription/NetworkProtectionAccessState.kt b/network-protection/network-protection-subscription-internal/src/main/java/com/duckduckgo/networkprotection/subscription/NetworkProtectionAccessState.kt index ee96dbb4141c..7faf17162a67 100644 --- a/network-protection/network-protection-subscription-internal/src/main/java/com/duckduckgo/networkprotection/subscription/NetworkProtectionAccessState.kt +++ b/network-protection/network-protection-subscription-internal/src/main/java/com/duckduckgo/networkprotection/subscription/NetworkProtectionAccessState.kt @@ -20,8 +20,8 @@ import com.duckduckgo.appbuildconfig.api.AppBuildConfig import com.duckduckgo.common.utils.DispatcherProvider import com.duckduckgo.di.scopes.AppScope import com.duckduckgo.navigation.api.GlobalActivityStarter.ActivityParams -import com.duckduckgo.networkprotection.api.NetPWaitlistInvitedScreenNoParams -import com.duckduckgo.networkprotection.api.NetworkProtectionManagementScreenNoParams +import com.duckduckgo.networkprotection.api.NetworkProtectionScreens.NetPWaitlistInvitedScreenNoParams +import com.duckduckgo.networkprotection.api.NetworkProtectionScreens.NetworkProtectionManagementScreenNoParams import com.duckduckgo.networkprotection.api.NetworkProtectionState import com.duckduckgo.networkprotection.api.NetworkProtectionWaitlist import com.duckduckgo.networkprotection.api.NetworkProtectionWaitlist.NetPWaitlistState diff --git a/network-protection/network-protection-subscription-internal/src/main/java/com/duckduckgo/networkprotection/subscription/ui/NetpVerifySubscriptionActivity.kt b/network-protection/network-protection-subscription-internal/src/main/java/com/duckduckgo/networkprotection/subscription/ui/NetpVerifySubscriptionActivity.kt index fd754046c449..583b1699ab89 100644 --- a/network-protection/network-protection-subscription-internal/src/main/java/com/duckduckgo/networkprotection/subscription/ui/NetpVerifySubscriptionActivity.kt +++ b/network-protection/network-protection-subscription-internal/src/main/java/com/duckduckgo/networkprotection/subscription/ui/NetpVerifySubscriptionActivity.kt @@ -26,7 +26,7 @@ import com.duckduckgo.common.ui.DuckDuckGoActivity import com.duckduckgo.common.ui.viewbinding.viewBinding import com.duckduckgo.di.scopes.ActivityScope import com.duckduckgo.navigation.api.GlobalActivityStarter -import com.duckduckgo.networkprotection.api.NetPWaitlistInvitedScreenNoParams +import com.duckduckgo.networkprotection.api.NetworkProtectionScreens.NetPWaitlistInvitedScreenNoParams import com.duckduckgo.networkprotection.subscription.databinding.ActivityNetpVerifySubsBinding import com.duckduckgo.networkprotection.subscription.ui.NetpVerifySubscriptionViewModel.Command.LaunchNetPScreen import javax.inject.Inject diff --git a/subscriptions/subscriptions-impl/src/test/java/com/duckduckgo/subscriptions/impl/ui/SubscriptionWebViewViewModelTest.kt b/subscriptions/subscriptions-impl/src/test/java/com/duckduckgo/subscriptions/impl/ui/SubscriptionWebViewViewModelTest.kt index 8af811798c9f..2b1ee48893f5 100644 --- a/subscriptions/subscriptions-impl/src/test/java/com/duckduckgo/subscriptions/impl/ui/SubscriptionWebViewViewModelTest.kt +++ b/subscriptions/subscriptions-impl/src/test/java/com/duckduckgo/subscriptions/impl/ui/SubscriptionWebViewViewModelTest.kt @@ -6,7 +6,7 @@ import com.android.billingclient.api.ProductDetails.PricingPhase import com.android.billingclient.api.ProductDetails.PricingPhases import com.android.billingclient.api.ProductDetails.SubscriptionOfferDetails import com.duckduckgo.common.test.CoroutineTestRule -import com.duckduckgo.networkprotection.api.NetPWaitlistInvitedScreenNoParams +import com.duckduckgo.networkprotection.api.NetworkProtectionScreens.NetPWaitlistInvitedScreenNoParams import com.duckduckgo.networkprotection.api.NetworkProtectionWaitlist import com.duckduckgo.subscriptions.impl.CurrentPurchase import com.duckduckgo.subscriptions.impl.JSONObjectAdapter