Skip to content

Commit

Permalink
Merge pull request #545 from Kyle-Ye/bugfix/dock
Browse files Browse the repository at this point in the history
Fix broken DockProgress Bar
  • Loading branch information
MattKiazyk authored Jun 28, 2024
2 parents 4a4b469 + 33dc634 commit f973e7d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Xcodes.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1529,7 +1529,7 @@
repositoryURL = "https://github.com/sindresorhus/DockProgress";
requirement = {
kind = upToNextMinorVersion;
minimumVersion = 3.2.0;
minimumVersion = 4.3.1;
};
};
E84E4F552B335094003F3959 /* XCRemoteSwiftPackageReference "swift-collections" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"repositoryURL": "https://github.com/sindresorhus/DockProgress",
"state": {
"branch": null,
"revision": "7100b68571e2dafe3a06ad5905b80fc3b0107b4b",
"version": "3.2.0"
"revision": "d4f23b5a8f5ca0fac393eb7ba78c2fe3e32e52da",
"version": "4.3.1"
}
},
{
Expand Down
24 changes: 15 additions & 9 deletions Xcodes/Backend/AppState+Install.swift
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ extension AppState {
self.error = error
self.presentedAlert = .generic(title: localizeString("Alert.InstallArchive.Error.Title"), message: error.legibleLocalizedDescription)
}
resetDockProgressTracking()
})
.catch { _ in
Just(installedXcode)
Expand Down Expand Up @@ -473,19 +474,24 @@ extension AppState {
// MARK: - Dock Progress Tracking

private func setupDockProgress() {
DockProgress.progressInstance = nil
DockProgress.style = .bar

let progress = Progress(totalUnitCount: AppState.totalProgressUnits)
progress.kind = .file
progress.fileOperationKind = .downloading
overallProgress = progress
Task { @MainActor in
DockProgress.progressInstance = nil
DockProgress.style = .bar

let progress = Progress(totalUnitCount: AppState.totalProgressUnits)
progress.kind = .file
progress.fileOperationKind = .downloading
overallProgress = progress

DockProgress.progressInstance = overallProgress
}

DockProgress.progressInstance = overallProgress
}

func resetDockProgressTracking() {
DockProgress.progress = 1 // Only way to completely remove overlay with DockProgress is setting progress to complete
Task { @MainActor in
DockProgress.progress = 1 // Only way to completely remove overlay with DockProgress is setting progress to complete
}
}

// MARK: -
Expand Down

0 comments on commit f973e7d

Please sign in to comment.