Merge pull request #2680 from matiu/bug/android-hamburger-click

Bug/android hamburger click
This commit is contained in:
Gustavo Maximiliano Cortez 2015-05-04 14:19:52 -03:00
commit affe404c55
12 changed files with 79 additions and 36 deletions

View file

@ -17,7 +17,7 @@
"foundation-icon-fonts": "*", "foundation-icon-fonts": "*",
"ng-lodash": "~0.2.0", "ng-lodash": "~0.2.0",
"angular-moment": "~0.9.0", "angular-moment": "~0.9.0",
"angular-bitcore-wallet-client": "^0.0.20", "angular-bitcore-wallet-client": "^0.0.21",
"angular-ui-router": "~0.2.13", "angular-ui-router": "~0.2.13",
"qrcode-decoder-js": "*", "qrcode-decoder-js": "*",
"fastclick": "*", "fastclick": "*",

View file

@ -21,9 +21,9 @@
<i class="icon-arrow-right3 size-24 right text-gray"></i> <i class="icon-arrow-right3 size-24 right text-gray"></i>
<span translate>Backup</span> <span translate>Backup</span>
</li> </li>
<li class="line-b p20" ng-click="$root.go('delete')"> <li class="line-b p20" ng-click="$root.go('preferencesAdvanced')">
<i class="icon-arrow-right3 size-24 right text-gray"></i> <i class="icon-arrow-right3 size-24 right text-gray"></i>
<span translate>Delete</span> <span translate>Advanced</span>
</li> </li>
<h4 class="title m0" translate>Global settings</h4> <h4 class="title m0" translate>Global settings</h4>

View file

@ -0,0 +1,15 @@
<div class="content preferences" ng-controller="preferencesAdvancedController as preferences">
<ul class="no-bullet m0 size-14">
<li class="line-b p20" ng-click="index.retryScan(); $root.go('walletHome'); ">
<span translate>Scan addresses for funds</span>
</li>
<li class="line-b p20" ng-click="$root.go('delete')">
<i class="icon-arrow-right3 size-24 right text-gray"></i>
<span translate>Delete Wallet</span>
</li>
</ul>
</div>
<div class="extra-margin-bottom"></div>

View file

@ -6,7 +6,7 @@
</span> </span>
</div> </div>
<div class="columns text-center m10t"> <div class="columns text-center m10t">
<p translate class="size-12 text-gray">Permanently delete this wallet. WARNING: this action cannot be reversed.</p> <p translate class="size-14 text-gray">Permanently delete this wallet. THIS ACTION CANNONT BE REVERSED</p>
<button class="button expand warning" ng-click="preferences.deleteWallet()" translate> <button class="button expand warning" ng-click="preferences.deleteWallet()" translate>
Delete wallet Delete wallet
</button> </button>

View file

@ -110,9 +110,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r
if (self.tab === tab && !reset) if (self.tab === tab && !reset)
return; return;
if (! document.getElementById('menu-' + tab) && ++tries<5) { if (!document.getElementById('menu-' + tab) && ++tries < 5) {
return $timeout(function() { return $timeout(function() {
self.setTab(tab,reset, tries); self.setTab(tab, reset, tries);
}, 300); }, 300);
} }
@ -564,7 +564,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.debouncedUpdate = lodash.throttle(function() { self.debouncedUpdate = lodash.throttle(function() {
self.updateAll(); self.updateAll();
self.updateTxHistory(); self.updateTxHistory();
}, 4000, {leading: false, trailing: true}); }, 4000, {
leading: false,
trailing: true
});
// No need ot listing to Local/Resume since // No need ot listing to Local/Resume since
@ -578,14 +581,20 @@ angular.module('copayApp.controllers').controller('indexController', function($r
$rootScope.$on('Local/Online', function(event) { $rootScope.$on('Local/Online', function(event) {
self.isOffline = false; self.isOffline = false;
self.offLineSince = null;
}); });
self.offLineSince = null;;
$rootScope.$on('Local/Offline', function(event) { $rootScope.$on('Local/Offline', function(event) {
$log.debug('### Offline event'); $log.debug('### Offline event');
self.isOffline = true; if (!self.offLineSince) self.offLineSince = Date.now();
$timeout(function() {
$rootScope.$apply(); if (Date.now() - self.offLineSince > 10000) {
}); self.isOffline = true;
$timeout(function() {
$rootScope.$apply();
});
}
}); });
$rootScope.$on('Local/BackupDone', function(event) { $rootScope.$on('Local/BackupDone', function(event) {
@ -629,9 +638,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r
}); });
$rootScope.$on('Local/WalletImported', function(event, walletId) { $rootScope.$on('Local/WalletImported', function(event, walletId) {
storageService.setBackupFlag(walletId, function() {}); storageService.setBackupFlag(walletId, function() {
storageService.clearLastAddress(walletId, function(err) { storageService.clearLastAddress(walletId, function(err) {
self.startScan(walletId); self.startScan(walletId);
});
}); });
}); });

View file

@ -2,9 +2,6 @@
angular.module('copayApp.controllers').controller('preferencesController', angular.module('copayApp.controllers').controller('preferencesController',
function($scope, $rootScope, $filter, $timeout, $modal, $log, lodash, configService, profileService) { function($scope, $rootScope, $filter, $timeout, $modal, $log, lodash, configService, profileService) {
this.error = null;
this.success = null;
var config = configService.getSync(); var config = configService.getSync();
this.unitName = config.wallet.settings.unitName; this.unitName = config.wallet.settings.unitName;

View file

@ -0,0 +1,5 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesAdvancedController',
function($scope) {
});

View file

@ -1,12 +1,9 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesBwsUrlController', angular.module('copayApp.controllers').controller('preferencesBwsUrlController',
function($scope, $rootScope, $filter, $timeout, $modal, balanceService, notification, backupService, profileService, configService, isMobile, isCordova, go, rateService, applicationService, bwcService) { function($scope, configService, isMobile, isCordova, go, applicationService ) {
this.isSafari = isMobile.Safari(); this.isSafari = isMobile.Safari();
this.isCordova = isCordova; this.isCordova = isCordova;
this.hideAdv = true;
this.hidePriv = true;
this.hideSecret = true;
this.error = null; this.error = null;
this.success = null; this.success = null;

View file

@ -23,6 +23,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
this.isRateAvailable = false; this.isRateAvailable = false;
this.showScanner = false; this.showScanner = false;
this.isMobile = isMobile.any(); this.isMobile = isMobile.any();
this.addr = null;
var disableScannerListener = $rootScope.$on('dataScanned', function(event, data) { var disableScannerListener = $rootScope.$on('dataScanned', function(event, data) {
self.setForm(data); self.setForm(data);
@ -47,16 +48,12 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
var disableOnlineListener = $rootScope.$on('Local/Online', function() { var disableOnlineListener = $rootScope.$on('Local/Online', function() {
// This is needed then the apps go to sleep // This is needed then the apps go to sleep
$timeout(function() { self.bindTouchDown();
self.bindTouchDown();
}, 2000);
}); });
var disableResumeListener = $rootScope.$on('Local/Resume', function() { var disableResumeListener = $rootScope.$on('Local/Resume', function() {
// This is needed then the apps go to sleep // This is needed then the apps go to sleep
$timeout(function() { self.bindTouchDown();
self.bindTouchDown();
}, 2000);
}); });
@ -390,8 +387,11 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
['hamburger', 'menu-walletHome', 'menu-send', 'menu-receive', 'menu-history'].forEach(function(id) { ['hamburger', 'menu-walletHome', 'menu-send', 'menu-receive', 'menu-history'].forEach(function(id) {
var e = document.getElementById(id); var e = document.getElementById(id);
if (e) e.addEventListener('touchstart', function() { if (e) e.addEventListener('touchstart', function() {
try {
event.preventDefault();
} catch (e) {};
angular.element(e).triggerHandler('click'); angular.element(e).triggerHandler('click');
}); }, true);
}); });
} }

View file

@ -12,9 +12,9 @@ function makeSwipeDirective(directiveName, direction, eventName) {
// The maximum vertical delta for a swipe should be less than 75px. // The maximum vertical delta for a swipe should be less than 75px.
var MAX_VERTICAL_DISTANCE = 75; var MAX_VERTICAL_DISTANCE = 75;
// Vertical distance should not be more than a fraction of the horizontal distance. // Vertical distance should not be more than a fraction of the horizontal distance.
var MAX_VERTICAL_RATIO = 0.3; var MAX_VERTICAL_RATIO = 0.4;
// At least a 30px lateral motion is necessary for a swipe. // At least a 30px lateral motion is necessary for a swipe.
var MIN_HORIZONTAL_DISTANCE = 25; var MIN_HORIZONTAL_DISTANCE = 30;
return function(scope, element, attr) { return function(scope, element, attr) {
var swipeHandler = $parse(attr[directiveName]); var swipeHandler = $parse(attr[directiveName]);

View file

@ -53,8 +53,8 @@ angular
try { try {
if (window.cordova) if (window.cordova)
console.log(args.join(' ')); console.log(args.join(' '));
orig.apply(null, args);
historicLog.add(level, args.join(' ')); historicLog.add(level, args.join(' '));
orig.apply(null, args);
} catch (e) { } catch (e) {
console.log('Error at log decorator:', e); console.log('Error at log decorator:', e);
} }
@ -279,6 +279,24 @@ angular
} }
} }
}) })
.state('preferencesAdvanced', {
url: '/preferencesAdvanced',
templateUrl: 'views/preferencesAdvanced.html',
walletShouldBeComplete: true,
needProfile: true,
views: {
'main': {
templateUrl: 'views/preferencesAdvanced.html'
},
'topbar': {
templateUrl: 'views/includes/topbar.html',
controller: function($scope) {
$scope.titleSection = 'Advanced';
$scope.goBackToState = 'preferences';
}
}
}
})
.state('preferencesColor', { .state('preferencesColor', {
url: '/preferencesColor', url: '/preferencesColor',
templateUrl: 'views/preferencesColor.html', templateUrl: 'views/preferencesColor.html',
@ -348,8 +366,9 @@ angular
'topbar': { 'topbar': {
templateUrl: 'views/includes/topbar.html', templateUrl: 'views/includes/topbar.html',
controller: function($scope, gettext) { controller: function($scope, gettext) {
$scope.titleSection = gettext('Delete'); $scope.titleSection = gettext('Delete Wallet');
$scope.goBackToState = 'preferences'; $scope.goBackToState = 'preferences';
$scope.goBackToState = 'preferencesAdvanced';
} }
} }
} }
@ -490,7 +509,8 @@ angular
preferences: 0, preferences: 0,
preferencesColor: 12, preferencesColor: 12,
backup: 12, backup: 12,
delete: 12, preferencesAdvanced: 12,
delete: 13,
preferencesLanguage: 12, preferencesLanguage: 12,
preferencesUnit: 12, preferencesUnit: 12,
preferencesAltCurrency: 12, preferencesAltCurrency: 12,
@ -510,7 +530,6 @@ angular
}); });
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) { $rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
if (pageWeight[fromState.name] > pageWeight[toState.name]) { if (pageWeight[fromState.name] > pageWeight[toState.name]) {
$rootScope.$emit('Animation/SwipeRight'); $rootScope.$emit('Animation/SwipeRight');
} else if (pageWeight[fromState.name] < pageWeight[toState.name]) { } else if (pageWeight[fromState.name] < pageWeight[toState.name]) {
@ -533,12 +552,13 @@ angular
} }
} else { } else {
$log.debug('Profile loaded ... Starting UX.'); $log.debug('Profile loaded ... Starting UX.');
$state.transitionTo(toState, toParams); $state.transitionTo(toState.name || toState, toParams);
} }
}); });
} }
if (profileService.focusedClient && !profileService.focusedClient.isComplete() && toState.walletShouldBeComplete) { if (profileService.focusedClient && !profileService.focusedClient.isComplete() && toState.walletShouldBeComplete) {
$state.transitionTo('copayers'); $state.transitionTo('copayers');
event.preventDefault(); event.preventDefault();
} }

View file

@ -47,7 +47,6 @@ angular.module('copayApp.services').factory('go', function($window, $rootScope,
root.walletHome = function() { root.walletHome = function() {
var fc = profileService.focusedClient; var fc = profileService.focusedClient;
if (fc && !fc.isComplete()) { if (fc && !fc.isComplete()) {
root.path('copayers'); root.path('copayers');
} else { } else {