Let background page instantiate AccountManagers
Remove the need to expose the server url config as a global. // FREEBIE
This commit is contained in:
parent
edd76ec65a
commit
e626355e0c
3 changed files with 8 additions and 5 deletions
|
@ -123,8 +123,7 @@
|
|||
var prekey = new PreKey({id: keyId});
|
||||
|
||||
new Promise(function(resolve) {
|
||||
var accountManager = new textsecure.AccountManager(TEXT_SECURE_SERVER_URL);
|
||||
accountManager.refreshPreKeys().then(resolve);
|
||||
getAccountManager().refreshPreKeys().then(resolve);
|
||||
});
|
||||
|
||||
return new Promise(function(resolve) {
|
||||
|
|
|
@ -62,6 +62,12 @@
|
|||
return -1;
|
||||
}
|
||||
};
|
||||
window.getAccountManager = function() {
|
||||
var USERNAME = storage.get('number_id');
|
||||
var PASSWORD = storage.get('password');
|
||||
return new textsecure.AccountManager(SERVER_URL, USERNAME, PASSWORD);
|
||||
};
|
||||
|
||||
storage.fetch();
|
||||
storage.onready(function() {
|
||||
setUnreadCount(storage.get("unreadCount", 0));
|
||||
|
@ -74,8 +80,6 @@
|
|||
init(true);
|
||||
});
|
||||
|
||||
window.TEXT_SECURE_SERVER_URL = 'https://textsecure-service-staging.whispersystems.org';
|
||||
|
||||
if (open) {
|
||||
openInbox();
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
$('#init-setup').show().addClass('in');
|
||||
$('#status').text("Connecting...");
|
||||
|
||||
var accountManager = new bg.textsecure.AccountManager(bg.TEXT_SECURE_SERVER_URL);
|
||||
var accountManager = new bg.getAccountManager();
|
||||
accountManager.registerSecondDevice(setProvisioningUrl, confirmNumber, incrementCounter).then(function() {
|
||||
var launch = function() {
|
||||
bg.openInbox();
|
||||
|
|
Loading…
Add table
Reference in a new issue