Skip to content

feat: [UEPR-183] Added an alert when trying to import an unsupported face sensing project #170

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion packages/scratch-gui/src/lib/sb-file-uploader-hoc.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ const messages = defineMessages({
id: 'gui.projectLoader.loadError',
defaultMessage: 'The project file that was selected failed to load.',
description: 'An error that displays when a local project file fails to load.'
},
faceSensingError: {
id: 'gui.projectLoader.faceSensingError',
defaultMessage: 'This project uses features (Face Sensing) that are not supported in your current version' +
' of the Scratch editor. Try updating to latest editor version or opening it in Scratch Lab.',
description: 'An error that displays when a local project file fails to load because it has face sensing.'
}
});

Expand Down Expand Up @@ -159,7 +165,13 @@ const SBFileUploaderHOC = function (WrappedComponent) {
})
.catch(error => {
log.warn(error);
alert(this.props.intl.formatMessage(messages.loadError)); // eslint-disable-line no-alert
if (error.message.includes('faceSensing')) {
alert( // eslint-disable-line no-alert
this.props.intl.formatMessage(messages.faceSensingError)
);
} else {
alert(this.props.intl.formatMessage(messages.loadError)); // eslint-disable-line no-alert
}
})
.then(() => {
this.props.onLoadingFinished(this.props.loadingState, loadingSuccess);
Expand Down