Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mikescamell committed Dec 17, 2024
1 parent 845126b commit 72f177a
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ interface NetworkProtectionAccessState {
data object Expired : Visible
data object Activating : Visible
}
data object Hidden: NetPVisibilityState
data object Hidden : NetPVisibilityState
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ interface NetworkProtectionState {
enum class ConnectionState {
CONNECTED,
CONNECTING,
DISCONNECTED;
DISCONNECTED,
;

fun isConnected(): Boolean = this == CONNECTED
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 72f177a

Please sign in to comment.