-
Notifications
You must be signed in to change notification settings - Fork 935
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
Conversation
@@ -108,7 +109,7 @@ namespace gdjs { | |||
.then((fontFace) => document.fonts.add(fontFace)); | |||
}; | |||
|
|||
const _loadStyles = () => { | |||
const _loadStyleSheet = () => { | |||
const adhocStyle = document.createElement('style'); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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 = |
There was a problem hiding this comment.
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(...)
?
GDJS/Runtime/runtimegame.ts
Outdated
@@ -191,6 +191,7 @@ namespace gdjs { | |||
_sessionMetricsInitialized: boolean = false; | |||
_disableMetrics: boolean = false; | |||
_isPreview: boolean; | |||
_displayMessageInPreview: boolean = false; |
There was a problem hiding this comment.
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?
601c54d
to
9949711
Compare
9949711
to
6acdaf9
Compare
No description provided.