Show Optimization Message During Database Migration (#2165)
This commit is contained in:
commit
a3d43a56a7
5 changed files with 45 additions and 4 deletions
|
@ -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"
|
||||
|
|
|
@ -951,7 +951,6 @@
|
|||
<script type='text/javascript' src='js/wall_clock_listener.js'></script>
|
||||
<script type='text/javascript' src='js/rotate_signed_prekey_listener.js'></script>
|
||||
<script type='text/javascript' src='js/keychange_listener.js'></script>
|
||||
<script type='text/javascript' src='js/background.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class='app-loading-screen'>
|
||||
|
@ -962,8 +961,10 @@
|
|||
<span class='dot'></span>
|
||||
<span class='dot'></span>
|
||||
</div>
|
||||
<div class='message'>Loading...</div>
|
||||
<div class='message'></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type='text/javascript' src='js/background.js'></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
const { IdleDetector, MessageDataMigrator } = Signal.Workflow;
|
||||
const { Errors, Message } = window.Signal.Types;
|
||||
const { upgradeMessageSchema } = window.Signal.Migrations;
|
||||
const { Views } = window.Signal;
|
||||
|
||||
// Implicitly used in `indexeddb-backbonejs-adapter`:
|
||||
// https://github.com/signalapp/Signal-Desktop/blob/4033a9f8137e62ed286170ed5d4941982b1d3a64/components/indexeddb-backbonejs-adapter/backbone-indexeddb.js#L569
|
||||
|
@ -74,6 +75,8 @@
|
|||
return accountManager;
|
||||
};
|
||||
|
||||
const cancelInitializationMessage = Views.Initialization.setMessage();
|
||||
console.log('Start IndexedDB migrations');
|
||||
storage.fetch();
|
||||
|
||||
|
||||
|
@ -163,6 +166,7 @@
|
|||
connect(true);
|
||||
});
|
||||
|
||||
cancelInitializationMessage();
|
||||
var appView = window.owsDesktopApp.appView = new Whisper.AppView({el: $('body')});
|
||||
|
||||
Whisper.WallClockListener.init(Whisper.events);
|
||||
|
|
30
js/modules/views/initialization.js
Normal file
30
js/modules/views/initialization.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
/* eslint-env browser */
|
||||
|
||||
/* global i18n: false */
|
||||
|
||||
|
||||
const OPTIMIZATION_MESSAGE_DISPLAY_THRESHOLD = 1000; // milliseconds
|
||||
|
||||
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,
|
||||
};
|
|
@ -124,7 +124,7 @@
|
|||
|
||||
const { IdleDetector} = require('./js/modules/idle_detector');
|
||||
|
||||
window.Signal = window.Signal || {};
|
||||
window.Signal = {};
|
||||
window.Signal.Backup = require('./js/modules/backup');
|
||||
window.Signal.Crypto = require('./js/modules/crypto');
|
||||
window.Signal.Logs = require('./js/modules/logs');
|
||||
|
@ -134,12 +134,14 @@
|
|||
window.Signal.Migrations.upgradeMessageSchema = upgradeMessageSchema;
|
||||
window.Signal.Migrations.V17 = require('./js/modules/migrations/17');
|
||||
window.Signal.OS = require('./js/modules/os');
|
||||
window.Signal.Types = window.Signal.Types || {};
|
||||
window.Signal.Types = {};
|
||||
window.Signal.Types.Attachment = Attachment;
|
||||
window.Signal.Types.Errors = require('./js/modules/types/errors');
|
||||
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 =
|
||||
|
|
Loading…
Reference in a new issue