Skip to content

Commit

Permalink
Release 0.25.0
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Oct 9, 2024
1 parent fa57697 commit c599826
Show file tree
Hide file tree
Showing 17 changed files with 414 additions and 136 deletions.
6 changes: 6 additions & 0 deletions Copilot for Xcode/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@ struct VisualEffect: NSViewRepresentable {
func updateNSView(_ nsView: NSView, context: Context) { }
}

class AppDelegate: NSObject, NSApplicationDelegate {
func applicationShouldTerminateAfterLastWindowClosed(_: NSApplication) -> Bool { true }
}

@main
struct CopilotForXcodeApp: App {
@NSApplicationDelegateAdaptor private var appDelegate: AppDelegate

var body: some Scene {
WindowGroup {
TabContainer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ struct SuggestionFeatureDisabledLanguageListView: View {
if settings.suggestionFeatureDisabledLanguageList.isEmpty {
Text("""
Empty
Disable the language of a file by right clicking the circular widget.
Disable the language of a file from the Copilot menu in the status bar.
""")
.multilineTextAlignment(.center)
.padding()
Expand Down
69 changes: 36 additions & 33 deletions Core/Sources/HostApp/GeneralView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ struct GeneralView: View {
Spacer().frame(height: 40)
rightsView
.padding(.horizontal, 20)
.padding(.bottom, 20)
}
.frame(maxWidth: .infinity)
}
Expand Down Expand Up @@ -123,7 +124,8 @@ struct GeneralSettingsView: View {
@StateObject var settings = Settings()
@Environment(\.updateChecker) var updateChecker
@AppStorage(\.realtimeSuggestionToggle) var isCopilotEnabled: Bool
@State private var shouldPresentInstructionSheet = false
@AppStorage(\.extensionPermissionShown) var extensionPermissionShown: Bool
@State private var shouldPresentExtensionPermissionAlert = false
@State private var shouldPresentTurnoffSheet = false

let store: StoreOf<General>
Expand Down Expand Up @@ -151,17 +153,15 @@ struct GeneralSettingsView: View {
VStack(alignment: .leading) {
let grantedStatus: String = {
guard let granted = store.isAccessibilityPermissionGranted else { return StringConstants.loading }
return granted ? "Granted" : "Not Granted"
return granted ? "Granted" : "Not Granted. Required to run. Click to open System Preferences."
}()
Text(StringConstants.accessibilityPermissions)
Text(StringConstants.accessibilityPermission)
.font(.body)
Text("\(StringConstants.status) \(grantedStatus)")
Text("\(StringConstants.status) \(grantedStatus)")
.font(.footnote)
}
Spacer()

Image(systemName: "control")
.rotationEffect(.degrees(90))
Image(systemName: "chevron.right")
}
}
.foregroundStyle(.primary)
Expand All @@ -170,23 +170,19 @@ struct GeneralSettingsView: View {
Divider()
HStack {
VStack(alignment: .leading) {
let grantedStatus: String = {
guard let granted = store.isAccessibilityPermissionGranted else { return StringConstants.loading }
return granted ? "Granted" : "Not Granted"
}()
Text(StringConstants.extensionPermissions)
Text(StringConstants.extensionPermission)
.font(.body)
Text("\(StringConstants.status) \(grantedStatus)")
.font(.footnote)
.onTapGesture {
shouldPresentInstructionSheet = true
}
Text("""
Check for GitHub Copilot in Xcode's Editor menu. \
Restart Xcode if greyed out.
""")
.font(.footnote)
}
Spacer()
Link(destination: URL(string: "x-apple.systempreferences:com.apple.ExtensionsPreferences")!) {
Image(systemName: "control")
.rotationEffect(.degrees(90))
}
Image(systemName: "chevron.right")
}
.onTapGesture {
shouldPresentExtensionPermissionAlert = true
}
.foregroundStyle(.primary)
.padding(.horizontal, 8)
Expand All @@ -210,11 +206,17 @@ struct GeneralSettingsView: View {
}
}
.padding(.horizontal, 20)
.sheet(isPresented: $shouldPresentInstructionSheet) {
} content: {
InstructionSheet {
shouldPresentInstructionSheet = false
}
.alert(
"Enable Extension Permission",
isPresented: $shouldPresentExtensionPermissionAlert
) {
Button("Open System Preferences", action: {
let url = "x-apple.systempreferences:com.apple.ExtensionsPreferences"
NSWorkspace.shared.open(URL(string: url)!)
}).keyboardShortcut(.defaultAction)
Button("Close", role: .cancel, action: {})
} message: {
Text("Enable GitHub Copilot under Xcode Source Editor extensions")
}
.alert(isPresented: $shouldPresentTurnoffSheet) {
Alert(
Expand All @@ -229,6 +231,11 @@ struct GeneralSettingsView: View {
}
)
}
.task {
if extensionPermissionShown { return }
extensionPermissionShown = true
shouldPresentExtensionPermissionAlert = true
}
}
}

Expand Down Expand Up @@ -314,8 +321,7 @@ struct CopilotConnectionView: View {
.font(.body)
Spacer()

Image(systemName: "control")
.rotationEffect(.degrees(90))
Image(systemName: "chevron.right")
}
}
.foregroundStyle(.primary)
Expand All @@ -327,7 +333,6 @@ struct CopilotConnectionView: View {
}
.padding(.horizontal, 20)
.onAppear {
store.send(.reloadStatus)
viewModel.checkStatus()
}
}
Expand All @@ -345,8 +350,7 @@ struct CopilotConnectionView: View {
Text(StringConstants.copilotDocumentation)
.font(.body)
Spacer()
Image(systemName: "control")
.rotationEffect(.degrees(90))
Image(systemName: "chevron.right")
}
}
.foregroundStyle(.primary)
Expand All @@ -361,8 +365,7 @@ struct CopilotConnectionView: View {
Text(StringConstants.copilotFeedbackForum)
.font(.body)
Spacer()
Image(systemName: "control")
.rotationEffect(.degrees(90))
Image(systemName: "chevron.right")
}
}
.foregroundStyle(.primary)
Expand Down
82 changes: 0 additions & 82 deletions Core/Sources/HostApp/InstructionSheet.swift

This file was deleted.

4 changes: 2 additions & 2 deletions Core/Sources/HostApp/StringConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ struct StringConstants {
static let installPreReleases = "Install pre-releases"
static let general = "General"
static let quitCopilot = "Quit GitHub Copilot when Xcode App is closed"
static let accessibilityPermissions = "Accessibility Permissions"
static let extensionPermissions = "Extension Permissions"
static let accessibilityPermission = "Accessibility Permission"
static let extensionPermission = "Extension Permission"
static let status = "Status:"
static let cancel = "Cancel"
static let turnOff = "Turn off"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public extension UserDefaultPreferenceKeys {
}

var darkXcodeTheme: PreferenceKey<UserDefaultsStorageBox<XcodeTheme?>> {
.init(defaultValue: .init(nil), key: "LightXcodeTheme")
.init(defaultValue: .init(nil), key: "DarkXcodeTheme")
}

var lastSyncedHighlightJSThemeCreatedAt: PreferenceKey<TimeInterval> {
Expand Down
Loading

0 comments on commit c599826

Please sign in to comment.