mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-26 17:36:05 -05:00
rename UpdateError to UpdateFailed
This commit is contained in:
parent
7397193e57
commit
92c22d25e4
6 changed files with 16 additions and 16 deletions
|
@ -9,8 +9,8 @@
|
|||
namespace geode {
|
||||
using UpdateFinished = std::monostate;
|
||||
using UpdateProgress = std::pair<uint8_t, std::string>;
|
||||
using UpdateError = std::string;
|
||||
using UpdateStatus = std::variant<UpdateFinished, UpdateProgress, UpdateError>;
|
||||
using UpdateFailed = std::string;
|
||||
using UpdateStatus = std::variant<UpdateFinished, UpdateProgress, UpdateFailed>;
|
||||
|
||||
struct GEODE_DLL ModInstallEvent : public Event {
|
||||
const std::string modID;
|
||||
|
|
|
@ -59,7 +59,7 @@ struct CustomLoadingLayer : Modify<CustomLoadingLayer, LoadingLayer> {
|
|||
m_fields->m_updatingResources = false;
|
||||
this->loadAssets();
|
||||
},
|
||||
[&](UpdateError const& error) {
|
||||
[&](UpdateFailed const& error) {
|
||||
InternalLoader::platformMessageBox(
|
||||
"Error updating resources",
|
||||
"Unable to update Geode resources: " +
|
||||
|
|
|
@ -32,7 +32,7 @@ $execute {
|
|||
INDEX_UPDATE_NOTIF->waitAndHide();
|
||||
INDEX_UPDATE_NOTIF = nullptr;
|
||||
},
|
||||
[](UpdateError const& info) {
|
||||
[](UpdateFailed const& info) {
|
||||
INDEX_UPDATE_NOTIF->setIcon(NotificationIcon::Error);
|
||||
INDEX_UPDATE_NOTIF->setString(info);
|
||||
INDEX_UPDATE_NOTIF->setTime(NOTIFICATION_LONG_TIME);
|
||||
|
@ -135,7 +135,7 @@ struct CustomMenuLayer : Modify<CustomMenuLayer, MenuLayer> {
|
|||
void onIndexUpdate(IndexUpdateEvent* event) {
|
||||
if (
|
||||
std::holds_alternative<UpdateFinished>(event->status) ||
|
||||
std::holds_alternative<UpdateError>(event->status)
|
||||
std::holds_alternative<UpdateFailed>(event->status)
|
||||
) {
|
||||
this->addUpdateIndicator();
|
||||
}
|
||||
|
|
|
@ -147,14 +147,14 @@ void InternalLoader::downloadLoaderResources() {
|
|||
auto unzip = file::Unzip::intoDir(tempResourcesZip, resourcesDir, true);
|
||||
if (!unzip) {
|
||||
return ResourceDownloadEvent(
|
||||
UpdateError("Unable to unzip new resources: " + unzip.unwrapErr())
|
||||
UpdateFailed("Unable to unzip new resources: " + unzip.unwrapErr())
|
||||
).post();
|
||||
}
|
||||
ResourceDownloadEvent(UpdateFinished()).post();
|
||||
})
|
||||
.expect([](std::string const& info) {
|
||||
ResourceDownloadEvent(
|
||||
UpdateError("Unable to download resources: " + info)
|
||||
UpdateFailed("Unable to download resources: " + info)
|
||||
).post();
|
||||
})
|
||||
.progress([](auto&, double now, double total) {
|
||||
|
|
|
@ -202,7 +202,7 @@ void Index::onSourceUpdate(SourceUpdateEvent* event) {
|
|||
break;
|
||||
}
|
||||
// otherwise, if some source failed, then post failed
|
||||
else if (std::holds_alternative<UpdateError>(status)) {
|
||||
else if (std::holds_alternative<UpdateFailed>(status)) {
|
||||
if (whatToPost != Progress) {
|
||||
whatToPost = Failed;
|
||||
}
|
||||
|
@ -239,14 +239,14 @@ void Index::onSourceUpdate(SourceUpdateEvent* event) {
|
|||
case Failed: {
|
||||
std::string info = "";
|
||||
for (auto& [src, status] : m_sourceStatuses) {
|
||||
if (std::holds_alternative<UpdateError>(status)) {
|
||||
info += src + ": " + std::get<UpdateError>(status) + "\n";
|
||||
if (std::holds_alternative<UpdateFailed>(status)) {
|
||||
info += src + ": " + std::get<UpdateFailed>(status) + "\n";
|
||||
}
|
||||
}
|
||||
// clear source statuses to allow updating index again
|
||||
m_sourceStatuses.clear();
|
||||
// post finish event
|
||||
IndexUpdateEvent(UpdateError(info)).post();
|
||||
IndexUpdateEvent(UpdateFailed(info)).post();
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ void Index::checkSourceUpdates(IndexSourceImpl* src) {
|
|||
.expect([src](std::string const& err) {
|
||||
SourceUpdateEvent(
|
||||
src,
|
||||
UpdateError(fmt::format("Error checking for updates: {}", err))
|
||||
UpdateFailed(fmt::format("Error checking for updates: {}", err))
|
||||
).post();
|
||||
});
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ void Index::downloadSource(IndexSourceImpl* src) {
|
|||
}
|
||||
catch(...) {
|
||||
return SourceUpdateEvent(
|
||||
src, UpdateError("Unable to clear cached index")
|
||||
src, UpdateFailed("Unable to clear cached index")
|
||||
).post();
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,7 @@ void Index::downloadSource(IndexSourceImpl* src) {
|
|||
.expect("Unable to unzip new index");
|
||||
if (!unzip) {
|
||||
return SourceUpdateEvent(
|
||||
src, UpdateError(unzip.unwrapErr())
|
||||
src, UpdateFailed(unzip.unwrapErr())
|
||||
).post();
|
||||
}
|
||||
|
||||
|
@ -331,7 +331,7 @@ void Index::downloadSource(IndexSourceImpl* src) {
|
|||
})
|
||||
.expect([src](std::string const& err) {
|
||||
SourceUpdateEvent(
|
||||
src, UpdateError(fmt::format("Error downloading: {}", err))
|
||||
src, UpdateFailed(fmt::format("Error downloading: {}", err))
|
||||
).post();
|
||||
})
|
||||
.progress([src](auto&, double now, double total) {
|
||||
|
|
|
@ -422,7 +422,7 @@ void ModListLayer::onIndexUpdate(IndexUpdateEvent* event) {
|
|||
[&](UpdateFinished const&) {
|
||||
this->reloadList();
|
||||
},
|
||||
[&](UpdateError const& error) {
|
||||
[&](UpdateFailed const& error) {
|
||||
this->reloadList();
|
||||
}
|
||||
}, event->status);
|
||||
|
|
Loading…
Reference in a new issue