Show a warning if trying to open same wallet in same browser. Fix redirect to receive.
This commit is contained in:
parent
fe53f1b87c
commit
801e746d11
8 changed files with 93 additions and 6 deletions
|
|
@ -92,6 +92,27 @@ Wallet.prototype.connectToAll = function() {
|
|||
}
|
||||
};
|
||||
|
||||
Wallet.prototype.getIsOpen = function() {
|
||||
return this.storage.getIsOpen(this.id);
|
||||
};
|
||||
|
||||
Wallet.prototype.setIsOpen = function() {
|
||||
return this.storage.setIsOpen(this.id);
|
||||
};
|
||||
|
||||
Wallet.prototype.closeIfOpen = function() {
|
||||
this.storage.removeIsOpen(this.id);
|
||||
};
|
||||
|
||||
Wallet.prototype._checkLocked = function() {
|
||||
if (this.getIsOpen()) {
|
||||
this.isLocked = true;
|
||||
}
|
||||
else {
|
||||
this.setIsOpen();
|
||||
}
|
||||
};
|
||||
|
||||
Wallet.prototype._handleIndexes = function(senderId, data, isInbound) {
|
||||
this.log('RECV INDEXES:', data);
|
||||
var inIndexes = HDParams.fromList(data.indexes);
|
||||
|
|
@ -409,6 +430,9 @@ Wallet.prototype._lockIncomming = function() {
|
|||
Wallet.prototype.netStart = function(callback) {
|
||||
var self = this;
|
||||
var net = this.network;
|
||||
|
||||
this._checkLocked();
|
||||
|
||||
net.removeAllListeners();
|
||||
net.on('connect', self._handleConnect.bind(self));
|
||||
net.on('disconnect', self._handleDisconnect.bind(self));
|
||||
|
|
|
|||
|
|
@ -180,6 +180,18 @@ Storage.prototype.getLastOpened = function() {
|
|||
return this.getGlobal('lastOpened');
|
||||
}
|
||||
|
||||
Storage.prototype.setIsOpen = function(walletId) {
|
||||
this.setGlobal(this._key(walletId, 'isOpen'), true);
|
||||
}
|
||||
|
||||
Storage.prototype.getIsOpen = function(walletId) {
|
||||
return this.getGlobal(this._key(walletId, 'isOpen'));
|
||||
}
|
||||
|
||||
Storage.prototype.removeIsOpen = function(walletId) {
|
||||
this.localStorage.removeItem(this._key(walletId, 'isOpen'));
|
||||
}
|
||||
|
||||
//obj contains keys to be set
|
||||
Storage.prototype.setFromObj = function(walletId, obj) {
|
||||
for (var k in obj) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue