rm old files
This commit is contained in:
parent
320de62f13
commit
5ebb0b7195
2 changed files with 0 additions and 253 deletions
|
|
@ -1,73 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('HeadController', function($scope, $rootScope, $filter, $timeout, notification, identityService, balanceService) {
|
||||
$scope.username = $rootScope.iden ? $rootScope.iden.getName() : '';
|
||||
$scope.hoverMenu = false;
|
||||
|
||||
var isChromeApp = typeof window !== "undefined" && window.chrome && chrome.runtime && chrome.runtime.id;
|
||||
|
||||
$scope.hoverIn = function() {
|
||||
this.hoverMenu = true;
|
||||
};
|
||||
|
||||
$scope.hoverOut = function() {
|
||||
this.hoverMenu = false;
|
||||
};
|
||||
|
||||
$scope.signout = function() {
|
||||
identityService.signout();
|
||||
};
|
||||
|
||||
$scope.refresh = function() {
|
||||
var w = $rootScope.wallet;
|
||||
if (!w) return;
|
||||
|
||||
if (w.isComplete()) {
|
||||
w.sendWalletReady();
|
||||
balanceService.clearBalanceCache(w);
|
||||
balanceService.update(w, function() {
|
||||
$rootScope.$digest();
|
||||
}, true);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//Ensures a graceful disconnect
|
||||
window.onbeforeunload = function() {
|
||||
$scope.signout();
|
||||
};
|
||||
|
||||
$scope.$on('$destroy', function() {
|
||||
if (isChromeApp) return;
|
||||
window.onbeforeunload = undefined;
|
||||
});
|
||||
|
||||
$scope.init = function() {
|
||||
if (!$rootScope.wallet) return;
|
||||
|
||||
$scope.$on('IdleStart', function() {});
|
||||
$scope.$on('IdleWarn', function(a, countdown) {
|
||||
$rootScope.countdown = countdown;
|
||||
$rootScope.sessionExpired = true;
|
||||
$rootScope.$apply();
|
||||
});
|
||||
$scope.$on('IdleEnd', function() {
|
||||
$timeout(function() {
|
||||
$rootScope.sessionExpired = null;
|
||||
}, 500);
|
||||
});
|
||||
$scope.$on('IdleTimeout', function() {
|
||||
$rootScope.sessionExpired = null;
|
||||
$scope.signout();
|
||||
notification.warning('Session closed', 'Session closed because a long time of inactivity');
|
||||
});
|
||||
$scope.$on('Keepalive', function() {
|
||||
if ($rootScope.wallet) {
|
||||
$rootScope.wallet.keepAlive();
|
||||
}
|
||||
});
|
||||
$rootScope.$watch('title', function(newTitle, oldTitle) {
|
||||
$scope.title = newTitle;
|
||||
});
|
||||
};
|
||||
});
|
||||
180
js/routes.js
180
js/routes.js
|
|
@ -1,180 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
var LS = require('../js/plugins/LocalStorage');
|
||||
var ls = new LS();
|
||||
|
||||
var unsupported = false;
|
||||
|
||||
if (!ls || ls.length < 1)
|
||||
unsupported = true;
|
||||
|
||||
|
||||
if (window && window.navigator) {
|
||||
var rxaosp = window.navigator.userAgent.match(/Android.*AppleWebKit\/([\d.]+)/);
|
||||
var isaosp = (rxaosp && rxaosp[1] < 537);
|
||||
if (!window.cordova && isaosp)
|
||||
unsupported = true;
|
||||
}
|
||||
|
||||
|
||||
//Setting up route
|
||||
angular
|
||||
.module('copayApp')
|
||||
.config(function($routeProvider) {
|
||||
|
||||
$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',
|
||||
})
|
||||
// Payment intents come here.
|
||||
.when('/uri-payment/:data', {
|
||||
template: " ", // just fire controller
|
||||
controller: 'paymentUriController',
|
||||
})
|
||||
.when('/selectWalletForPayment', {
|
||||
template: " ", // just fire controller
|
||||
controller: 'walletForPaymentController',
|
||||
logged: true
|
||||
})
|
||||
.when('/join', {
|
||||
templateUrl: 'views/join.html',
|
||||
logged: true
|
||||
})
|
||||
.when('/import', {
|
||||
templateUrl: 'views/import.html',
|
||||
logged: true
|
||||
})
|
||||
.when('/importProfile', {
|
||||
templateUrl: 'views/importProfile.html',
|
||||
})
|
||||
.when('/create', {
|
||||
templateUrl: 'views/create.html',
|
||||
logged: true
|
||||
})
|
||||
.when('/copayers', {
|
||||
templateUrl: 'views/copayers.html',
|
||||
logged: true
|
||||
})
|
||||
.when('/homeWallet', {
|
||||
templateUrl: 'views/homeWallet.html',
|
||||
walletShouldBeComplete: true,
|
||||
logged: true
|
||||
})
|
||||
.when('/receive', {
|
||||
templateUrl: 'views/receive.html',
|
||||
walletShouldBeComplete: true,
|
||||
logged: true
|
||||
})
|
||||
.when('/history', {
|
||||
templateUrl: 'views/history.html',
|
||||
walletShouldBeComplete: true,
|
||||
logged: true
|
||||
})
|
||||
.when('/send', {
|
||||
templateUrl: 'views/send.html',
|
||||
walletShouldBeComplete: true,
|
||||
logged: true
|
||||
})
|
||||
.when('/more', {
|
||||
templateUrl: 'views/more.html',
|
||||
walletShouldBeComplete: true,
|
||||
logged: true
|
||||
})
|
||||
.when('/settings', {
|
||||
templateUrl: 'views/settings.html',
|
||||
walletShouldBeComplete: true,
|
||||
logged: false
|
||||
})
|
||||
.when('/warning', {
|
||||
templateUrl: 'views/warning.html',
|
||||
logged: true
|
||||
})
|
||||
.when('/profile', {
|
||||
templateUrl: 'views/profile.html',
|
||||
logged: true
|
||||
})
|
||||
.when('/add', {
|
||||
templateUrl: 'views/add.html',
|
||||
logged: true
|
||||
})
|
||||
.when('/signout', {
|
||||
template: " ", // just fire controller
|
||||
controller: 'signOutController',
|
||||
logged: true
|
||||
});
|
||||
|
||||
if (config.developmentFeatures) {
|
||||
$routeProvider.when('/devLogin/:mail/:password', {
|
||||
templateUrl: 'views/devLogin.html',
|
||||
logged: false
|
||||
});
|
||||
}
|
||||
|
||||
$routeProvider.otherwise({
|
||||
templateUrl: 'views/errors/404.html',
|
||||
title: 'Error'
|
||||
});
|
||||
});
|
||||
|
||||
//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.idle(timeout); // in seconds
|
||||
IdleProvider.timeout(40); // in seconds
|
||||
KeepaliveProvider.interval(30); // in seconds
|
||||
})
|
||||
.run(function($rootScope, $location, Idle, gettextCatalog, uriHandler, isCordova, amMoment) {
|
||||
|
||||
var userLang, androidLang;
|
||||
|
||||
if (navigator && navigator.userAgent && (androidLang = navigator.userAgent.match(/android.*\W(\w\w)-(\w\w)\W/i))) {
|
||||
userLang = androidLang[1];
|
||||
} else {
|
||||
// works for iOS and Android 4.x
|
||||
userLang = navigator.userLanguage || navigator.language;
|
||||
}
|
||||
|
||||
userLang = userLang ? (userLang.split('-', 1)[0] || 'en') : 'en';
|
||||
gettextCatalog.setCurrentLanguage(userLang);
|
||||
amMoment.changeLanguage(userLang);
|
||||
|
||||
// Register URI handler, not for mobileApp
|
||||
if (!isCordova) {
|
||||
Idle.watch();
|
||||
uriHandler.register();
|
||||
}
|
||||
|
||||
$rootScope.$on('$routeChangeStart', function(event, next, current) {
|
||||
if (unsupported) {
|
||||
$location.path('unsupported');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$rootScope.iden && next.logged) {
|
||||
Idle.unwatch();
|
||||
$location.path('/');
|
||||
}
|
||||
if ($rootScope.wallet && !$rootScope.wallet.isComplete() && next.walletShouldBeComplete) {
|
||||
$location.path('/copayers');
|
||||
}
|
||||
});
|
||||
})
|
||||
.config(function($compileProvider) {
|
||||
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|tel|chrome-extension|resource):/);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue