Runs Copay as native desktop app
This commit is contained in:
parent
4953d86d8c
commit
f14aeaef0c
4 changed files with 36 additions and 8 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue