Add initialization view

This commit is contained in:
Daniel Gasienica 2018-03-22 11:52:52 -04:00
parent 1c4b7eb01c
commit add19aa732
3 changed files with 39 additions and 0 deletions

View file

@ -39,6 +39,10 @@
"message": "Loading...",
"description": "Message shown on the loading screen before we've loaded any messages"
},
"optimizingApplication": {
"message": "Optimizing application...",
"description": "Message shown on the loading screen while we are doing application optimizations"
},
"chooseDirectory": {
"message": "Choose folder",
"description": "Button to allow the user to find a folder on disk"

View file

@ -0,0 +1,33 @@
/* eslint-env browser */
/* global i18n: false */
const OPTIMIZATION_MESSAGE_DISPLAY_THRESHOLD = 2000; // milliseconds
// type Canceler = () => Eff Unit
//
// setMessage :: Unit -> Eff (dom :: DOM) Canceler
const setMessage = () => {
const message = document.querySelector('.app-loading-screen .message');
if (!message) {
return () => {};
}
message.innerText = i18n('loading');
const optimizingMessageTimeoutId = setTimeout(() => {
const innerMessage = document.querySelector('.app-loading-screen .message');
if (!innerMessage) {
return;
}
innerMessage.innerText = i18n('optimizingApplication');
}, OPTIMIZATION_MESSAGE_DISPLAY_THRESHOLD);
return () => {
clearTimeout(optimizingMessageTimeoutId);
};
};
module.exports = {
setMessage,
};

View file

@ -140,6 +140,8 @@
window.Signal.Types.Message = Message;
window.Signal.Types.MIME = require('./js/modules/types/mime');
window.Signal.Types.Settings = require('./js/modules/types/settings');
window.Signal.Views = {};
window.Signal.Views.Initialization = require('./js/modules/views/initialization');
window.Signal.Workflow = {};
window.Signal.Workflow.IdleDetector = IdleDetector;
window.Signal.Workflow.MessageDataMigrator =