mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-22 12:47:44 +00:00
Introduce LauncherCore::login, which removes the wierd if-else checks
For some reason the login call sites required them to handle whether or not the profile was Sapphire or not, which is stupid.
This commit is contained in:
parent
bf87010aca
commit
ce7854626f
5 changed files with 20 additions and 16 deletions
|
@ -59,11 +59,7 @@ bool CMDInterface::parse(QCommandLineParser& parser, LauncherCore& core) {
|
|||
info->username = username;
|
||||
info->password = password;
|
||||
|
||||
if (profile.isSapphire) {
|
||||
core.sapphireLauncher->login(profile.lobbyURL, *info);
|
||||
} else {
|
||||
core.squareBoot->bootCheck(*info);
|
||||
}
|
||||
core.login(*info);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -153,6 +153,14 @@ public:
|
|||
int addProfile();
|
||||
int deleteProfile(QString name);
|
||||
|
||||
/*
|
||||
* Begins the login process, and may call SquareBoot or SapphireLauncher depending on the profile type.
|
||||
* It's designed to be opaque as possible to the caller.
|
||||
*
|
||||
* The login process is asynchronous.
|
||||
*/
|
||||
void login(LoginInformation& loginInformation);
|
||||
|
||||
/*
|
||||
* Launches the game using the provided authentication.
|
||||
*/
|
||||
|
|
|
@ -723,3 +723,11 @@ void LauncherCore::readGameData(ProfileSettings& profile) {
|
|||
physis_gamedata_free_sheet_header(exh);
|
||||
}
|
||||
}
|
||||
|
||||
void LauncherCore::login(LoginInformation& loginInformation) {
|
||||
if (loginInformation.settings->isSapphire) {
|
||||
sapphireLauncher->login(loginInformation.settings->lobbyURL, loginInformation);
|
||||
} else {
|
||||
squareBoot->checkGateStatus(&loginInformation);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,11 +93,7 @@ AutoLoginWindow::AutoLoginWindow(ProfileSettings& profile, LauncherCore& core, Q
|
|||
free (totp);
|
||||
}
|
||||
|
||||
if (profile.isSapphire) {
|
||||
core.sapphireLauncher->login(profile.lobbyURL, *info);
|
||||
} else {
|
||||
core.squareBoot->bootCheck(*info);
|
||||
}
|
||||
core.login(*info);
|
||||
|
||||
close();
|
||||
autologinTimer->stop();
|
||||
|
|
|
@ -263,7 +263,7 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo
|
|||
connect(core.assetUpdater, &AssetUpdater::finishedUpdating, [=] {
|
||||
auto& profile = currentProfile();
|
||||
|
||||
LoginInformation* info = new LoginInformation();
|
||||
auto info = new LoginInformation();
|
||||
info->settings = &profile;
|
||||
info->username = usernameEdit->text();
|
||||
info->password = passwordEdit->text();
|
||||
|
@ -287,11 +287,7 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo
|
|||
}
|
||||
#endif
|
||||
|
||||
if (currentProfile().isSapphire) {
|
||||
this->core.sapphireLauncher->login(currentProfile().lobbyURL, *info);
|
||||
} else {
|
||||
this->core.squareBoot->checkGateStatus(info);
|
||||
}
|
||||
this->core.login(*info);
|
||||
});
|
||||
|
||||
connect(loginButton, &QPushButton::released, [=] {
|
||||
|
|
Loading…
Add table
Reference in a new issue