-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PIA-1177: Integrate VPN profile installing in App flow (#61)
- Loading branch information
1 parent
bb71380
commit 63525f2
Showing
19 changed files
with
260 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// Routes.swift | ||
// PIA VPN-tvOS | ||
// | ||
// Created by Said Rehouni on 12/1/24. | ||
// Copyright © 2024 Private Internet Access Inc. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
|
||
enum AuthenticationDestinations: Destinations { | ||
case loginCredentials | ||
} | ||
|
||
enum OnboardingDestinations: Destinations { | ||
case installVPNProfile | ||
case dashboard | ||
} | ||
|
||
public extension View { | ||
func withAuthenticationRoutes() -> some View { | ||
self.navigationDestination(for: AuthenticationDestinations.self) { destination in | ||
switch destination { | ||
case .loginCredentials: | ||
LoginFactory.makeLoginView() | ||
} | ||
} | ||
} | ||
|
||
func withOnboardingRoutes() -> some View { | ||
self.navigationDestination(for: OnboardingDestinations.self) { destination in | ||
switch destination { | ||
case .installVPNProfile: | ||
VPNConfigurationInstallingFactory.makeVPNConfigurationInstallingView() | ||
case .dashboard: | ||
UserActivatedContainerFactory.makeUSerActivatedContainerView() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// | ||
// AppRouterSpy.swift | ||
// PIA VPN-tvOSTests | ||
// | ||
// Created by Said Rehouni on 15/1/24. | ||
// Copyright © 2024 Private Internet Access Inc. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
@testable import PIA_VPN_tvOS | ||
|
||
class AppRouterSpy: AppRouterType { | ||
enum Request: Equatable { | ||
static func == (lhs: AppRouterSpy.Request, rhs: AppRouterSpy.Request) -> Bool { | ||
switch (lhs, rhs) { | ||
case let (.navigate(lhsRoute), .navigate(rhsRoute)): | ||
|
||
if let lhsOnboarding = lhsRoute as? OnboardingDestinations, let rhsOnboarding = rhsRoute as? OnboardingDestinations { | ||
return lhsOnboarding == rhsOnboarding | ||
} | ||
|
||
if let lhsAuth = lhsRoute as? AuthenticationDestinations, let rhsAuth = rhsRoute as? AuthenticationDestinations { | ||
return lhsAuth == rhsAuth | ||
} | ||
|
||
return false | ||
case (.pop, .pop), (.goBackToRoot, .goBackToRoot): | ||
return true | ||
default: | ||
return false | ||
} | ||
} | ||
|
||
case navigate(any Destinations) | ||
case pop | ||
case goBackToRoot | ||
} | ||
|
||
var stackCount: Int = 0 | ||
var requests = [AppRouterSpy.Request]() | ||
|
||
var didGetARequest: (() -> Void)? | ||
|
||
func navigate(to destination: any Destinations) { | ||
requests.append(.navigate(destination)) | ||
didGetARequest?() | ||
} | ||
|
||
func pop() { | ||
requests.append(.pop) | ||
didGetARequest?() | ||
} | ||
|
||
func goBackToRoot() { | ||
requests.append(.goBackToRoot) | ||
didGetARequest?() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.