From f22ca08b3934f17655c156d6b36f045493a5f246 Mon Sep 17 00:00:00 2001 From: Manuel Araoz Date: Tue, 15 Apr 2014 10:55:50 -0300 Subject: [PATCH] remove WalletFactory file (everything is in Wallet) --- js/models/core/WalletFactory.js | 47 --------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 js/models/core/WalletFactory.js diff --git a/js/models/core/WalletFactory.js b/js/models/core/WalletFactory.js deleted file mode 100644 index 7aace1ca8..000000000 --- a/js/models/core/WalletFactory.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; - -var imports = require('soop').imports(); - -function Wallet(opts) { - opts = opts || {}; - this.host = 'localhost'; - this.port = '3001'; -} - -WalletFactory = function() { - this.storage = copay.Storage.default(); -}; - -WalletFactory.prototype.create = function(config, opts) { - var w = new Wallet(config, opts); - w.store(); - this._addWalletId(w.id); -}; - -WalletFactory.prototype.get = function(walletId) { - return Wallet.read(walletId); -}; - -WalletFactory.prototype.remove = function(walletId) { - // TODO remove wallet contents, not only the id (Wallet.remove?) - this._delWalletId(walletId); -}; - -WalletFactory.prototype._addWalletId = function(walletId) { - var ids = this._getWalletIds(); - if (ids.indexOf(walletId) == -1) return; - localStorage.setItem('walletIds', (ids ? ids + ',' : '') + walletId); -}; - -WalletFactory.prototype._delWalletId = function(walletId) { - var ids = this._getWalletIds(); - var index = ids.indexOf(walletId); - if (index == -1) return; - ids.splice(index, 1); // removes walletId - this.storage.set('walletIds', ids.join(',')); -}; - -WalletFactory.prototype._getWalletIds = function() { - var ids = this.storage.get('walletIds'); - return ids ? ids.split(',') : []; -};