Level up to strict Concurrency (#361)
Trigger and resolve some additional Concurrency issues.
This commit is contained in:
parent
c5cf0ca1d2
commit
7de000148f
|
@ -1898,6 +1898,7 @@
|
|||
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "match Development com.algoritmico.ios.Passepartout catalyst";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_STRICT_CONCURRENCY = targeted;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
|
@ -1924,6 +1925,7 @@
|
|||
PROVISIONING_PROFILE_SPECIFIER = "match Development com.algoritmico.ios.Passepartout";
|
||||
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "match Development com.algoritmico.ios.Passepartout catalyst";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
SWIFT_STRICT_CONCURRENCY = targeted;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
|
|
|
@ -53,8 +53,6 @@ extension ProfileManager {
|
|||
}
|
||||
|
||||
extension ProviderManager {
|
||||
|
||||
@MainActor
|
||||
static let shared = AppContext.shared.providerManager
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import Foundation
|
|||
import Intents
|
||||
import PassepartoutLibrary
|
||||
|
||||
@MainActor
|
||||
final class IntentDispatcher {
|
||||
private struct Groups {
|
||||
static let vpn = "VPN"
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
import Foundation
|
||||
import PassepartoutLibrary
|
||||
|
||||
@MainActor
|
||||
protocol ProviderProfileAvailability {
|
||||
var profile: Profile { get }
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ final class MacBundleDelegate: MacMenuDelegate {
|
|||
DefaultLightVPNManager()
|
||||
}
|
||||
|
||||
@MainActor
|
||||
var utils: LightUtils {
|
||||
DefaultLightUtils()
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
import Combine
|
||||
import Foundation
|
||||
import Intents
|
||||
@preconcurrency import Intents
|
||||
import IntentsUI
|
||||
import PassepartoutLibrary
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import CoreData
|
|||
import Foundation
|
||||
import PassepartoutLibrary
|
||||
|
||||
@MainActor
|
||||
final class PersistenceManager: ObservableObject {
|
||||
let store: KeyValueStore
|
||||
|
||||
|
@ -80,16 +81,12 @@ final class PersistenceManager: ObservableObject {
|
|||
|
||||
extension PersistenceManager {
|
||||
func eraseCloudKitStore() async {
|
||||
await MainActor.run {
|
||||
isErasingCloudKitStore = true
|
||||
}
|
||||
isErasingCloudKitStore = true
|
||||
await Self.eraseCloudKitStore(
|
||||
fromContainerWithId: ckContainerId,
|
||||
zoneId: .init(zoneName: ckCoreDataZone)
|
||||
)
|
||||
await MainActor.run {
|
||||
isErasingCloudKitStore = false
|
||||
}
|
||||
isErasingCloudKitStore = false
|
||||
}
|
||||
|
||||
// WARNING: this is not running on main actor
|
||||
|
|
|
@ -27,6 +27,8 @@ import Foundation
|
|||
import PassepartoutLibrary
|
||||
|
||||
extension AddProviderView {
|
||||
|
||||
@MainActor
|
||||
final class ViewModel: ObservableObject {
|
||||
enum PendingOperation {
|
||||
case index
|
||||
|
|
|
@ -329,6 +329,8 @@ private struct EndpointsByAddress: Identifiable {
|
|||
// MARK: - Bindings
|
||||
|
||||
private extension ObservableProfile {
|
||||
|
||||
@MainActor
|
||||
func builderBinding(providerManager: ProviderManager) -> Binding<OpenVPN.ConfigurationBuilder> {
|
||||
.init {
|
||||
if self.value.isProvider {
|
||||
|
|
|
@ -120,6 +120,8 @@ private extension EndpointView.WireGuardView {
|
|||
// MARK: - Bindings
|
||||
|
||||
private extension ObservableProfile {
|
||||
|
||||
@MainActor
|
||||
func builderBinding(providerManager: ProviderManager) -> Binding<WireGuard.ConfigurationBuilder> {
|
||||
.init {
|
||||
if self.value.isProvider {
|
||||
|
|
|
@ -103,7 +103,9 @@ private extension ProfileView.ProviderSection {
|
|||
Label(L10n.Provider.Preset.title, systemImage: themeProviderPresetImage)
|
||||
.withTrailingText(currentProviderPreset)
|
||||
}
|
||||
Button(action: refreshInfrastructure) {
|
||||
Button {
|
||||
refreshInfrastructure()
|
||||
} label: {
|
||||
Text(L10n.Profile.Items.Provider.Refresh.caption)
|
||||
}.withTrailingProgress(when: isRefreshingInfrastructure)
|
||||
} footer: {
|
||||
|
|
|
@ -309,6 +309,8 @@ private extension ProviderLocationView.ServerListView {
|
|||
// MARK: - Bindings
|
||||
|
||||
private extension ObservableProfile {
|
||||
|
||||
@MainActor
|
||||
func selectedServerBinding(providerManager: ProviderManager, isPresented: Binding<Bool>) -> Binding<ProviderServer?> {
|
||||
.init {
|
||||
guard let serverId = self.value.providerServerId else {
|
||||
|
|
|
@ -95,6 +95,8 @@ private extension ProviderPresetView {
|
|||
// MARK: - Bindings
|
||||
|
||||
private extension ObservableProfile {
|
||||
|
||||
@MainActor
|
||||
func selectedPresetBinding(providerManager: ProviderManager) -> Binding<ProviderServer.Preset?> {
|
||||
.init {
|
||||
guard let serverId = self.value.providerServerId else {
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
import Foundation
|
||||
|
||||
@MainActor
|
||||
public protocol RateLimited: AnyObject {
|
||||
associatedtype ActionID: Hashable
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import Combine
|
|||
import Foundation
|
||||
import PassepartoutCore
|
||||
|
||||
@MainActor
|
||||
public final class ProviderManager: ObservableObject, RateLimited {
|
||||
private let localProvidersRepository: LocalProvidersRepository
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import PassepartoutCore
|
|||
import PassepartoutProviders
|
||||
import PassepartoutVPN
|
||||
|
||||
@MainActor
|
||||
extension Profile {
|
||||
public func providerServer(_ providerManager: ProviderManager) -> ProviderServer? {
|
||||
guard let serverId = providerServerId else {
|
||||
|
|
|
@ -133,7 +133,7 @@ extension TunnelKitVPNManagerStrategy {
|
|||
}
|
||||
|
||||
public func reinstate(_ parameters: VPNConfigurationParameters) async throws {
|
||||
let configuration = try vpnConfiguration(withParameters: parameters)
|
||||
let configuration = try await vpnConfiguration(withParameters: parameters)
|
||||
guard let vpnType = configuration.neConfiguration as? VPNProtocolProviding else {
|
||||
fatalError("Configuration must implement VPNProtocolProviding")
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ extension TunnelKitVPNManagerStrategy {
|
|||
}
|
||||
|
||||
public func connect(_ parameters: VPNConfigurationParameters) async throws {
|
||||
let configuration = try vpnConfiguration(withParameters: parameters)
|
||||
let configuration = try await vpnConfiguration(withParameters: parameters)
|
||||
guard let vpnType = configuration.neConfiguration as? VPNProtocolProviding else {
|
||||
fatalError("Configuration must implement VPNProtocolProviding")
|
||||
}
|
||||
|
@ -301,6 +301,8 @@ private extension TunnelKitVPNManagerStrategy {
|
|||
// MARK: Configuration
|
||||
|
||||
private extension TunnelKitVPNManagerStrategy {
|
||||
|
||||
@MainActor
|
||||
func vpnConfiguration(withParameters parameters: VPNConfigurationParameters) throws -> TunnelKitVPNConfiguration {
|
||||
let profile = parameters.profile
|
||||
do {
|
||||
|
|
|
@ -30,6 +30,7 @@ import PassepartoutProviders
|
|||
@testable import PassepartoutProvidersImpl
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
final class ProvidersTests: XCTestCase {
|
||||
private var persistence: ProvidersPersistence!
|
||||
|
||||
|
|
Loading…
Reference in New Issue