add --skipSplash param

This commit is contained in:
luiscuenca 2019-07-25 11:22:20 -07:00
parent 13952bf27e
commit c3ad65f628
No known key found for this signature in database
GPG key ID: 2387ECD129A6961D
4 changed files with 33 additions and 23 deletions

View file

@ -43,6 +43,7 @@ BOOL CLauncherApp::InitInstance() {
bool restarting = false; bool restarting = false;
bool noUpdate = false; bool noUpdate = false;
bool continueUpdating = false; bool continueUpdating = false;
bool skipSplash = false;
if (iNumOfArgs > 1) { if (iNumOfArgs > 1) {
for (int i = 1; i < iNumOfArgs; i++) { for (int i = 1; i < iNumOfArgs; i++) {
CString curArg = CString(pArgs[i]); CString curArg = CString(pArgs[i]);
@ -54,6 +55,8 @@ BOOL CLauncherApp::InitInstance() {
noUpdate = true; noUpdate = true;
} else if (curArg.Compare(_T("--continueUpdating")) == 0) { } else if (curArg.Compare(_T("--continueUpdating")) == 0) {
continueUpdating = true; continueUpdating = true;
} else if (curArg.Compare(_T("--skipSplash")) == 0) {
skipSplash = true;
} }
} }
} }
@ -68,7 +71,7 @@ BOOL CLauncherApp::InitInstance() {
if (uninstalling) { if (uninstalling) {
_manager.uninstall(); _manager.uninstall();
} else { } else {
_manager.init(!noUpdate, continueUpdating); _manager.init(!noUpdate, continueUpdating, skipSplash);
} }
if (!_manager.hasFailed() && !_manager.installLauncher()) { if (!_manager.hasFailed() && !_manager.installLauncher()) {
return FALSE; return FALSE;

View file

@ -693,7 +693,6 @@ void CLauncherDlg::OnTimer(UINT_PTR nIDEvent) {
} }
} }
} }
BOOL needsToWait = theApp._manager.needsToWait();
if (_showSplash) { if (_showSplash) {
if (_splashStep == 0) { if (_splashStep == 0) {
if (theApp._manager.needsUninstall()) { if (theApp._manager.needsUninstall()) {
@ -704,10 +703,14 @@ void CLauncherDlg::OnTimer(UINT_PTR nIDEvent) {
setDrawDialog(DrawStep::DrawProcessUpdate); setDrawDialog(DrawStep::DrawProcessUpdate);
theApp._manager.updateProgress(LauncherManager::ProcessType::Uninstall, 0.0f); theApp._manager.updateProgress(LauncherManager::ProcessType::Uninstall, 0.0f);
} else { } else {
theApp._manager.addToLog(_T("Start splash screen")); if (theApp._manager.shouldSkipSplashScreen()) {
setDrawDialog(DrawStep::DrawLogo); _splashStep = SPLASH_DURATION;
} else {
theApp._manager.addToLog(_T("Start splash screen"));
setDrawDialog(DrawStep::DrawLogo);
}
} }
} else if (_splashStep > SPLASH_DURATION && !needsToWait) { } else if (_splashStep > SPLASH_DURATION && !theApp._manager.needsToWait()) {
_showSplash = false; _showSplash = false;
if (theApp._manager.shouldShutDown()) { if (theApp._manager.shouldShutDown()) {
if (_applicationWND != NULL) { if (_applicationWND != NULL) {

View file

@ -21,11 +21,13 @@ LauncherManager::LauncherManager() {
LauncherManager::~LauncherManager() { LauncherManager::~LauncherManager() {
} }
void LauncherManager::init(BOOL allowUpdate, BOOL continueUpdating) { void LauncherManager::init(BOOL allowUpdate, BOOL continueUpdating, BOOL skipSplashScreen) {
initLog(); initLog();
int tokenPos = 0; int tokenPos = 0;
_updateLauncherAllowed = allowUpdate; _updateLauncherAllowed = allowUpdate;
_continueUpdating = continueUpdating; _continueUpdating = continueUpdating;
_skipSplashScreen = skipSplashScreen;
_shouldWait = !skipSplashScreen;
if (_continueUpdating) { if (_continueUpdating) {
_progressOffset = CONTINUE_UPDATING_GLOBAL_OFFSET; _progressOffset = CONTINUE_UPDATING_GLOBAL_OFFSET;
} }
@ -613,7 +615,7 @@ void LauncherManager::restartNewLauncher() {
if (_willContinueUpdating) { if (_willContinueUpdating) {
LauncherUtils::launchApplication(_tempLauncherPath, _T(" --restart --noUpdate --continueUpdating")); LauncherUtils::launchApplication(_tempLauncherPath, _T(" --restart --noUpdate --continueUpdating"));
} else { } else {
LauncherUtils::launchApplication(_tempLauncherPath, _T(" --restart --noUpdate")); LauncherUtils::launchApplication(_tempLauncherPath, _T(" --restart --noUpdate --skipSplash"));
} }
Sleep(500); Sleep(500);
} }

View file

@ -59,7 +59,7 @@ public:
}; };
LauncherManager(); LauncherManager();
~LauncherManager(); ~LauncherManager();
void init(BOOL allowUpdate, BOOL continueUpdating); void init(BOOL allowUpdate, BOOL continueUpdating, BOOL skipSplashScreen);
BOOL initLog(); BOOL initLog();
BOOL addToLog(const CString& line); BOOL addToLog(const CString& line);
void closeLog(); void closeLog();
@ -90,18 +90,19 @@ public:
const CString& getVersion() const { return _version; } const CString& getVersion() const { return _version; }
BOOL shouldShutDown() const { return _shouldShutdown; } BOOL shouldShutDown() const { return _shouldShutdown; }
BOOL shouldLaunch() const { return _shouldLaunch; } BOOL shouldLaunch() const { return _shouldLaunch; }
BOOL needsUpdate() { return _shouldUpdate; } BOOL shouldSkipSplashScreen() const { return _skipSplashScreen; }
BOOL needsSelfUpdate() { return _shouldUpdateLauncher; } BOOL needsUpdate() const { return _shouldUpdate; }
BOOL needsSelfDownload() { return _shouldDownloadLauncher; } BOOL needsSelfUpdate() const { return _shouldUpdateLauncher; }
BOOL needsUninstall() { return _shouldUninstall; } BOOL needsSelfDownload() const { return _shouldDownloadLauncher; }
BOOL needsInstall() { return _shouldInstall; } BOOL needsUninstall() const { return _shouldUninstall; }
BOOL needsToWait() { return _shouldWait; } BOOL needsInstall() const { return _shouldInstall; }
BOOL needsRestartNewLauncher() { return _shouldRestartNewLauncher; } BOOL needsToWait() const { return _shouldWait; }
BOOL shouldContinueUpdating() { return _continueUpdating; } BOOL needsRestartNewLauncher() const { return _shouldRestartNewLauncher; }
BOOL willContinueUpdating() { return _willContinueUpdating; } BOOL shouldContinueUpdating() const { return _continueUpdating; }
BOOL willContinueUpdating() const { return _willContinueUpdating; }
void setDisplayName(const CString& displayName) { _displayName = displayName; } void setDisplayName(const CString& displayName) { _displayName = displayName; }
bool isLoggedIn() { return _loggedIn; } bool isLoggedIn() const { return _loggedIn; }
bool hasFailed() { return _hasFailed; } bool hasFailed() const { return _hasFailed; }
void setFailed(bool hasFailed) { _hasFailed = hasFailed; } void setFailed(bool hasFailed) { _hasFailed = hasFailed; }
const CString& getLatestInterfaceURL() const { return _latestApplicationURL; } const CString& getLatestInterfaceURL() const { return _latestApplicationURL; }
void uninstall() { _shouldUninstall = true; _shouldWait = false; }; void uninstall() { _shouldUninstall = true; _shouldWait = false; };
@ -115,7 +116,7 @@ public:
void restartNewLauncher(); void restartNewLauncher();
void onZipExtracted(ProcessType type, int size); void onZipExtracted(ProcessType type, int size);
void onFileDownloaded(ProcessType type); void onFileDownloaded(ProcessType type);
float getProgress() { return _progress; } float getProgress() const { return _progress; }
void updateProgress(ProcessType processType, float progress); void updateProgress(ProcessType processType, float progress);
void onCancel(); void onCancel();
const CString& getLauncherVersion() const { return _launcherVersion; } const CString& getLauncherVersion() const { return _launcherVersion; }
@ -145,11 +146,12 @@ private:
BOOL _shouldLaunch { FALSE }; BOOL _shouldLaunch { FALSE };
BOOL _shouldWait { TRUE }; BOOL _shouldWait { TRUE };
BOOL _shouldUpdateLauncher { FALSE }; BOOL _shouldUpdateLauncher { FALSE };
BOOL _shouldDownloadLauncher{ FALSE }; BOOL _shouldDownloadLauncher { FALSE };
BOOL _updateLauncherAllowed { TRUE }; BOOL _updateLauncherAllowed { TRUE };
BOOL _shouldRestartNewLauncher { FALSE }; BOOL _shouldRestartNewLauncher { FALSE };
BOOL _continueUpdating{ FALSE }; BOOL _continueUpdating { FALSE };
BOOL _willContinueUpdating{ FALSE }; BOOL _willContinueUpdating { FALSE };
BOOL _skipSplashScreen { FALSE };
float _progressOffset { 0.0f }; float _progressOffset { 0.0f };
float _progress { 0.0f }; float _progress { 0.0f };
CStdioFile _logFile; CStdioFile _logFile;