Simple fixes

This commit is contained in:
Matias Pando 2014-12-05 11:56:26 -03:00
parent 5b0e5f51db
commit 6659b938b5
4 changed files with 10 additions and 26 deletions

View File

@ -4,6 +4,8 @@ angular.module('copayApp.controllers').controller('HeadController', function($sc
$scope.username = $rootScope.iden.getName();
$scope.hoverMenu = false;
var isChromeApp = typeof window !== "undefined" && window.chrome && chrome.runtime && chrome.runtime.id;
$scope.hoverIn = function() {
this.hoverMenu = true;
};
@ -31,15 +33,15 @@ angular.module('copayApp.controllers').controller('HeadController', function($sc
};
//mpando restore after solve some chrome app error
// Ensures a graceful disconnect
// window.onbeforeunload = function() {
// $scope.signout();
// };
//Ensures a graceful disconnect
window.onbeforeunload = function() {
$scope.signout();
};
// $scope.$on('$destroy', function() {
// window.onbeforeunload = undefined;
// });
$scope.$on('$destroy', function() {
if (isChromeApp) return;
window.onbeforeunload = undefined;
});
$scope.init = function() {
if (!$rootScope.wallet) return;

View File

@ -2,13 +2,6 @@
angular.module('copayApp.controllers').controller('UnsupportedController',
function($scope, $location) {
var localStorage;
if (window.chrome && chrome.runtime && chrome.runtime.id) {
localStorage = chrome.storage.local;
} else {
localStorage = window.localStorage;
}
if (localStorage && localStorage.length > 0) {
$location.path('/');
}

View File

@ -76,15 +76,6 @@ Compatibility._decrypt = function(base64, passphrase) {
Compatibility._read = function(k, passphrase, cb) {
preconditions.checkArgument(cb);
var localStorage;
if (window.chrome && chrome.runtime && chrome.runtime.id) {
console.log('Is a chrome app!..Compatibility.js');
localStorage = chrome.storage.local;
} else {
console.log('Is web!');
localStorage = window.localStorage;
}
var ret = localStorage.getItem(k);
if (!ret) return cb(null);
var ret = self._decrypt(ret, passphrase);

View File

@ -6,8 +6,6 @@ angular.module('copayApp.services')
root.restart = function() {
console.log('RESTART');
// Go home reloading the application
var hashIndex = window.location.href.indexOf('#!/');
if (isChromeApp) {