1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-25 05:47:45 +00:00

Re-open the game window (if you have that option enabled) to show sync

This commit is contained in:
Joshua Goins 2024-07-30 19:58:40 -04:00
parent a0da4d02b7
commit ce1411de79
3 changed files with 18 additions and 4 deletions

View file

@ -147,6 +147,7 @@ Q_SIGNALS:
void currentProfileChanged();
void autoLoginProfileChanged();
void cachedLogoImageChanged();
void showWindow();
protected:
friend class Patcher;

View file

@ -518,15 +518,24 @@ QCoro::Task<> LauncherCore::fetchNews()
QCoro::Task<> LauncherCore::handleGameExit(Profile *profile)
{
#ifdef BUILD_SYNC
qCDebug(ASTRA_LOG) << "Game closed! Uploading character data...";
const auto characterSync = new CharacterSync(*profile->account(), *this, this);
co_await characterSync->sync(false); // TODO: handle errors and especially interactive ones
#endif
if (m_settings->enableSync()) {
Q_EMIT showWindow();
qCDebug(ASTRA_LOG) << "Game closed! Uploading character data...";
const auto characterSync = new CharacterSync(*profile->account(), *this, this);
co_await characterSync->sync(false);
// Tell the user they can now quit.
Q_EMIT stageChanged(i18n("You may now safely close the game."));
co_return;
}
#endif
// Otherwise, quit when everything is finished.
if (m_settings->closeWhenLaunched()) {
QCoreApplication::exit();
}
co_return;
}

View file

@ -121,6 +121,10 @@ Kirigami.ApplicationWindow {
function onCurrentProfileChanged() {
appWindow.checkSetup();
}
function onShowWindow() {
appWindow.show();
}
}
Connections {