Skip to content

Commit

Permalink
Kick off checks for updates in more situations
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnonnenberg-signal committed Oct 10, 2019
1 parent 5c00b89 commit 0f93c78
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 30 deletions.
5 changes: 5 additions & 0 deletions js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,11 @@
},

showStickerPack: async (packId, key) => {
// We can get these events even if the user has never linked this instance.
if (Whisper.Import.isIncomplete() || !Whisper.Registration.everDone()) {
return;
}

// Kick off the download
window.Signal.Stickers.downloadEphemeralPack(packId, key);

Expand Down
2 changes: 2 additions & 0 deletions js/views/install_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
// the actual next step happens in confirmNumber() on submit form #link-phone
},
initialize(options = {}) {
window.readyForUpdates();

this.selectStep(Steps.SCAN_QR_CODE);
this.connect();
this.on('disconnected', this.reconnect);
Expand Down
2 changes: 2 additions & 0 deletions js/views/standalone_registration_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
templateName: 'standalone',
className: 'full-screen-flow',
initialize() {
window.readyForUpdates();

this.accountManager = getAccountManager();

this.render();
Expand Down
16 changes: 14 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,14 @@ ipc.on('show-window', () => {
showWindow();
});

ipc.once('ready-for-updates', async () => {
let isReadyForUpdates = false;
async function readyForUpdates() {
if (isReadyForUpdates) {
return;
}

isReadyForUpdates = true;

// First, install requested sticker pack
if (process.argv.length > 1) {
const [incomingUrl] = process.argv;
Expand All @@ -417,7 +424,12 @@ ipc.once('ready-for-updates', async () => {
error && error.stack ? error.stack : error
);
}
});
}

ipc.once('ready-for-updates', readyForUpdates);

const TEN_MINUTES = 10 * 60 * 1000;
setTimeout(readyForUpdates, TEN_MINUTES);

function openReleaseNotes() {
shell.openExternal(
Expand Down
56 changes: 28 additions & 28 deletions ts/util/lint/exceptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@
"rule": "jQuery-$(",
"path": "js/views/install_view.js",
"line": " this.$('#qr img').remove();",
"lineNumber": 133,
"lineNumber": 135,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -605,7 +605,7 @@
"rule": "jQuery-$(",
"path": "js/views/install_view.js",
"line": " this.$('#qr .container').show();",
"lineNumber": 135,
"lineNumber": 137,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -614,7 +614,7 @@
"rule": "jQuery-$(",
"path": "js/views/install_view.js",
"line": " if ($('#qr').length === 0) {",
"lineNumber": 139,
"lineNumber": 141,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -623,7 +623,7 @@
"rule": "jQuery-$(",
"path": "js/views/install_view.js",
"line": " this.$('#qr .container').hide();",
"lineNumber": 144,
"lineNumber": 146,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -632,7 +632,7 @@
"rule": "jQuery-$(",
"path": "js/views/install_view.js",
"line": " this.qr = new QRCode(this.$('#qr')[0]).makeCode(url);",
"lineNumber": 145,
"lineNumber": 147,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -641,7 +641,7 @@
"rule": "jQuery-$(",
"path": "js/views/install_view.js",
"line": " this.$('#qr').addClass('ready');",
"lineNumber": 147,
"lineNumber": 149,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -650,7 +650,7 @@
"rule": "jQuery-$(",
"path": "js/views/install_view.js",
"line": " this.$(DEVICE_NAME_SELECTOR).val(deviceName || window.getHostName());",
"lineNumber": 152,
"lineNumber": 154,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -659,7 +659,7 @@
"rule": "jQuery-$(",
"path": "js/views/install_view.js",
"line": " this.$('#link-phone').submit();",
"lineNumber": 157,
"lineNumber": 159,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -668,7 +668,7 @@
"rule": "jQuery-$(",
"path": "js/views/install_view.js",
"line": " this.$('#link-phone').submit(e => {",
"lineNumber": 167,
"lineNumber": 169,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -677,7 +677,7 @@
"rule": "jQuery-$(",
"path": "js/views/install_view.js",
"line": " let name = this.$(DEVICE_NAME_SELECTOR).val();",
"lineNumber": 171,
"lineNumber": 173,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -686,7 +686,7 @@
"rule": "jQuery-$(",
"path": "js/views/install_view.js",
"line": " this.$(DEVICE_NAME_SELECTOR).focus();",
"lineNumber": 174,
"lineNumber": 176,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand Down Expand Up @@ -982,7 +982,7 @@
"rule": "jQuery-$(",
"path": "js/views/standalone_registration_view.js",
"line": " this.$('input.number').val(number);",
"lineNumber": 21,
"lineNumber": 23,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -991,7 +991,7 @@
"rule": "jQuery-$(",
"path": "js/views/standalone_registration_view.js",
"line": " el: this.$('#phone-number-input'),",
"lineNumber": 24,
"lineNumber": 26,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -1000,7 +1000,7 @@
"rule": "jQuery-$(",
"path": "js/views/standalone_registration_view.js",
"line": " this.$('#error').hide();",
"lineNumber": 26,
"lineNumber": 28,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -1009,7 +1009,7 @@
"rule": "jQuery-$(",
"path": "js/views/standalone_registration_view.js",
"line": " const verificationCode = $('#code')",
"lineNumber": 37,
"lineNumber": 39,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -1018,7 +1018,7 @@
"rule": "jQuery-$(",
"path": "js/views/standalone_registration_view.js",
"line": " this.$('#status').text(s);",
"lineNumber": 50,
"lineNumber": 52,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -1027,7 +1027,7 @@
"rule": "jQuery-$(",
"path": "js/views/standalone_registration_view.js",
"line": " const verificationCode = $('#code')",
"lineNumber": 53,
"lineNumber": 55,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -1036,7 +1036,7 @@
"rule": "jQuery-$(",
"path": "js/views/standalone_registration_view.js",
"line": " this.$('#error')",
"lineNumber": 64,
"lineNumber": 66,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -1045,7 +1045,7 @@
"rule": "jQuery-$(",
"path": "js/views/standalone_registration_view.js",
"line": " if (this.$('#number-container').hasClass('valid')) {",
"lineNumber": 71,
"lineNumber": 73,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -1054,7 +1054,7 @@
"rule": "jQuery-$(",
"path": "js/views/standalone_registration_view.js",
"line": " this.$('#request-sms, #request-voice').prop('disabled', 'disabled');",
"lineNumber": 74,
"lineNumber": 76,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -1063,7 +1063,7 @@
"rule": "jQuery-$(",
"path": "js/views/standalone_registration_view.js",
"line": " this.$('#code').addClass('invalid');",
"lineNumber": 79,
"lineNumber": 81,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -1072,7 +1072,7 @@
"rule": "jQuery-$(",
"path": "js/views/standalone_registration_view.js",
"line": " this.$('#code').removeClass('invalid');",
"lineNumber": 81,
"lineNumber": 83,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -1081,7 +1081,7 @@
"rule": "jQuery-$(",
"path": "js/views/standalone_registration_view.js",
"line": " this.$('#error').hide();",
"lineNumber": 86,
"lineNumber": 88,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -1090,7 +1090,7 @@
"rule": "jQuery-$(",
"path": "js/views/standalone_registration_view.js",
"line": " this.$('#step2')",
"lineNumber": 92,
"lineNumber": 94,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -1099,7 +1099,7 @@
"rule": "jQuery-$(",
"path": "js/views/standalone_registration_view.js",
"line": " this.$('#number-container').addClass('invalid');",
"lineNumber": 96,
"lineNumber": 98,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -1108,7 +1108,7 @@
"rule": "jQuery-$(",
"path": "js/views/standalone_registration_view.js",
"line": " $('#error').hide();",
"lineNumber": 101,
"lineNumber": 103,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -1117,7 +1117,7 @@
"rule": "jQuery-$(",
"path": "js/views/standalone_registration_view.js",
"line": " this.$('#step2')",
"lineNumber": 107,
"lineNumber": 109,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand All @@ -1126,7 +1126,7 @@
"rule": "jQuery-$(",
"path": "js/views/standalone_registration_view.js",
"line": " this.$('#number-container').addClass('invalid');",
"lineNumber": 111,
"lineNumber": 113,
"reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input"
Expand Down

0 comments on commit 0f93c78

Please sign in to comment.