Fix conversations opening from the background
From a notification, for example, we were opening the inbox but not the conversation. // FREEBIE
This commit is contained in:
parent
24a18e91b3
commit
98aed2975c
2 changed files with 24 additions and 7 deletions
|
@ -24,7 +24,14 @@
|
||||||
window.location = '/options.html';
|
window.location = '/options.html';
|
||||||
} else {
|
} else {
|
||||||
extension.windows.getCurrent(function(appWindow) {
|
extension.windows.getCurrent(function(appWindow) {
|
||||||
new bg.Whisper.InboxView({appWindow: appWindow}).$el.prependTo(bg.$('body',document));
|
var view = new bg.Whisper.InboxView({appWindow: appWindow});
|
||||||
|
view.$el.prependTo(bg.$('body',document));
|
||||||
|
window.openConversation = function(conversation) {
|
||||||
|
if (conversation) {
|
||||||
|
view.openConversation(null, {conversation: conversation});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
openConversation(bg.getOpenConversation());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -118,12 +118,6 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function openConversation(conversation) {
|
|
||||||
openInbox();
|
|
||||||
var appWindow = chrome.app.window.get(inboxWindowId);
|
|
||||||
appWindow.contentWindow.trigger('open', {conversation: conversation});
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Inbox window controller */
|
/* Inbox window controller */
|
||||||
var inboxOpened = false;
|
var inboxOpened = false;
|
||||||
var inboxWindowId = 'inbox';
|
var inboxWindowId = 'inbox';
|
||||||
|
@ -164,6 +158,22 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var open;
|
||||||
|
function openConversation(conversation) {
|
||||||
|
if (inboxOpened === true) {
|
||||||
|
var appWindow = chrome.app.window.get(inboxWindowId);
|
||||||
|
appWindow.contentWindow.openConversation(conversation);
|
||||||
|
} else {
|
||||||
|
open = conversation;
|
||||||
|
openInbox();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
window.getOpenConversation = function() {
|
||||||
|
var o = open;
|
||||||
|
open = null;
|
||||||
|
return o;
|
||||||
|
};
|
||||||
|
|
||||||
extension.onLaunched(function() {
|
extension.onLaunched(function() {
|
||||||
storage.onready(function() {
|
storage.onready(function() {
|
||||||
if (textsecure.registration.isDone()) {
|
if (textsecure.registration.isDone()) {
|
||||||
|
|
Loading…
Reference in a new issue