Add nightly/prerelease warnings

This commit is contained in:
Pk11
2022-02-21 04:26:35 -06:00
committed by Dark98
parent c91372f66b
commit 0a2848158c
9 changed files with 41 additions and 8 deletions
+1 -1
View File
@@ -51,7 +51,7 @@ public:
void Draw(void) const override;
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
private:
std::vector<std::string> dwnldList, dwnldSizes;
std::vector<std::string> dwnldList, dwnldSizes, dwnldTypes;
bool initialized = false, fetchDown = false, showMarks = false, showSettings = false,
ascending = false, updateFilter = false, screenshotFetch = false, canDisplay = false, isAND = true;
+1
View File
@@ -55,6 +55,7 @@ public:
std::string GetLicenseEntry(int index) const;
C2D_Image GetIconEntry(int index) const;
std::string GetFileSizes(int index, const std::string &entry) const;
std::string GetFileTypes(int index, const std::string &entry) const;
std::vector<std::string> GetScreenshotList(int index) const;
std::vector<std::string> GetScreenshotNames(int index) const;
std::string GetReleaseNotes(int index) const;
+2 -1
View File
@@ -53,6 +53,7 @@ public:
std::vector<std::string> GetCategoryFull() const { return this->FullCategory; };
std::vector<std::string> GetConsoleFull() const { return this->FullConsole; };
std::vector<std::string> GetSizes() const { return this->Sizes; };
std::vector<std::string> GetTypes() const { return this->Types; };
std::vector<std::string> GetScreenshots() const { return this->Screenshots; };
std::vector<std::string> GetScreenshotNames() const { return this->ScreenshotNames; };
std::string GetReleaseNotes() const { return this->ReleaseNotes; };
@@ -69,7 +70,7 @@ private:
std::string Title, Author, Description, Category, Version, Console, LastUpdated, License, MarkString, ReleaseNotes;
C2D_Image Icon;
int SheetIndex, EntryIndex, Marks;
std::vector<std::string> FullCategory, FullConsole, Sizes, Screenshots, ScreenshotNames;
std::vector<std::string> FullCategory, FullConsole, Sizes, Types, Screenshots, ScreenshotNames;
bool UpdateAvailable;
};
+1 -1
View File
@@ -61,7 +61,7 @@ namespace StoreUtils {
/* Download entries. */
void DrawDownList(const std::vector<std::string> &entries, bool fetch, const std::unique_ptr<StoreEntry> &entry, const std::vector<std::string> &sizes, const std::vector<bool> &installs);
void 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 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);
/* Queue System. */
void DrawQueueMenu(const int queueIndex);
+2
View File
@@ -66,6 +66,8 @@
"ENTRIES": "Entries",
"EXECUTE_ENTRY": "Would you like to execute this entry?",
"EXIT_APP": "Exit DarkStore",
"NOTE_NIGHTLY": "Note: \"Nightly\" versions are intended for testing\nupcoming features and may be unstable.\n\nIf you simply want to install,\nplease cancel and install the normal version.",
"NOTE_PRERELEASE": "Note: This is a prerelease build and may be unstable.\n\nIf you simply want to install, you may\nwant to install the normal version if one exists.",
"EXTRACTING": "Extracting... %s / %s (%.2f%%)",
"EXTRACT_ERROR": "Extract error!",
"FEATURE_SIDE_EFFECTS": "This Feature may have side effects while the Queue is running.\nAre you sure you want to continue?",
+9 -3
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());
}
}
+3 -1
View File
@@ -235,6 +235,7 @@ void MainScreen::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
this->installs.clear();
this->dwnldList.clear();
this->dwnldSizes.clear();
this->dwnldTypes.clear();
if (StoreUtils::store && StoreUtils::store->GetValid()) {
const std::vector<std::string> installedNames = StoreUtils::meta->GetInstalled(StoreUtils::store->GetStoreTitle(), StoreUtils::entries[StoreUtils::store->GetEntry()]->GetTitle());
@@ -244,6 +245,7 @@ void MainScreen::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
if ((int)StoreUtils::entries.size() > StoreUtils::store->GetEntry()) {
this->dwnldList = StoreUtils::store->GetDownloadList(StoreUtils::entries[StoreUtils::store->GetEntry()]->GetEntryIndex());
this->dwnldSizes = StoreUtils::entries[StoreUtils::store->GetEntry()]->GetSizes();
this->dwnldTypes = StoreUtils::entries[StoreUtils::store->GetEntry()]->GetTypes();
for (int i = 0; i < (int)this->dwnldList.size(); i++) {
bool good = false;
@@ -269,7 +271,7 @@ void MainScreen::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
break;
case 1:
if (StoreUtils::store && StoreUtils::store->GetValid() && StoreUtils::entries.size() > 0) StoreUtils::DownloadHandle(StoreUtils::entries[StoreUtils::store->GetEntry()], this->dwnldList, storeMode, this->lastMode, this->smallDelay, this->installs);
if (StoreUtils::store && StoreUtils::store->GetValid() && StoreUtils::entries.size() > 0) StoreUtils::DownloadHandle(StoreUtils::entries[StoreUtils::store->GetEntry()], this->dwnldList, storeMode, this->lastMode, this->smallDelay, this->installs, this->dwnldTypes);
break;
case 2:
+20
View File
@@ -506,6 +506,26 @@ std::string Store::GetFileSizes(int index, const std::string &entry) const {
return "";
}
/*
Get file script type for each download entry.
int index: The index.
const std::string &entry: The entry name.
*/
std::string Store::GetFileTypes(int index, const std::string &entry) const {
if (!this->valid) return "";
if (index > (int)this->storeJson["storeContent"].size() - 1) return "";
if (this->storeJson["storeContent"][index].contains(entry) && this->storeJson["storeContent"][index][entry].type() == nlohmann::json::value_t::object) {
if (this->storeJson["storeContent"][index][entry].contains("type") && this->storeJson["storeContent"][index][entry]["type"].is_string()) {
return this->storeJson["storeContent"][index][entry]["type"];
}
}
return "";
}
/*
Get Screenshot URL list.
+1
View File
@@ -61,6 +61,7 @@ StoreEntry::StoreEntry(const std::unique_ptr<Store> &store, const std::unique_pt
if (!entries.empty()) {
for (int i = 0; i < (int)entries.size(); i++) {
this->Sizes.push_back( store->GetFileSizes(index, entries[i]) );
this->Types.push_back( store->GetFileTypes(index, entries[i]) );
}
}