From 8e031a83adeaa2a920f8f3b8c97d86535552adae Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Fri, 12 Aug 2016 10:54:31 -0300 Subject: [PATCH] add app config --- .gitignore | 2 +- app-template/copay/appConfig.json | 21 +++++++++++ src/js/controllers/tab-home.js | 61 +++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 app-template/copay/appConfig.json create mode 100644 src/js/controllers/tab-home.js diff --git a/.gitignore b/.gitignore index 06fdf1546..81e6b9838 100644 --- a/.gitignore +++ b/.gitignore @@ -107,7 +107,7 @@ public/lib/* public/js/* ## templates -appConfig.json +./appConfig.json cordova/Makefile cordova/ProjectMakefile app-template/bpapp diff --git a/app-template/copay/appConfig.json b/app-template/copay/appConfig.json new file mode 100644 index 000000000..8b7046f9e --- /dev/null +++ b/app-template/copay/appConfig.json @@ -0,0 +1,21 @@ +{ + + "name": "copay", + "nameNoSpace": "copay", + "nameCase": "Copay", + "nameCaseNoSpace": "Copay", + "url": "https://copay.io", + "appDescription": "Copay Bitcoin Wallet", + "winAppName": "CopayWallet", + "wpPublisherId": "{31cdd08b-457c-413d-b440-f6665eec847d}", + "wpProductId": "{5381aa50-9069-11e4-84cc-293caf9cbdc8}", + "description": "A Secure Bitcoin Wallet", + "version": "2.5.0", + "androidVersion": "115", + "_extraCSS": null, + "_enabledExtensions": { + "coinbase": true, + "glidera": true, + "amazon": true + } +} diff --git a/src/js/controllers/tab-home.js b/src/js/controllers/tab-home.js new file mode 100644 index 000000000..3acea1dc7 --- /dev/null +++ b/src/js/controllers/tab-home.js @@ -0,0 +1,61 @@ +'use strict'; + +angular.module('copayApp.controllers').controller('tabHomeController', + function($rootScope, $timeout, $scope, lodash, profileService, walletService, configService ) { + var self = this; + + + // wallet list change + $rootScope.$on('Local/WalletListUpdated', function(event) { + self.walletSelection = false; + self.setWallets(); + }); + + $rootScope.$on('Local/ColorUpdated', function(event) { + self.setWallets(); + }); + + $rootScope.$on('Local/AliasUpdated', function(event) { + self.setWallets(); + }); + + self.setWallets = function() { + if (!profileService.profile) return; + + var config = configService.getSync(); + config.colorFor = config.colorFor || {}; + config.aliasFor = config.aliasFor || {}; + + // Sanitize empty wallets (fixed in BWC 1.8.1, and auto fixed when wallets completes) + var credentials = lodash.filter(profileService.profile.credentials, 'walletName'); + var ret = lodash.map(credentials, function(c) { + return { + m: c.m, + n: c.n, + name: config.aliasFor[c.walletId] || c.walletName, + id: c.walletId, + color: config.colorFor[c.walletId] || '#4A90E2', + }; + }); + + $scope.wallets = lodash.sortBy(ret, 'name'); + }; + self.updateAllClients = function() { + lodash.each(profileService.getClients(), function(client) { + walletService.updateStatus(client, {}, function(err, status) { + if (err) +console.log('[tab-home.js.47]', err); //TODO +console.log('[tab-home.js.47:console:]',status); //TODO + + + }); + }); + } + + self.setWallets(); + self.updateAllClients(); + $scope.bitpayCardEnabled = true; // TODO + + + + });