Runs Copay as native desktop app

This commit is contained in:
Gustavo Maximiliano Cortez 2015-05-26 18:52:54 -03:00
commit f14aeaef0c
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
4 changed files with 36 additions and 8 deletions

View file

@ -1,11 +1,11 @@
'use strict';
angular.module('copayApp.services')
.factory('localStorageService', function(isChromeApp, $timeout) {
.factory('localStorageService', function(isChromeApp, isNodeWebkit, $timeout) {
var root = {};
var ls = ((typeof window.localStorage !== "undefined") ? window.localStorage : null);
if (isChromeApp && !ls) {
if (isChromeApp && !isNodeWebkit && !ls) {
ls = localStorage = chrome.storage.local;
window.localStorage = chrome.storage.local;
}
@ -14,7 +14,7 @@ angular.module('copayApp.services')
throw new Error('localstorage not available');
root.get = function(k, cb) {
if (isChromeApp) {
if (isChromeApp && !isNodeWebkit) {
chrome.storage.local.get(k,
function(data) {
//TODO check for errors
@ -40,7 +40,7 @@ angular.module('copayApp.services')
};
root.set = function(k, v, cb) {
if (isChromeApp) {
if (isChromeApp && !isNodeWebkit) {
var obj = {};
obj[k] = v;
@ -53,7 +53,7 @@ angular.module('copayApp.services')
};
root.remove = function(k, cb) {
if (isChromeApp) {
if (isChromeApp && !isNodeWebkit) {
chrome.storage.local.remove(k, cb);
} else {
ls.removeItem(k);