diff --git a/Gruntfile.js b/Gruntfile.js index f08be00c4..bf463a00b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -46,7 +46,6 @@ module.exports = function(grunt) { }, angular: { src: [ - 'bower_components/fastclick/lib/fastclick.js', 'bower_components/qrcode-generator/js/qrcode.js', 'bower_components/qrcode-decoder-js/lib/qrcode-decoder.js', 'bower_components/moment/min/moment-with-locales.js', diff --git a/bower.json b/bower.json index dce25dbc1..43c388f13 100644 --- a/bower.json +++ b/bower.json @@ -16,7 +16,6 @@ "angular-ui-router": "0.2.15", "angular-ui-switch": "0.1.1", "animate.css": "3.4.0", - "fastclick": "1.0.6", "foundation": "5.5.2", "foundation-icon-fonts": "*", "moment": "2.10.3", diff --git a/public/index.html b/public/index.html index a385dbe5e..efb6bba99 100644 --- a/public/index.html +++ b/public/index.html @@ -3,7 +3,7 @@ - + @@ -14,20 +14,19 @@ -
- -
+
+
+
+
+
+
+ +
- -
-
-
-
- +
diff --git a/public/views/includes/sidebar.html b/public/views/includes/sidebar.html index 282e14a8f..67169ee12 100644 --- a/public/views/includes/sidebar.html +++ b/public/views/includes/sidebar.html @@ -9,7 +9,7 @@ ng-repeat="item in sidebar.wallets track by $index" ng-class="{'selected': item.id == index.walletId}" class="nav-item"> - +
diff --git a/public/views/includes/topbar.html b/public/views/includes/topbar.html index 1a7f28d40..59908279f 100644 --- a/public/views/includes/topbar.html +++ b/public/views/includes/topbar.html @@ -3,21 +3,21 @@ ng-style="{'background-color': noColor ? '#4B6178' : index.backgroundColor}">
+ fast-click callback-fn="index.openMenu()"> + fast-click callback-fn="$root.go(goBackToState); goBackToState = null"> {{'Back'|translate}} + fast-click callback-fn="topbar.goHome(); index.setCompactTxHistory(); closeToHome = null"> {{'Close'|translate}}
- +
diff --git a/public/views/includes/transaction.html b/public/views/includes/transaction.html index 4b3fa3fcb..9c37a6534 100644 --- a/public/views/includes/transaction.html +++ b/public/views/includes/transaction.html @@ -1,6 +1,6 @@
+ fast-click callback-fn="home.openTxpModal(tx, index.copayers, !!index.glideraStatus)">
diff --git a/public/views/includes/tx-details.html b/public/views/includes/tx-details.html new file mode 100644 index 000000000..d7a507a10 --- /dev/null +++ b/public/views/includes/tx-details.html @@ -0,0 +1,159 @@ +
+ + + +
+
+
+
+ sync +

Received

+
+
+ sync +

Sent

+
+
+ sync +

Moved

+
+ +
+ + + - + {{index.showTx.amountStr}} +
+
+ + {{alternativeAmountStr}} + + + {{rateStr}} ({{rateDate | amDateFormat:'MM/DD/YYYY HH:mm a'}}) + +
+
+
+ - +
+
+ +

Details

+ +
    + +
  • + To + + + {{index.showTx.merchant.domain}} + {{index.showTx.merchant.domain}} + + + {{index.showTx.labelTo}} + + + +
  • + +
  • + Recipients + {{index.showTx.recipientCount}} + + + +
  • + +
    +
    + +
  • + + This transaction has become invalid; possibly due to a double spend attempt. + +
  • + Date + + + + +
  • +
  • + Fee + {{index.showTx.feeStr}} +
  • +
  • + Note + {{index.showTx.message}} +
  • +
  • + Merchant message + + {{index.showTx.merchant.pr.pd.memo}} + +
  • +
  • + Confirmations + + + Unconfirmed + + + {{index.showTx.confirmations}} + + + {{index.showTx.safeConfirmed}} + + + +
  • +
+ +
+

Participants

+
    +
  • + + + + + + {{c.copayerName}} ({{'Me'|translate}}) +
  • +
+
+ +
+
+ +
+
+ +
+
+
diff --git a/public/views/modals/destination-address.html b/public/views/modals/destination-address.html index c62bf4a55..a7959b2bc 100644 --- a/public/views/modals/destination-address.html +++ b/public/views/modals/destination-address.html @@ -1,7 +1,7 @@
My contacts + ng-style="{'color':!selectedWalletsOpt ? color : 'inherit'}" translate>My contacts
diff --git a/public/views/walletHome.html b/public/views/walletHome.html index 89d0a8005..d33459be6 100644 --- a/public/views/walletHome.html +++ b/public/views/walletHome.html @@ -199,7 +199,7 @@
diff --git a/src/css/main.css b/src/css/main.css index 3dd261ed8..68355d572 100644 --- a/src/css/main.css +++ b/src/css/main.css @@ -73,7 +73,7 @@ h4.title a { } -.preferences h4, .modal-content h4, .glidera h4 { +.preferences h4, .modal-content h4, .glidera h4, .txModal h4 { background: #F6F7F9; padding: 25px 0px 5px 10px; text-transform: uppercase; @@ -88,7 +88,7 @@ h4.title a { } -.preferences ul, .modal-content ul { +.preferences ul, .modal-content ul, .txModal ul { font-size:14px; background: white; } @@ -1399,7 +1399,21 @@ input.ng-invalid-match, input.ng-invalid-match:focus { border-top-right-radius: 5px; } -/*******************/ +.txModal-content { + overflow: auto; + height: 100%; + padding-bottom: 50px; +} + +.txModal { + background: #f6f7f9; + position: absolute; + width: 100%; + top: 0; + bottom: 0; + overflow: hidden; + 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..93cf26111 --- /dev/null +++ b/src/js/controllers/tx.js @@ -0,0 +1,75 @@ +'use strict'; + +angular.module('copayApp.controllers').controller('txController', + function($rootScope, $scope, $timeout, $filter, lodash, profileService, isCordova, nodeWebkit, configService, animationService, gettextCatalog) { + + 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 (nodeWebkit.isDefined()) { + 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); + + }); diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js index 7eff987b6..5bbb9ae88 100644 --- a/src/js/controllers/walletHome.js +++ b/src/js/controllers/walletHome.js @@ -1149,77 +1149,8 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi return this.alternativeIsoCode; }; - this.openTxModal = function(btx) { - $rootScope.modalOpened = true; - var self = this; - var fc = profileService.focusedClient; - var ModalInstanceCtrl = function($scope, $filter, $log, $modalInstance) { - $scope.btx = btx; - $scope.settings = walletSettings; - $scope.color = fc.backgroundColor; - $scope.copayerId = fc.credentials.copayerId; - $scope.isShared = fc.credentials.n > 1; - - $scope.getAlternativeAmount = function() { - 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(); - } - }); - }; - - $scope.getAmount = function(amount) { - return self.getAmount(amount); - }; - - $scope.getUnitName = function() { - return self.getUnitName(); - }; - - $scope.getShortNetworkName = function() { - var n = fc.credentials.network; - return n.substring(0, 4); - }; - - $scope.copyToClipboard = function(addr) { - if (!addr) return; - self.copyToClipboard(addr); - }; - - $scope.cancel = lodash.debounce(function() { - $modalInstance.dismiss('cancel'); - }, 0, 1000); - - }; - - var modalInstance = $modal.open({ - templateUrl: 'views/modals/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); - }); + this.openTxModal = function(tx) { + $rootScope.$emit('Local/TxModal', tx); }; this.hasAction = function(actions, action) { diff --git a/src/js/directives/directives.js b/src/js/directives/directives.js index f09f8bd23..f3f725538 100644 --- a/src/js/directives/directives.js +++ b/src/js/directives/directives.js @@ -317,4 +317,65 @@ 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(); + }); + } 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; + + return true; + }); + + element.on('touchend', function(event) { + if (trackingClick) { + scope.someCtrlFn(); + event.preventDefault(); + } + trackingClick = false; + return false; + }); + + element.on('touchmove', function(event) { + if (!trackingClick) { + return true; + } + + // 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();