Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Xcodes/Backend/AppState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,11 @@ class AppState: ObservableObject {
guard let availableXcode = availableXcodes.first(where: { $0.version == id }) else { return }

installationPublishers[id] = signInIfNeeded()
.handleEvents(
receiveSubscription: { [unowned self] _ in
self.setInstallationStep(of: availableXcode.version, to: .authenticating)
}
)
.flatMap { [unowned self] in
// signInIfNeeded might finish before the user actually authenticates if UI is involved.
// This publisher will wait for the @Published authentication state to change to authenticated or unauthenticated before finishing,
Expand Down
4 changes: 1 addition & 3 deletions Xcodes/Backend/XcodeCommands.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ struct XcodeCommands: Commands {

struct InstallButton: View {
@EnvironmentObject var appState: AppState
@State private var isLoading = false

let xcode: Xcode?

var body: some View {
ProgressButton(isInProgress: isLoading) {
Button {
install()
} label: {
Text("Install")
Expand All @@ -49,7 +48,6 @@ struct InstallButton: View {
}

private func install() {
isLoading = true
guard let xcode = xcode else { return }
appState.checkMinVersionAndInstall(id: xcode.id)
}
Expand Down
2 changes: 1 addition & 1 deletion Xcodes/Frontend/InfoPane/InstallationStepDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct InstallationStepDetailView: View {
showsAdditionalDescription: true
)

case .unarchiving, .moving, .trashingArchive, .checkingSecurity, .finishing:
case .authenticating, .unarchiving, .moving, .trashingArchive, .checkingSecurity, .finishing:
ProgressView()
.scaleEffect(0.5)
}
Expand Down
2 changes: 1 addition & 1 deletion Xcodes/Frontend/XcodeList/InstallationStepRowView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct InstallationStepRowView: View {
controlSize: .small,
style: .spinning
)
case .unarchiving, .moving, .trashingArchive, .checkingSecurity, .finishing:
case .authenticating, .unarchiving, .moving, .trashingArchive, .checkingSecurity, .finishing:
ProgressView()
.scaleEffect(0.5)
}
Expand Down
17 changes: 17 additions & 0 deletions Xcodes/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{

Check failure on line 1 in Xcodes/Resources/Localizable.xcstrings

View workflow job for this annotation

GitHub Actions / test

'Authenticating' is missing translations for language: ca in file: /Users/runner/work/XcodesApp/XcodesApp/Xcodes/Resources/Localizable.xcstrings

Check failure on line 1 in Xcodes/Resources/Localizable.xcstrings

View workflow job for this annotation

GitHub Actions / test

'Authenticating' is missing translations for language: de in file: /Users/runner/work/XcodesApp/XcodesApp/Xcodes/Resources/Localizable.xcstrings

Check failure on line 1 in Xcodes/Resources/Localizable.xcstrings

View workflow job for this annotation

GitHub Actions / test

'Authenticating' is missing translations for language: el in file: /Users/runner/work/XcodesApp/XcodesApp/Xcodes/Resources/Localizable.xcstrings

Check failure on line 1 in Xcodes/Resources/Localizable.xcstrings

View workflow job for this annotation

GitHub Actions / test

'Authenticating' is missing translations for language: es in file: /Users/runner/work/XcodesApp/XcodesApp/Xcodes/Resources/Localizable.xcstrings

Check failure on line 1 in Xcodes/Resources/Localizable.xcstrings

View workflow job for this annotation

GitHub Actions / test

'Authenticating' is missing translations for language: fi in file: /Users/runner/work/XcodesApp/XcodesApp/Xcodes/Resources/Localizable.xcstrings

Check failure on line 1 in Xcodes/Resources/Localizable.xcstrings

View workflow job for this annotation

GitHub Actions / test

'Authenticating' is missing translations for language: fr in file: /Users/runner/work/XcodesApp/XcodesApp/Xcodes/Resources/Localizable.xcstrings

Check failure on line 1 in Xcodes/Resources/Localizable.xcstrings

View workflow job for this annotation

GitHub Actions / test

'Authenticating' is missing translations for language: hi in file: /Users/runner/work/XcodesApp/XcodesApp/Xcodes/Resources/Localizable.xcstrings

Check failure on line 1 in Xcodes/Resources/Localizable.xcstrings

View workflow job for this annotation

GitHub Actions / test

'Authenticating' is missing translations for language: it in file: /Users/runner/work/XcodesApp/XcodesApp/Xcodes/Resources/Localizable.xcstrings

Check failure on line 1 in Xcodes/Resources/Localizable.xcstrings

View workflow job for this annotation

GitHub Actions / test

'Authenticating' is missing translations for language: ko in file: /Users/runner/work/XcodesApp/XcodesApp/Xcodes/Resources/Localizable.xcstrings

Check failure on line 1 in Xcodes/Resources/Localizable.xcstrings

View workflow job for this annotation

GitHub Actions / test

'Authenticating' is missing translations for language: nl in file: /Users/runner/work/XcodesApp/XcodesApp/Xcodes/Resources/Localizable.xcstrings
"sourceLanguage" : "en",
"strings" : {
"" : {
Expand Down Expand Up @@ -4446,6 +4446,23 @@
}
}
},
"Authenticating" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Authenticating"
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "認証中"
Copy link
Contributor Author

@chuganzy chuganzy Sep 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added only Japanese as it is my primary language but want the community help for others!

}
}
}
},
"AutomaticallyCreateSymbolicLink" : {
"localizations" : {
"ar" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Foundation

// A numbered step
public enum XcodeInstallationStep: Equatable, CustomStringConvertible {
case authenticating
case downloading(progress: Progress)
case unarchiving
case moving(destination: String)
Expand All @@ -22,6 +23,8 @@ public enum XcodeInstallationStep: Equatable, CustomStringConvertible {

public var message: String {
switch self {
case .authenticating:
return localizeString("Authenticating")
case .downloading:
return localizeString("Downloading")
case .unarchiving:
Expand All @@ -39,16 +42,17 @@ public enum XcodeInstallationStep: Equatable, CustomStringConvertible {

public var stepNumber: Int {
switch self {
case .downloading: return 1
case .unarchiving: return 2
case .moving: return 3
case .trashingArchive: return 4
case .checkingSecurity: return 5
case .finishing: return 6
case .authenticating: return 1
case .downloading: return 2
case .unarchiving: return 3
case .moving: return 4
case .trashingArchive: return 5
case .checkingSecurity: return 6
case .finishing: return 7
}
}

public var stepCount: Int { 6 }
public var stepCount: Int { 7 }
}

func localizeString(_ key: String, comment: String = "") -> String {
Expand Down
Loading