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});
|
var prekey = new PreKey({id: keyId});
|
||||||
|
|
||||||
new Promise(function(resolve) {
|
new Promise(function(resolve) {
|
||||||
var accountManager = new textsecure.AccountManager(TEXT_SECURE_SERVER_URL);
|
getAccountManager().refreshPreKeys().then(resolve);
|
||||||
accountManager.refreshPreKeys().then(resolve);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return new Promise(function(resolve) {
|
return new Promise(function(resolve) {
|
||||||
|
|
|
@ -62,6 +62,12 @@
|
||||||
return -1;
|
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.fetch();
|
||||||
storage.onready(function() {
|
storage.onready(function() {
|
||||||
setUnreadCount(storage.get("unreadCount", 0));
|
setUnreadCount(storage.get("unreadCount", 0));
|
||||||
|
@ -74,8 +80,6 @@
|
||||||
init(true);
|
init(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
window.TEXT_SECURE_SERVER_URL = 'https://textsecure-service-staging.whispersystems.org';
|
|
||||||
|
|
||||||
if (open) {
|
if (open) {
|
||||||
openInbox();
|
openInbox();
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
$('#init-setup').show().addClass('in');
|
$('#init-setup').show().addClass('in');
|
||||||
$('#status').text("Connecting...");
|
$('#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() {
|
accountManager.registerSecondDevice(setProvisioningUrl, confirmNumber, incrementCounter).then(function() {
|
||||||
var launch = function() {
|
var launch = function() {
|
||||||
bg.openInbox();
|
bg.openInbox();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue