-
Notifications
You must be signed in to change notification settings - Fork 928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Settings: Update VPN settings item #5394
Update Settings: Update VPN settings item #5394
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
f436476
to
d306ac3
Compare
72f177a
to
76b9911
Compare
76b9911
to
49dea28
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as expected, check with @aitorvs and @karlenDimla for changes related to NetP API.
...ction-api/src/main/java/com/duckduckgo/networkprotection/api/NetworkProtectionAccessState.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed offline, the only thing I’d look into changing is to move all the UI States into the impl module because they don’t need to be exposed.
Please hold off checking until I've made some changes, I think we can move the new NetworkProtectionAccessState API to the impl module as no other module is using it. |
I will review the changes. |
.../src/main/java/com/duckduckgo/networkprotection/impl/subscription/NetpSubscriptionManager.kt
Outdated
Show resolved
Hide resolved
...om/duckduckgo/networkprotection/impl/subscription/settings/NetworkProtectionSettingsState.kt
Outdated
Show resolved
Hide resolved
if (!status.isActive()) { | ||
// if entitlement check succeeded and not an active subscription then reset state | ||
handleRevokedVPNState() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this logic be here?
If I understand correctly, a user can have an inactive subscription but continue using the VPN as long as they don't open settings? That seems odd/wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm taking the logic that already exists in NetworkProtectionAccessStateImpl
and adding it here.
override suspend fun getStateFlow(): Flow<NetPAccessState> = withContext(dispatcherProvider.io()) {
netpSubscriptionManager.vpnStatus().map { status ->
if (!status.isActive()) {
// if entitlement check succeeded and no entitlement, reset state and hide access.
handleRevokedVPNState()
Locked
} else {
UnLocked
}
}
}
This is only ever called by the current NetP Settings item: ProSettingNetPViewModel
(LegacyProSettingNetPViewModel
in this PR)
Once the new Settings is rolled out, NetworkProtectionAccessStateImpl.getStateFlow
will never be called, so I wanted to ensure the behaviour stays the same when that eventually happens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed on Zoom, this is existing behaviour in the Legacy ProSettingNetPViewModel
and therefore I'm going to leave it as is so as not to affect existing behaviour.
b9956a7
to
8bde9db
Compare
copy paste of legacy
We'll need more states to represent our new VPN statuses as we'll see in upcoming commits.
The VPN status states have changed for the new settings as we need to know more about the subscription status of the VPN to correctly render the new states, therefore we need to know if we're in a waiting state so we can in future render an "Activating" state We
Locked and Unlocked are no longer sufficient for us to render the correct states. We add a new NetPVisibilityState which tells us if we should show the VPN item to the user, and if we do, what it's subscription state is. I'm not entirely sure about nesting the subscription status, or having this as a property of Visible state, I'm open to suggestions
With all the new information and states we can now render the VPN item correctly and kill off some of the legacy code we copied over
Seeing as we will aim to get rid of the netpAccessState.getLegacyState() function we need to change to use the new netpAccessState.getState() in the RealVpnTileStateProvider Practically the same, just rejigged the order to make more sense
This is an internal only class used to determine the state for the settings item as we need to know more information about the user's subscription to determine how to show the new VPN item
After talking to Aitor about onboarding we decided even though no one could give me an answer yesterday RE if we still want onboarding checks we should probably add this back in so we're consistent with previous behaviour
8bde9db
to
81c774d
Compare
81c774d
to
da4e853
Compare
Task/Issue URL: https://app.asana.com/0/0/1208966262488271/f
Description
Updates the VPN settings item to match new designs. As the new designs require us to know more about the subscription state we need to expose more Subscription Statuses so we can reflect that in the settings screen like the "Waiting" state that is equivalent to our new "Activating" state.
The biggest thing to note is that now it's not like it used to be where we had just 2 states, locked and unlocked, we now more readily show the user the VPN item and what it's subscription state is.
I'm still waiting on answers regarding the onboarded state
And connecting state but I can always circle back later and address these as necessary.
Designs
Steps to test this PR
Prerequisite: Enable
newSettings
feature togglePrerequisite: Apply the patch in the Asana task
Note: Only the VPN item and possibly the Settings item will be seen, depending on the different states. PIR, ITR are not included as part of this PR and so are not visible.
VPN Subscribed and Off
VPN Subscribed and On
NetworkProtectionStateImpl
change ln 98 toreturn flowOf(CONNECTED)
Unsubscribed
SubscriptionManager
change ln 442 toreturn SubscriptionStatus.UNKNOWN
VPN Expired
SubscriptionManager
change ln 442 toreturn SubscriptionStatus.EXPIRED
PPro Activating
SubscriptionManager
change ln 442 toreturn SubscriptionStatus.WAITING
No Entitlement
SubscriptionManager
change ln 442 toreturn SubscriptionStatus.AUTO_RENEWABLE
RealSubscriptions
change ln 77 toreturn flowOf(listOf())
Legacy Support
newSettings
UI changes