Skip to content

New welcome screen and tweaks to update checking flow #28671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

mathesoncalum
Copy link
Contributor

No description provided.


if (appUpdateScenario()) {
++totalChecksExpected;
DEFER {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The content of the DEFER is executed when leaving the scope within which it appears. And since it is the last statement in this scope (i.e. the {} of the if), that means the content is executed immediately, so the fact that it is inside DEFER makes no difference.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oof - thanks for letting me know, I'd assumed it was tied to the method scope...

@@ -48,12 +48,12 @@ class UpdateScenario : public IUpdateScenario, public Injectable, public async::
UpdateScenario(const modularity::ContextPtr& iocCtx)
: Injectable(iocCtx) {}

void checkForUpdate(bool manual) override;
void checkForUpdate(bool manual, const CheckForUpdateCompleteCallback& callback = nullptr) override;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't work with such callbacks very often. Instead, would it be an idea to expose a Progress, or make this a Promise?

return;
}

if (!configuration()->needCheckForUpdate() || multiInstancesProvider()->instances().size() != 1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be preferable to move these checks plus the timer to the caller (i.e. StartupScenario), so that checkForUpdate becomes just doCheckForUpdate and nothing else?

I also feel like we might now have two sources of delay, namely the one second from AUTO_CHECK_UPDATE_INTERVAL, and whatever delay mechanism the caller might use.

if (splashScreen) {
splashScreen->close();
delete splashScreen;
const Version welcomeDialogLastShownVersion(appshellConfiguration()->welcomeDialogLastShownVersion());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move all this logic into StartupScenario?
Ideally, this part should only include method calls like runOnSplashScreen, runAfterSplashScreen, and so on.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also recommend keeping the methods more abstract, because in your case you’re exposing the internal logic of the scenario.


void WelcomeDialogModel::init()
{
// TODO: This is entirely placeholder code - figure out where to store/pull this information...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let’s move this to StartupScenario and make WelcomeDialog more abstract - that way, if we decide to fetch data from the server in the future, part of the work will already be in place, and the dialog will be ready for it.

@mathesoncalum
Copy link
Contributor Author

@Eism @cbjeukendrup thanks guys - updated now:

  • Eliminated DEFER usage
  • Switched callbacks for Promises
  • Moved welcome dialog "last shown version" logic to StartupScenario
  • Reinstated more abstract naming for StartupScenario methods (runOnSplashScreen, runAfterSplashScreen)
  • Moved needCheckForUpdate checks to StartupScenario
  • Moved data for welcome dialog to StartupScenario

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants