Skip to content

Commit

Permalink
Load child Privacy Pro views lazily (#2917)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/547792610048271/1207482157703809/f
Tech Design URL:
CC:

Description:

This PR updates Privacy Pro child views to load lazily. Without this, we were loading all of them as soon as the Privacy Pro flow was opened, and attempting to check auth state etc.
  • Loading branch information
samsymons authored Jun 4, 2024
1 parent 21b9851 commit b1afd46
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Core/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ extension Pixel {

case networkProtectionDisconnected

case networkProtectionNoAuthTokenFoundError
case networkProtectionNoAccessTokenFoundError

case networkProtectionMemoryWarning
case networkProtectionMemoryCritical
Expand Down Expand Up @@ -1058,7 +1058,7 @@ extension Pixel.Event {
case .networkProtectionActivationRequestFailed: return "m_netp_network_extension_error_activation_request_failed"
case .networkProtectionFailedToStartTunnel: return "m_netp_failed_to_start_tunnel"
case .networkProtectionDisconnected: return "m_netp_vpn_disconnect"
case .networkProtectionNoAuthTokenFoundError: return "m_netp_no_auth_token_found_error"
case .networkProtectionNoAccessTokenFoundError: return "m_netp_no_access_token_found_error"
case .networkProtectionMemoryWarning: return "m_netp_vpn_memory_warning"
case .networkProtectionMemoryCritical: return "m_netp_vpn_memory_critical"
case .networkProtectionUnhandledError: return "m_netp_unhandled_error"
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/EventMapping+NetworkProtectionError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ extension EventMapping where Event == NetworkProtectionError {
pixelEvent = .networkProtectionKeychainDeleteError
params[PixelParameters.keychainErrorCode] = String(status)
case .noAuthTokenFound:
pixelEvent = .networkProtectionNoAuthTokenFoundError
pixelEvent = .networkProtectionNoAccessTokenFoundError
case .vpnAccessRevoked:
return
case .noServerRegistrationInfo,
Expand Down
6 changes: 3 additions & 3 deletions DuckDuckGo/Subscription/Views/SubscriptionEmailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ struct SubscriptionEmailView: View {

var body: some View {
// Hidden Navigation Links for Onboarding sections
NavigationLink(destination: NetworkProtectionRootView().navigationViewStyle(.stack),
NavigationLink(destination: LazyView(NetworkProtectionRootView().navigationViewStyle(.stack)),
isActive: $isShowingNetP,
label: { EmptyView() })
NavigationLink(destination: SubscriptionITPView().navigationViewStyle(.stack),
NavigationLink(destination: LazyView(SubscriptionITPView().navigationViewStyle(.stack)),
isActive: $isShowingITR,
label: { EmptyView() })
NavigationLink(destination: SubscriptionPIRView().navigationViewStyle(.stack),
NavigationLink(destination: LazyView(SubscriptionPIRView().navigationViewStyle(.stack)),
isActive: $isShowingDBP,
label: { EmptyView() })

Expand Down
6 changes: 3 additions & 3 deletions DuckDuckGo/Subscription/Views/SubscriptionFlowView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ struct SubscriptionFlowView: View {
var body: some View {

// Hidden Navigation Links for Onboarding sections
NavigationLink(destination: NetworkProtectionRootView().navigationViewStyle(.stack),
NavigationLink(destination: LazyView(NetworkProtectionRootView().navigationViewStyle(.stack)),
isActive: $isShowingNetP,
label: { EmptyView() })
NavigationLink(destination: SubscriptionITPView().navigationViewStyle(.stack),
NavigationLink(destination: LazyView(SubscriptionITPView().navigationViewStyle(.stack)),
isActive: $isShowingITR,
label: { EmptyView() })
NavigationLink(destination: SubscriptionPIRView().navigationViewStyle(.stack),
NavigationLink(destination: LazyView(SubscriptionPIRView().navigationViewStyle(.stack)),
isActive: $isShowingDBP,
label: { EmptyView() })

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ final class NetworkProtectionPacketTunnelProvider: PacketTunnelProvider {
pixelEvent = .networkProtectionWireguardErrorCannotStartWireguardBackend
params[PixelParameters.wireguardErrorCode] = String(code)
case .noAuthTokenFound:
pixelEvent = .networkProtectionNoAuthTokenFoundError
pixelEvent = .networkProtectionNoAccessTokenFoundError
case .vpnAccessRevoked:
return
case .unhandledError(function: let function, line: let line, error: let error):
Expand Down

0 comments on commit b1afd46

Please sign in to comment.