diff --git a/README.md b/README.md index 440af199d984bf7cbb29c4af8112336817bb619d..83c2d0407ff7029ae6dfd5bacc506d27ae9b092a 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,11 @@ To contribute and compile cesium, you will have to: cd cesium npm install bower install + ionic state restore +``` + - Installing Cordova plugins +``` + ionic state restore ``` - Compiling and running application diff --git a/config.xml b/config.xml index de06e4792dfaa0d74ba15cacb4c82731edb22f9f..11c90352cd1eaf4d18d860a6c20af89083330dba 100644 --- a/config.xml +++ b/config.xml @@ -15,7 +15,7 @@ </author> <content src="index.html" /> <access origin="*" /> - <icon src="www/img/logo.png" /> + <icon src="www/img/logo_96px.png" /> <preference name="webviewbounce" value="false" /> <preference name="UIWebViewBounce" value="false" /> <preference name="DisallowOverscroll" value="true" /> @@ -75,4 +75,8 @@ <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" /> <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" /> </platform> + <platform name="firefoxos"> + <icon height="128" src="resources/firefoxos/img/logo_128.png" width="128" /> + <icon height="60" src="resources/firefoxos/img/logo_60.png" width="60" /> + </platform> </widget> diff --git a/package.json b/package.json index 704bdf5d7ff5ad77041a369ead5cf2a75f31dc6e..5bdb2528bf1f67f498ec59509f2590fcdbc2caf6 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,6 @@ "gulp-concat": "^2.2.0", "gulp-rename": "^1.2.0", "gulp-sass": "^2.2.0", - "ionic-native-transitions": "^1.0.0-rc10", "node-sass": "^3.3.3" }, "devDependencies": { @@ -53,20 +52,19 @@ "cordova-plugin-console", "ionic-plugin-keyboard", "cordova-plugin-device", - "com.telerik.plugins.nativepagetransitions", - "org.apache.cordova.statusbar", - "org.apache.cordova.camera", + "cordova-plugin-statusbar", + "cordova-plugin-camera", + "cordova-plugin-websocket", + "cordova-plugin-vibration", + "cordova-plugin-dialogs", { "locator": "https://github.com/phonegap/phonegap-plugin-barcodescanner.git", "id": "phonegap-plugin-barcodescanner" - }, - "cordova-plugin-camera" + } ], "cordovaPlatforms": [ "ios", - { - "platform": "android", - "locator": "firefoxos" - } + "android", + "firefoxos" ] } diff --git a/resources/firefoxos/icon/logo_128px.png b/resources/firefoxos/icon/logo_128px.png new file mode 100644 index 0000000000000000000000000000000000000000..295d17aff561b02c0841edc3656453bd874fd9fb Binary files /dev/null and b/resources/firefoxos/icon/logo_128px.png differ diff --git a/resources/firefoxos/icon/logo_60px.png b/resources/firefoxos/icon/logo_60px.png new file mode 100644 index 0000000000000000000000000000000000000000..9a284d5d8ea2ed6a2013fadf6b5724d7729c6b0e Binary files /dev/null and b/resources/firefoxos/icon/logo_60px.png differ diff --git a/www/img/logo.png b/www/img/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..d68ee9c288a901a1d4c0731521029cdd3cfcede0 Binary files /dev/null and b/www/img/logo.png differ diff --git a/www/js/app.js b/www/js/app.js index 9d52b0884e361756986f6fb563e44ac8efa84baf..2fd8f9db392e70b5f1a5256a91badb35299ccc28 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -6,7 +6,7 @@ // 'starter.controllers' is found in controllers.js angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'ngAnimate', 'pascalprecht.translate', 'angularMoment', 'ngApi', // removeIf(no-device) - 'ngCordova', 'ionic-native-transitions', + 'ngCordova', // endRemoveIf(no-device) // removeIf(no-plugin) 'cesium.plugins', @@ -143,13 +143,15 @@ angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'ngAnimate', }) // removeIf(no-device) + // FIXME: native transition on a PAD move also move the left menu ! + /* .config(function($ionicNativeTransitionsProvider){ 'ngInject'; // Use native transition - // FIXME : native transition on a PAD move also the left menu ! - //var enableNativeTransitions = ionic.Platform.isAndroid() || ionic.Platform.isIOS(); - //$ionicNativeTransitionsProvider.enable(enableNativeTransitions); + var enableNativeTransitions = ionic.Platform.isAndroid() || ionic.Platform.isIOS(); + $ionicNativeTransitionsProvider.enable(enableNativeTransitions); }) + */ // endRemoveIf(no-device) .config(function($ionicConfigProvider) { @@ -207,3 +209,11 @@ angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'ngAnimate', PluginService.start(); }) ; + +// Workaround to add startsWith() if not present +if (typeof String.prototype.startsWith !== 'function') { + console.log("Adding String.prototype.startsWith() -> was missing on this platform"); + String.prototype.startsWith = function(prefix) { + return this.indexOf(prefix) === 0; + }; +} diff --git a/www/js/controllers/login-controllers.js b/www/js/controllers/login-controllers.js index 27ea7b9935571caf699c652745c2fad3c0935361..e7c8357fee6ae3a8e06123d28948f864a54c8910 100644 --- a/www/js/controllers/login-controllers.js +++ b/www/js/controllers/login-controllers.js @@ -60,8 +60,7 @@ function LoginModalController($scope, $rootScope, $ionicModal, Wallet, CryptoUti $timeout(function() { Modals.showNewAccount(); }, 300); - - } + }; // TODO : for DEV only /*$timeout(function() { diff --git a/www/js/controllers/wot-controllers.js b/www/js/controllers/wot-controllers.js index 6619dba3049b136c9c76efa6c6a4524776a55042..1b6cd124bbf4fefd252c99cd38debb93534f7788 100644 --- a/www/js/controllers/wot-controllers.js +++ b/www/js/controllers/wot-controllers.js @@ -248,7 +248,7 @@ function WotCertificationsViewController($scope, $state, BMA, Wallet, UIUtils, $ } }, 10); }); - } + }; // Certify click $scope.certify = function() { diff --git a/www/js/directives.js b/www/js/directives.js index 08db54fcf9600fb1e7c875ebe593148ea0e96eb5..718013447ea109ffe7f2822241a5f6421e85c09c 100644 --- a/www/js/directives.js +++ b/www/js/directives.js @@ -69,7 +69,7 @@ angular.module('cesium.directives', ['cesium.services']) path = path.substring(1); //hack because path does not return including hashbang scope.location = $location; scope.$watch('location.path()', function (newPath) { - if (newPath.startsWith(path)) { + if (newPath && newPath.indexOf(path) === 0) { element.addClass(clazz); } else { element.removeClass(clazz); @@ -174,7 +174,7 @@ angular.module('cesium.directives', ['cesium.services']) _.forEach(extensionPoints, function(extensionPoint){ tElement.append(getTemplate(extensionPoint)); }); - }; + } } return { @@ -183,8 +183,8 @@ angular.module('cesium.directives', ['cesium.services']) }, post: function(scope, iElement, iAttrs, controller){ PluginService.extensions.points.current.set(); - }, - } + } + }; }; @@ -196,6 +196,6 @@ angular.module('cesium.directives', ['cesium.services']) scope: { content:'=' } - } + }; }) ; diff --git a/www/js/services/bma-services.js b/www/js/services/bma-services.js index 80630ea2d72126cf419ed82161e5de2f7cead310..08867c85bd54e41097a33f6a4cbb879f098a032f 100644 --- a/www/js/services/bma-services.js +++ b/www/js/services/bma-services.js @@ -274,7 +274,6 @@ angular.module('cesium.bma.services', ['cesium.http.services', 'ngResource', } return result; }); - ; } function resetWotData() { diff --git a/www/js/services/currency-services.js b/www/js/services/currency-services.js index 3e5c2dcd39309dda01c56d65b90ed14c80b0e277..a62fe96f22a926887ee9143572d5b08ea9758991 100644 --- a/www/js/services/currency-services.js +++ b/www/js/services/currency-services.js @@ -30,7 +30,7 @@ angular.module('cesium.currency.services', ['ngResource', 'ngApi', 'cesium.bma.s ); // API extension point - return api.data.raisePromise.load(data) + return api.data.raisePromise.load(data); }) .then(function() { data.loaded = true; diff --git a/www/js/services/device-services.js b/www/js/services/device-services.js index 51bcd35bfc4dda7e6f269f4194f59901b9a6adf6..20bd9e80963186ec650b72b578dc5a0432add5e3 100644 --- a/www/js/services/device-services.js +++ b/www/js/services/device-services.js @@ -123,7 +123,7 @@ angular.module('cesium.device.services', ['ngResource', 'cesium.utils.services'] ready().then(function() { enable = !!navigator.camera; if (!enable) { - console.log('Device service disable'); + console.log('Device service disable (no camera)'); } }); diff --git a/www/js/services/plugin-services.js b/www/js/services/plugin-services.js index f6a006d7894d8e9f2b95b849760ea201273c716b..9d3fceefe7598e5c33e7b8fdd6c26afcdf839786 100644 --- a/www/js/services/plugin-services.js +++ b/www/js/services/plugin-services.js @@ -22,7 +22,7 @@ angular.module('cesium.plugin.services', []) extensionByStates[stateName].push(extension); } return this; - } + }; this.$get = ['$injector', '$state', function pluginFactory($injector, $state) { @@ -43,7 +43,7 @@ angular.module('cesium.plugin.services', []) return extensions.reduce(function(res, extension){ return extension.points && extension.points[extensionPointName] ? res.concat(extension.points[extensionPointName]) : res; }, []); - }; + } function setCurrentExtensionPointName(extensionPointName) { currentExtensionPointName = extensionPointName; diff --git a/www/js/services/wallet-services.js b/www/js/services/wallet-services.js index a5c95d9185c73aa48c4a691cef56c30994c2bc99..ca56874604607f6ab76f43d0b3f41eb2d4172135 100644 --- a/www/js/services/wallet-services.js +++ b/www/js/services/wallet-services.js @@ -199,7 +199,7 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser // If connected and same pubkey isUserPubkey = function(pubkey) { return isLogin() && data.pubkey === pubkey; - }; + }, store = function() { if (data.settings.useLocalStorage) { @@ -567,51 +567,51 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser }, loadData = function() { - if (data.loaded) { - return refreshData(); - } + if (data.loaded) { + return refreshData(); + } - return $q(function(resolve, reject){ - data.loaded = false; + return $q(function(resolve, reject){ + data.loaded = false; - $q.all([ + $q.all([ - // Get currency parameters - loadParameters(), + // Get currency parameters + loadParameters(), - // Get UDs - loadUDs(), + // Get UDs + loadUDs(), - // Get requirements - loadRequirements(), + // Get requirements + loadRequirements(), - // Get sources - loadSources(), + // Get sources + loadSources(), - // Get transactions - loadTransactions(), + // Get transactions + loadTransactions(), - // API extension - api.data.raisePromise.load(data) - ]) + // API extension + api.data.raisePromise.load(data) + ]) + .then(function() { + // Process transactions and sources + processTransactionsAndSources() .then(function() { - // Process transactions and sources - processTransactionsAndSources() - .then(function() { - finishLoadRequirements(); // must be call after loadParameters() and loadRequirements() - data.loaded = true; - resolve(data); - }) - .catch(function(err) { - data.loaded = false; - reject(err); - }); + finishLoadRequirements(); // must be call after loadParameters() and loadRequirements() + data.loaded = true; + resolve(data); }) .catch(function(err) { data.loaded = false; reject(err); }); + }) + .catch(function(err) { + data.loaded = false; + reject(err); }); + }); }, refreshData = function() { @@ -1028,7 +1028,8 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser resolve(); } }); - }; + } + ; // Register extension points api.registerEvent('data', 'load'); diff --git a/www/js/services/wot-services.js b/www/js/services/wot-services.js index 193ee4ae133bc38035167d20cd81c568321d1855..68f303e6b7eebf85c09b97a1ee4f4b9cc7a46c68 100644 --- a/www/js/services/wot-services.js +++ b/www/js/services/wot-services.js @@ -212,7 +212,7 @@ angular.module('cesium.wot.services', ['ngResource', 'ngApi', 'cesium.bma.servic return loadIdentity(pubkey, requirements) .then(function(identity){ angular.merge(data, identity); - }) + }); }), // Get sources diff --git a/www/manifest.json b/www/manifest.json index c0d5fed01708467550c30d11135f18034d9dd351..13f0b19bbdcf351e3e462f455deb3b76991d57d4 100644 --- a/www/manifest.json +++ b/www/manifest.json @@ -13,7 +13,7 @@ "type": "image/png" }, { - "src": "img/logo_large.svg", + "src": "img/logo.svg", "sizes": "192x192", "type": "image/svg" } diff --git a/www/plugins/es/js/controllers/common-controllers.js b/www/plugins/es/js/controllers/common-controllers.js index 2ee0dc7bde63e46417ad85ee92e15c5daf1b6dd6..64c67d1a405a1e03a6d624f894a743bebfc3e8f5 100644 --- a/www/plugins/es/js/controllers/common-controllers.js +++ b/www/plugins/es/js/controllers/common-controllers.js @@ -100,7 +100,7 @@ function ESCategoryModalController($scope, UIUtils, $timeout, parameters) { $timeout(function() { UIUtils.ink(); }, 10); - } + }; this.doSearch = function() { var searchText = this.searchText.toLowerCase().trim(); @@ -128,7 +128,7 @@ function ESCategoryModalController($scope, UIUtils, $timeout, parameters) { parameters.load() .then(function(res){ $scope.afterLoad(res); - }) + }); } } diff --git a/www/plugins/es/js/controllers/market-controllers.js b/www/plugins/es/js/controllers/market-controllers.js index 15f3e2a0193a1bb5e419982bfa5cbcde89092b6e..212571d2a53ef798fa02e164c8d82723478cd9ff 100644 --- a/www/plugins/es/js/controllers/market-controllers.js +++ b/www/plugins/es/js/controllers/market-controllers.js @@ -299,11 +299,11 @@ function ESMarketLookupController($scope, $rootScope, esMarket, $state, $focus, $scope.showCategoryModal = function() { // load categories esMarket.category.all() - .then(function(result){ + .then(function(categories){ return ModalUtils.show('plugins/es/templates/common/modal_category.html', 'ESCategoryModalCtrl as ctrl', - {categories : result}, + {categories : categories}, {focusFirstInput: true} - ) + ); }) .then(function(cat){ if (cat && cat.parent) { @@ -499,7 +499,7 @@ function ESMarketRecordEditController($scope, $ionicModal, Wallet, esMarket, UIU UIUtils.motion.ripple(); } $focus('market-record-title'); - }) + }); }); $scope.load = function(id) { @@ -603,7 +603,7 @@ function ESMarketRecordEditController($scope, $ionicModal, Wallet, esMarket, UIU $scope.cancel = function() { $ionicHistory.goBack(); - } + }; /* -- modals -- */ $scope.showRecordTypeModal = function() { @@ -618,11 +618,11 @@ function ESMarketRecordEditController($scope, $ionicModal, Wallet, esMarket, UIU $scope.showCategoryModal = function() { // load categories esMarket.category.all() - .then(function(result){ + .then(function(categories){ return ModalUtils.show('plugins/es/templates/common/modal_category.html', 'ESCategoryModalCtrl as ctrl', - {categories : result}, + {categories : categories}, {focusFirstInput: true} - ) + ); }) .then(function(cat){ if (cat && cat.parent) { diff --git a/www/plugins/es/js/controllers/registry-controllers.js b/www/plugins/es/js/controllers/registry-controllers.js index d149feeff4bbd6207d95335eb32cf18bfbf23e60..80358a29ce2cb5ec96b4d2026d03180b0c0240a1 100644 --- a/www/plugins/es/js/controllers/registry-controllers.js +++ b/www/plugins/es/js/controllers/registry-controllers.js @@ -249,7 +249,7 @@ function ESRegistryLookupController($scope, $state, $focus, $q, $timeout, esRegi $scope.search.results = []; } else { - var formatSlug = $filter('formatSlug') + var formatSlug = $filter('formatSlug'); var records = res.hits.hits.reduce(function(result, hit) { var record = hit._source; record.id = hit._id; @@ -314,10 +314,10 @@ function ESRegistryLookupController($scope, $state, $focus, $q, $timeout, esRegi $scope.showCategoryModal = function(parameters) { // load categories esRegistry.category.all() - .then(function(result){ + .then(function(categories){ // open modal return ModalUtils.show('plugins/es/templates/common/modal_category.html', 'ESCategoryModalCtrl as ctrl', - {categories: result}, {focusFirstInput: true}) + {categories: categories}, {focusFirstInput: true}); }) .then(function(cat){ if (cat && cat.parent) { @@ -581,7 +581,7 @@ function ESRegistryRecordEditController($scope, Wallet, esRegistry, UIUtils, $st }) .catch(UIUtils.onError('REGISTRY.ERROR.SAVE_RECORD_FAILED')); } - } + }; // Resize pictures $scope.formData.picturesCount = $scope.pictures.length; @@ -664,10 +664,10 @@ function ESRegistryRecordEditController($scope, Wallet, esRegistry, UIUtils, $st $scope.showCategoryModal = function(parameters) { // load categories esRegistry.category.all() - .then(function(result){ + .then(function(categories){ // open modal return ModalUtils.show('plugins/es/templates/common/modal_category.html', 'ESCategoryModalCtrl as ctrl', - {categories: result}, {focusFirstInput: true}) + {categories: categories}, {focusFirstInput: true}); }) .then(function(cat){ if (cat && cat.parent) { diff --git a/www/plugins/es/js/controllers/user-controllers.js b/www/plugins/es/js/controllers/user-controllers.js index 60a4e1f265e1ac540e1031737443a9dfb014b4a8..ab3dc80aeeed9d24df293c5521ca66e107fb8e18 100644 --- a/www/plugins/es/js/controllers/user-controllers.js +++ b/www/plugins/es/js/controllers/user-controllers.js @@ -110,7 +110,7 @@ function ProfileController($scope, $rootScope, UIUtils, $timeout, esUser, $filte $scope.submitAndSave = function() { $scope.form.$submitted=true; $scope.save(); - } + }; $scope.save = function(silent) { if(!$scope.form.$valid || !$rootScope.walletData) { @@ -133,7 +133,8 @@ function ProfileController($scope, $rootScope, UIUtils, $timeout, esUser, $filte UIUtils.toast.show(message); }); } - } + }; + var doFinishSave = function(formData) { if (!$scope.existing) { esUser.profile.add(formData) @@ -171,6 +172,6 @@ function ProfileController($scope, $rootScope, UIUtils, $timeout, esUser, $filte $scope.cancel = function() { $ionicHistory.goBack(); - } + }; } diff --git a/www/plugins/es/js/services/user-services.js b/www/plugins/es/js/services/user-services.js index 0c584425424776f59b023ae8365ed3b55362e31a..c2af90dfd64e8e20b319312dcd2fd74036dfc1f1 100644 --- a/www/plugins/es/js/services/user-services.js +++ b/www/plugins/es/js/services/user-services.js @@ -29,7 +29,7 @@ angular.module('cesium.es.user.services', ['cesium.services', 'cesium.es.http.se } } - onWalletLoad = function(data, resolve, reject) { + function onWalletLoad(data, resolve, reject) { if (!data || !data.pubkey) { if (resolve) { resolve(); @@ -58,7 +58,7 @@ angular.module('cesium.es.user.services', ['cesium.services', 'cesium.es.http.se }); } - onWotLoad = function(data, resolve, reject) { + function onWotLoad(data, resolve, reject) { if (!data || !data.pubkey) { if (resolve) { resolve(); @@ -90,7 +90,7 @@ angular.module('cesium.es.user.services', ['cesium.services', 'cesium.es.http.se }); } - onWotSearch = function(text, datas, resolve, reject) { + function onWotSearch(text, datas, resolve, reject) { if (!datas) { if (resolve) { resolve(); @@ -98,7 +98,7 @@ angular.module('cesium.es.user.services', ['cesium.services', 'cesium.es.http.se return; } - var text = text.toLowerCase().trim(); + text = text.toLowerCase().trim(); var map = {}; var request = { @@ -190,6 +190,13 @@ angular.module('cesium.es.user.services', ['cesium.services', 'cesium.es.http.se }); } + function removeListeners() { + _.forEach(listeners, function(remove){ + remove(); + }); + listeners = []; + } + // Extend Wallet.loadData() and WotService.loadData() if (esHttp.isEnable()) { listeners = [ @@ -199,12 +206,6 @@ angular.module('cesium.es.user.services', ['cesium.services', 'cesium.es.http.se ]; } - function removeListeners() { - _.forEach(listeners, function(remove){ - remove(); - }); - listeners = []; - } return { copy: copy,