Fix blank window after unlink

Don't wait for background init before rendering inbox.

If the client detects that it has become unlinked, it will not call
`init()`, never fire the deferredInit, and never render the inbox,
but we want to allow users access to their local messages even if they
have (perhaps temporarily) unlinked the desktop client.

Also, prefer not to extend Backbone.Model until/unless we really need
it.

// FREEBIE
pull/749/head
lilia 9 years ago
parent ed4991974b
commit 06e53871b2

@ -121,8 +121,6 @@
SERVER_URL, SERVER_PORTS, USERNAME, PASSWORD SERVER_URL, SERVER_PORTS, USERNAME, PASSWORD
); );
deferredInit.resolve(owsDesktopApp);
if (firstRun === true && textsecure.storage.user.getDeviceId() != '1') { if (firstRun === true && textsecure.storage.user.getDeviceId() != '1') {
if (!storage.get('theme-setting') && textsecure.storage.get('userAgent') === 'OWI') { if (!storage.get('theme-setting') && textsecure.storage.get('userAgent') === 'OWI') {
storage.put('theme-setting', 'ios'); storage.put('theme-setting', 'ios');
@ -301,10 +299,7 @@
}); });
} }
var App = Backbone.Model.extend({ window.owsDesktopApp = {
initialize: function(opts) {
this.inboxView = null;
},
getAppView: function(destWindow) { getAppView: function(destWindow) {
var self = this; var self = this;
@ -327,11 +322,7 @@
} }
}); });
} }
}); };
window.owsDesktopApp = new App();
var deferredInit = $.Deferred();
window.initLoading = deferredInit.promise();
})(); })();

@ -17,15 +17,12 @@
function render() { function render() {
extension.windows.getBackground(function(bg) { extension.windows.getBackground(function(bg) {
bg.owsDesktopApp.getAppView(window).then(function(appView) {
var inboxPromise = bg.initLoading.done(function(owsDesktopApp) {
owsDesktopApp.getAppView(window).then(function(appView) {
var bodyEl = document.getElementById('signal-container'); var bodyEl = document.getElementById('signal-container');
bodyEl.innerHTML = ""; bodyEl.innerHTML = "";
bodyEl.append(appView.el); bodyEl.append(appView.el);
}); });
}); });
});
} }
window.addEventListener('onreload', render); window.addEventListener('onreload', render);

Loading…
Cancel
Save