-
Notifications
You must be signed in to change notification settings - Fork 8
Invoke onProgress callback in SdkManager.InstallPackagesAsync #40
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -125,7 +125,13 @@ public Task InstallPackagesAsync(IEnumerable<string> packages, bool acceptLicens | |||||
|
|
||||||
| public Task InstallPackagesAsync(IEnumerable<string> packages, bool acceptLicenses, Action<string, int, int>? onProgress, CancellationToken cancellationToken = default) | ||||||
| { | ||||||
| InstalledPackageSets.Add(packages.ToList()); | ||||||
| var pkgList = packages.ToList(); | ||||||
| InstalledPackageSets.Add(pkgList); | ||||||
| if (onProgress is not null) | ||||||
| { | ||||||
| for (var i = 0; i < pkgList.Count; i++) | ||||||
| onProgress(pkgList[i], i + 1, pkgList.Count); | ||||||
|
||||||
| onProgress(pkgList[i], i + 1, pkgList.Count); | |
| onProgress(pkgList[i], i, pkgList.Count); |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -106,9 +106,24 @@ public async Task InstallPackagesAsync(IEnumerable<string> packages, bool accept | |||||||||||||||||||||
| SyncPaths(); | ||||||||||||||||||||||
| EnsureAvailable(); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| var packageList = packages.ToList(); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| try | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
|
Comment on lines
+109
to
112
|
||||||||||||||||||||||
| var packageList = packages.ToList(); | |
| try | |
| { | |
| if (packages is null) | |
| throw new System.ArgumentNullException(nameof(packages)); | |
| try | |
| { | |
| var packageList = packages.ToList(); |
Copilot
AI
Mar 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onProgress is currently invoked with idx as i + 1 (1-based). The only in-repo caller (AndroidCommands.Install) formats ({idx + 1}/{total}), which will display 2..(total+1) and can show 4/3 on the last package. Either change the callback contract to be 0-based here (pass i) or update the caller (and document the contract) so all consumers agree on the indexing semantics.
| onProgress(packageList[i], i + 1, packageList.Count); | |
| // onProgress index is 0-based; callers can display (idx + 1)/total | |
| onProgress(packageList[i], i, packageList.Count); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test asserts 1-based
idxvalues (1..N). However, the CLI formatting inAndroidCommands.Installusesidx + 1when displaying({idx + 1}/{total}), implying it expects 0-based indexing. Update the test expectations to match the finalizedonProgresscontract (and ensure the production caller aligns), otherwise the UI can end up off-by-one while tests still pass.