Skip to content

Commit

Permalink
Merge branch 'hotfix/0.33.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
intitni committed Aug 13, 2024
2 parents 9ff8a1c + 9ac79f9 commit 912a721
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 4 deletions.
8 changes: 8 additions & 0 deletions Core/Sources/HostApp/DebugView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ final class DebugSettings: ObservableObject {
var observeToAXNotificationWithDefaultMode
@AppStorage(\.useCloudflareDomainNameForLicenseCheck)
var useCloudflareDomainNameForLicenseCheck
@AppStorage(\.doNotInstallLaunchAgentAutomatically)
var doNotInstallLaunchAgentAutomatically
init() {}
}

Expand Down Expand Up @@ -136,6 +138,12 @@ struct DebugSettingsView: View {
Text("Use Cloudflare domain name for license check")
}

Toggle(
isOn: $settings.doNotInstallLaunchAgentAutomatically
) {
Text("Don't install launch agent automatically")
}

Button("Reset update cycle") {
updateChecker.resetUpdateCycle()
}
Expand Down
3 changes: 3 additions & 0 deletions Core/Sources/HostApp/General.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ struct General {
switch action {
case .appear:
return .run { send in
if UserDefaults.shared.value(for: \.doNotInstallLaunchAgentAutomatically) {
return
}
await send(.setupLaunchAgentIfNeeded)
}

Expand Down
4 changes: 4 additions & 0 deletions Tool/Sources/Preferences/Keys.swift
Original file line number Diff line number Diff line change
Expand Up @@ -748,5 +748,9 @@ public extension UserDefaultPreferenceKeys {
var useCloudflareDomainNameForLicenseCheck: FeatureFlag {
.init(defaultValue: false, key: "FeatureFlag-UseCloudflareDomainNameForLicenseCheck")
}

var doNotInstallLaunchAgentAutomatically: FeatureFlag {
.init(defaultValue: false, key: "FeatureFlag-DoNotInstallLaunchAgentAutomatically")
}
}

18 changes: 15 additions & 3 deletions Tool/Sources/XPCShared/XPCService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class XPCService {
let interface: NSXPCInterface
let logger: Logger
weak var delegate: XPCServiceDelegate?

@XPCServiceActor
private var isInvalidated = false

Expand Down Expand Up @@ -101,6 +101,12 @@ private class InvalidatingConnection {

struct NoDataError: Error {}

struct EmptyResponseError: Error, LocalizedError {
var errorDescription: String? {
"The server is not returning a response. The app may be installed in the wrong directory."
}
}

struct AutoFinishContinuation<T> {
var continuation: AsyncThrowingStream<T, Error>.Continuation

Expand Down Expand Up @@ -129,7 +135,10 @@ func withXPCServiceConnected<T, P>(
} as! P
fn(service, .init(continuation: continuation))
}
return try await stream.first(where: { _ in true })!
guard let result = try await stream.first(where: { _ in true }) else {
throw EmptyResponseError()
}
return result
}

@XPCServiceActor
Expand All @@ -144,9 +153,12 @@ public func testXPCListenerEndpoint(_ endpoint: NSXPCListenerEndpoint) async ->
continuation.finish()
}
do {
try await stream.first(where: { _ in true })!
guard let _ = try await stream.first(where: { _ in true }) else {
throw EmptyResponseError()
}
return true
} catch {
return false
}
}

2 changes: 1 addition & 1 deletion Version.xcconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
APP_VERSION = 0.33.7
APP_BUILD = 398
APP_BUILD = 399

0 comments on commit 912a721

Please sign in to comment.