diff --git a/src/css/main.css b/src/css/main.css
index 3dd261ed8..f03714489 100644
--- a/src/css/main.css
+++ b/src/css/main.css
@@ -1399,7 +1399,14 @@ input.ng-invalid-match, input.ng-invalid-match:focus {
border-top-right-radius: 5px;
}
-/*******************/
+.txModal {
+ background: #FFFFFF;
+ border-radius: 5px;
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ z-index: 1100;
+}
.alertModal {
background: #FFFFFF;
diff --git a/src/css/mobile.css b/src/css/mobile.css
index fcdc3af21..e0d5f6cf0 100644
--- a/src/css/mobile.css
+++ b/src/css/mobile.css
@@ -644,6 +644,8 @@ body.modal-open {
.reveal-modal.animated.slideInRight,
.reveal-modal.animated.slideOutRight,
+.txModal.animated.slideInRight,
+.txModal.animated.slideOutRight,
.reveal-modal.animated.fadeOutUp,
.reveal-modal.animated.slideInUp,
.reveal-modal.animated.slideInDown {
diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js
index d256afeda..a8b33cb97 100644
--- a/src/js/controllers/index.js
+++ b/src/js/controllers/index.js
@@ -1344,6 +1344,13 @@ angular.module('copayApp.controllers').controller('indexController', function($r
});
});
+ $rootScope.$on('Local/TxModal', function(event, tx) {
+ self.showTx = tx;
+ $timeout(function() {
+ $rootScope.$apply();
+ });
+ });
+
$rootScope.$on('NewIncomingTx', function() {
self.newTx = true;
self.updateAll({
diff --git a/src/js/controllers/tx.js b/src/js/controllers/tx.js
new file mode 100644
index 000000000..93f70aec9
--- /dev/null
+++ b/src/js/controllers/tx.js
@@ -0,0 +1,67 @@
+'use strict';
+
+angular.module('copayApp.controllers').controller('txController',
+ function($rootScope, $scope, $timeout, profileService, notification, go, gettext, isCordova, nodeWebkit) {
+
+ var fc = profileService.focusedClient;
+ this.color = fc.backgroundColor;
+ this.copayerId = fc.credentials.copayerId;
+ this.isShared = fc.credentials.n > 1;
+
+ if (isCordova) {
+ $scope.modalOpening = true;
+ $timeout(function() {
+ $scope.modalOpening = false;
+ }, 300);
+ }
+
+ this.getAlternativeAmount = function(btx) {
+console.log('[tx.js:18]',btx); //TODO
+ var satToBtc = 1 / 100000000;
+ fc.getFiatRate({
+ code: self.alternativeIsoCode,
+ ts: btx.time * 1000
+ }, function(err, res) {
+console.log('[tx.js:24]',res); //TODO
+ 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.copyAddress = function(addr) {
+ if (!addr) return;
+ if (isCordova) {
+ window.cordova.plugins.clipboard.copy(addr);
+ window.plugins.toast.showShortCenter(gettextCatalog.getString('Copied to clipboard'));
+ } else if (nodeWebkit.isDefined()) {
+ nodeWebkit.writeToClipboard(addr);
+ }
+ };
+
+ this.cancel = function() {
+ if (isCordova) {
+ $scope.modalClosing = true;
+ $timeout(function() {
+ $scope.modalClosing = false;
+ $rootScope.$emit('Local/TxModal', null);
+ }, 300);
+ } else {
+ $rootScope.$emit('Local/TxModal', null);
+ }
+ };
+
+ });
diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js
index 7eff987b6..d2f13f912 100644
--- a/src/js/controllers/walletHome.js
+++ b/src/js/controllers/walletHome.js
@@ -1149,6 +1149,10 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
return this.alternativeIsoCode;
};
+ this.openNewTxModal = function(tx) {
+ $rootScope.$emit('Local/TxModal', tx);
+ };
+
this.openTxModal = function(btx) {
$rootScope.modalOpened = true;
var self = this;
diff --git a/src/js/directives/directives.js b/src/js/directives/directives.js
index f09f8bd23..3aa66d5b6 100644
--- a/src/js/directives/directives.js
+++ b/src/js/directives/directives.js
@@ -317,4 +317,71 @@ angular.module('copayApp.directives')
replace: true,
templateUrl: 'views/includes/available-balance.html'
}
- });
+ })
+ .directive('fastClick', [ 'isCordova', '$timeout', function(isCordova, $timeout) {
+ return {
+ scope: { someCtrlFn: '&callbackFn'},
+ link: function(scope, element, attrs) {
+
+ if (!isCordova) {
+ element.on('click', function(){
+ scope.someCtrlFn();
+ console.log('click real');
+ });
+ } else {
+ var trackingClick = false;
+ var targetElement = null;
+ var touchStartX = 0;
+ var touchStartY = 0;
+ var touchBoundary = 10;
+
+ element.on('touchstart', function(event) {
+
+ trackingClick = true;
+ targetElement = event.target;
+ touchStartX = event.targetTouches[0].pageX;
+ touchStartY = event.targetTouches[0].pageY;
+
+ console.log('PRIMER CLICKKKKKK!!');
+
+ return true;
+ });
+
+ element.on('touchend', function(event) {
+ if (trackingClick) {
+ scope.someCtrlFn();
+ event.preventDefault();
+ }
+ trackingClick = false;
+ console.log('SOLTANDO EL CLICKKKKKK!!');
+ return false;
+ });
+
+ element.on('touchmove', function(event) {
+console.log('[directives.js:357] MOVING 1', trackingClick); //TODO
+ if (!trackingClick) {
+ return true;
+ }
+console.log('[directives.js:361] MOVING 2', trackingClick); //TODO
+
+ // If the touch has moved, cancel the click tracking
+ if (targetElement !== event.target
+ || (Math.abs(event.changedTouches[0].pageX - touchStartX) > touchBoundary
+ || (Math.abs(event.changedTouches[0].pageY - touchStartY) > touchBoundary))) {
+ trackingClick = false;
+ targetElement = null;
+ }
+
+ return true;
+ });
+
+ element.on('touchcancel', function() {
+ trackingClick = false;
+ targetElement = null;
+ });
+ }
+ }
+ }
+ }]);
+
+;
diff --git a/src/js/routes.js b/src/js/routes.js
index 469d7aeb5..1e0fe8283 100644
--- a/src/js/routes.js
+++ b/src/js/routes.js
@@ -511,7 +511,6 @@ angular
});
})
.run(function($rootScope, $state, $log, uriHandler, isCordova, profileService, $timeout, nodeWebkit, uxLanguage, animationService) {
- FastClick.attach(document.body);
uxLanguage.init();