diff --git a/browser-extensions/include b/browser-extensions/include index f4860b28b..5a43929ed 100644 --- a/browser-extensions/include +++ b/browser-extensions/include @@ -13,3 +13,4 @@ popup.html lib/angular/angular-csp.css lib/angular/angular.min.js.map lib/angular-route/angular-route.min.js.map +lib/angular-touch/angular-touch.min.js.map diff --git a/css/src/main.css b/css/src/main.css index 4a4b32666..e83fc982d 100644 --- a/css/src/main.css +++ b/css/src/main.css @@ -22,6 +22,7 @@ color: #B7C2CD; } + #qr-canvas { display: none; } #qrcode-scanner-video { display: block; @@ -60,6 +61,7 @@ body, html{ height:100%; width:100%; color: #2C3E50; + -webkit-user-select: text; } header { diff --git a/index.html b/index.html index 5aac51371..b349ec383 100644 --- a/index.html +++ b/index.html @@ -21,6 +21,7 @@ +
Loading...
diff --git a/init.js b/init.js index 5376f93de..69fb26301 100644 --- a/init.js +++ b/init.js @@ -20,6 +20,18 @@ function init() { ld.visibility = "hidden"; } else if (ns6 || ie4) { ld.display = "none"; + } else { + console.log('Warning!! is a chrome app!'); + console.log('ns4', ns4); + console.log('ns6', ns6); + console.log('ie4', ie4); + + ld = document.loading; + + ld = document.getElementById("loading").style; + + ld.visibility = "hidden"; + ld.display = "none"; } } init(); diff --git a/initial.js b/initial.js index 728ed4f7f..fc12301b5 100644 --- a/initial.js +++ b/initial.js @@ -1,8 +1,8 @@ chrome.app.runtime.onLaunched.addListener(function() { chrome.app.window.create('index.html', { 'bounds': { - 'width': 1024, - 'height': 768 + 'width': 1200, + 'height': 800 } }); }); diff --git a/js/app.js b/js/app.js index c2d32926f..f6549f34a 100644 --- a/js/app.js +++ b/js/app.js @@ -4,19 +4,67 @@ var copay = require('copay'); var _ = require('lodash'); var config = defaultConfig; +var isChromeApp = window.chrome && chrome.runtime && chrome.runtime.id; + var localStorage; -if (window.chrome && chrome.runtime && chrome.runtime.id) { - console.log('Is a chrome app!'); +if (isChromeApp) { + var storage = chrome.storage.local; + + var myAccess = 'myAccess'; + + var obj = {}; + + obj[myAccess] = Math.floor((Math.random() * 1000) + 1);; + + storage.get(myAccess, function(result) { + console.log('Last access 1', JSON.stringify(myAccess), JSON.stringify(result)); + }); + + storage.set(obj); + + storage.get(myAccess, function(result) { + console.log('Last access 2', JSON.stringify(myAccess), JSON.stringify(result)); + }); + + + + console.log('Is a chrome app!...app.js'); + console.log('chrome.storage', chrome.storage); + chrome.storage.local.set({ + 'MiNombre': 'Matias' + }, function(done) { + console.log('Saving to local storage', done); + }); localStorage = chrome.storage.local; + + + console.log('localStorage', localStorage); } else { console.log('Is web!'); localStorage = window.localStorage; } +console.log('access to localStorage'); + var localConfig; if (localStorage) { - localConfig = JSON.parse(localStorage.getItem('config')); + + if (isChromeApp) { + var result; + localStorage.getItem('config', function(data) { + result = data; + }); + + console.log('retrieving data from local storage', result); + localConfig = JSON.parse(result); + } else { + localConfig = JSON.parse(localStorage.getItem('config')); + console.log('localStorage', localConfig); + } +} else { + + console.log('localStorage is null '); } diff --git a/js/controllers/settings.js b/js/controllers/settings.js index 894b40702..e3de9e3d7 100644 --- a/js/controllers/settings.js +++ b/js/controllers/settings.js @@ -12,7 +12,7 @@ angular.module('copayApp.controllers').controller('SettingsController', function var isChromeApp = window.chrome && chrome.runtime && chrome.runtime.id; if (isChromeApp) { - console.log('Is a chrome app!'); + console.log('Is a chrome app!...settings.js'); localStorage = chrome.storage.local; } else { console.log('Is web!'); @@ -92,6 +92,7 @@ angular.module('copayApp.controllers').controller('SettingsController', function plugins[$scope.selectedStorage.pluginName] = true; copay.logger.setLevel($scope.selectedLogLevel.name); + localstorageService.setItem('config', JSON.stringify({ network: insightSettings, version: copay.version, @@ -107,6 +108,7 @@ angular.module('copayApp.controllers').controller('SettingsController', function }), function() { applicationService.restart(); }); + }; diff --git a/js/controllers/unsupported.js b/js/controllers/unsupported.js index 714b01c19..661ca3141 100644 --- a/js/controllers/unsupported.js +++ b/js/controllers/unsupported.js @@ -5,7 +5,7 @@ angular.module('copayApp.controllers').controller('UnsupportedController', var localStorage; if (window.chrome && chrome.runtime && chrome.runtime.id) { - console.log('Is a chrome app!'); + console.log('Is a chrome app!..unssoported.js'); localStorage = chrome.storage.local; } else { console.log('Is web!'); diff --git a/js/models/Compatibility.js b/js/models/Compatibility.js index bab4f5b57..7a7c733d3 100644 --- a/js/models/Compatibility.js +++ b/js/models/Compatibility.js @@ -76,6 +76,15 @@ Compatibility._decrypt = function(base64, passphrase) { Compatibility._read = function(k, passphrase, cb) { preconditions.checkArgument(cb); + var localStorage; + if (window.chrome && chrome.runtime && chrome.runtime.id) { + console.log('Is a chrome app!..Compatibility.js'); + localStorage = chrome.storage.local; + } else { + console.log('Is web!'); + localStorage = window.localStorage; + } + var ret = localStorage.getItem(k); if (!ret) return cb(null); var ret = self._decrypt(ret, passphrase); diff --git a/js/plugins/LocalStorage.js b/js/plugins/LocalStorage.js index b0d852892..fc25aa894 100644 --- a/js/plugins/LocalStorage.js +++ b/js/plugins/LocalStorage.js @@ -7,6 +7,7 @@ var isChromeApp = window.chrome && chrome.runtime && chrome.runtime.id; function LocalStorage() { this.type = 'DB'; + if (isChromeApp) { localStorage = chrome.storage.local; window.localStorage = chrome.storage.local; diff --git a/js/routes.js b/js/routes.js index 8f5bf78ba..78609d2c1 100644 --- a/js/routes.js +++ b/js/routes.js @@ -119,12 +119,14 @@ angular } $rootScope.$on('$routeChangeStart', function(event, next, current) { + var localStorage; if (window.chrome && chrome.runtime && chrome.runtime.id) { - console.log('Is a chrome app!'); + console.log('Is a chrome app!...routes.js'); + console.log('chrome.storage', chrome.storage); + console.log('chrome.storage.local', chrome.storage.local); localStorage = chrome.storage.local; - console.log('chrome.storage', chrome.storage); console.log('localStorage', localStorage); } else { console.log('Is web!'); diff --git a/js/services/notifications.js b/js/services/notifications.js index cfb665938..42187f159 100644 --- a/js/services/notifications.js +++ b/js/services/notifications.js @@ -6,7 +6,7 @@ factory('notification', ['$timeout', var localStorage; if (window.chrome && chrome.runtime && chrome.runtime.id) { - console.log('Is a chrome app!'); + console.log('Is a chrome app!...notification.js'); localStorage = chrome.storage.local; } else { console.log('Is web!');