Skip to content

Commit 908e7ba

Browse files
committed
Add authenticating step
1 parent 74237f8 commit 908e7ba

6 files changed

Lines changed: 36 additions & 12 deletions

File tree

Xcodes/Backend/AppState.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,11 @@ class AppState: ObservableObject {
436436
guard let availableXcode = availableXcodes.first(where: { $0.version == id }) else { return }
437437

438438
installationPublishers[id] = signInIfNeeded()
439+
.handleEvents(
440+
receiveSubscription: { [unowned self] _ in
441+
self.setInstallationStep(of: availableXcode.version, to: .authenticating)
442+
}
443+
)
439444
.flatMap { [unowned self] in
440445
// signInIfNeeded might finish before the user actually authenticates if UI is involved.
441446
// This publisher will wait for the @Published authentication state to change to authenticated or unauthenticated before finishing,

Xcodes/Backend/XcodeCommands.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,11 @@ struct XcodeCommands: Commands {
3535

3636
struct InstallButton: View {
3737
@EnvironmentObject var appState: AppState
38-
@State private var isLoading = false
3938

4039
let xcode: Xcode?
4140

4241
var body: some View {
43-
ProgressButton(isInProgress: isLoading) {
42+
Button {
4443
install()
4544
} label: {
4645
Text("Install")
@@ -49,7 +48,6 @@ struct InstallButton: View {
4948
}
5049

5150
private func install() {
52-
isLoading = true
5351
guard let xcode = xcode else { return }
5452
appState.checkMinVersionAndInstall(id: xcode.id)
5553
}

Xcodes/Frontend/InfoPane/InstallationStepDetailView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct InstallationStepDetailView: View {
1717
showsAdditionalDescription: true
1818
)
1919

20-
case .unarchiving, .moving, .trashingArchive, .checkingSecurity, .finishing:
20+
case .authenticating, .unarchiving, .moving, .trashingArchive, .checkingSecurity, .finishing:
2121
ProgressView()
2222
.scaleEffect(0.5)
2323
}

Xcodes/Frontend/XcodeList/InstallationStepRowView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ struct InstallationStepRowView: View {
1818
controlSize: .small,
1919
style: .spinning
2020
)
21-
case .unarchiving, .moving, .trashingArchive, .checkingSecurity, .finishing:
21+
case .authenticating, .unarchiving, .moving, .trashingArchive, .checkingSecurity, .finishing:
2222
ProgressView()
2323
.scaleEffect(0.5)
2424
}

Xcodes/Resources/Localizable.xcstrings

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4446,6 +4446,23 @@
44464446
}
44474447
}
44484448
},
4449+
"Authenticating" : {
4450+
"extractionState" : "manual",
4451+
"localizations" : {
4452+
"en" : {
4453+
"stringUnit" : {
4454+
"state" : "translated",
4455+
"value" : "Authenticating"
4456+
}
4457+
},
4458+
"ja" : {
4459+
"stringUnit" : {
4460+
"state" : "translated",
4461+
"value" : "認証中"
4462+
}
4463+
}
4464+
}
4465+
},
44494466
"AutomaticallyCreateSymbolicLink" : {
44504467
"localizations" : {
44514468
"ar" : {

Xcodes/XcodesKit/Sources/XcodesKit/Models/XcodeInstallationStep.swift

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Foundation
99

1010
// A numbered step
1111
public enum XcodeInstallationStep: Equatable, CustomStringConvertible {
12+
case authenticating
1213
case downloading(progress: Progress)
1314
case unarchiving
1415
case moving(destination: String)
@@ -22,6 +23,8 @@ public enum XcodeInstallationStep: Equatable, CustomStringConvertible {
2223

2324
public var message: String {
2425
switch self {
26+
case .authenticating:
27+
return localizeString("Authenticating")
2528
case .downloading:
2629
return localizeString("Downloading")
2730
case .unarchiving:
@@ -39,16 +42,17 @@ public enum XcodeInstallationStep: Equatable, CustomStringConvertible {
3942

4043
public var stepNumber: Int {
4144
switch self {
42-
case .downloading: return 1
43-
case .unarchiving: return 2
44-
case .moving: return 3
45-
case .trashingArchive: return 4
46-
case .checkingSecurity: return 5
47-
case .finishing: return 6
45+
case .authenticating: return 1
46+
case .downloading: return 2
47+
case .unarchiving: return 3
48+
case .moving: return 4
49+
case .trashingArchive: return 5
50+
case .checkingSecurity: return 6
51+
case .finishing: return 7
4852
}
4953
}
5054

51-
public var stepCount: Int { 6 }
55+
public var stepCount: Int { 7 }
5256
}
5357

5458
func localizeString(_ key: String, comment: String = "") -> String {

0 commit comments

Comments
 (0)