Skip to content

Commit 1c785b9

Browse files
committed
Add an alert for user-code so that it's more obvious
1 parent f90f64a commit 1c785b9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Copilot for Xcode/CopilotView.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ struct CopilotView: View {
1111
@State var userCode: String?
1212
@State var version: String?
1313
@State var isRunningAction: Bool = false
14+
@State var isUserCodeCopiedAlertPresented = false
1415

1516
var body: some View {
1617
Section {
@@ -25,6 +26,13 @@ struct CopilotView: View {
2526
Button("Refresh") { checkStatus() }
2627
if copilotStatus == .notSignedIn {
2728
Button("Sign In") { signIn() }
29+
.alert(isPresented: $isUserCodeCopiedAlertPresented) {
30+
Alert(
31+
title: Text(userCode ?? ""),
32+
message: Text("The user code is pasted into your clipboard, please paste it in the opened website to login.\nAfter that, click \"Confirm Sign-in\" to finish."),
33+
dismissButton: .default(Text("OK"))
34+
)
35+
}
2836
Button("Confirm Sign-in") { confirmSignIn() }
2937
}
3038
if copilotStatus == .ok || copilotStatus == .alreadySignedIn || copilotStatus == .notAuthorized {
@@ -89,6 +97,7 @@ struct CopilotView: View {
8997
pasteboard.setString(userCode, forType: NSPasteboard.PasteboardType.string)
9098
message = "Usercode \(userCode) already copied!"
9199
openURL(url)
100+
isUserCodeCopiedAlertPresented = true
92101
} catch {
93102
message = error.localizedDescription
94103
}

Copilot for Xcode/InstructionView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Text("""
1515
1. Install Node.
1616
2. Click `Set Up Launch Agent` to set up an XPC service to run in the background.
1717
3. Refresh Copilot status or restart the app.
18-
4. Click `Sign In` to sign into your GitHub Account.
18+
4. Click `Sign In` to sign into your GitHub account.
1919
5. After submitting your user code to the verification website, click `Confirm Sign-in` to finish the sign-in.
2020
6. Go to `Settings.app > Privacy & Security > Extension > Xcode Source Editor Extension` to turn **Copilot for Xcode** on.
2121
7. Restart Xcode, the Copilot commands should be available in the menu bar.

0 commit comments

Comments
 (0)