Close stale windows on background refresh
All the old event listeners and in-memory objects have perished with the old background page. Also reopen the inbox if it was already open. Fixes #289 // FREEBIE
This commit is contained in:
parent
815b79dc64
commit
971079980e
1 changed files with 9 additions and 0 deletions
|
@ -22,6 +22,11 @@
|
||||||
});
|
});
|
||||||
chrome.alarms.create('awake', {periodInMinutes: 1});
|
chrome.alarms.create('awake', {periodInMinutes: 1});
|
||||||
}
|
}
|
||||||
|
var open = false;
|
||||||
|
chrome.app.window.getAll().forEach(function(appWindow) {
|
||||||
|
open = true;
|
||||||
|
appWindow.close();
|
||||||
|
});
|
||||||
|
|
||||||
storage.fetch();
|
storage.fetch();
|
||||||
storage.onready(function() {
|
storage.onready(function() {
|
||||||
|
@ -52,6 +57,10 @@
|
||||||
|
|
||||||
// initialize the socket and start listening for messages
|
// initialize the socket and start listening for messages
|
||||||
messageReceiver = new textsecure.MessageReceiver(window);
|
messageReceiver = new textsecure.MessageReceiver(window);
|
||||||
|
|
||||||
|
if (open) {
|
||||||
|
openInbox();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onContactReceived(ev) {
|
function onContactReceived(ev) {
|
||||||
|
|
Loading…
Reference in a new issue