From 76b9911c4093b01415678d757bcb3476561f2e37 Mon Sep 17 00:00:00 2001 From: Mike Scamell Date: Mon, 16 Dec 2024 09:59:13 +0100 Subject: [PATCH] formatting --- .../networkprotection/api/NetworkProtectionAccessState.kt | 2 +- .../networkprotection/api/NetworkProtectionState.kt | 3 ++- .../impl/subscription/NetpSubscriptionManager.kt | 1 - .../subscription/settings/LegacyProSettingNetPViewModel.kt | 5 ++++- .../impl/subscription/settings/ProSettingNetPView.kt | 4 ++-- .../impl/subscription/settings/ProSettingNetPViewModel.kt | 2 +- .../impl/subscription/settings/SubsSettingsPlugin.kt | 2 +- 7 files changed, 11 insertions(+), 8 deletions(-) diff --git a/network-protection/network-protection-api/src/main/java/com/duckduckgo/networkprotection/api/NetworkProtectionAccessState.kt b/network-protection/network-protection-api/src/main/java/com/duckduckgo/networkprotection/api/NetworkProtectionAccessState.kt index 04f31882fe2e..8da359be2f44 100644 --- a/network-protection/network-protection-api/src/main/java/com/duckduckgo/networkprotection/api/NetworkProtectionAccessState.kt +++ b/network-protection/network-protection-api/src/main/java/com/duckduckgo/networkprotection/api/NetworkProtectionAccessState.kt @@ -71,6 +71,6 @@ interface NetworkProtectionAccessState { data object Expired : Visible data object Activating : Visible } - data object Hidden: NetPVisibilityState + data object Hidden : NetPVisibilityState } } diff --git a/network-protection/network-protection-api/src/main/java/com/duckduckgo/networkprotection/api/NetworkProtectionState.kt b/network-protection/network-protection-api/src/main/java/com/duckduckgo/networkprotection/api/NetworkProtectionState.kt index 61ddced7c67d..2119466a3fb4 100644 --- a/network-protection/network-protection-api/src/main/java/com/duckduckgo/networkprotection/api/NetworkProtectionState.kt +++ b/network-protection/network-protection-api/src/main/java/com/duckduckgo/networkprotection/api/NetworkProtectionState.kt @@ -90,7 +90,8 @@ interface NetworkProtectionState { enum class ConnectionState { CONNECTED, CONNECTING, - DISCONNECTED; + DISCONNECTED, + ; fun isConnected(): Boolean = this == CONNECTED } diff --git a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/subscription/NetpSubscriptionManager.kt b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/subscription/NetpSubscriptionManager.kt index b68c3af64850..193a88075e62 100644 --- a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/subscription/NetpSubscriptionManager.kt +++ b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/subscription/NetpSubscriptionManager.kt @@ -19,7 +19,6 @@ package com.duckduckgo.networkprotection.impl.subscription import com.duckduckgo.common.utils.DispatcherProvider import com.duckduckgo.di.scopes.AppScope import com.duckduckgo.networkprotection.impl.subscription.NetpSubscriptionManager.VpnStatus -import com.duckduckgo.networkprotection.impl.subscription.settings.ProSettingNetPViewModel.NetPEntryState.Hidden import com.duckduckgo.settings.api.NewSettingsFeature import com.duckduckgo.subscriptions.api.Product.NetP import com.duckduckgo.subscriptions.api.SubscriptionStatus diff --git a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/subscription/settings/LegacyProSettingNetPViewModel.kt b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/subscription/settings/LegacyProSettingNetPViewModel.kt index 752c905982be..a15a8e42fafb 100644 --- a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/subscription/settings/LegacyProSettingNetPViewModel.kt +++ b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/subscription/settings/LegacyProSettingNetPViewModel.kt @@ -86,7 +86,10 @@ class LegacyProSettingNetPViewModel( super.onStart(owner) viewModelScope.launch { - combine(networkProtectionAccessState.getLegacyStateFlow(), networkProtectionState.getConnectionStateFlow()) { accessState, connectionState -> + combine( + networkProtectionAccessState.getLegacyStateFlow(), + networkProtectionState.getConnectionStateFlow(), + ) { accessState, connectionState -> _viewState.emit( viewState.value.copy( networkProtectionEntryState = getNetworkProtectionEntryState(accessState, connectionState), diff --git a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/subscription/settings/ProSettingNetPView.kt b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/subscription/settings/ProSettingNetPView.kt index aefee1f64a91..dcfc63c9974c 100644 --- a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/subscription/settings/ProSettingNetPView.kt +++ b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/subscription/settings/ProSettingNetPView.kt @@ -31,7 +31,6 @@ import com.duckduckgo.di.scopes.ViewScope import com.duckduckgo.navigation.api.GlobalActivityStarter import com.duckduckgo.networkprotection.impl.R import com.duckduckgo.networkprotection.impl.databinding.ViewSettingsNetpBinding -import com.duckduckgo.networkprotection.impl.subscription.settings.LegacyProSettingNetPViewModel.NetPEntryState.Pending import com.duckduckgo.networkprotection.impl.subscription.settings.ProSettingNetPViewModel.Command import com.duckduckgo.networkprotection.impl.subscription.settings.ProSettingNetPViewModel.Command.OpenNetPScreen import com.duckduckgo.networkprotection.impl.subscription.settings.ProSettingNetPViewModel.Factory @@ -93,7 +92,8 @@ class ProSettingNetPView @JvmOverloads constructor( when (networkProtectionEntryState) { Hidden -> isGone = true Activating, - Expired -> { + Expired, + -> { isVisible = true isClickable = false setLeadingIconResource(R.drawable.ic_vpn_grayscale_color_24) diff --git a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/subscription/settings/ProSettingNetPViewModel.kt b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/subscription/settings/ProSettingNetPViewModel.kt index f7b878f90b07..5aa94f8f9912 100644 --- a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/subscription/settings/ProSettingNetPViewModel.kt +++ b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/subscription/settings/ProSettingNetPViewModel.kt @@ -27,10 +27,10 @@ import com.duckduckgo.common.utils.DispatcherProvider import com.duckduckgo.navigation.api.GlobalActivityStarter.ActivityParams import com.duckduckgo.networkprotection.api.NetworkProtectionAccessState import com.duckduckgo.networkprotection.api.NetworkProtectionAccessState.NetPVisibilityState +import com.duckduckgo.networkprotection.api.NetworkProtectionAccessState.NetPVisibilityState.Hidden import com.duckduckgo.networkprotection.api.NetworkProtectionAccessState.NetPVisibilityState.Visible.Activating import com.duckduckgo.networkprotection.api.NetworkProtectionAccessState.NetPVisibilityState.Visible.Expired import com.duckduckgo.networkprotection.api.NetworkProtectionAccessState.NetPVisibilityState.Visible.Subscribed -import com.duckduckgo.networkprotection.api.NetworkProtectionAccessState.NetPVisibilityState.Hidden import com.duckduckgo.networkprotection.api.NetworkProtectionState import com.duckduckgo.networkprotection.api.NetworkProtectionState.ConnectionState import com.duckduckgo.networkprotection.impl.pixels.NetworkProtectionPixelNames.NETP_SETTINGS_PRESSED diff --git a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/subscription/settings/SubsSettingsPlugin.kt b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/subscription/settings/SubsSettingsPlugin.kt index 1d7b89e63880..d721a5dea065 100644 --- a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/subscription/settings/SubsSettingsPlugin.kt +++ b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/subscription/settings/SubsSettingsPlugin.kt @@ -29,7 +29,7 @@ import javax.inject.Inject @PriorityKey(200) class ProSettingsNetP @Inject constructor(private val newSettingsFeature: NewSettingsFeature) : ProSettingsPlugin { override fun getView(context: Context): View { - return if(newSettingsFeature.self().isEnabled()) { + return if (newSettingsFeature.self().isEnabled()) { ProSettingNetPView(context) } else { return LegacyProSettingNetPView(context)