Merge index.html into background.html

Nothing stops us from rendering the inbox in the background page, since
it is no longer a background page at all. TODO: intercept window close
events to hide this window instead of closing it unless the app is quit
explicitly.

// FREEBIE
This commit is contained in:
lilia 2017-03-09 10:40:47 -08:00 committed by Scott Nonnenberg
parent 859d49b3f4
commit 5a6e65d11b
No known key found for this signature in database
GPG key ID: A4931C09644C654B
2 changed files with 23 additions and 34 deletions

View file

@ -47,41 +47,12 @@
console.log('open inbox');
if (inboxOpened === false) {
inboxOpened = true;
extension.windows.open({
id: 'inbox',
url: 'index.html',
focused: true,
width: 580,
height: 440,
minWidth: 600,
minHeight: 360
}, function (windowInfo) {
appWindow = windowInfo;
inboxWindowId = appWindow.id;
appWindow.contentWindow.addEventListener('load', function() {
setUnreadCount(storage.get("unreadCount", 0));
});
appWindow.onClosed.addListener(function () {
inboxOpened = false;
appWindow = null;
});
appWindow.contentWindow.addEventListener('blur', function() {
inboxFocused = false;
});
appWindow.contentWindow.addEventListener('focus', function() {
inboxFocused = true;
clearAttention();
});
// close the inbox if background.html is refreshed
extension.windows.onSuspend(function() {
// TODO: reattach after reload instead of closing.
extension.windows.remove(inboxWindowId);
});
owsDesktopApp.getAppView(window).then(function(appView) {
var bodyEl = $('body');
bodyEl.innerHTML = "";
bodyEl.append(appView.el);
});
owsDesktopApp.openConversation(getOpenConversation());
} else if (inboxOpened === true) {
extension.windows.focus(inboxWindowId, function (error) {
if (error) {