Fix Read iCloud profile before starting
This commit is contained in:
@@ -50,6 +50,7 @@ public class ExtensionProfile: ObservableObject {
|
||||
}
|
||||
|
||||
public func start() async throws {
|
||||
await fetchProfile()
|
||||
manager.isEnabled = true
|
||||
if await SharedPreferences.alwaysOn.get() {
|
||||
manager.isOnDemandEnabled = true
|
||||
@@ -76,6 +77,16 @@ public class ExtensionProfile: ObservableObject {
|
||||
try manager.connection.startVPNTunnel()
|
||||
}
|
||||
|
||||
public func fetchProfile() async {
|
||||
do {
|
||||
if let profile = try await ProfileManager.get(Int64(SharedPreferences.selectedProfileID.get())) {
|
||||
if profile.type == .icloud {
|
||||
_ = try profile.read()
|
||||
}
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
|
||||
public func stop() async throws {
|
||||
if manager.isOnDemandEnabled {
|
||||
manager.isOnDemandEnabled = false
|
||||
|
||||
Reference in New Issue
Block a user