Replaces custom-fastClick by Angular-Stateful-Fastclick (#4136)

* Replaces custom-fastClick by Angular-Stateful-Fastclick

* Resolves fastclick version
This commit is contained in:
Gustavo Maximiliano Cortez 2016-04-28 10:40:06 -03:00
parent 265dc26666
commit c27759b770
No known key found for this signature in database
GPG Key ID: 15EDAD8D9F2EB1AF
13 changed files with 32 additions and 84 deletions

View File

@ -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',

View File

@ -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"
}
}

View File

@ -35,7 +35,7 @@
}"></section>
</div>
</div>
<a class="close-menu" fast-click callback-fn="index.closeMenu()"></a>
<a class="close-menu" ng-click="index.closeMenu()"></a>
</div>
</div>

View File

@ -5,13 +5,13 @@
ng-style="{'background-color': '#2b71b1'}">
<section class="left-small">
<a class="p10"
fast-click callback-fn="topbar.goHome()">
ng-click="topbar.goHome()">
<span class="text-close">Close</span>
</a>
</section>
<section class="right-small">
<a class="p10" fast-click callback-fn="$root.go('preferencesCoinbase')">
<a class="p10" ng-click="$root.go('preferencesCoinbase')">
<i class="fi-widget size-24"></i>
</a>
</section>

View File

@ -9,7 +9,7 @@
ng-repeat="item in sidebar.wallets track by $index"
ng-class="{'selected': item.id == index.walletId}"
class="nav-item">
<a fast-click callback-fn="sidebar.closeMenu(); sidebar.switchWallet(item.id, index.walletId)" class="oh">
<a ng-click="sidebar.closeMenu(); sidebar.switchWallet(item.id, index.walletId)" class="oh">
<div class="avatar-wallet"
ng-style="{'background-color':item.color}">
<i class="icon-wallet size-21"></i>

View File

@ -3,21 +3,21 @@
ng-style="{'background-color': noColor ? '#4B6178' : index.backgroundColor}">
<section class="left-small">
<a id="hamburger" class="p10" ng-show="!goBackToState && !closeToHome && !index.noFocusedWallet"
fast-click callback-fn="index.openMenu()"><i class="fi-list size-24"></i>
ng-click="index.openMenu()"><i class="fi-list size-24"></i>
</a>
<a ng-show="goBackToState"
fast-click callback-fn="$root.go(goBackToState); goBackToState = null"><i class="icon-arrow-left3 icon-back"></i>
ng-click="$root.go(goBackToState); goBackToState = null"><i class="icon-arrow-left3 icon-back"></i>
<span class="text-back">{{'Back'|translate}}</span>
</a>
<a ng-show="closeToHome" class="p10 "
fast-click callback-fn="topbar.goHome(); index.setCompactTxHistory(); closeToHome = null">
ng-click="topbar.goHome(); index.setCompactTxHistory(); closeToHome = null">
<span class="text-close">{{'Close'|translate}}</span>
</a>
</section>
<section class="right-small" ng-show="showPreferences && !index.noFocusedWallet">
<a class="p10" fast-click callback-fn="topbar.goPreferences(); index.setCompactTxHistory()">
<a class="p10" ng-click="topbar.goPreferences(); index.setCompactTxHistory()">
<i class="fi-widget size-24"></i>
</a>
</section>

View File

@ -1,6 +1,6 @@
<div class="ng-animate-disabled row collapse last-transactions-content line-b"
ng-class="{'text-gray':!tx.pendingForUs}"
fast-click callback-fn="home.openTxpModal(tx, index.copayers, !!index.glideraStatus)">
ng-click="home.openTxpModal(tx, index.copayers, !!index.glideraStatus)">
<div class="large-6 medium-6 small-6 columns size-14">
<div class="m10r left pr">
<i class="icon-circle-active size-10" ng-show="tx.pendingForUs" ng-style="{'color':index.backgroundColor}"></i>

View File

@ -6,7 +6,7 @@
<nav class="tab-bar" ng-style="{'background-color':txc.color}">
<section class="left-small">
<a fast-click callback-fn="txc.cancel()">
<a ng-click="txc.cancel()">
<i class="icon-arrow-left3 icon-back"></i>
<span class="text-back" translate>Back</span>
</a>

View File

@ -1,7 +1,7 @@
<div ng-init="wallets[0] ? selectedWalletsOpt = true : selectedWalletsOpt = false; checkClipboard()">
<nav class="tab-bar" ng-style="{'background-color':color}">
<section class="left-small">
<a ng-show="!editAddressbook && !addAddressbookEntry" fast-click callback-fn="cancel()" class="p10">
<a ng-show="!editAddressbook && !addAddressbookEntry" ng-click="cancel()" class="p10">
<span class="text-close" translate>Close</span>
</a>
</section>

View File

@ -8,7 +8,7 @@
<span translate>Sent</span>
</div>
<div class="text-center m20t">
<a class="button outline round light-gray tiny small-4" fast-click callback-fn="cancel()" translate>OKAY</a>
<a class="button outline round light-gray tiny small-4" ng-click="cancel()" translate>OKAY</a>
</div>
</div>
@ -19,7 +19,7 @@
<span translate>Payment Proposal Created</span>
</div>
<div class="text-center">
<a class="button outline round light-gray tiny small-4" fast-click callback-fn="cancel()" translate>OKAY</a>
<a class="button outline round light-gray tiny small-4" ng-click="cancel()" translate>OKAY</a>
</div>
</div>
@ -31,7 +31,7 @@
<span translate>Payment Accepted</span>
</div>
<div class="text-center">
<a class="button outline round light-gray tiny small-4" fast-click callback-fn="cancel()" translate>OKAY</a>
<a class="button outline round light-gray tiny small-4" ng-click="cancel()" translate>OKAY</a>
</div>
</div>
@ -41,6 +41,6 @@
<span translate>Payment Rejected</span>
</div>
<div class="text-center">
<a class="button outline light-gray round tiny small-4" fast-click callback-fn="cancel()" translate>OKAY</a>
<a class="button outline light-gray round tiny small-4" ng-click="cancel()" translate>OKAY</a>
</div>
</div>

View File

@ -219,7 +219,7 @@
</div>
</div>
<div ng-repeat="btx in index.txHistorySearchResults track by btx.txid"
fast-click callback-fn="home.openTxModal(btx)"
ng-click="home.openTxModal(btx)"
class="row collapse last-transactions-content">
<div class="large-6 medium-6 small-6 columns size-14">
<div class="m10r left">
@ -437,7 +437,7 @@
</div>
<a class="postfix size-12 m0 text-gray"
ng-style="{'color':index.backgroundColor}"
fast-click callback-fn="home.openDestinationAddressModal(index.otherWallets, _address)">
ng-click="home.openDestinationAddressModal(index.otherWallets, _address)">
<i class="icon-wallet text-bold size-18"></i>
</a>
</div>
@ -505,11 +505,11 @@
<div class="row" ng-show="!home.onGoingProcess">
<div class="large-6 medium-6 small-6 columns" ng-show="!home.blockUx && (home._paypro || home.lockAddress || home.lockAmount)">
<a fast-click callback-fn="home.resetForm(sendForm)" class="button expand outline dark-gray round" translate>Cancel</a>
<a ng-click="home.resetForm(sendForm)" class="button expand outline dark-gray round" translate>Cancel</a>
</div>
<div class="columns" ng-class="{'small-6 medium-6 large-6':(home._paypro || home.lockAddress || home.lockAmount)}">
<button class="button black round expand" ng-disabled="sendForm.$invalid || home.blockUx || index.isOffline || home.paymentExpired"
ng-style="{'background-color':index.backgroundColor}" fast-click callback-fn="home.submitForm()" translate>
ng-style="{'background-color':index.backgroundColor}" ng-click="home.submitForm()" translate>
Send
</button>
</div>

View File

@ -10,6 +10,7 @@ var modules = [
'uiSwitch',
'ngSanitize',
'ngCsv',
'ngTouch',
'bwcModule',
'copayApp.filters',
'copayApp.services',

View File

@ -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;
});
}
}
}
}]);
;