@@ -29,6 +29,7 @@ struct GeneralView: View {
29
29
Spacer ( ) . frame ( height: 40 )
30
30
rightsView
31
31
. padding ( . horizontal, 20 )
32
+ . padding ( . bottom, 20 )
32
33
}
33
34
. frame ( maxWidth: . infinity)
34
35
}
@@ -123,7 +124,8 @@ struct GeneralSettingsView: View {
123
124
@StateObject var settings = Settings ( )
124
125
@Environment ( \. updateChecker) var updateChecker
125
126
@AppStorage ( \. realtimeSuggestionToggle) var isCopilotEnabled : Bool
126
- @State private var shouldPresentInstructionSheet = false
127
+ @AppStorage ( \. extensionPermissionShown) var extensionPermissionShown : Bool
128
+ @State private var shouldPresentExtensionPermissionAlert = false
127
129
@State private var shouldPresentTurnoffSheet = false
128
130
129
131
let store : StoreOf < General >
@@ -151,17 +153,15 @@ struct GeneralSettingsView: View {
151
153
VStack ( alignment: . leading) {
152
154
let grantedStatus : String = {
153
155
guard let granted = store. isAccessibilityPermissionGranted else { return StringConstants . loading }
154
- return granted ? " Granted " : " Not Granted "
156
+ return granted ? " Granted " : " Not Granted. Required to run. Click to open System Preferences. "
155
157
} ( )
156
- Text ( StringConstants . accessibilityPermissions )
158
+ Text ( StringConstants . accessibilityPermission )
157
159
. font ( . body)
158
- Text ( " \( StringConstants . status) \( grantedStatus) ⓘ " )
160
+ Text ( " \( StringConstants . status) \( grantedStatus) " )
159
161
. font ( . footnote)
160
162
}
161
163
Spacer ( )
162
-
163
- Image ( systemName: " control " )
164
- . rotationEffect ( . degrees( 90 ) )
164
+ Image ( systemName: " chevron.right " )
165
165
}
166
166
}
167
167
. foregroundStyle ( . primary)
@@ -170,23 +170,19 @@ struct GeneralSettingsView: View {
170
170
Divider ( )
171
171
HStack {
172
172
VStack ( alignment: . leading) {
173
- let grantedStatus : String = {
174
- guard let granted = store. isAccessibilityPermissionGranted else { return StringConstants . loading }
175
- return granted ? " Granted " : " Not Granted "
176
- } ( )
177
- Text ( StringConstants . extensionPermissions)
173
+ Text ( StringConstants . extensionPermission)
178
174
. font ( . body)
179
- Text ( " \( StringConstants . status ) \( grantedStatus ) ⓘ " )
180
- . font ( . footnote )
181
- . onTapGesture {
182
- shouldPresentInstructionSheet = true
183
- }
175
+ Text ( """
176
+ Check for GitHub Copilot in Xcode's Editor menu. \
177
+ Restart Xcode if greyed out.
178
+ """ )
179
+ . font ( . footnote )
184
180
}
185
181
Spacer ( )
186
- Link ( destination : URL ( string : " x-apple.systempreferences:com.apple.ExtensionsPreferences " ) ! ) {
187
- Image ( systemName : " control " )
188
- . rotationEffect ( . degrees ( 90 ) )
189
- }
182
+ Image ( systemName : " chevron.right " )
183
+ }
184
+ . onTapGesture {
185
+ shouldPresentExtensionPermissionAlert = true
190
186
}
191
187
. foregroundStyle ( . primary)
192
188
. padding ( . horizontal, 8 )
@@ -210,11 +206,17 @@ struct GeneralSettingsView: View {
210
206
}
211
207
}
212
208
. padding ( . horizontal, 20 )
213
- . sheet ( isPresented: $shouldPresentInstructionSheet) {
214
- } content: {
215
- InstructionSheet {
216
- shouldPresentInstructionSheet = false
217
- }
209
+ . alert (
210
+ " Enable Extension Permission " ,
211
+ isPresented: $shouldPresentExtensionPermissionAlert
212
+ ) {
213
+ Button ( " Open System Preferences " , action: {
214
+ let url = " x-apple.systempreferences:com.apple.ExtensionsPreferences "
215
+ NSWorkspace . shared. open ( URL ( string: url) !)
216
+ } ) . keyboardShortcut ( . defaultAction)
217
+ Button ( " Close " , role: . cancel, action: { } )
218
+ } message: {
219
+ Text ( " Enable GitHub Copilot under Xcode Source Editor extensions " )
218
220
}
219
221
. alert ( isPresented: $shouldPresentTurnoffSheet) {
220
222
Alert (
@@ -229,6 +231,11 @@ struct GeneralSettingsView: View {
229
231
}
230
232
)
231
233
}
234
+ . task {
235
+ if extensionPermissionShown { return }
236
+ extensionPermissionShown = true
237
+ shouldPresentExtensionPermissionAlert = true
238
+ }
232
239
}
233
240
}
234
241
@@ -314,8 +321,7 @@ struct CopilotConnectionView: View {
314
321
. font ( . body)
315
322
Spacer ( )
316
323
317
- Image ( systemName: " control " )
318
- . rotationEffect ( . degrees( 90 ) )
324
+ Image ( systemName: " chevron.right " )
319
325
}
320
326
}
321
327
. foregroundStyle ( . primary)
@@ -327,7 +333,6 @@ struct CopilotConnectionView: View {
327
333
}
328
334
. padding ( . horizontal, 20 )
329
335
. onAppear {
330
- store. send ( . reloadStatus)
331
336
viewModel. checkStatus ( )
332
337
}
333
338
}
@@ -345,8 +350,7 @@ struct CopilotConnectionView: View {
345
350
Text ( StringConstants . copilotDocumentation)
346
351
. font ( . body)
347
352
Spacer ( )
348
- Image ( systemName: " control " )
349
- . rotationEffect ( . degrees( 90 ) )
353
+ Image ( systemName: " chevron.right " )
350
354
}
351
355
}
352
356
. foregroundStyle ( . primary)
@@ -361,8 +365,7 @@ struct CopilotConnectionView: View {
361
365
Text ( StringConstants . copilotFeedbackForum)
362
366
. font ( . body)
363
367
Spacer ( )
364
- Image ( systemName: " control " )
365
- . rotationEffect ( . degrees( 90 ) )
368
+ Image ( systemName: " chevron.right " )
366
369
}
367
370
}
368
371
. foregroundStyle ( . primary)
0 commit comments