Fix compile errors from #984

This commit is contained in:
Davide 2024-12-08 19:02:31 +01:00
parent f7013a98a9
commit edaa151911
No known key found for this signature in database
GPG Key ID: A48836171C759F5E
1 changed files with 15 additions and 14 deletions

View File

@ -47,6 +47,7 @@ extension AppContext {
) )
let processor = dependencies.appProcessor(with: iapManager) let processor = dependencies.appProcessor(with: iapManager)
let tunnelEnvironment = dependencies.tunnelEnvironment()
let profileManager: ProfileManager = { let profileManager: ProfileManager = {
let remoteRepositoryBlock: (Bool) -> ProfileRepository = { let remoteRepositoryBlock: (Bool) -> ProfileRepository = {
@ -69,7 +70,7 @@ extension AppContext {
) )
} }
return ProfileManager( return ProfileManager(
repository: dependencies.mainProfileRepository(), repository: dependencies.mainProfileRepository(environment: tunnelEnvironment),
backupRepository: dependencies.backupProfileRepository(), backupRepository: dependencies.backupProfileRepository(),
remoteRepositoryBlock: remoteRepositoryBlock, remoteRepositoryBlock: remoteRepositoryBlock,
mirrorsRemoteRepository: dependencies.mirrorsRemoteRepository, mirrorsRemoteRepository: dependencies.mirrorsRemoteRepository,
@ -78,8 +79,8 @@ extension AppContext {
}() }()
let tunnel = ExtendedTunnel( let tunnel = ExtendedTunnel(
tunnel: Tunnel(strategy: dependencies.tunnelStrategy()), tunnel: Tunnel(strategy: dependencies.tunnelStrategy(environment: tunnelEnvironment)),
environment: dependencies.tunnelEnvironment(), environment: tunnelEnvironment,
processor: processor, processor: processor,
interval: Constants.shared.tunnel.refreshInterval interval: Constants.shared.tunnel.refreshInterval
) )
@ -179,11 +180,11 @@ private extension Dependencies {
#if targetEnvironment(simulator) #if targetEnvironment(simulator)
private extension Dependencies { private extension Dependencies {
func tunnelStrategy() -> TunnelObservableStrategy { func tunnelStrategy(environment: TunnelEnvironment) -> TunnelObservableStrategy {
FakeTunnelStrategy(environment: .shared, dataCountInterval: 1000) FakeTunnelStrategy(environment: environment, dataCountInterval: 1000)
} }
func mainProfileRepository() -> ProfileRepository { func mainProfileRepository(environment: TunnelEnvironment) -> ProfileRepository {
coreDataProfileRepository(observingResults: true) coreDataProfileRepository(observingResults: true)
} }
@ -197,12 +198,12 @@ private extension Dependencies {
// MARK: Device // MARK: Device
private extension Dependencies { private extension Dependencies {
func tunnelStrategy() -> TunnelObservableStrategy { func tunnelStrategy(environment: TunnelEnvironment) -> TunnelObservableStrategy {
neStrategy() neStrategy(environment: environment)
} }
func mainProfileRepository() -> ProfileRepository { func mainProfileRepository(environment: TunnelEnvironment) -> ProfileRepository {
neProfileRepository() neProfileRepository(environment: environment)
} }
func backupProfileRepository() -> ProfileRepository? { func backupProfileRepository() -> ProfileRepository? {
@ -223,17 +224,17 @@ private extension Dependencies {
#endif #endif
} }
func neProfileRepository() -> ProfileRepository { func neProfileRepository(environment: TunnelEnvironment) -> ProfileRepository {
NEProfileRepository(repository: neStrategy()) { NEProfileRepository(repository: neStrategy(environment: environment)) {
profileTitle($0) profileTitle($0)
} }
} }
func neStrategy() -> NETunnelStrategy { func neStrategy(environment: TunnelEnvironment) -> NETunnelStrategy {
NETunnelStrategy( NETunnelStrategy(
bundleIdentifier: BundleConfiguration.mainString(for: .tunnelId), bundleIdentifier: BundleConfiguration.mainString(for: .tunnelId),
coder: neProtocolCoder(), coder: neProtocolCoder(),
environment: tunnelEnvironment() environment: environment
) )
} }