2014-11-09 10:17:26 +00:00
|
|
|
/*global $, Whisper, Backbone, textsecure, extension*/
|
2015-09-07 21:53:43 +00:00
|
|
|
/*
|
|
|
|
* vim: ts=4:sw=4:expandtab
|
2014-05-04 06:34:13 +00:00
|
|
|
*/
|
2014-11-09 10:17:26 +00:00
|
|
|
(function () {
|
2015-09-01 20:04:20 +00:00
|
|
|
'use strict';
|
2014-05-04 06:34:13 +00:00
|
|
|
|
2015-12-07 21:42:19 +00:00
|
|
|
function logError(error) {
|
|
|
|
extension.windows.getBackground(function(bg) {
|
|
|
|
bg.console.log('index.html: ', error);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
window.onerror = function(message, script, line, col, error) {
|
|
|
|
logError(error);
|
|
|
|
};
|
|
|
|
|
2015-09-01 20:04:20 +00:00
|
|
|
var view;
|
2015-05-11 21:22:15 +00:00
|
|
|
|
2015-09-01 20:04:20 +00:00
|
|
|
function render() {
|
|
|
|
extension.windows.getBackground(function(bg) {
|
2015-05-21 20:05:52 +00:00
|
|
|
extension.windows.getCurrent(function(appWindow) {
|
2016-03-18 03:58:56 +00:00
|
|
|
bg.ConversationController.updateInbox().then(function() {
|
|
|
|
try {
|
|
|
|
if (view) { view.remove(); }
|
|
|
|
var $body = bg.$('body',document).empty();
|
|
|
|
view = new bg.Whisper.InboxView({appWindow: appWindow});
|
|
|
|
view.$el.prependTo($body);
|
|
|
|
window.openConversation = function(conversation) {
|
|
|
|
if (conversation) {
|
|
|
|
view.openConversation(null, conversation);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
openConversation(bg.getOpenConversation());
|
|
|
|
} catch (e) {
|
|
|
|
logError(e);
|
|
|
|
}
|
|
|
|
});
|
2015-05-21 20:05:52 +00:00
|
|
|
});
|
2015-09-01 20:04:20 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
window.addEventListener('onreload', render);
|
|
|
|
render();
|
2014-11-09 10:17:26 +00:00
|
|
|
}());
|