Solving chrome app problems

This commit is contained in:
Matias Pando 2014-12-01 11:19:18 -03:00
commit 40910c3b34
11 changed files with 204 additions and 45 deletions

View file

@ -4,6 +4,8 @@ angular.module('copayApp.controllers').controller('HeadController', function($sc
$scope.username = $rootScope.iden.getName();
$scope.hoverMenu = false;
console.log('$scope.username', $scope.username);
$scope.hoverIn = function() {
this.hoverMenu = true;
};
@ -30,14 +32,16 @@ angular.module('copayApp.controllers').controller('HeadController', function($sc
}
};
// Ensures a graceful disconnect
window.onbeforeunload = function() {
$scope.signout();
};
$scope.$on('$destroy', function() {
window.onbeforeunload = undefined;
});
//mpando restore after solve some chrome app error
// Ensures a graceful disconnect
// window.onbeforeunload = function() {
// $scope.signout();
// };
// $scope.$on('$destroy', function() {
// window.onbeforeunload = undefined;
// });
$scope.init = function() {
if (!$rootScope.wallet) return;

View file

@ -7,6 +7,18 @@ angular.module('copayApp.controllers').controller('SettingsController', function
$scope.insightTestnet = config.network.testnet.url;
$scope.defaultLogLevel = config.logLevel || 'log';
var localStorage;
var isChromeApp = window.chrome && chrome.runtime && chrome.runtime.id;
if (isChromeApp) {
console.log('Is a chrome app!');
localStorage = chrome.storage.local;
} else {
console.log('Is web!');
localStorage = window.localStorage;
}
var logLevels = copay.logger.getLevels();
$scope.availableLogLevels = [];

View file

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