|
6 | 6 | #include "TableOutput.h"
|
7 | 7 | #include <winget/PinningData.h>
|
8 | 8 | #include <winget/RepositorySearch.h>
|
| 9 | +#include <winget/PackageVersionSelection.h> |
9 | 10 |
|
10 | 11 | using namespace AppInstaller::Repository;
|
11 | 12 |
|
@@ -38,21 +39,20 @@ namespace AppInstaller::CLI::Workflow
|
38 | 39 |
|
39 | 40 | if (context.Args.Contains(Execution::Args::Type::PinInstalled))
|
40 | 41 | {
|
41 |
| - auto installedVersion = package->GetInstalledVersion(); |
| 42 | + auto installedVersion = GetInstalledVersion(package); |
42 | 43 | if (installedVersion)
|
43 | 44 | {
|
44 | 45 | pinKeys.emplace(Pinning::PinKey::GetPinKeyForInstalled(installedVersion->GetProperty(PackageVersionProperty::Id)));
|
45 | 46 | }
|
46 | 47 | }
|
47 | 48 | else
|
48 | 49 | {
|
49 |
| - auto packageVersionKeys = package->GetAvailableVersionKeys(); |
50 |
| - for (const auto& versionKey : packageVersionKeys) |
| 50 | + auto availablePackages = package->GetAvailable(); |
| 51 | + for (const auto& availablePackage : availablePackages) |
51 | 52 | {
|
52 |
| - auto availableVersion = package->GetAvailableVersion(versionKey); |
53 | 53 | pinKeys.emplace(
|
54 |
| - availableVersion->GetProperty(PackageVersionProperty::Id).get(), |
55 |
| - availableVersion->GetProperty(PackageVersionProperty::SourceIdentifier).get()); |
| 54 | + availablePackage->GetProperty(PackageProperty::Id).get(), |
| 55 | + availablePackage->GetSource().GetIdentifier()); |
56 | 56 | }
|
57 | 57 | }
|
58 | 58 |
|
@@ -140,7 +140,7 @@ namespace AppInstaller::CLI::Workflow
|
140 | 140 | }
|
141 | 141 | else
|
142 | 142 | {
|
143 |
| - auto availableVersion = package->GetAvailableVersion({ pinKey.SourceId, "", "" }); |
| 143 | + auto availableVersion = GetAvailablePackageFromSource(package, pinKey.SourceId)->GetLatestVersion(); |
144 | 144 | if (availableVersion)
|
145 | 145 | {
|
146 | 146 | packageNameToReport = availableVersion->GetProperty(PackageVersionProperty::Name);
|
@@ -198,8 +198,6 @@ namespace AppInstaller::CLI::Workflow
|
198 | 198 | // Note that if a source was specified in the command line,
|
199 | 199 | // that will be the only one we get version keys from.
|
200 | 200 | // So, we remove pins from all sources unless one was provided.
|
201 |
| - auto packageVersionKeys = package->GetAvailableVersionKeys(); |
202 |
| - |
203 | 201 | for (const auto& pin : pins)
|
204 | 202 | {
|
205 | 203 | AICLI_LOG(CLI, Info, << "Removing Pin " << pin.GetKey().ToString());
|
@@ -255,15 +253,19 @@ namespace AppInstaller::CLI::Workflow
|
255 | 253 | else
|
256 | 254 | {
|
257 | 255 | // This ensures we get the info from the right source if it exists on multiple
|
258 |
| - auto availableVersion = match.Package->GetAvailableVersion({ pinKey.SourceId, "", "" }); |
259 |
| - if (availableVersion) |
| 256 | + auto availablePackage = GetAvailablePackageFromSource(match.Package, pinKey.SourceId); |
| 257 | + if (availablePackage) |
260 | 258 | {
|
261 |
| - packageName = availableVersion->GetProperty(PackageVersionProperty::Name); |
262 |
| - sourceName = availableVersion->GetProperty(PackageVersionProperty::SourceName); |
| 259 | + auto availableVersion = availablePackage->GetLatestVersion(); |
| 260 | + if (availableVersion) |
| 261 | + { |
| 262 | + packageName = availableVersion->GetProperty(PackageVersionProperty::Name); |
| 263 | + sourceName = availableVersion->GetProperty(PackageVersionProperty::SourceName); |
| 264 | + } |
263 | 265 | }
|
264 | 266 | }
|
265 | 267 |
|
266 |
| - auto installedVersion = match.Package->GetInstalledVersion(); |
| 268 | + auto installedVersion = GetInstalledVersion(match.Package); |
267 | 269 | if (installedVersion)
|
268 | 270 | {
|
269 | 271 | packageName = installedVersion->GetProperty(PackageVersionProperty::Name);
|
|
0 commit comments