From c27759b770bd11b89dd9d2082285496e5ccdd48c Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Thu, 28 Apr 2016 10:40:06 -0300 Subject: [PATCH] Replaces custom-fastClick by Angular-Stateful-Fastclick (#4136) * Replaces custom-fastClick by Angular-Stateful-Fastclick * Resolves fastclick version --- Gruntfile.js | 7 ++- bower.json | 9 ++- public/index.html | 2 +- public/views/coinbase.html | 4 +- public/views/includes/sidebar.html | 2 +- public/views/includes/topbar.html | 8 +-- public/views/includes/transaction.html | 2 +- public/views/includes/tx-details.html | 2 +- public/views/modals/destination-address.html | 2 +- public/views/modals/tx-status.html | 8 +-- public/views/walletHome.html | 8 +-- src/js/app.js | 1 + src/js/directives/directives.js | 61 -------------------- 13 files changed, 32 insertions(+), 84 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 94412c9fe..b70fda526 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -82,18 +82,21 @@ module.exports = function(grunt) { sourceMapStyle: 'link' // embed, link, inline }, angular: { - src: [ + src: [ 'bower_components/qrcode-generator/js/qrcode.js', 'bower_components/qrcode-decoder-js/lib/qrcode-decoder.js', 'bower_components/moment/min/moment-with-locales.js', 'bower_components/angular/angular.js', 'bower_components/angular-ui-router/release/angular-ui-router.js', 'bower_components/angular-foundation/mm-foundation-tpls.js', + 'bower_components/angular-touch/angular-touch.js', + 'bower_components/fastclick/lib/fastclick.js', + 'bower_components/stateful-fastclick/dist/stateful-fastclick.js', + 'bower_components/angular-stateful-fastclick/lib/angular-stateful-fastclick.js', 'bower_components/angular-moment/angular-moment.js', 'bower_components/ng-lodash/build/ng-lodash.js', 'bower_components/angular-qrcode/angular-qrcode.js', 'bower_components/angular-gettext/dist/angular-gettext.js', - 'bower_components/angular-touch/angular-touch.js', 'bower_components/angular-ui-switch/angular-ui-switch.js', 'bower_components/angular-sanitize/angular-sanitize.js', 'bower_components/ng-csv/build/ng-csv.js', diff --git a/bower.json b/bower.json index fbc87c26f..bed7802a4 100644 --- a/bower.json +++ b/bower.json @@ -21,10 +21,15 @@ "ng-lodash": "0.2.3", "qrcode-decoder-js": "*", "trezor-connect": "~1.0.1", - "ng-csv": "~0.3.6" + "ng-csv": "~0.3.6", + "angular-touch": "^1.5.5", + "fastclick": "^1.0.6", + "stateful-fastclick": "^1.0.2", + "angular-stateful-fastclick": "^1.0.2" }, "resolutions": { "angular": "1.4.6", - "qrcode-generator": "0.1.0" + "qrcode-generator": "0.1.0", + "fastclick": "1.0.6" } } diff --git a/public/index.html b/public/index.html index efb6bba99..6522699c5 100644 --- a/public/index.html +++ b/public/index.html @@ -35,7 +35,7 @@ }"> - + diff --git a/public/views/coinbase.html b/public/views/coinbase.html index a60660727..051cc3f68 100644 --- a/public/views/coinbase.html +++ b/public/views/coinbase.html @@ -5,13 +5,13 @@ ng-style="{'background-color': '#2b71b1'}">
+ ng-click="topbar.goHome()"> Close
- +
diff --git a/public/views/includes/sidebar.html b/public/views/includes/sidebar.html index 752e3cbbb..9d8c34916 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 59908279f..1a7f28d40 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}">
+ ng-click="index.openMenu()"> + ng-click="$root.go(goBackToState); goBackToState = null"> {{'Back'|translate}} + ng-click="topbar.goHome(); index.setCompactTxHistory(); closeToHome = null"> {{'Close'|translate}}
- +
diff --git a/public/views/includes/transaction.html b/public/views/includes/transaction.html index 9c37a6534..4b3fa3fcb 100644 --- a/public/views/includes/transaction.html +++ b/public/views/includes/transaction.html @@ -1,6 +1,6 @@
+ ng-click="home.openTxpModal(tx, index.copayers, !!index.glideraStatus)">
diff --git a/public/views/includes/tx-details.html b/public/views/includes/tx-details.html index 48ca37c93..d7a507a10 100644 --- a/public/views/includes/tx-details.html +++ b/public/views/includes/tx-details.html @@ -6,7 +6,7 @@
@@ -19,7 +19,7 @@ Payment Proposal Created
- OKAY + OKAY
@@ -31,7 +31,7 @@ Payment Accepted
- OKAY + OKAY
@@ -41,6 +41,6 @@ Payment Rejected
- OKAY + OKAY
diff --git a/public/views/walletHome.html b/public/views/walletHome.html index 4b030b926..721025c0b 100644 --- a/public/views/walletHome.html +++ b/public/views/walletHome.html @@ -219,7 +219,7 @@
@@ -505,11 +505,11 @@
diff --git a/src/js/app.js b/src/js/app.js index 061e38b1c..f72997ac0 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -10,6 +10,7 @@ var modules = [ 'uiSwitch', 'ngSanitize', 'ngCsv', + 'ngTouch', 'bwcModule', 'copayApp.filters', 'copayApp.services', diff --git a/src/js/directives/directives.js b/src/js/directives/directives.js index ee5ae9fcb..1638b9859 100644 --- a/src/js/directives/directives.js +++ b/src/js/directives/directives.js @@ -318,65 +318,4 @@ angular.module('copayApp.directives') templateUrl: 'views/includes/available-balance.html' } }) - .directive('fastClick', [ 'isCordova', '$timeout', 'isMobile', function(isCordova, $timeout, isMobile) { - return { - scope: { someCtrlFn: '&callbackFn'}, - link: function(scope, element, attrs) { - - var isWindowsPhoneApp = isMobile.Windows() && isCordova; - if (!isCordova || isWindowsPhoneApp) { - 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; - }); - } - } - } - }]); - ;