diff options
-rw-r--r-- | xbmc/addons/AddonRepos.cpp | 25 | ||||
-rw-r--r-- | xbmc/addons/gui/GUIDialogAddonInfo.cpp | 2 |
2 files changed, 24 insertions, 3 deletions
diff --git a/xbmc/addons/AddonRepos.cpp b/xbmc/addons/AddonRepos.cpp index 29e751829c..ea4d359510 100644 --- a/xbmc/addons/AddonRepos.cpp +++ b/xbmc/addons/AddonRepos.cpp @@ -21,6 +21,7 @@ #include "utils/StringUtils.h" #include "utils/log.h" +#include <algorithm> #include <vector> using namespace ADDON; @@ -493,9 +494,31 @@ bool CAddonRepos::FindDependencyByParentRepo(const std::string& dependsId, void CAddonRepos::BuildCompatibleVersionsList( std::vector<std::shared_ptr<IAddon>>& compatibleVersions) const { + std::vector<std::shared_ptr<IAddon>> officialVersions; + std::vector<std::shared_ptr<IAddon>> privateVersions; + for (const auto& addon : m_allAddons) { if (m_addonMgr.IsCompatible(*addon)) - compatibleVersions.emplace_back(addon); + { + if (IsFromOfficialRepo(addon, CheckAddonPath::NO)) + { + officialVersions.emplace_back(addon); + } + else + { + privateVersions.emplace_back(addon); + } + } } + + auto comparator = [](const std::shared_ptr<IAddon>& a, const std::shared_ptr<IAddon>& b) { + return (a->Version() > b->Version()); + }; + + std::sort(officialVersions.begin(), officialVersions.end(), comparator); + std::sort(privateVersions.begin(), privateVersions.end(), comparator); + + compatibleVersions = officialVersions; + std::copy(privateVersions.begin(), privateVersions.end(), back_inserter(compatibleVersions)); } diff --git a/xbmc/addons/gui/GUIDialogAddonInfo.cpp b/xbmc/addons/gui/GUIDialogAddonInfo.cpp index dbb4e25df7..a5114f4d11 100644 --- a/xbmc/addons/gui/GUIDialogAddonInfo.cpp +++ b/xbmc/addons/gui/GUIDialogAddonInfo.cpp @@ -230,8 +230,6 @@ int CGUIDialogAddonInfo::AskForVersion(std::vector<std::pair<AddonVersion, std:: dialog->SetHeading(CVariant{21338}); dialog->SetUseDetails(true); - std::sort(versions.begin(), versions.end(), std::greater<std::pair<AddonVersion, std::string>>()); - for (const auto& versionInfo : versions) { CFileItem item(StringUtils::Format(g_localizeStrings.Get(21339).c_str(), |