diff --git a/copay.js b/copay.js index ae82ed15a..8da76ebc7 100644 --- a/copay.js +++ b/copay.js @@ -2,5 +2,5 @@ module.exports.Storage = require('./js/models/Storage'); module.exports.PublicKeyRing = require('./js/models/PublicKeyRing'); module.exports.Wallet = require('./js/models/Wallet'); - +module.exports.CopayPeer = require('./js/models/CopayPeer'); module.exports.FakeStorage = require('./test/FakeStorage'); diff --git a/css/main.css b/css/main.css index a7a4c5878..9ceb2b6fc 100644 --- a/css/main.css +++ b/css/main.css @@ -73,12 +73,16 @@ body { .panel { background: #FFFFFF; - padding: 0.25rem 1rem; + padding: 0.7rem 1rem; + border:0; +} + +.panel:hover { + background: #efefef; } .box-backup { margin: 2rem 0; - background: white; padding: 2rem 1rem; } @@ -87,22 +91,32 @@ a.box-backup { color: #111; } -a.box-backup:hover { - color:#666; -} - .box-backup i { margin-bottom: 2rem; display: block; } +p { + margin-bottom: 0.5rem; +} + +.pending button { + margin: 0; +} + +.line { + border-top: 1px solid #ccc; + padding-bottom: 1rem; +} + button.primary { background-color: #111; } button.secondary { background-color: #FAE448 !important; } button.primary:hover { background-color: #333;} button.secondary:hover { background-color: #D7C020 !important;} - +.m0 {margin: 0;} +.db {display: block;} .size-12 { font-size: 12px; } .size-14 { font-size: 14px; } .size-16 { font-size: 16px; } diff --git a/index.html b/index.html index f022894d4..b5942f087 100644 --- a/index.html +++ b/index.html @@ -10,7 +10,8 @@
-Backup to email
diff --git a/js/config.js b/js/config.js index 1d866dd7f..abead97d4 100644 --- a/js/config.js +++ b/js/config.js @@ -2,4 +2,7 @@ var config = { networkName: 'testnet', + p2pApiKey: 'lwjd5qra8257b9', + p2pDebug: 3, + maxPeers: 5, }; diff --git a/js/controllers/header.js b/js/controllers/header.js index 5e510854a..6a2787e54 100644 --- a/js/controllers/header.js +++ b/js/controllers/header.js @@ -32,9 +32,12 @@ angular.module('copay.header').controller('HeaderController', }; $scope.signout = function() { - $rootScope.isLogged = false; Network.disconnect(function() { $location.path('signin'); }); }; + + $scope.clearFlashMessage = function() { + $rootScope.flashMessage = {}; + }; }); diff --git a/js/controllers/signin.js b/js/controllers/signin.js index 42b4183a5..fee00a14a 100644 --- a/js/controllers/signin.js +++ b/js/controllers/signin.js @@ -2,26 +2,52 @@ angular.module('copay.signin').controller('SigninController', function($scope, $rootScope, $location, Network, Storage) { - var peerData = Storage.get('peerData'); + + var peerData = Storage.get($rootScope.walletId, 'peerData'); $scope.loading = false; $rootScope.peerId = peerData ? peerData.peerId : null; + $scope.listWalletIds = function() { + return Storage.getWalletIds(); + }; + $scope.create = function() { $scope.loading = true; + Network.createWallet(); Network.init(function() { $location.path('peer'); + $rootScope.$digest(); }); }; + $scope.open = function(walletId) { + $scope.loading = true; + + if (Network.openWallet(walletId)) { + Network.init(function() { + $location.path('peer'); + $rootScope.$digest(); + }); + } + }; + $scope.join = function(cid) { $scope.loading = true; if (cid) { Network.init(function() { - Network.connect(cid, function() { - $location.path('peer'); + Network.connect(cid, + function() { + $location.path('peer'); + $rootScope.$digest(); + }, function() { + +console.log('[signin.js.46] SETTING MESSAGE'); //TODO + $rootScope.flashMessage = { message: 'Connection refussed', type: 'error'}; + $location.path('home'); + $rootScope.$digest(); }); }); } diff --git a/js/copayBundle.js b/js/copayBundle.js new file mode 100644 index 000000000..b1dfb62b1 --- /dev/null +++ b/js/copayBundle.js @@ -0,0 +1,2958 @@ +require= +// modules are defined as an array +// [ module function, map of requireuires ] +// +// map of requireuires is short require name -> numeric require +// +// anything defined in a previous bundle is accessed via the +// orig method which is the requireuire for previous bundles +(function outer (modules, cache, entry) { + // Save the require from previous bundle to this closure if any + var previousRequire = typeof require == "function" && require; + + function newRequire(name, jumped, inSkipCache){ + + var m, skipCache = inSkipCache; + if (typeof name === 'string') { + if (name.charAt(0) === '!' ) { + name = name.substr(1); + skipCache=true; + } + } + if(skipCache || !cache[name]) { + if(!modules[name]) { + // if we cannot find the the module within our internal map or + // cache jump to the current global require ie. the last bundle + // that was added to the page. + var currentRequire = typeof require == "function" && require; + if (!jumped && currentRequire) return currentRequire(name, true); + + // If there are other bundles on this page the require from the + // previous one is saved to 'previousRequire'. Repeat this as + // many times as there are bundles until the module is found or + // we exhaust the require chain. + if (previousRequire) return previousRequire(name, true); + throw new Error('Cannot find module \'' + name + '\''); + } + + m = {exports:{}}; + var nextSkipCache = inSkipCache ? false : skipCache; + if (!skipCache) cache[name] = m; + skipCache = false; + modules[name][0].call(m.exports, function(x){ + var id = modules[name][1][x]; + return newRequire(id ? id : x, false, nextSkipCache); + },m,m.exports,outer,modules,cache,entry); + } + return m ? m.exports:cache[name].exports; + } + for(var i=0;i