Refactor install view

Let install view manage the connection to the provisioning socket as
well as cleaning up the window on completion, simplifying options.js.
Call `remove` so that the view stops listening when the window closes.
Move view script and template to background page.
Adds ability to hide nav if this isn't our first run.

// FREEBIE
This commit is contained in:
lilia 2017-04-12 18:43:00 -07:00
parent df65585e71
commit 44a4ff3b52
5 changed files with 152 additions and 142 deletions

View file

@ -126,14 +126,15 @@
storage.put('theme-setting', 'ios');
}
var syncRequest = new textsecure.SyncRequest(textsecure.messaging, messageReceiver);
Whisper.events.trigger('contactsync:begin');
syncRequest.addEventListener('success', function() {
console.log('sync successful');
storage.put('synced_at', Date.now());
window.dispatchEvent(new Event('textsecure:contactsync'));
Whisper.events.trigger('contactsync');
});
syncRequest.addEventListener('timeout', function() {
console.log('sync timed out');
window.dispatchEvent(new Event('textsecure:contactsync'));
Whisper.events.trigger('contactsync');
});
}
}