Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1dd4c21

Browse files
committed
Release 0.31.0
1 parentc933346 commit1dd4c21

File tree

3 files changed

+34
-4
lines changed

3 files changed

+34
-4
lines changed

‎Tool/Sources/AXNotificationStream/AXNotificationStream.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ public final class AXNotificationStream: AsyncSequence {
110110
)
111111
varpendingRegistrationNames=Set(notificationNames)
112112
varretry=0
113+
varshouldLogAXDisabledEvent:Bool=true
113114
while !pendingRegistrationNames.isEmpty, retry<100{
114115
guardlet selfelse{return}
115116
retry+=1
@@ -125,14 +126,18 @@ public final class AXNotificationStream: AsyncSequence {
125126
}
126127
switch e{
127128
case.success:
129+
shouldLogAXDisabledEvent=true
128130
pendingRegistrationNames.remove(name)
129131
awaitStatus.shared.updateAXStatus(.granted)
130132
case.actionUnsupported:
131133
Logger.service.error("AXObserver: Action unsupported:\(name)")
132134
pendingRegistrationNames.remove(name)
133135
case.apiDisabled:
134-
Logger.service
135-
.error("AXObserver: Accessibility API disabled, will try again later")
136+
if shouldLogAXDisabledEvent{ // Avoid keeping log AX disabled too many times
137+
shouldLogAXDisabledEvent=false
138+
Logger.service
139+
.error("AXObserver: Accessibility API disabled, will try again later")
140+
}
136141
retry-=1
137142
awaitStatus.shared.updateAXStatus(.notGranted)
138143
case.invalidUIElement:

‎Tool/Sources/BuiltinExtension/BuiltinExtensionTelemetryServiceProvider.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ public final class BuiltinExtensionTelemetryServiceProvider<
4343

4444
publicfunc sendError(_ request:TelemetryExceptionRequest)asyncthrows{
4545
guardlet telemetryServiceelse{
46-
Logger.service.error("Builtin telemetry service not found.")
46+
print("Builtin telemetry service not found.")
4747
throwBuiltinExtensionTelemetryServiceNotFoundError()
4848
}
4949
guardlet workspaceInfo=awaitactiveWorkspace()else{
50-
Logger.service.error("Builtin active workspace info not found.")
50+
print("Builtin active workspace info not found.")
5151
throwBuiltinExtensionActiveWorkspaceInfoNotFoundError()
5252
}
5353

‎Tool/Sources/XcodeInspector/XcodeInspector+TriggerCommand.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,33 @@ public extension XcodeAppInstanceInspector {
77
func triggerCopilotCommand(name:String, activateXcode:Bool=true)asyncthrows{
88
letbundleName=Bundle.main
99
.object(forInfoDictionaryKey:"EXTENSION_BUNDLE_NAME")as!String
10+
11+
guardawaitisBundleEnabled(bundleName: bundleName)else{
12+
print("Bundle\(bundleName) is not enabled")
13+
return
14+
}
15+
1016
tryawaittriggerMenuItem(path:["Editor", bundleName, name], activateApp: activateXcode)
1117
}
18+
19+
privatefunc isBundleEnabled(bundleName:String)async->Bool{
20+
letapp=AXUIElementCreateApplication(runningApplication.processIdentifier)
21+
22+
guardlet menuBar= app.menuBar,
23+
let editorMenu= menuBar.child(title:"Editor")else{
24+
returnfalse
25+
}
26+
27+
iflet bundleMenuItem= editorMenu.child(title: bundleName, role:"AXMenuItem"){
28+
varenabled:CFTypeRef?
29+
leterror=AXUIElementCopyAttributeValue(bundleMenuItem, kAXEnabledAttributeasCFString,&enabled)
30+
if error==.success,let isEnabled= enabledas?Bool{
31+
return isEnabled
32+
}
33+
}
34+
35+
returnfalse
36+
}
1237
}
1338

1439
publicextensionAppInstanceInspector{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp