Merge pull request #2640 from matiu/feat/modal2

Feat/modal2
This commit is contained in:
Gustavo Maximiliano Cortez 2015-04-27 10:12:45 -03:00
commit 6bd35493de
9 changed files with 67 additions and 64 deletions

View file

@ -14,7 +14,7 @@
</div> </div>
<form name="setupForm" ng-submit="create.create(setupForm)" ng-show="!create.loading" novalidate> <form name="setupForm" ng-submit="create.create(setupForm)" novalidate>
<div class="row"> <div class="row">
<div class="large-12 columns"> <div class="large-12 columns">
<div class="box-notification" ng-show="create.error"> <div class="box-notification" ng-show="create.error">

View file

@ -19,7 +19,7 @@
</section> </section>
<section class="middle tab-bar-section"> <section class="middle tab-bar-section">
<h1 class="title ellipsis" ng-style="{'color':index.backgroundColor}"> <h1 class="title ellipsis" ng-style="{'color': noColor ? '#4B6178' : index.backgroundColor}">
{{(titleSection|translate) || index.walletName}} {{(titleSection|translate) || index.walletName}}
</h1> </h1>
</section> </section>

View file

@ -12,7 +12,7 @@
</div> </div>
</div> </div>
<div class="row" ng-show="!join.loading"> <div class="row">
<div class="large-12 columns"> <div class="large-12 columns">
<div class="box-notification" ng-show="join.error "> <div class="box-notification" ng-show="join.error ">

View file

@ -39,7 +39,7 @@
</div> </div>
</div> </div>
<div class="onGoingProcess" ng-show="home.onGoingProcess && !index.anyOnGoingProcess"> <div class="onGoingProcess" ng-show="home.onGoingProcess && !index.anyOnGoingProces && !index.isOffline">
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}"> <div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
<div class="spinner"> <div class="spinner">
<div class="rect1"></div> <div class="rect1"></div>
@ -189,28 +189,25 @@
<!-- Address--> <!-- Address-->
<div class="large-12 columns"> <div class="large-12 columns">
<h2 class="text-center m10t" translate>My Bitcoin address</h2> <h2 class="text-center m10t" translate>My Bitcoin address</h2>
<div ng-show="!home.generatingAddress"> <div >
<div class="text-center" ng-click="home.copyAddress(home.addr)"> <div class="text-center" ng-click="home.copyAddress(home.addr)">
<qrcode size="220" data="bitcoin:{{home.addr}}"></qrcode> <qrcode size="220" data="bitcoin:{{home.addr}}"></qrcode>
<div class="m10t"> <div ng-show="home.generatingAddress" style="position:relative; top:-226px; height:0px">
<h4 ng-class="{'enable_text_select': !index.isCordova}" class="size-12">{{home.addr}}</h4> <div style="height:220px; width:220px; margin:auto; background: url(img/qr.png) white">
</div> <div class="spinner" style="margin-top:80px">
</div> <div class="rect1"></div>
</div> <div class="rect2"></div>
<div ng-show="home.generatingAddress"> <div class="rect3"></div>
<div class="text-center" style="margin-bottom:14px;"> <div class="rect4"></div>
<div style="height:220px; width:220px; margin:auto; background: url(img/qr.png) white"> <div class="rect5"></div>
<div class="spinner" style="margin-top:80px"> </div>
<div class="rect1"></div>
<div class="rect2"></div>
<div class="rect3"></div>
<div class="rect4"></div>
<div class="rect5"></div>
</div> </div>
</div> </div>
<div class="m10t" >
<h4 ng-class="{'enable_text_select': !index.isCordova}" class="size-12">
{{home.generatingAddress ? '...' : home.addr}}
<div class="m10t"> </h4>
<h4 class="size-12">...</h4>
</div> </div>
</div> </div>
</div> </div>
@ -265,7 +262,7 @@
</div> </div>
<div class="row m20t"> <div class="row m20t">
<div class="large-12 large-centered columns"> <div class="large-12 large-centered columns">
<form ng-show="!home.onGoingProcess" name="sendForm" ng-submit="home.submitForm()" ng-disabled="home.blockUx" novalidate> <form name="sendForm" ng-submit="home.submitForm()" ng-disabled="home.blockUx || home.onGoingProcess" novalidate>
<div class="box-notification" ng-show="home.error" ng-click="home.resetError()"> <div class="box-notification" ng-show="home.error" ng-click="home.resetError()">
<span class="text-warning"> <span class="text-warning">
{{home.error|translate}} {{home.error|translate}}

View file

@ -649,7 +649,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.updateAll(); self.updateAll();
$timeout(function() { $timeout(function() {
self.updateTxHistory(); self.updateTxHistory();
}, 5000); }, 3000);
}); });
}); });

View file

@ -145,14 +145,15 @@ angular.module('copayApp.controllers').controller('joinController',
extendedPrivateKey: form.privateKey.$modelValue, extendedPrivateKey: form.privateKey.$modelValue,
myName: form.myName.$modelValue myName: form.myName.$modelValue
}, function(err) { }, function(err) {
self.loading = false;
if (err) { if (err) {
self.loading = false;
self.error = 'Could not join wallet: ' + (err.message ? err.message : err); self.error = 'Could not join wallet: ' + (err.message ? err.message : err);
$rootScope.$apply(); $rootScope.$apply();
return
} }
else { $timeout(function() {
go.walletHome(); go.walletHome();
} }, 2000);
}); });
}, 100); }, 100);
} }

View file

@ -486,17 +486,18 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
message: comment, message: comment,
payProUrl: paypro ? paypro.url : null, payProUrl: paypro ? paypro.url : null,
}, function(err, txp) { }, function(err, txp) {
self.setOngoingProcess();
if (err) { if (err) {
self.setOngoingProcess();
profileService.lockFC(); profileService.lockFC();
return self.setError(err); return self.setError(err);
} }
self.signAndBroadcast(txp, function(err) { self.signAndBroadcast(txp, function(err) {
profileService.lockFC();
if (err) { if (err) {
self.setOngoingProcess();
return self.setError(err); return self.setError(err);
} }
self.resetForm(); self.resetForm();
}); });
}); });
@ -509,43 +510,37 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
self.setOngoingProcess('Signing transaction'); self.setOngoingProcess('Signing transaction');
fc.signTxProposal(txp, function(err, signedTx) { fc.signTxProposal(txp, function(err, signedTx) {
profileService.lockFC(); profileService.lockFC();
self.setOngoingProcess();
if (err) { if (err) {
self.setOngoingProcess();
return cb(err); return cb(err);
} }
if (signedTx.status == 'accepted') { if (signedTx.status == 'accepted') {
self.setOngoingProcess('Broadcasting transaction'); self.setOngoingProcess('Broadcasting transaction');
fc.broadcastTxProposal(signedTx, function(err, btx) { fc.broadcastTxProposal(signedTx, function(err, btx) {
self.setOngoingProcess();
if (err) { if (err) {
self.setOngoingProcess();
$scope.error = 'Transaction not broadcasted. Please try again.'; $scope.error = 'Transaction not broadcasted. Please try again.';
$scope.$digest(); $scope.$digest();
} else { return;
txStatus.notify(btx);
$scope.$emit('Local/TxProposalAction');
} }
return cb(); $scope.$emit('Local/TxProposalAction');
txStatus.notify(btx, function() {
self.setOngoingProcess();
return cb();
});
}); });
} else { } else {
txStatus.notify(signedTx);
$scope.$emit('Local/TxProposalAction'); $scope.$emit('Local/TxProposalAction');
return cb(); txStatus.notify(signedTx, function() {
self.setOngoingProcess();
return cb();
});
} }
}); });
}; };
this.setTopAmount = function() {
throw new Error('todo: setTopAmount');
var form = $scope.sendForm;
if (form) {
form.amount.$setViewValue(w.balanceInfo.topAmount);
form.amount.$render();
form.amount.$isValid = true;
}
};
this.setForm = function(to, amount, comment) { this.setForm = function(to, amount, comment) {
var form = $scope.sendForm; var form = $scope.sendForm;
if (to) { if (to) {

View file

@ -30,11 +30,15 @@ angular
var orig = $delegate[level]; var orig = $delegate[level];
$delegate[level] = function() { $delegate[level] = function() {
var args = [].slice.call(arguments); var args = [].slice.call(arguments);
if (!Array.isArray(args)) args = [args];
args = args.map(function(v) { args = args.map(function(v) {
try { try {
if (typeof v == 'undefined') v = 'undefined'; if (typeof v == 'undefined') v = 'undefined';
if (typeof v == 'object') { if (typeof v == 'object') {
v = JSON.stringify(v); if (v.message)
v = v.message;
else
v = JSON.stringify(v);
} }
v = v.toString(); v = v.toString();
if (v.length > 200) if (v.length > 200)
@ -48,7 +52,7 @@ angular
try { try {
if (window.cordova) if (window.cordova)
console.log(args.join(' ')); console.log(args.join(' '));
orig.apply(null, args) orig.apply(null, args);
historicLog.add(level, args.join(' ')); historicLog.add(level, args.join(' '));
} catch (e) { } catch (e) {
console.log('Error at log decorator:', e); console.log('Error at log decorator:', e);
@ -96,6 +100,7 @@ angular
templateUrl: 'views/createProfile.html', templateUrl: 'views/createProfile.html',
controller: function($scope) { controller: function($scope) {
$scope.mainDark = true; $scope.mainDark = true;
$scope.noColor = true;
} }
} }
} }
@ -120,6 +125,7 @@ angular
templateUrl: 'views/includes/topbar.html', templateUrl: 'views/includes/topbar.html',
controller: function($scope) { controller: function($scope) {
$scope.goBackToState = 'walletHome'; $scope.goBackToState = 'walletHome';
$scope.noColor = true;
} }
} }
}, },
@ -142,6 +148,7 @@ angular
controller: function($scope) { controller: function($scope) {
$scope.titleSection = 'Join shared wallet'; $scope.titleSection = 'Join shared wallet';
$scope.goBackToState = 'add'; $scope.goBackToState = 'add';
$scope.noColor = true;
} }
} }
} }
@ -158,6 +165,7 @@ angular
controller: function($scope) { controller: function($scope) {
$scope.titleSection = 'Import wallet'; $scope.titleSection = 'Import wallet';
$scope.goBackToState = 'add'; $scope.goBackToState = 'add';
$scope.noColor = true;
} }
} }
} }
@ -179,6 +187,7 @@ angular
controller: function($scope) { controller: function($scope) {
$scope.titleSection = 'Import legacy wallet'; $scope.titleSection = 'Import legacy wallet';
$scope.goBackToState = 'add'; $scope.goBackToState = 'add';
$scope.noColor = true;
} }
} }
} }
@ -197,6 +206,7 @@ angular
controller: function($scope) { controller: function($scope) {
$scope.titleSection = 'Create new wallet'; $scope.titleSection = 'Create new wallet';
$scope.goBackToState = 'add'; $scope.goBackToState = 'add';
$scope.noColor = true;
} }
} }
} }
@ -213,12 +223,6 @@ angular
} }
} }
}) })
.state('profile', {
url: '/profile',
controller: 'profileController',
templateUrl: 'views/profile.html',
needProfile: true
})
.state('preferences', { .state('preferences', {
url: '/preferences', url: '/preferences',
templateUrl: 'views/preferences.html', templateUrl: 'views/preferences.html',
@ -250,6 +254,7 @@ angular
controller: function($scope) { controller: function($scope) {
$scope.titleSection = 'Language'; $scope.titleSection = 'Language';
$scope.goBackToState = 'preferences'; $scope.goBackToState = 'preferences';
$scope.noColor = true;
} }
} }
} }
@ -268,6 +273,7 @@ angular
controller: function($scope) { controller: function($scope) {
$scope.titleSection = 'Unit'; $scope.titleSection = 'Unit';
$scope.goBackToState = 'preferences'; $scope.goBackToState = 'preferences';
$scope.noColor = true;
} }
} }
} }
@ -305,6 +311,7 @@ angular
controller: function($scope) { controller: function($scope) {
$scope.titleSection = 'Alternative Currency'; $scope.titleSection = 'Alternative Currency';
$scope.goBackToState = 'preferences'; $scope.goBackToState = 'preferences';
$scope.noColor = true;
} }
} }
} }
@ -323,6 +330,7 @@ angular
controller: function($scope) { controller: function($scope) {
$scope.titleSection = 'Bitcore Wallet Service'; $scope.titleSection = 'Bitcore Wallet Service';
$scope.goBackToState = 'preferences'; $scope.goBackToState = 'preferences';
$scope.noColor = true;
} }
} }
} }
@ -359,6 +367,7 @@ angular
controller: function($scope) { controller: function($scope) {
$scope.titleSection = 'About'; $scope.titleSection = 'About';
$scope.goBackToState = 'preferences'; $scope.goBackToState = 'preferences';
$scope.noColor = true;
} }
} }
} }
@ -377,6 +386,7 @@ angular
controller: function($scope) { controller: function($scope) {
$scope.titleSection = 'Logs'; $scope.titleSection = 'Logs';
$scope.goBackToState = 'about'; $scope.goBackToState = 'about';
$scope.noColor = true;
} }
} }
} }
@ -424,6 +434,7 @@ angular
controller: function($scope) { controller: function($scope) {
$scope.titleSection = 'Add wallet'; $scope.titleSection = 'Add wallet';
$scope.closeToHome = true; $scope.closeToHome = true;
$scope.noColor = true;
} }
} }
} }

View file

@ -1,9 +1,9 @@
'use strict'; 'use strict';
angular.module('copayApp.services').factory('txStatus', function($modal, lodash, profileService) { angular.module('copayApp.services').factory('txStatus', function($modal, lodash, profileService, $timeout) {
var root = {}; var root = {};
root.notify = function(txp) { root.notify = function(txp, cb) {
var fc = profileService.focusedClient; var fc = profileService.focusedClient;
var msg; var msg;
@ -11,8 +11,7 @@ angular.module('copayApp.services').factory('txStatus', function($modal, lodash,
if (status == 'broadcasted') { if (status == 'broadcasted') {
msg = 'Transaction broadcasted'; msg = 'Transaction broadcasted';
} } else {
else {
var action = lodash.find(txp.actions, { var action = lodash.find(txp.actions, {
copayerId: fc.credentials.copayerId copayerId: fc.credentials.copayerId
}); });
@ -25,16 +24,16 @@ angular.module('copayApp.services').factory('txStatus', function($modal, lodash,
} }
} }
if (msg) root.openModal(msg, cb);
root.openModal(msg);
}; };
root.openModal = function(statusStr) { root.openModal = function(statusStr, cb) {
var ModalInstanceCtrl = function($scope, $modalInstance) { var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.statusStr = statusStr; $scope.statusStr = statusStr;
$scope.cancel = function() { $scope.cancel = function() {
$modalInstance.dismiss('cancel'); $modalInstance.dismiss('cancel');
}; };
if (cb) $timeout(cb, 100);
}; };
$modal.open({ $modal.open({
templateUrl: 'views/modals/tx-status.html', templateUrl: 'views/modals/tx-status.html',