Skip to content
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

Refresh in app tutorial message in preview when hot reloading preview #7407

Merged
merged 2 commits into from
Feb 17, 2025

Conversation

AlexandreSi
Copy link
Collaborator

No description provided.

@AlexandreSi AlexandreSi requested a review from 4ian as a code owner February 17, 2025 10:02
@@ -108,7 +109,7 @@ namespace gdjs {
.then((fontFace) => document.fonts.add(fontFace));
};

const _loadStyles = () => {
const _loadStyleSheet = () => {
const adhocStyle = document.createElement('style');
Copy link
Owner

Choose a reason for hiding this comment

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

Should you store a reference to it to avoid re-creating it each time _loadStylesheet is called?

containerPositionStyle,
messageContainerPositionStyle,
} = _getPositioningStyle(position);

_loadFonts();
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe make this method do nothing if fonts are already loaded.

@@ -108,7 +109,7 @@ namespace gdjs {
.then((fontFace) => document.fonts.add(fontFace));
Copy link
Owner

Choose a reason for hiding this comment

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

You can async/await and set a boolean when finished

@@ -174,6 +176,17 @@ namespace gdjs {
const newRuntimeGameOptions: RuntimeGameOptions =
gdjs.runtimeGameOptions;

this._runtimeGame._displayMessageInPreview =
Copy link
Owner

Choose a reason for hiding this comment

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

I'm a bit uneasy at this patching of a private variable + patching of _options.
Could we rather call a method, like runtimeGame.displayInAppTutorialMessage(...)?

@@ -191,6 +191,7 @@ namespace gdjs {
_sessionMetricsInitialized: boolean = false;
_disableMetrics: boolean = false;
_isPreview: boolean;
_displayMessageInPreview: boolean = false;
Copy link
Owner

Choose a reason for hiding this comment

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

This boolean is a bit weird, it acts as "show it once" but it's not super clear when reading its name.
Do we really need it?

@AlexandreSi AlexandreSi force-pushed the in-preview-messages-reload branch from 601c54d to 9949711 Compare February 17, 2025 10:37
@AlexandreSi AlexandreSi force-pushed the in-preview-messages-reload branch from 9949711 to 6acdaf9 Compare February 17, 2025 10:38
@AlexandreSi AlexandreSi merged commit 303ebfa into master Feb 17, 2025
5 of 6 checks passed
@AlexandreSi AlexandreSi deleted the in-preview-messages-reload branch February 17, 2025 11:07
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.

2 participants