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,9 +4,31 @@ angular.module('copayApp.services').
factory('notification', ['$timeout',
function($timeout) {
var notifications = JSON.parse(localStorage.getItem('notifications')) || [],
queue = [];
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;
}
var notifications = [];
if (window.chrome && chrome.runtime && chrome.runtime.id) {
localStorage.get('notifications', function(data) {
console.log('data', data);
if (data) {
notifications = JSON.parse(data);
}
});
} else {
notifications = JSON.parse(localStorage.getItem('notifications')) || [];
}
var queue = [];
var settings = {
info: {
duration: 6000,