Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App icon install progress bar stuck #529

Open
jnozzi opened this issue Mar 14, 2024 · 6 comments · May be fixed by #545
Open

App icon install progress bar stuck #529

jnozzi opened this issue Mar 14, 2024 · 6 comments · May be fixed by #545
Labels
bug Something isn't working

Comments

@jnozzi
Copy link

jnozzi commented Mar 14, 2024

Describe the bug
After a successful installation, the app icon's progress bar remained at mostly-done. This is visible both in the dock and in the app switcher.

To Reproduce
I'm not exactly sure; I clicked to install 15.2, then clicked the iOS 17.2 installer shortly after, while the Xcode install was in progress. I haven't tried it again (I'm a bit swamped).

Expected behavior
When there're no running tasks, the app icon (both Dock and in app switcher) shouldn't show a progress bar.

Screenshots
I didn't think to take a screenshot. The progress bar had maybe <=10% left.

Version

  • OS: 14.4
  • Xcodes: 15.2, 15.3
@jnozzi jnozzi added the bug Something isn't working label Mar 14, 2024
@Kyle-Ye
Copy link
Contributor

Kyle-Ye commented Mar 25, 2024

+1 for this issue.

This seems to be related with resetDockProgressTracking and setupDockProgress call.

cc @senmu

I will also try to debug and solve it if I'm available this week.

@Kyle-Ye
Copy link
Contributor

Kyle-Ye commented Mar 25, 2024

Found the issue here

image
  1. First we hit line 431 unxipProgress.completedUnitCount = AppState.totalProgressUnits and set progress to 0.9987682686384189
  2. Then we hit line 432 to call resetDockProgressTracking()

This should remove the overlay as the comments is saying. (At first, I suspect the bug is because we are missing resetDockProgressTracking call somewhere)

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

But it will actually do nothing in this case, because the previous progress is 0.9987682686384189 and the diff is less than 0.01 so the DockProgress just ignores the update.

// DockProgress.swift
public static var progress: Double = 0 {
	didSet {
		if previousProgress == 0 || (progress - previousProgress).magnitude > 0.01 {
			previousProgress = progress
			updateDockIcon()
		}
	}
}

We can fix it on our side or update the library version.

The latest upstream version has removed such limitation. https://github.com/sindresorhus/DockProgress/blob/fb80c50c8eac4c1143da6ec602b8fad760c1613a/Sources/DockProgress/DockProgress.swift#L107-L115

Also I was wondering why DockProgress.resetProgress is not working previously so that the original contributor is using DockProgress.progress = 1 here.

Would you help to tell use what's the suggested way to reset/remove it? cc @sindresorhus

@Kyle-Ye
Copy link
Contributor

Kyle-Ye commented Mar 25, 2024

XcodesApp is using DockProgress 3.2.0 now.

To solve the issue, I think upgrade the latest 4.3.0 would probably fix it. (DockProgress.progress.setter logic has been updated on 4.3.0)

And also we'd like to confirm the preferred way to reset the Dock bar: DockProgress.progress = 1 or DockProgress.resetProgress()

@Kyle-Ye
Copy link
Contributor

Kyle-Ye commented Mar 25, 2024

Update:

  1. Update DockProgress 3.2.0 -> 4.3.0. XcodesApp will need some code change to adopt the new @MainActor check

  2. Keep DockProgress.progress = 1 or change it to DockProgress.resetProgress() will present a full progress bar and never disappear after the dependency update.

image

We may need to call other API to achieve the same effect(Present full progress bar and then disappear) after the update.

image

There may also be other issues on XcodesApp which cause the DockProgress API is not called on the main thread. Identified the issue and fixed it.

@Kyle-Ye
Copy link
Contributor

Kyle-Ye commented Mar 30, 2024

This issue and #491 seems to be duplicated. Would you help close one as duplicated? (Prefer to close the latter since we have more context on this issue here)cc @MattKiazyk

@Kyle-Ye Kyle-Ye linked a pull request Mar 30, 2024 that will close this issue
@Kyle-Ye
Copy link
Contributor

Kyle-Ye commented Mar 30, 2024

This upstream has patched a commit to fix the issue.

Opened #545 and make it a draft due to a missing new release version from the upstream.

Update the PR. It's ready for a review.

See detail here sindresorhus/DockProgress#20 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants