Add nightly/prerelease warnings

This commit is contained in:
Pk11 2022-02-21 04:26:35 -06:00
commit 3cde3a3a1f
9 changed files with 40 additions and 7 deletions

View file

@ -169,7 +169,7 @@ void StoreUtils::DrawDownList(const std::vector<std::string> &entries, bool fetc
int &smallDelay: Reference to the small delay. This helps to not directly press A.
std::vector<bool> &installs: Reference to the installed states.
*/
void StoreUtils::DownloadHandle(const std::unique_ptr<StoreEntry> &entry, const std::vector<std::string> &entries, int &currentMenu, const int &lastMode, int &smallDelay, std::vector<bool> &installs) {
void StoreUtils::DownloadHandle(const std::unique_ptr<StoreEntry> &entry, const std::vector<std::string> &entries, int &currentMenu, const int &lastMode, int &smallDelay, std::vector<bool> &installs, const std::vector<std::string> &types) {
if (StoreUtils::store && entry) { // Ensure, store & entry is not a nullptr.
if (smallDelay > 0) {
smallDelay--;
@ -212,7 +212,10 @@ void StoreUtils::DownloadHandle(const std::unique_ptr<StoreEntry> &entry, const
for (int i = 0; i < DOWNLOAD_ENTRIES; i++) {
if (touching(touch, downloadBoxes[i])) {
if (i + StoreUtils::store->GetDownloadSIndex() < (int)entries.size()) {
if (Msg::promptMsg(Lang::get("EXECUTE_ENTRY") + "\n\n" + entries[i + StoreUtils::store->GetDownloadSIndex()])) {
std::string Msg = Lang::get("EXECUTE_ENTRY") + "\n\n" + entries[i + StoreUtils::store->GetDownloadSIndex()];
if (types[i + StoreUtils::store->GetDownloadSIndex()] == "nightly") Msg += "\n\n" + Lang::get("NOTE_NIGHTLY");
else if (types[i + StoreUtils::store->GetDownloadSIndex()] == "prerelease") Msg += "\n\n" + Lang::get("NOTE_PRERELEASE");
if (Msg::promptMsg(Msg)) {
StoreUtils::AddToQueue(entry->GetEntryIndex(), entries[i + StoreUtils::store->GetDownloadSIndex()], entry->GetTitle(), entry->GetLastUpdated());
}
}
@ -234,7 +237,10 @@ void StoreUtils::DownloadHandle(const std::unique_ptr<StoreEntry> &entry, const
}
if (smallDelay == 0 && hDown & KEY_A && !entries.empty()) {
if (Msg::promptMsg(Lang::get("EXECUTE_ENTRY") + "\n\n" + entries[StoreUtils::store->GetDownloadIndex()])) {
std::string Msg = Lang::get("EXECUTE_ENTRY") + "\n\n" + entries[StoreUtils::store->GetDownloadIndex()];
if (types[StoreUtils::store->GetDownloadIndex()] == "nightly") Msg += "\n\n" + Lang::get("NOTE_NIGHTLY");
else if (types[StoreUtils::store->GetDownloadIndex()] == "prerelease") Msg += "\n\n" + Lang::get("NOTE_PRERELEASE");
if (Msg::promptMsg(Msg)) {
StoreUtils::AddToQueue(entry->GetEntryIndex(), entries[StoreUtils::store->GetDownloadIndex()], entry->GetTitle(), entry->GetLastUpdated());
}
}