Update to signal 1.18.0

pull/40/head
Mikunj 7 years ago
commit 4b4999ac35

@ -7,9 +7,9 @@ module.exports = {
const ONE_DAY = 24 * 60 * 60 * 1000; // one day const ONE_DAY = 24 * 60 * 60 * 1000; // one day
const MINIMUM_TIME_LEFT = 2 * 60 * 60 * 1000; // two hours const MINIMUM_TIME_LEFT = 2 * 60 * 60 * 1000; // two hours
let initialized = false;
let timeout = null; let timeout = null;
let scheduledTime = null; let scheduledTime = null;
let scheduleNext = null;
// We need to refresh our own profile regularly to account for newly-added devices which // We need to refresh our own profile regularly to account for newly-added devices which
// do not support unidentified delivery. // do not support unidentified delivery.
@ -20,19 +20,16 @@ function refreshOurProfile() {
} }
function initialize({ events, storage, navigator, logger }) { function initialize({ events, storage, navigator, logger }) {
if (initialized) { // We don't want to set up all of the below functions, but we do want to ensure that our
logger.warn('refreshSenderCertificate: already initialized!'); // refresh timer is up-to-date.
if (scheduleNext) {
scheduleNext();
return; return;
} }
initialized = true;
runWhenOnline(); runWhenOnline();
events.on('timetravel', () => { events.on('timetravel', scheduleNextRotation);
if (initialized) {
scheduleNextRotation();
}
});
function scheduleNextRotation() { function scheduleNextRotation() {
const now = Date.now(); const now = Date.now();
@ -55,6 +52,9 @@ function initialize({ events, storage, navigator, logger }) {
setTimeoutForNextRun(time); setTimeoutForNextRun(time);
} }
// Keeping this entrypoint around so more inialize() calls just kick the timing
scheduleNext = scheduleNextRotation;
async function run() { async function run() {
logger.info('refreshSenderCertificate: Getting new certificate...'); logger.info('refreshSenderCertificate: Getting new certificate...');
try { try {

@ -3,7 +3,7 @@
"productName": "Loki Messenger", "productName": "Loki Messenger",
"description": "Private messaging from your desktop", "description": "Private messaging from your desktop",
"repository": "https://github.com/sloki-project/loki-messenger.git", "repository": "https://github.com/sloki-project/loki-messenger.git",
"version": "1.17.0", "version": "1.18.0",
"license": "GPL-3.0", "license": "GPL-3.0",
"author": { "author": {
"name": "Open Whisper Systems", "name": "Open Whisper Systems",

Loading…
Cancel
Save