ionic modals in coinbase and glidera and delete confirmation

This commit is contained in:
Gabriel Bazán 2016-06-10 15:16:02 -03:00
commit d2bdca00f4
28 changed files with 566 additions and 717 deletions

View file

@ -24,7 +24,7 @@
</div> </div>
</div> </div>
<div class="row m20t" <div class="row m20ti"
ng-show="index.coinbaseAccount && !buy.buyInfo && !buy.receiveInfo"> ng-show="index.coinbaseAccount && !buy.buyInfo && !buy.receiveInfo">
<div class="columns"> <div class="columns">
@ -105,7 +105,7 @@
</div> </div>
</div> </div>
<div class="m20t row" ng-show="buy.receiveInfo && !buy.sellInfo && !buy.success"> <div class="m20ti row" ng-show="buy.receiveInfo && !buy.sellInfo && !buy.success">
<div class="columns"> <div class="columns">
<h1>Funds sent to Copay Wallet</h1> <h1>Funds sent to Copay Wallet</h1>
<p class="size-12 text-gray"> <p class="size-12 text-gray">

View file

@ -10,7 +10,7 @@
</a> </a>
</section> </section>
<section class="right-small"> <section class="right-small" ng-show="index.coinbaseAccount">
<a class="p10" ng-click="$root.go('preferencesCoinbase')"> <a class="p10" ng-click="$root.go('preferencesCoinbase')">
<i class="fi-widget size-24"></i> <i class="fi-widget size-24"></i>
</a> </a>

View file

@ -1,3 +1,4 @@
<ion-modal-view ng-controller="coinbaseConfirmationController">
<div class="m20tp text-center"> <div class="m20tp text-center">
<div class="row"> <div class="row">
<h1 class="text-center m20b p20h">Are you sure you would like to log out of your Coinbase account?</h1> <h1 class="text-center m20b p20h">Are you sure you would like to log out of your Coinbase account?</h1>
@ -14,3 +15,4 @@
</div> </div>
</div> </div>
</div> </div>
</ion-modal-view>

View file

@ -1,4 +1,5 @@
<nav class="tab-bar"> <ion-modal-view ng-controller="coinbaseTxDetailsController">
<nav class="tab-bar" ng-style="{'background-color': '#2b71b1'}">
<section class="left-small"> <section class="left-small">
<a ng-click="cancel()"> <a ng-click="cancel()">
<i class="icon-arrow-left3 icon-back"></i> <i class="icon-arrow-left3 icon-back"></i>
@ -12,9 +13,8 @@
</section> </section>
</nav> </nav>
<div class="modal-content fix-modals-touch" <ion-content overflow-scroll="true">
ng-swipe-disable-mouse <div class="modal-content fix-modals-touch">
ng-swipe-right="cancel()">
<div class="header-modal bg-gray text-center"> <div class="header-modal bg-gray text-center">
<div class="p20"> <div class="p20">
<img src="img/bought.svg" alt="bought" width="65" ng-show="(tx.type == 'buy' || (tx.type == 'send' && tx.to)) && tx.status == 'completed'"> <img src="img/bought.svg" alt="bought" width="65" ng-show="(tx.type == 'buy' || (tx.type == 'send' && tx.to)) && tx.status == 'completed'">
@ -95,7 +95,7 @@
This action will remove the transaction. This action will remove the transaction.
</p> </p>
<button class="button outline round dark-gray expand tiny" <button class="button outline round dark-gray expand tiny"
ng-click="remove(tx);" ng-click="remove();"
ng-disabled="loading"> ng-disabled="loading">
<i class="fi-x"></i> <i class="fi-x"></i>
Remove Remove
@ -105,3 +105,5 @@
<div class="extra-margin-bottom"></div> <div class="extra-margin-bottom"></div>
</div> </div>
</ion-content>
</ion-modal-view>

View file

@ -1,3 +1,4 @@
<ion-modal-view ng-controller="confirmationController">
<div class="m20tp text-center"> <div class="m20tp text-center">
<div class="row"> <div class="row">
<h1 class="text-center m20b p20">{{title|translate}}</h1> <h1 class="text-center m20b p20">{{title|translate}}</h1>
@ -14,3 +15,4 @@
</div> </div>
</div> </div>
</div> </div>
</ion-modal-view>

View file

@ -1,3 +1,4 @@
<ion-modal-view ng-controller="glideraConfirmationController">
<div class="m20tp text-center"> <div class="m20tp text-center">
<div class="row"> <div class="row">
<h1 class="text-center m20b p20h">Are you sure you would like to log out of your Glidera account?</h1> <h1 class="text-center m20b p20h">Are you sure you would like to log out of your Glidera account?</h1>
@ -14,3 +15,4 @@
</div> </div>
</div> </div>
</div> </div>
</ion-modal-view>

View file

@ -1,3 +1,4 @@
<ion-modal-view ng-controller="glideraTxDetailsController">
<nav class="tab-bar"> <nav class="tab-bar">
<section class="left-small"> <section class="left-small">
<a ng-click="cancel()"> <a ng-click="cancel()">
@ -12,9 +13,8 @@
</section> </section>
</nav> </nav>
<div class="modal-content fix-modals-touch" <ion-content overflow-scroll="true">
ng-swipe-disable-mouse <div class="modal-content fix-modals-touch">
ng-swipe-right="cancel()">
<div class="header-modal bg-gray text-center"> <div class="header-modal bg-gray text-center">
<div class="p20"> <div class="p20">
<img src="img/bought.svg" alt="bought" width="80" ng-show="tx.type == 'BUY' && tx.status == 'COMPLETE'"> <img src="img/bought.svg" alt="bought" width="80" ng-show="tx.type == 'BUY' && tx.status == 'COMPLETE'">
@ -66,3 +66,5 @@
</ul> </ul>
<div class="extra-margin-bottom"></div> <div class="extra-margin-bottom"></div>
</div> </div>
</ion-content>
</ion-modal-view>

View file

@ -1,3 +1,4 @@
<ion-modal-view ng-controller="walletsController">
<nav class="tab-bar"> <nav class="tab-bar">
<section class="left-small"> <section class="left-small">
<a ng-click="cancel()" class="p10"> <a ng-click="cancel()" class="p10">
@ -13,7 +14,8 @@
</section> </section>
</nav> </nav>
<div class="modal-content"> <ion-content class="m20t" overflow-scroll="true">
<div class="modal-content m20t">
<div ng-show="type == 'SELL'"> <div ng-show="type == 'SELL'">
<h4 class="title m0 oh"> <h4 class="title m0 oh">
<div class="left"> <div class="left">
@ -24,6 +26,10 @@
</div> </div>
</h4> </h4>
</div> </div>
<div ng-show="type != 'SELL'">
<h4 class="title m0 oh">
</h4>
</div>
<ul class="no-bullet"> <ul class="no-bullet">
<li class="line-b" ng-repeat="w in wallets"> <li class="line-b" ng-repeat="w in wallets">
<a ng-click="selectWallet(w.id, w.name)" class="db oh"> <a ng-click="selectWallet(w.id, w.name)" class="db oh">
@ -40,3 +46,5 @@
</ul> </ul>
<div class="extra-margin-bottom"></div> <div class="extra-margin-bottom"></div>
</div> </div>
</ion-content>
</ion-modal-view>

View file

@ -24,7 +24,7 @@
</div> </div>
</div> </div>
<div class="row m20t" <div class="row m20ti"
ng-show="index.coinbaseAccount && !sell.sellInfo && !sell.sendInfo"> ng-show="index.coinbaseAccount && !sell.sellInfo && !sell.sendInfo">
<div class="columns"> <div class="columns">
<form <form
@ -141,7 +141,7 @@
</div> </div>
</div> </div>
<div class="m20t row" ng-show="sell.sendInfo && !sell.sellInfo && !sell.success"> <div class="m20ti row" ng-show="sell.sendInfo && !sell.sellInfo && !sell.success">
<div class="columns"> <div class="columns">
<h1>Funds sent to Coinbase Account</h1> <h1>Funds sent to Coinbase Account</h1>
<p class="size-12 text-gray"> <p class="size-12 text-gray">

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('buyCoinbaseController', angular.module('copayApp.controllers').controller('buyCoinbaseController',
function($scope, $modal, $log, $timeout, lodash, profileService, coinbaseService, animationService, bwsError, addressService) { function($scope, $modal, $log, $ionicModal, $timeout, lodash, profileService, coinbaseService, bwsError, addressService) {
window.ignoreMobilePause = true; window.ignoreMobilePause = true;
var self = this; var self = this;
@ -62,48 +62,20 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController',
$scope.openWalletsModal = function(wallets) { $scope.openWalletsModal = function(wallets) {
self.error = null; self.error = null;
var ModalInstanceCtrl = function($scope, $modalInstance) { self.selectedWalletId = null;
self.selectedWalletName = null;
$scope.type = 'BUY'; $scope.type = 'BUY';
$scope.wallets = wallets; $scope.wallets = wallets;
$scope.noColor = true; $scope.noColor = true;
$scope.cancel = function() { $scope.self = self;
$modalInstance.dismiss('cancel');
};
$scope.selectWallet = function(walletId, walletName) { $ionicModal.fromTemplateUrl('views/modals/wallets.html', {
var client = profileService.getClient(walletId); scope: $scope,
profileService.isReady(client, function(err) { animation: 'slide-in-up'
if (err) { }).then(function(modal) {
self.error = {errors: [{ message: err }]}; $scope.walletsModal = modal;
$modalInstance.dismiss('cancel'); $scope.walletsModal.show();
} else {
$modalInstance.close({
'walletId': walletId,
'walletName': walletName,
});
}
});
};
};
var modalInstance = $modal.open({
templateUrl: 'views/modals/wallets.html',
windowClass: animationService.modalAnimated.slideUp,
controller: ModalInstanceCtrl,
});
modalInstance.result.finally(function() {
var m = angular.element(document.getElementsByClassName('reveal-modal'));
m.addClass(animationService.modalAnimated.slideOutDown);
});
modalInstance.result.then(function(obj) {
$timeout(function() {
self.selectedWalletId = obj.walletId;
self.selectedWalletName = obj.walletName;
fc = profileService.getClient(obj.walletId);
$scope.$apply();
}, 100);
}); });
}; };
@ -149,7 +121,11 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController',
addressService.getAddress(self.selectedWalletId, false, function(err, addr) { addressService.getAddress(self.selectedWalletId, false, function(err, addr) {
if (err) { if (err) {
self.loading = null; self.loading = null;
self.error = {errors: [{ message: 'Could not create address' }]}; self.error = {
errors: [{
message: 'Could not create address'
}]
};
return; return;
} }
updatedTx.data['toAddr'] = addr; updatedTx.data['toAddr'] = addr;
@ -190,7 +166,9 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController',
self.receiveInfo = res.data; self.receiveInfo = res.data;
if (!res.data.id) return; if (!res.data.id) return;
coinbaseService.getTransaction(token, accountId, res.data.id, function(err, sendTx) { coinbaseService.getTransaction(token, accountId, res.data.id, function(err, sendTx) {
coinbaseService.savePendingTransaction(tx, {remove: true}, function(err) { coinbaseService.savePendingTransaction(tx, {
remove: true
}, function(err) {
coinbaseService.savePendingTransaction(sendTx.data, {}, function(err) { coinbaseService.savePendingTransaction(sendTx.data, {}, function(err) {
$timeout(function() { $timeout(function() {
$scope.$emit('Local/CoinbaseTx'); $scope.$emit('Local/CoinbaseTx');

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('buyGlideraController', angular.module('copayApp.controllers').controller('buyGlideraController',
function($scope, $timeout, $modal, profileService, addressService, glideraService, bwsError, lodash, animationService) { function($scope, $timeout, $modal, $ionicModal, profileService, addressService, glideraService, bwsError, lodash) {
var self = this; var self = this;
this.show2faCodeInput = null; this.show2faCodeInput = null;
@ -41,47 +41,18 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
self.error = null; self.error = null;
self.selectedWalletId = null; self.selectedWalletId = null;
self.selectedWalletName = null; self.selectedWalletName = null;
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.type = 'BUY'; $scope.type = 'BUY';
$scope.wallets = wallets; $scope.wallets = wallets;
$scope.noColor = true; $scope.noColor = true;
$scope.cancel = function() { $scope.self = self;
$modalInstance.dismiss('cancel');
};
$scope.selectWallet = function(walletId, walletName) { $ionicModal.fromTemplateUrl('views/modals/wallets.html', {
var client = profileService.getClient(walletId); scope: $scope,
profileService.isReady(client, function(err) { animation: 'slide-in-up'
if (err) { }).then(function(modal) {
self.error = err; $scope.walletsModal = modal;
$modalInstance.dismiss('cancel'); $scope.walletsModal.show();
return;
}
$modalInstance.close({
'walletId': walletId,
'walletName': walletName,
});
});
};
};
var modalInstance = $modal.open({
templateUrl: 'views/modals/wallets.html',
windowClass: animationService.modalAnimated.slideUp,
controller: ModalInstanceCtrl,
});
modalInstance.result.finally(function() {
var m = angular.element(document.getElementsByClassName('reveal-modal'));
m.addClass(animationService.modalAnimated.slideOutDown);
});
modalInstance.result.then(function(obj) {
$timeout(function() {
self.selectedWalletId = obj.walletId;
self.selectedWalletName = obj.walletName;
$scope.$apply();
}, 100);
}); });
}; };

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('coinbaseController', angular.module('copayApp.controllers').controller('coinbaseController',
function($rootScope, $scope, $timeout, $modal, profileService, configService, storageService, coinbaseService, animationService, lodash, platformInfo) { function($rootScope, $scope, $timeout, $modal, $ionicModal, profileService, configService, storageService, coinbaseService, lodash, platformInfo) {
var isNW = platformInfo.isNW; var isNW = platformInfo.isNW;
window.ignoreMobilePause = true; window.ignoreMobilePause = true;
@ -46,8 +46,7 @@ angular.module('copayApp.controllers').controller('coinbaseController',
$timeout(function() { $timeout(function() {
$scope.$apply(); $scope.$apply();
}, 100); }, 100);
} } else if (data && data.access_token && data.refresh_token) {
else if (data && data.access_token && data.refresh_token) {
storageService.setCoinbaseToken(network, data.access_token, function() { storageService.setCoinbaseToken(network, data.access_token, function() {
storageService.setCoinbaseRefreshToken(network, data.refresh_token, function() { storageService.setCoinbaseRefreshToken(network, data.refresh_token, function() {
$scope.$emit('Local/CoinbaseUpdated', data.access_token); $scope.$emit('Local/CoinbaseUpdated', data.access_token);
@ -62,44 +61,14 @@ angular.module('copayApp.controllers').controller('coinbaseController',
}; };
this.openTxModal = function(tx) { this.openTxModal = function(tx) {
$rootScope.modalOpened = true;
var self = this;
var config = configService.getSync().wallet.settings;
var fc = profileService.focusedClient;
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.tx = tx; $scope.tx = tx;
$scope.settings = config;
$scope.color = fc.backgroundColor;
$scope.noColor = true;
$scope.remove = function() { $ionicModal.fromTemplateUrl('views/modals/coinbase-tx-details.html', {
coinbaseService.savePendingTransaction($scope.tx, {remove: true}, function(err) { scope: $scope,
$rootScope.$emit('Local/CoinbaseTx'); animation: 'slide-in-up'
$scope.cancel(); }).then(function(modal) {
}); $scope.coinbaseTxDetailsModal = modal;
}; $scope.coinbaseTxDetailsModal.show();
$scope.cancel = lodash.debounce(function() {
$modalInstance.dismiss('cancel');
}, 0, 1000);
};
var modalInstance = $modal.open({
templateUrl: 'views/modals/coinbase-tx-details.html',
windowClass: animationService.modalAnimated.slideRight,
controller: ModalInstanceCtrl,
});
var disableCloseModal = $rootScope.$on('closeModal', function() {
modalInstance.dismiss('cancel');
});
modalInstance.result.finally(function() {
$rootScope.modalOpened = false;
disableCloseModal();
var m = angular.element(document.getElementsByClassName('reveal-modal'));
m.addClass(animationService.modalAnimated.slideOutRight);
}); });
}; };

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('copayersController', angular.module('copayApp.controllers').controller('copayersController',
function($scope, $rootScope, $timeout, $log, $modal, profileService, go, notification, platformInfo, gettext, gettextCatalog, animationService) { function($scope, $rootScope, $timeout, $log, $modal, $ionicModal, profileService, go, notification, platformInfo, gettext, gettextCatalog) {
var self = this; var self = this;
var isCordova = platformInfo.isCordova; var isCordova = platformInfo.isCordova;
var isWP = platformInfo.isWP; var isWP = platformInfo.isWP;
@ -27,35 +27,19 @@ angular.module('copayApp.controllers').controller('copayersController',
}; };
var _modalDeleteWallet = function() { var _modalDeleteWallet = function() {
var ModalInstanceCtrl = function($scope, $modalInstance, gettext) {
$scope.title = delete_msg; $scope.title = delete_msg;
$scope.accept_msg = accept_msg;
$scope.cancel_msg = cancel_msg;
$scope.confirm_msg = confirm_msg;
$scope.okAction = doDeleteWallet;
$scope.loading = false; $scope.loading = false;
$scope.ok = function() { $ionicModal.fromTemplateUrl('views/modals/confirmation.html', {
$scope.loading = true; scope: $scope,
$modalInstance.close(accept_msg); animation: 'slide-in-up'
}).then(function(modal) {
}; $scope.confirmationModal = modal;
$scope.cancel = function() { $scope.confirmationModal.show();
$modalInstance.dismiss(cancel_msg);
};
};
var modalInstance = $modal.open({
templateUrl: 'views/modals/confirmation.html',
windowClass: animationService.modalAnimated.slideUp,
controller: ModalInstanceCtrl
});
modalInstance.result.finally(function() {
var m = angular.element(document.getElementsByClassName('reveal-modal'));
m.addClass(animationService.modalAnimated.slideOutDown);
});
modalInstance.result.then(function(ok) {
if (ok) {
doDeleteWallet();
}
}); });
}; };

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('glideraController', angular.module('copayApp.controllers').controller('glideraController',
function($rootScope, $scope, $timeout, $modal, profileService, configService, storageService, glideraService, animationService, lodash) { function($rootScope, $scope, $timeout, $modal, $ionicModal, profileService, configService, storageService, glideraService, lodash) {
this.getAuthenticateUrl = function() { this.getAuthenticateUrl = function() {
return glideraService.getOauthCodeUrl(); return glideraService.getOauthCodeUrl();
@ -21,8 +21,7 @@ angular.module('copayApp.controllers').controller('glideraController',
$timeout(function() { $timeout(function() {
$scope.$apply(); $scope.$apply();
}, 100); }, 100);
} } else if (data && data.access_token) {
else if (data && data.access_token) {
storageService.setGlideraToken(network, data.access_token, function() { storageService.setGlideraToken(network, data.access_token, function() {
$scope.$emit('Local/GlideraUpdated', data.access_token); $scope.$emit('Local/GlideraUpdated', data.access_token);
$timeout(function() { $timeout(function() {
@ -35,41 +34,23 @@ angular.module('copayApp.controllers').controller('glideraController',
}; };
this.openTxModal = function(token, tx) { this.openTxModal = function(token, tx) {
$rootScope.modalOpened = true;
var self = this; var self = this;
var config = configService.getSync().wallet.settings;
var fc = profileService.focusedClient; $scope.self = self;
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.tx = tx; $scope.tx = tx;
$scope.settings = config;
$scope.color = fc.backgroundColor;
$scope.noColor = true;
glideraService.getTransaction(token, tx.transactionUuid, function(error, tx) { glideraService.getTransaction(token, tx.transactionUuid, function(error, tx) {
$scope.tx = tx; $scope.tx = tx;
}); });
$scope.cancel = lodash.debounce(function() { $ionicModal.fromTemplateUrl('views/modals/glidera-tx-details.html', {
$modalInstance.dismiss('cancel'); scope: $scope,
}, 0, 1000); backdropClickToClose: false,
hardwareBackButtonClose: false,
}; animation: 'slide-in-up'
}).then(function(modal) {
var modalInstance = $modal.open({ $scope.glideraTxDetailsModal = modal;
templateUrl: 'views/modals/glidera-tx-details.html', $scope.glideraTxDetailsModal.show();
windowClass: animationService.modalAnimated.slideRight,
controller: ModalInstanceCtrl,
});
var disableCloseModal = $rootScope.$on('closeModal', function() {
modalInstance.dismiss('cancel');
});
modalInstance.result.finally(function() {
$rootScope.modalOpened = false;
disableCloseModal();
var m = angular.element(document.getElementsByClassName('reveal-modal'));
m.addClass(animationService.modalAnimated.slideOutRight);
}); });
}; };

View file

@ -0,0 +1,20 @@
'use strict';
angular.module('copayApp.controllers').controller('coinbaseConfirmationController', function($scope, $timeout, coinbaseService, applicationService) {
$scope.ok = function() {
coinbaseService.logout($scope.network, function() {
$timeout(function() {
applicationService.restart();
}, 1000);
});
$scope.cancel();
};
$scope.cancel = function() {
$scope.coinbaseConfirmationModal.hide();
};
});

View file

@ -0,0 +1,18 @@
'use strict';
angular.module('copayApp.controllers').controller('coinbaseTxDetailsController', function($scope, coinbaseService) {
$scope.remove = function() {
coinbaseService.savePendingTransaction($scope.tx, {
remove: true
}, function(err) {
$rootScope.$emit('Local/CoinbaseTx');
$scope.cancel();
});
};
$scope.cancel = function() {
$scope.coinbaseTxDetailsModal.hide();
};
});

View file

@ -0,0 +1,15 @@
'use strict';
angular.module('copayApp.controllers').controller('confirmationController', function($scope) {
$scope.ok = function() {
$scope.loading = true;
$scope.okAction();
$scope.cancel();
};
$scope.cancel = function() {
$scope.confirmationModal.hide();
};
});

View file

@ -0,0 +1,18 @@
'use strict';
angular.module('copayApp.controllers').controller('glideraConfirmationController', function($scope, $timeout, storageService, applicationService) {
$scope.ok = function() {
storageService.removeGlideraToken($scope.network, function() {
$timeout(function() {
applicationService.restart();
}, 100);
});
$scope.cancel();
};
$scope.cancel = function() {
$scope.glideraConfirmationModal.hide();
};
});

View file

@ -0,0 +1,9 @@
'use strict';
angular.module('copayApp.controllers').controller('glideraTxDetailsController', function($scope) {
$scope.cancel = function() {
$scope.glideraTxDetailsModal.hide();
};
});

View file

@ -0,0 +1,30 @@
'use strict';
angular.module('copayApp.controllers').controller('walletsController', function($scope, bwsError, profileService) {
var self = $scope.self;
$scope.selectWallet = function(walletId, walletName) {
if (!profileService.getClient(walletId).isComplete()) {
self.error = bwsError.msg({
'code': 'WALLET_NOT_COMPLETE'
}, 'Could not choose the wallet');
self.error = {
errors: [{
message: 'The Wallet could not be selected'
}]
};
$scope.cancel();
return;
}
self.selectedWalletId = walletId;
self.selectedWalletName = walletName;
self.fc = profileService.getClient(self.selectedWalletId);
$scope.cancel();
};
$scope.cancel = function() {
$scope.walletsModal.hide();
};
});

View file

@ -1,38 +1,17 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesCoinbaseController', angular.module('copayApp.controllers').controller('preferencesCoinbaseController',
function($scope, $modal, $timeout, applicationService, coinbaseService, animationService) { function($scope, $modal, $timeout, $ionicModal, applicationService, coinbaseService) {
this.revokeToken = function(testnet) { this.revokeToken = function(testnet) {
var network = testnet ? 'testnet' : 'livenet'; $scope.network = testnet ? 'testnet' : 'livenet';
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.ok = function() {
$modalInstance.close(true);
};
$scope.cancel = function() {
$modalInstance.dismiss();
};
};
var modalInstance = $modal.open({ $ionicModal.fromTemplateUrl('views/modals/coinbase-confirmation.html', {
templateUrl: 'views/modals/coinbase-confirmation.html', scope: $scope,
windowClass: animationService.modalAnimated.slideRight, animation: 'slide-in-up'
controller: ModalInstanceCtrl }).then(function(modal) {
}); $scope.coinbaseConfirmationModal = modal;
$scope.coinbaseConfirmationModal.show();
modalInstance.result.then(function(ok) {
if (ok) {
coinbaseService.logout(network, function() {
$timeout(function() {
applicationService.restart();
}, 1000);
});
}
});
modalInstance.result.finally(function() {
var m = angular.element(document.getElementsByClassName('reveal-modal'));
m.addClass(animationService.modalAnimated.slideOutRight);
}); });
}; };

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesDeleteWalletController', angular.module('copayApp.controllers').controller('preferencesDeleteWalletController',
function($scope, $rootScope, $filter, $timeout, $modal, $log, storageService, notification, profileService, platformInfo, go, gettext, gettextCatalog, animationService, applicationService) { function($scope, $rootScope, $filter, $timeout, $modal, $log, $ionicModal, storageService, notification, profileService, platformInfo, go, gettext, gettextCatalog, applicationService) {
var isCordova = platformInfo.isCordova; var isCordova = platformInfo.isCordova;
this.isCordova = isCordova; this.isCordova = isCordova;
this.error = null; this.error = null;
@ -13,35 +13,19 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
var confirm_msg = gettextCatalog.getString('Confirm'); var confirm_msg = gettextCatalog.getString('Confirm');
var _modalDeleteWallet = function() { var _modalDeleteWallet = function() {
var ModalInstanceCtrl = function($scope, $modalInstance, gettext) {
$scope.title = delete_msg; $scope.title = delete_msg;
$scope.accept_msg = accept_msg;
$scope.cancel_msg = cancel_msg;
$scope.confirm_msg = confirm_msg;
$scope.okAction = doDeleteWallet;
$scope.loading = false; $scope.loading = false;
$scope.ok = function() { $ionicModal.fromTemplateUrl('views/modals/confirmation.html', {
$scope.loading = true; scope: $scope,
$modalInstance.close(accept_msg); animation: 'slide-in-up'
}).then(function(modal) {
}; $scope.confirmationModal = modal;
$scope.cancel = function() { $scope.confirmationModal.show();
$modalInstance.dismiss(cancel_msg);
};
};
var modalInstance = $modal.open({
templateUrl: 'views/modals/confirmation.html',
windowClass: animationService.modalAnimated.slideUp,
controller: ModalInstanceCtrl
});
modalInstance.result.finally(function() {
var m = angular.element(document.getElementsByClassName('reveal-modal'));
m.addClass(animationService.modalAnimated.slideOutDown);
});
modalInstance.result.then(function(ok) {
if (ok) {
doDeleteWallet();
}
}); });
}; };

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesGlideraController', angular.module('copayApp.controllers').controller('preferencesGlideraController',
function($scope, $modal, $timeout, profileService, applicationService, glideraService, storageService, animationService) { function($scope, $modal, $timeout, $ionicModal, profileService, applicationService, glideraService, storageService) {
this.getEmail = function(token) { this.getEmail = function(token) {
var self = this; var self = this;
@ -32,35 +32,15 @@ angular.module('copayApp.controllers').controller('preferencesGlideraController'
}; };
this.revokeToken = function(testnet) { this.revokeToken = function(testnet) {
var network = testnet ? 'testnet' : 'livenet'; $scope.network = testnet ? 'testnet' : 'livenet';
var ModalInstanceCtrl = function($scope, $modalInstance) { $scope.loading = false;
$scope.ok = function() {
$modalInstance.close(true);
};
$scope.cancel = function() {
$modalInstance.dismiss();
};
};
var modalInstance = $modal.open({ $ionicModal.fromTemplateUrl('views/modals/glidera-confirmation.html', {
templateUrl: 'views/modals/glidera-confirmation.html', scope: $scope,
windowClass: animationService.modalAnimated.slideRight, animation: 'slide-in-up'
controller: ModalInstanceCtrl }).then(function(modal) {
}); $scope.glideraConfirmationModal = modal;
$scope.glideraConfirmationModal.show();
modalInstance.result.then(function(ok) {
if (ok) {
storageService.removeGlideraToken(network, function() {
$timeout(function() {
applicationService.restart();
}, 100);
});
}
});
modalInstance.result.finally(function() {
var m = angular.element(document.getElementsByClassName('reveal-modal'));
m.addClass(animationService.modalAnimated.slideOutRight);
}); });
}; };

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('sellCoinbaseController', angular.module('copayApp.controllers').controller('sellCoinbaseController',
function($rootScope, $scope, $modal, $log, $timeout, lodash, profileService, coinbaseService, animationService, bwsError, configService, walletService, fingerprintService) { function($rootScope, $scope, $modal, $log, $timeout, $ionicModal, lodash, profileService, coinbaseService, bwsError, configService, walletService, fingerprintService) {
window.ignoreMobilePause = true; window.ignoreMobilePause = true;
var self = this; var self = this;
@ -94,47 +94,20 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
$scope.openWalletsModal = function(wallets) { $scope.openWalletsModal = function(wallets) {
self.error = null; self.error = null;
var ModalInstanceCtrl = function($scope, $modalInstance) { self.selectedWalletId = null;
self.selectedWalletName = null;
$scope.type = 'SELL'; $scope.type = 'SELL';
$scope.wallets = wallets; $scope.wallets = wallets;
$scope.noColor = true; $scope.noColor = true;
$scope.cancel = function() { $scope.self = self;
$modalInstance.dismiss('cancel');
};
$scope.selectWallet = function(walletId, walletName) { $ionicModal.fromTemplateUrl('views/modals/wallets.html', {
if (!profileService.getClient(walletId).isComplete()) { scope: $scope,
self.error = bwsError.msg({ animation: 'slide-in-up'
'code': 'WALLET_NOT_COMPLETE' }).then(function(modal) {
}, 'Could not choose the wallet'); $scope.walletsModal = modal;
$modalInstance.dismiss('cancel'); $scope.walletsModal.show();
return;
}
$modalInstance.close({
'walletId': walletId,
'walletName': walletName,
});
};
};
var modalInstance = $modal.open({
templateUrl: 'views/modals/wallets.html',
windowClass: animationService.modalAnimated.slideUp,
controller: ModalInstanceCtrl,
});
modalInstance.result.finally(function() {
var m = angular.element(document.getElementsByClassName('reveal-modal'));
m.addClass(animationService.modalAnimated.slideOutDown);
});
modalInstance.result.then(function(obj) {
$timeout(function() {
self.selectedWalletId = obj.walletId;
self.selectedWalletName = obj.walletName;
fc = profileService.getClient(obj.walletId);
$scope.$apply();
}, 100);
}); });
}; };
@ -185,7 +158,9 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
self.error = null; self.error = null;
var accountId = account.id; var accountId = account.id;
var dataSrc = { name : 'Received from Copay: ' + self.selectedWalletName }; var dataSrc = {
name: 'Received from Copay: ' + self.selectedWalletName
};
var outputs = []; var outputs = [];
var config = configService.getSync(); var config = configService.getSync();
var configWallet = config.wallet; var configWallet = config.wallet;
@ -228,7 +203,11 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
if (err) { if (err) {
$log.debug(err); $log.debug(err);
self.loading = null; self.loading = null;
self.error = {errors: [{ message: 'Could not create transaction: ' + err.message }]}; self.error = {
errors: [{
message: 'Could not create transaction: ' + err.message
}]
};
$scope.$apply(); $scope.$apply();
return; return;
} }
@ -237,7 +216,11 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
if (accept) { if (accept) {
self.confirmTx(createdTxp, function(err, tx) { self.confirmTx(createdTxp, function(err, tx) {
if (err) { if (err) {
self.error = {errors: [{ message: 'Could not create transaction: ' + err.message }]}; self.error = {
errors: [{
message: 'Could not create transaction: ' + err.message
}]
};
return; return;
} }
self.loading = 'Checking transaction...'; self.loading = 'Checking transaction...';
@ -296,7 +279,11 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
if (err) { if (err) {
self.loading = null; self.loading = null;
$log.debug(err); $log.debug(err);
return cb({errors: [{ message: 'Transaction could not be published: ' + err.message }]}); return cb({
errors: [{
message: 'Transaction could not be published: ' + err.message
}]
});
} }
walletService.signTx(fc, publishedTxp, function(err, signedTxp) { walletService.signTx(fc, publishedTxp, function(err, signedTxp) {
@ -307,7 +294,11 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
walletService.removeTx(fc, signedTxp, function(err) { walletService.removeTx(fc, signedTxp, function(err) {
if (err) $log.debug(err); if (err) $log.debug(err);
}); });
return cb({errors: [{ message: 'The payment was created but could not be completed: ' + err.message }]}); return cb({
errors: [{
message: 'The payment was created but could not be completed: ' + err.message
}]
});
} }
walletService.broadcastTx(fc, signedTxp, function(err, broadcastedTxp) { walletService.broadcastTx(fc, signedTxp, function(err, broadcastedTxp) {
@ -317,7 +308,11 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
walletService.removeTx(fc, broadcastedTxp, function(err) { walletService.removeTx(fc, broadcastedTxp, function(err) {
if (err) $log.debug(err); if (err) $log.debug(err);
}); });
return cb({errors: [{ message: 'The payment was created but could not be broadcasted: ' + err.message }]}); return cb({
errors: [{
message: 'The payment was created but could not be broadcasted: ' + err.message
}]
});
} }
$timeout(function() { $timeout(function() {
self.loading = null; self.loading = null;

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('sellGlideraController', angular.module('copayApp.controllers').controller('sellGlideraController',
function($rootScope, $scope, $timeout, $log, $modal, configService, profileService, addressService, feeService, glideraService, bwsError, lodash, animationService, walletService, fingerprintService) { function($rootScope, $scope, $timeout, $ionicModal, $log, $modal, configService, profileService, addressService, feeService, glideraService, bwsError, lodash, walletService, fingerprintService) {
var self = this; var self = this;
var config = configService.getSync(); var config = configService.getSync();
@ -53,47 +53,18 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
self.error = null; self.error = null;
self.selectedWalletId = null; self.selectedWalletId = null;
self.selectedWalletName = null; self.selectedWalletName = null;
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.type = 'SELL'; $scope.type = 'SELL';
$scope.wallets = wallets; $scope.wallets = wallets;
$scope.noColor = true; $scope.noColor = true;
$scope.cancel = function() { $scope.self = self;
$modalInstance.dismiss('cancel');
};
$scope.selectWallet = function(walletId, walletName) { $ionicModal.fromTemplateUrl('views/modals/wallets.html', {
if (!profileService.getClient(walletId).isComplete()) { scope: $scope,
self.error = bwsError.msg({ animation: 'slide-in-up'
'code': 'WALLET_NOT_COMPLETE' }).then(function(modal) {
}, 'Could not choose the wallet'); $scope.walletsModal = modal;
$modalInstance.dismiss('cancel'); $scope.walletsModal.show();
return;
}
$modalInstance.close({
'walletId': walletId,
'walletName': walletName,
});
};
};
var modalInstance = $modal.open({
templateUrl: 'views/modals/wallets.html',
windowClass: animationService.modalAnimated.slideUp,
controller: ModalInstanceCtrl,
});
modalInstance.result.finally(function() {
var m = angular.element(document.getElementsByClassName('reveal-modal'));
m.addClass(animationService.modalAnimated.slideOutDown);
});
modalInstance.result.then(function(obj) {
$timeout(function() {
self.selectedWalletId = obj.walletId;
self.selectedWalletName = obj.walletName;
fc = profileService.getClient(obj.walletId);
$scope.$apply();
}, 100);
}); });
}; };

View file

@ -1,75 +0,0 @@
'use strict';
angular.module('copayApp.controllers').controller('txController',
function($rootScope, $scope, $timeout, $filter, lodash, profileService, platformInfo, nodeWebkit, configService, animationService, gettextCatalog) {
var isCordova = platformInfo.isCordova;
var fc = profileService.focusedClient;
var config = configService.getSync();
var configWallet = config.wallet;
var walletSettings = configWallet.settings;
var m = angular.element(document.getElementsByClassName('txModal'));
m.addClass(animationService.modalAnimated.slideRight);
this.alternativeIsoCode = walletSettings.alternativeIsoCode;
this.color = fc.backgroundColor;
this.copayerId = fc.credentials.copayerId;
this.isShared = fc.credentials.n > 1;
if (isCordova) {
$rootScope.modalOpened = true;
var self = this;
var disableCloseModal = $rootScope.$on('closeModal', function() {
self.cancel();
});
}
this.getAlternativeAmount = function(btx) {
var self = this;
var satToBtc = 1 / 100000000;
fc.getFiatRate({
code: self.alternativeIsoCode,
ts: btx.time * 1000
}, function(err, res) {
if (err) {
$log.debug('Could not get historic rate');
return;
}
if (res && res.rate) {
var alternativeAmountBtc = (btx.amount * satToBtc).toFixed(8);
$scope.rateDate = res.fetchedOn;
$scope.rateStr = res.rate + ' ' + self.alternativeIsoCode;
$scope.alternativeAmountStr = $filter('noFractionNumber')(alternativeAmountBtc * res.rate, 2) + ' ' + self.alternativeIsoCode;
$scope.$apply();
}
});
};
this.getShortNetworkName = function() {
var n = fc.credentials.network;
return n.substring(0, 4);
};
this.copyToClipboard = function(value) {
if (isCordova) {
window.cordova.plugins.clipboard.copy(value);
window.plugins.toast.showShortCenter(gettextCatalog.getString('Copied to clipboard'));
} else if (platformInfo.isNW) {
nodeWebkit.writeToClipboard(value);
}
};
this.cancel = lodash.debounce(function() {
m.addClass(animationService.modalAnimated.slideOutRight);
if (isCordova) {
$rootScope.modalOpened = false;
disableCloseModal();
$timeout(function() {
$rootScope.$emit('Local/TxModal', null);
}, 350);
} else {
$rootScope.$emit('Local/TxModal', null);
}
}, 0, 1000);
});

View file

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $interval, $timeout, $filter, $modal, $log, $ionicModal, notification, txStatus, profileService, lodash, configService, rateService, storageService, bitcore, gettext, gettextCatalog, platformInfo, addressService, ledger, bwsError, confirmDialog, txFormatService, animationService, addressbookService, go, feeService, walletService, fingerprintService, nodeWebkit) { angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $interval, $timeout, $filter, $modal, $log, $ionicModal, notification, txStatus, profileService, lodash, configService, rateService, storageService, bitcore, gettext, gettextCatalog, platformInfo, addressService, ledger, bwsError, confirmDialog, txFormatService, addressbookService, go, feeService, walletService, fingerprintService, nodeWebkit) {
var isCordova = platformInfo.isCordova; var isCordova = platformInfo.isCordova;
var isWP = platformInfo.isWP; var isWP = platformInfo.isWP;

View file

@ -630,6 +630,10 @@ ul.manage li {
margin-top: 20px; margin-top: 20px;
} }
.m20ti {
margin-top: 20px !important;
}
.m20tp { .m20tp {
margin-top: 20%; margin-top: 20%;
} }