Skip to content

Commit

Permalink
PIA-0000: Update vpn profile installing property enabling for mock
Browse files Browse the repository at this point in the history
  • Loading branch information
kp-said-rehouni committed Feb 2, 2024
1 parent 5fdcfeb commit 4430ca5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions PIA VPN-tvOS/RootContainer/UI/RootContainerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ struct RootContainerView: View {
.withOnboardingRoutes()
case .activatedNotOnboarded, .activated:
UserActivatedContainerFactory.makeUSerActivatedContainerView()
.withOnboardingRoutes()
}
}.onChange(of: scenePhase) { _, newPhase in
if newPhase == .active {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ import Foundation

class InstallVPNConfigurationUseCaseMock: InstallVPNConfigurationUseCaseType {
private let error: InstallVPNConfigurationError?
var onSuccessAction: (() -> Void)?

init(error: InstallVPNConfigurationError?) {
init(error: InstallVPNConfigurationError?, onSuccessAction: (() -> Void)? = nil) {
self.error = error
self.onSuccessAction = onSuccessAction
}

func callAsFunction() async throws {
guard let error = error else {
onSuccessAction?()
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ class VPNConfigurationInstallingFactory {
private static func makeInstallVPNConfigurationUseCase() -> InstallVPNConfigurationUseCaseType {

guard !isSimulator else {
return InstallVPNConfigurationUseCaseMock(error: nil)

let onSuccessAction = {
let vpnConfigurationAvailability = VPNConfigurationAvailability()
vpnConfigurationAvailability.set(value: true)
}

return InstallVPNConfigurationUseCaseMock(error: nil, onSuccessAction: onSuccessAction)
}

return InstallVpnConfigurationProvider(vpnProvider: makeVpnConfigurationProvider(),
Expand Down

0 comments on commit 4430ca5

Please sign in to comment.