replace href to ng-click in sidebars. add hack to close sidebars

This commit is contained in:
Matias Alejo Garcia 2014-12-07 12:40:59 -03:00
commit eeab451bbc
9 changed files with 38 additions and 32 deletions

View file

@ -1,10 +1,11 @@
'use strict';
angular.module('copayApp.controllers').controller('HomeController', function($scope, $rootScope, $location, $timeout, notification, identityService, Compatibility, pinService, applicationService, isMobile) {
angular.module('copayApp.controllers').controller('HomeController', function($scope, $rootScope, $timeout, go, notification, identityService, Compatibility, pinService, applicationService, isMobile) {
// Global functions (TODO should be somewhere else)
// Global go. This should be in a better place TODO
// We dont do a 'go' directive, to use the benefits of ng-touch with ng-click
$rootScope.go = function (path) {
$location.path(path);
go.go(path);
};
var _credentials, _firstpin;
@ -66,13 +67,14 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
$scope.error = 'Please enter the required fields';
return;
}
$rootScope.starting = true;
var credentials = pinService.get(pin, function(err, credentials) {
if (err || !credentials) {
$rootScope.starting = false;
$scope.error = 'Wrong PIN';
return;
}
$rootScope.starting = true;
$scope.open(credentials.email, credentials.password);
});
};

View file

@ -1,13 +1,21 @@
'use strict';
angular.element(document).ready(function() {
var startAngular = function () {
var startAngular = function() {
angular.bootstrap(document, ['copayApp']);
};
/* Cordova specific Init */
if (window.cordova !== undefined) {
document.addEventListener('deviceready', function() {
setTimeout(function(){ navigator.splashscreen.hide(); }, 2000);
document.addEventListener('pause', function() {
window.location = '#!';
});
setTimeout(function() {
navigator.splashscreen.hide();
}, 2000);
function handleBitcoinURI(url) {
if (!url) return;
@ -20,10 +28,6 @@ angular.element(document).ready(function() {
startAngular();
}, false);
document.addEventListener('pause', function() {
window.location = '#!';
});
} else {
startAngular();
}

View file

@ -114,15 +114,16 @@ angular
$keepaliveProvider.interval(30); // in seconds
})
.run(function($rootScope, $location, $idle, gettextCatalog, uriHandler) {
gettextCatalog.currentLanguage = config.defaultLanguage;
// not for mobileApp
// Register URI handler, not for mobileApp
if (!window.cordova) {
$idle.watch();
uriHandler.register();
}
$rootScope.$on('$routeChangeStart', function(event, next, current) {
if (!ls || ls.length < 1) {
$location.path('unsupported');
} else {

View file

@ -1,14 +1,13 @@
'use strict';
angular.module('copayApp.services')
.factory('applicationService', function($rootScope, $location, $timeout) {
.factory('applicationService', function($rootScope, $location, $timeout, go) {
var root = {};
var isChromeApp = window.chrome && chrome.runtime && chrome.runtime.id;
root.restart = function() {
if (1 || window.cordova !== undefined) {
$rootScope.iden = $rootScope.wallet = undefined;
// NOP. no need to restart on cordova apps.
$location.path('/');
go.go('/');
$timeout(function(){
$rootScope.$digest();
},1);

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.services')
.factory('identityService', function($rootScope, $location, $timeout, $filter, pluginManager, notification, pendingTxsService, balanceService, applicationService) {
.factory('identityService', function($rootScope, $location, $timeout, $filter, pluginManager, notification, pendingTxsService, balanceService, applicationService, go) {
notification.enableHtml5Mode(); // for chrome: if support, enable it
// TODO:
@ -334,7 +334,7 @@ angular.module('copayApp.services')
noWallets: true
}, function() {
$rootScope.signingOut = false;
$rootScope.iden.close();
$rootScope.iden.close(); // Will trigger 'closed'
});
}
};

View file

@ -5,7 +5,7 @@ angular.module('copayApp.services')
var KEY = 'pinDATA';
var SALT = '4gllotIKguqi0EkIslC0';
var ITER = 2000;
var ITER = 5000;
var ls = localstorageService;
var root = {};