2014-11-30 00:31:17 -03:00
|
|
|
'use strict';
|
|
|
|
|
angular.module('copayApp.services')
|
|
|
|
|
.factory('applicationService', function() {
|
2014-12-04 15:45:50 -03:00
|
|
|
var root = {};
|
|
|
|
|
var isChromeApp = window.chrome && chrome.runtime && chrome.runtime.id;
|
2014-11-30 00:31:17 -03:00
|
|
|
|
2014-12-04 15:45:50 -03:00
|
|
|
root.restart = function() {
|
|
|
|
|
|
|
|
|
|
console.log('RESTART');
|
|
|
|
|
|
|
|
|
|
// Go home reloading the application
|
|
|
|
|
var hashIndex = window.location.href.indexOf('#!/');
|
|
|
|
|
if (isChromeApp) {
|
|
|
|
|
console.log('isChromeApp restting ');
|
|
|
|
|
chrome.runtime.restart();
|
|
|
|
|
} else {
|
2014-11-30 00:31:17 -03:00
|
|
|
window.location = window.location.href.substr(0, hashIndex);
|
2014-12-04 15:45:50 -03:00
|
|
|
}
|
|
|
|
|
};
|
2014-11-30 00:31:17 -03:00
|
|
|
|
2014-12-04 15:45:50 -03:00
|
|
|
root.reload = function() {
|
|
|
|
|
window.location.reload();
|
|
|
|
|
};
|
2014-11-30 00:31:17 -03:00
|
|
|
|
2014-12-04 15:45:50 -03:00
|
|
|
return root;
|
2014-11-30 00:31:17 -03:00
|
|
|
});
|