avoid trying to reach the cloud when using Snap! offline

pull/95/head
jmoenig 2020-05-13 11:21:07 +02:00
rodzic cfa4b1bc15
commit abb58e7a4e
1 zmienionych plików z 11 dodań i 15 usunięć

Wyświetl plik

@ -78,7 +78,7 @@ Animation, BoxMorph, BlockEditorMorph, BlockDialogMorph, Note*/
// Global stuff ////////////////////////////////////////////////////////
modules.gui = '2020-May-11';
modules.gui = '2020-May-13';
// Declarations
@ -284,6 +284,7 @@ IDE_Morph.prototype.openIn = function (world) {
function initUser(username) {
sessionStorage.username = username;
myself.controlBar.cloudButton.refresh();
if (username) {
myself.source = 'cloud';
if (!myself.cloud.verified) {
@ -305,16 +306,6 @@ IDE_Morph.prototype.openIn = function (world) {
}
}
if (location.protocol !== 'file:') {
if (!sessionStorage.username) {
// check whether login should persist across browser sessions
this.cloud.initSession(initUser);
} else {
// login only persistent during a single browser session
this.cloud.checkCredentials(initUser);
}
}
this.buildPanes();
world.add(this);
world.userMenu = this.userMenu;
@ -553,10 +544,15 @@ IDE_Morph.prototype.openIn = function (world) {
interpretUrlAnchors.call(this);
}
this.cloud.checkCredentials(
() => this.controlBar.cloudButton.refresh(),
() => this.controlBar.cloudButton.refresh()
);
if (location.protocol !== 'file:') {
if (!sessionStorage.username) {
// check whether login should persist across browser sessions
this.cloud.initSession(initUser);
} else {
// login only persistent during a single browser session
this.cloud.checkCredentials(initUser);
}
}
world.keyboardFocus = this.stage;
this.warnAboutIE();