copay/js/routes.js

114 lines
3.0 KiB
JavaScript
Raw Normal View History

2014-04-07 20:54:38 -07:00
'use strict';
//Setting up route
angular
.module('copayApp')
.config(function($routeProvider) {
2014-04-07 20:54:38 -07:00
$routeProvider
.when('/', {
templateUrl: 'views/home.html',
})
.when('/createProfile', {
templateUrl: 'views/createProfile.html',
})
.when('/unsupported', {
templateUrl: 'views/unsupported.html'
})
.when('/confirmed', {
template: " ", // just fire controller
controller: 'EmailConfirmationController',
})
.when('/uri-payment/:data', {
templateUrl: 'views/uri-payment.html'
})
.when('/join', {
templateUrl: 'views/join.html',
logged: true
})
.when('/import', {
templateUrl: 'views/import.html',
logged: true
})
.when('/create', {
templateUrl: 'views/create.html',
logged: true
})
.when('/copayers', {
templateUrl: 'views/copayers.html',
logged: true
})
2014-10-31 07:49:52 -07:00
.when('/homeWallet', {
templateUrl: 'views/homeWallet.html',
logged: true
})
.when('/receive', {
2014-10-30 10:13:40 -07:00
templateUrl: 'views/receive.html',
logged: true
})
.when('/history', {
2014-10-30 10:13:40 -07:00
templateUrl: 'views/history.html',
logged: true
})
.when('/send', {
templateUrl: 'views/send.html',
logged: true
})
.when('/more', {
templateUrl: 'views/more.html',
logged: true
})
.when('/settings', {
templateUrl: 'views/settings.html',
logged: false
})
.when('/warning', {
templateUrl: 'views/warning.html',
logged: true
})
.when('/manage', {
templateUrl: 'views/manage.html',
logged: true
})
2014-11-04 05:58:32 -08:00
.when('/devLogin/:mail/:password', {
templateUrl: 'views/devLogin.html',
logged: false
})
.otherwise({
templateUrl: 'views/errors/404.html',
title: 'Error'
});
2014-04-07 20:54:38 -07:00
});
//Setting HTML5 Location Mode
angular
.module('copayApp')
.config(function($locationProvider, $idleProvider, $keepaliveProvider) {
$locationProvider
.html5Mode(false)
.hashPrefix('!');
// IDLE timeout
var timeout = config.wallet.idleDurationMin * 60 || 300;
$idleProvider.idleDuration(timeout); // in seconds
$idleProvider.warningDuration(40); // in seconds
$keepaliveProvider.interval(30); // in seconds
})
.run(function($rootScope, $location, $idle, gettextCatalog) {
gettextCatalog.currentLanguage = config.defaultLanguage;
$idle.watch();
$rootScope.$on('$routeChangeStart', function(event, next, current) {
if (!localStorage || localStorage.length < 1) {
$location.path('unsupported');
} else {
if (!$rootScope.iden && next.logged) {
console.log('not logged... redirecting')
$idle.unwatch();
$location.path('/');
}
2014-08-12 12:26:15 -07:00
}
});
})
.config(function($compileProvider) {
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|tel|chrome-extension|resource):/);
2014-04-07 20:54:38 -07:00
});