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

@ -2,6 +2,13 @@
<html>
<head>
<meta charset='utf-8'>
<meta content='width=device-width, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0' name='viewport'>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Signal</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href='images/icon_128.png' rel='shortcut icon'>
<link href="stylesheets/manifest.css" rel="stylesheet" type="text/css" />
<script type='text/x-tmpl-mustache' id='app-migration-screen'>
<div class='content'>
<img src='/images/icon_128.png'>
@ -766,5 +773,16 @@
<script type='text/javascript' src='js/background.js'></script>
</head>
<body>
<div class='app-loading-screen'>
<div class='content'>
<img src='/images/icon_128.png'>
<div class='container'>
<span class='dot'></span>
<span class='dot'></span>
<span class='dot'></span>
</div>
<div class='message'>Loading...</div>
</div>
</div>
</body>
</html>

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) {