Skip to content

Commit ad1160f

Browse files
committed
Rename CopilotStatus to GitHubCopilotAccountStatus
1 parent bf04ddd commit ad1160f

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

Copilot for Xcode/ContentView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import SwiftUI
55
struct ContentView: View {
66
@Environment(\.openURL) var openURL
77
@AppStorage("username") var username: String = ""
8-
@State var copilotStatus: CopilotStatus?
8+
@State var copilotStatus: GitHubCopilotAccountStatus?
99
@State var message: String?
1010
@State var userCode: String?
1111

Copilot for Xcode/CopilotView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import SwiftUI
66
struct CopilotView: View {
77
@Environment(\.openURL) var openURL
88
@AppStorage("username") var username: String = ""
9-
@State var copilotStatus: CopilotStatus?
9+
@State var copilotStatus: GitHubCopilotAccountStatus?
1010
@State var message: String?
1111
@State var userCode: String?
1212
@State var version: String?

Core/Sources/Client/AsyncXPCService.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public struct AsyncXPCService {
1111
self.service = service
1212
}
1313

14-
public func checkStatus() async throws -> CopilotStatus {
14+
public func checkStatus() async throws -> GitHubCopilotAccountStatus {
1515
try await withXPCServiceConnected(connection: connection) {
1616
service, continuation in
1717
service.checkStatus { status, error in
@@ -20,8 +20,8 @@ public struct AsyncXPCService {
2020
return
2121
}
2222
continuation.resume(
23-
status.flatMap(CopilotStatus.init(rawValue:))
24-
?? CopilotStatus.notAuthorized
23+
status.flatMap(GitHubCopilotAccountStatus.init(rawValue:))
24+
?? GitHubCopilotAccountStatus.notAuthorized
2525
)
2626
}
2727
}
@@ -63,7 +63,7 @@ public struct AsyncXPCService {
6363
}
6464

6565
public func signInConfirm(userCode: String) async throws
66-
-> (username: String, status: CopilotStatus)
66+
-> (username: String, status: GitHubCopilotAccountStatus)
6767
{
6868
try await withXPCServiceConnected(connection: connection) {
6969
service, continuation in
@@ -74,13 +74,13 @@ public struct AsyncXPCService {
7474
}
7575
continuation.resume((
7676
username ?? "",
77-
status.flatMap(CopilotStatus.init(rawValue:)) ?? .alreadySignedIn
77+
status.flatMap(GitHubCopilotAccountStatus.init(rawValue:)) ?? .alreadySignedIn
7878
))
7979
}
8080
}
8181
}
8282

83-
public func signOut() async throws -> CopilotStatus {
83+
public func signOut() async throws -> GitHubCopilotAccountStatus {
8484
try await withXPCServiceConnected(connection: connection) {
8585
service, continuation in
8686
service.signOut { finishstatus, error in
@@ -89,7 +89,7 @@ public struct AsyncXPCService {
8989
return
9090
}
9191
continuation
92-
.resume(finishstatus.flatMap(CopilotStatus.init(rawValue:)) ?? .notSignedIn)
92+
.resume(finishstatus.flatMap(GitHubCopilotAccountStatus.init(rawValue:)) ?? .notSignedIn)
9393
}
9494
}
9595
}

Core/Sources/CopilotModel/GitHubCopilotStatus.swift renamed to Core/Sources/CopilotModel/GitHubCopilotAccountStatus.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Foundation
22

3-
public enum CopilotStatus: String, Codable, CustomStringConvertible {
3+
public enum GitHubCopilotAccountStatus: String, Codable, CustomStringConvertible {
44
case alreadySignedIn = "AlreadySignedIn"
55
case maybeOk = "MaybeOk"
66
case notAuthorized = "NotAuthorized"

Core/Sources/GitHubCopilotService/CopilotRequest.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ enum CopilotRequest {
5252

5353
struct CheckStatus: CopilotRequestType {
5454
struct Response: Codable {
55-
var status: CopilotStatus
55+
var status: GitHubCopilotAccountStatus
5656
}
5757

5858
var request: ClientRequest {
@@ -76,7 +76,7 @@ enum CopilotRequest {
7676

7777
struct SignInConfirm: CopilotRequestType {
7878
struct Response: Codable {
79-
var status: CopilotStatus
79+
var status: GitHubCopilotAccountStatus
8080
var user: String
8181
}
8282

@@ -91,7 +91,7 @@ enum CopilotRequest {
9191

9292
struct SignOut: CopilotRequestType {
9393
struct Response: Codable {
94-
var status: CopilotStatus
94+
var status: GitHubCopilotAccountStatus
9595
}
9696

9797
var request: ClientRequest {

Core/Sources/GitHubCopilotService/CopilotService.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import Preferences
77
import XPCShared
88

99
public protocol CopilotAuthServiceType {
10-
func checkStatus() async throws -> CopilotStatus
10+
func checkStatus() async throws -> GitHubCopilotAccountStatus
1111
func signInInitiate() async throws -> (verificationUri: String, userCode: String)
12-
func signInConfirm(userCode: String) async throws -> (username: String, status: CopilotStatus)
13-
func signOut() async throws -> CopilotStatus
12+
func signInConfirm(userCode: String) async throws -> (username: String, status: GitHubCopilotAccountStatus)
13+
func signOut() async throws -> GitHubCopilotAccountStatus
1414
func version() async throws -> String
1515
}
1616

@@ -160,7 +160,7 @@ public final class CopilotAuthService: CopilotBaseService, CopilotAuthServiceTyp
160160
}
161161
}
162162

163-
public func checkStatus() async throws -> CopilotStatus {
163+
public func checkStatus() async throws -> GitHubCopilotAccountStatus {
164164
try await server.sendRequest(CopilotRequest.CheckStatus()).status
165165
}
166166

@@ -170,13 +170,13 @@ public final class CopilotAuthService: CopilotBaseService, CopilotAuthServiceTyp
170170
}
171171

172172
public func signInConfirm(userCode: String) async throws
173-
-> (username: String, status: CopilotStatus)
173+
-> (username: String, status: GitHubCopilotAccountStatus)
174174
{
175175
let result = try await server.sendRequest(CopilotRequest.SignInConfirm(userCode: userCode))
176176
return (result.user, result.status)
177177
}
178178

179-
public func signOut() async throws -> CopilotStatus {
179+
public func signOut() async throws -> GitHubCopilotAccountStatus {
180180
try await server.sendRequest(CopilotRequest.SignOut()).status
181181
}
182182

0 commit comments

Comments
 (0)