ios vpn app
This commit is contained in:
1 parent
96f16399d7
commit
1b506b9ee7
48 files changed
+4934
-45
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import SwiftUI
|
||||
|
||||
@main
|
||||
struct WhitelistBypassVPNApp: App {
|
||||
@StateObject private var appState = AppState()
|
||||
@StateObject private var vpn = VPNController()
|
||||
@Environment(\.scenePhase) private var scenePhase
|
||||
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ContentView()
|
||||
.environmentObject(appState)
|
||||
.environmentObject(vpn)
|
||||
.preferredColorScheme(appState.themeMode.colorScheme)
|
||||
.onAppear {
|
||||
vpn.appState = appState
|
||||
if appState.connectOnStart, appState.activeCall != nil {
|
||||
Task { await vpn.connect() }
|
||||
}
|
||||
}
|
||||
.onChange(of: scenePhase) { phase in
|
||||
switch phase {
|
||||
case .active: vpn.startPolling()
|
||||
case .background: vpn.stopPolling()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user