Skip to content
Merged
Changes from all commits
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
18 changes: 15 additions & 3 deletions Xcodes/Backend/AppState+Install.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,17 @@ extension AppState {
if let expectedInstallationTaskID, self.installationTaskIDs[availableXcode.xcodeID] != expectedInstallationTaskID {
return
}
self.setInstallationStep(of: availableXcode.version, to: .downloading(progress: progress))

let isAlreadyDownloading: Bool
if let xcode = self.allXcodes.first(where: { $0.version.isEquivalent(to: availableXcode.version) }),
case .installing(.downloading) = xcode.installState
{
isAlreadyDownloading = true
} else {
isAlreadyDownloading = false
}

self.setInstallationStep(of: availableXcode.version, to: .downloading(progress: progress), postNotification: !isAlreadyDownloading)
self.addDockProgressChildIfNeeded(progress, withPendingUnitCount: AppState.totalProgressUnits - AppState.unxipProgressWeight)
}
})
Expand Down Expand Up @@ -455,12 +465,14 @@ extension AppState {

// MARK: -

func setInstallationStep(of version: Version, to step: XcodeInstallationStep) {
func setInstallationStep(of version: Version, to step: XcodeInstallationStep, postNotification: Bool = true) {
guard let index = allXcodes.firstIndex(where: { $0.version.isEquivalent(to: version) }) else { return }
allXcodes[index].installState = .installing(step)

let xcode = allXcodes[index]
Current.notificationManager.scheduleNotification(title: xcode.version.major.description + "." + xcode.version.appleDescription, body: step.description, category: .normal)
if postNotification {
Current.notificationManager.scheduleNotification(title: xcode.version.major.description + "." + xcode.version.appleDescription, body: step.description, category: .normal)
}
}

func setInstallationStep(of runtime: DownloadableRuntime, to step: RuntimeInstallationStep, postNotification: Bool = true) {
Expand Down
Loading