Pre-release 0.27.92 · alltabs/CopilotForXcode@3404070 · GitHub
Skip to content

Commit 3404070

Browse files
committed
Pre-release 0.27.92
1 parent a9ad824 commit 3404070

24 files changed

Lines changed: 310 additions & 66 deletions

File tree

‎Copilot for Xcode.xcworkspace/xcshareddata/swiftpm/Package.resolved‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Core/Package.swift‎

Lines changed: 2 additions & 1 deletion

‎Core/Sources/HostApp/General.swift‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import Client
22
import ComposableArchitecture
33
import Foundation
44
import LaunchAgentManager
5+
import Status
56
import SwiftUI
67
import XPCShared
78
import Logger
@@ -11,7 +12,7 @@ struct General {
1112
@ObservableState
1213
struct State: Equatable {
1314
var xpcServiceVersion: String?
14-
var isAccessibilityPermissionGranted: Bool?
15+
var isAccessibilityPermissionGranted: ObservedAXStatus = .unknown
1516
var isReloading = false
1617
}
1718

@@ -20,7 +21,7 @@ struct General {
2021
case setupLaunchAgentIfNeeded
2122
case openExtensionManager
2223
case reloadStatus
23-
case finishReloading(xpcServiceVersion: String, permissionGranted: Bool)
24+
case finishReloading(xpcServiceVersion: String, permissionGranted: ObservedAXStatus)
2425
case failedReloading
2526
case retryReloading
2627
}
@@ -35,7 +36,7 @@ struct General {
3536
case .appear:
3637
return .run { send in
3738
await send(.setupLaunchAgentIfNeeded)
38-
for await _ in DistributedNotificationCenter.default().notifications(named: NSNotification.Name("com.apple.accessibility.api")) {
39+
for await _ in DistributedNotificationCenter.default().notifications(named: .serviceStatusDidChange) {
3940
await send(.reloadStatus)
4041
}
4142
}

‎Core/Sources/HostApp/GeneralSettings/CopilotConnectionView.swift‎

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
11
import ComposableArchitecture
22
import SwiftUI
33

4-
struct ActivityIndicatorView: NSViewRepresentable {
5-
func makeNSView(context _: Context) -> NSProgressIndicator {
6-
let progressIndicator = NSProgressIndicator()
7-
progressIndicator.style = .spinning
8-
progressIndicator.controlSize = .small
9-
progressIndicator.startAnimation(nil)
10-
return progressIndicator
11-
}
12-
13-
func updateNSView(_: NSProgressIndicator, context _: Context) {
14-
// No-op
15-
}
16-
}
17-
184
struct CopilotConnectionView: View {
195
@AppStorage("username") var username: String = ""
206
@Environment(\.toast) var toast
@@ -38,6 +24,9 @@ struct CopilotConnectionView: View {
3824
title: "GitHub Account Status Permissions",
3925
subtitle: "GitHub Connection: \(viewModel.status?.description ?? "Loading...")"
4026
) {
27+
if viewModel.isRunningAction || waitingForSignIn {
28+
ProgressView().controlSize(.small)
29+
}
4130
Button("Refresh Connection") {
4231
viewModel.checkStatus()
4332
}
@@ -72,9 +61,6 @@ struct CopilotConnectionView: View {
7261
viewModel.isSignInAlertPresented = false
7362
}
7463
}
75-
if viewModel.isRunningAction || waitingForSignIn {
76-
ActivityIndicatorView()
77-
}
7864
}
7965
}
8066

‎Core/Sources/HostApp/GeneralSettings/GeneralSettingsView.swift‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,14 @@ struct GeneralSettingsView: View {
99
let store: StoreOf<General>
1010

1111
var accessibilityPermissionSubtitle: String {
12-
guard let granted = store.isAccessibilityPermissionGranted else { return "Loading..." }
13-
return granted ? "Granted" : "Not Granted. Required to run. Click to open System Preferences."
12+
switch store.isAccessibilityPermissionGranted {
13+
case .granted:
14+
return "Granted"
15+
case .notGranted:
16+
return "Not Granted. Required to run. Click to open System Preferences."
17+
case .unknown:
18+
return ""
19+
}
1420
}
1521

1622
var body: some View {

‎Core/Sources/Service/RealtimeSuggestionController.swift‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import Combine
66
import Foundation
77
import Logger
88
import Preferences
9+
import Status
910
import QuartzCore
1011
import Workspace
1112
import XcodeInspector
@@ -124,10 +125,12 @@ public actor RealtimeSuggestionController {
124125
do {
125126
try await XcodeInspector.shared.safe.latestActiveXcode?
126127
.triggerCopilotCommand(name: "Sync Text Settings")
128+
await Status.shared.updateExtensionStatus(.succeeded)
127129
} catch {
128130
if filespace.codeMetadata.uti?.isEmpty ?? true {
129131
filespace.codeMetadata.uti = nil
130132
}
133+
await Status.shared.updateExtensionStatus(.failed)
131134
}
132135
}
133136
}

‎Core/Sources/Service/Service.swift‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public final class Service {
3232
let globalShortcutManager: GlobalShortcutManager
3333
let keyBindingManager: KeyBindingManager
3434
let xcodeThemeController: XcodeThemeController = .init()
35+
public var markAsProcessing: (Bool) -> Void = { _ in }
3536

3637
@Dependency(\.toast) var toast
3738
var cancellable = Set<AnyCancellable>()

‎Core/Sources/Service/SuggestionPresenter/PresentInWindowSuggestionPresenter.swift‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ struct PresentInWindowSuggestionPresenter {
3030
Task { @MainActor in
3131
let controller = Service.shared.guiController.widgetController
3232
controller.markAsProcessing(isProcessing)
33+
Service.shared.markAsProcessing(isProcessing)
3334
}
3435
}
3536

‎Core/Sources/Service/XPCService.swift‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import GitHubCopilotService
44
import LanguageServerProtocol
55
import Logger
66
import Preferences
7+
import Status
78
import XPCShared
89

910
public class XPCService: NSObject, XPCServiceProtocol {
@@ -16,8 +17,10 @@ public class XPCService: NSObject, XPCServiceProtocol {
1617
)
1718
}
1819

19-
public func getXPCServiceAccessibilityPermission(withReply reply: @escaping (Bool) -> Void) {
20-
reply(AXIsProcessTrusted())
20+
public func getXPCServiceAccessibilityPermission(withReply reply: @escaping (ObservedAXStatus) -> Void) {
21+
Task {
22+
reply(await Status.shared.getAXStatus())
23+
}
2124
}
2225

2326
// MARK: - Suggestion

‎ExtensionService/AppDelegate+Menu.swift‎

Lines changed: 16 additions & 18 deletions

0 commit comments

Comments
 (0)