Created an setup wizard on first startup.
This commit is contained in:
parent
65ff2d4b16
commit
973087d19a
@ -12,7 +12,7 @@ function wait(s) {
|
||||
while(getTime() - c_time <= s) {}
|
||||
}
|
||||
function getSettings() {
|
||||
return Object.assign({"firstrun": true}, storage.readJSON(settingsfile, true) || {});
|
||||
return Object.assign({"firstrun": true, "fullscreen": true}, storage.readJSON(settingsfile, true) || {});
|
||||
}
|
||||
|
||||
|
||||
@ -34,6 +34,29 @@ function animate100x100img_big2small(img, minscale, maxscale) {
|
||||
}
|
||||
}
|
||||
|
||||
function homescreen() {
|
||||
g.clear();
|
||||
}
|
||||
|
||||
function setupWizard() {
|
||||
E.showPrompt(
|
||||
"Do you want the app to stay full screen (default)?",
|
||||
{ "title": "FULLSCREEN", "buttons": {"Yes!": true, "No, I love Widgets!": false} }
|
||||
).then(function(v) {
|
||||
if(settings.fullscreen != v) {
|
||||
settings.fullscreen = v;
|
||||
storage.writeJSON(settingsfile, settings);
|
||||
E.showMessage("Changes will be visible after a restart of the application.", "INFO");
|
||||
wait(2);
|
||||
}
|
||||
// always do start homescreen
|
||||
g.clear();
|
||||
E.showMessage("You can now use your fully configured MemoryTrainer app.", "CONGRATULATIONS!");
|
||||
wait(2);
|
||||
homescreen();
|
||||
});
|
||||
}
|
||||
|
||||
function welcome(new_user) {
|
||||
var brain_trainer_text = storage.readJSON("memorytrainer.icons.json", true).brain_trainer_text;
|
||||
var img_brain_trainer_text = brain_trainer_text.data;
|
||||
@ -46,10 +69,12 @@ function welcome(new_user) {
|
||||
wait(1);
|
||||
g.clear();
|
||||
wait(0.2);
|
||||
setupWizard();
|
||||
return;
|
||||
}
|
||||
g.drawImage(img_brain_trainer_text, g.getWidth()/2, g.getHeight()/2, {rotate: 0.04, scale: 1.2});
|
||||
wait(1);
|
||||
g.clear();
|
||||
homescreen();
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user