diff --git a/app/config.json b/app/config.json index 8728e4c596ce166a270bc9d8cc67b265f7424ba4..7d811b91916dd97afd530bdc86f71c4fae2729fb 100644 --- a/app/config.json +++ b/app/config.json @@ -19,6 +19,16 @@ } }, + "android": { + "APP_CONFIG": { + "DUNITER_NODE": "cgeek.fr:9330", + "NEW_ISSUE_LINK": "https://github.com/duniter/cesium/issues/new?labels=bug", + "TIMEOUT": 6000, + "DEBUG": false, + "NATIVE_TRANSITION": true + } + }, + "duniter-fr-es": { "APP_CONFIG": { "DUNITER_NODE": "test-net.duniter.fr:9201", diff --git a/gulpfile.js b/gulpfile.js index 8988f85a9f1d8495bc46f9b5a29324c4065013b1..0f7750c92eddf5105dad8c3d2d7e738aa6b07d8d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -20,7 +20,7 @@ var paths = { templates: ['./www/templates/**/*.html'] }; -gulp.task('default', ['sass', /*'removeCode',*/ 'config']); +gulp.task('default', ['sass','config']); gulp.task('sass', function(done) { gulp.src('./scss/ionic.app.scss') @@ -34,12 +34,13 @@ gulp.task('sass', function(done) { .on('end', done); }); -gulp.task('removeCode', function(done) { - gulp.src('./www/templates/**/*.html') - .pipe(removeCode({ production: true })) - .pipe(gulp.dest('./dist/templates')) - .on('end', done); -}); +// TODO : enable to have a special buidl for phone +//gulp.task('removeCode', function(done) { +// gulp.src('./www/templates/**/*.html') +// .pipe(removeCode({ production: true })) +// .pipe(gulp.dest('./dist/templates')) +// .on('end', done); +//}); gulp.task('watch', function() { gulp.watch(paths.sass, ['sass']); diff --git a/package.json b/package.json index 7d7062d8a6dbbb091cce216fd5f90df7b289beec..b898f115d11f6a88788a009bb02646a2208f8b82 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cesium", - "version": "0.1.5", + "version": "0.1.6", "description": "A webapp client for Duniter network", "dependencies": { "gulp": "^3.9.1", @@ -26,7 +26,14 @@ "cordova-plugin-splashscreen", "cordova-plugin-console", "ionic-plugin-keyboard", - "cordova-plugin-device" + "cordova-plugin-device", + "com.telerik.plugins.nativepagetransitions", + "org.apache.cordova.statusbar", + "org.apache.cordova.camera", + { + "locator": "https://github.com/phonegap/phonegap-plugin-barcodescanner.git", + "id": "phonegap-plugin-barcodescanner" + } ], "cordovaPlatforms": [ "ios", diff --git a/www/css/style.css b/www/css/style.css index 6a771190abc81f9ae733825eb31d73f04b43817e..852f66b6ea4be659ecd210644b1a77ba9f2f963a 100644 --- a/www/css/style.css +++ b/www/css/style.css @@ -156,6 +156,10 @@ min-width: 130px !important; } +.item.item-icon-right .badge{ + right: 43px; +} + /*.button {*/ /*height: 50px !important;*/ /*font-size: 18px !important;*/ @@ -252,6 +256,10 @@ top: 14px; } +.peer-item:hover .badge{ + color: #fff !important; +} + .item-thumbnail-left-padding { padding-left: 106px; } @@ -267,5 +275,3 @@ #settings .item-divider { background-color: #f5f5f5; } - - diff --git a/www/index.html b/www/index.html index 25c883fa57cb7a176d6eaf3fbc9247758cf56bcb..624ad62713a924dfad75f77355c46aae09b86c6b 100644 --- a/www/index.html +++ b/www/index.html @@ -47,6 +47,7 @@ <!-- services --> <script src="js/services/crypto-services.js"></script> <script src="js/services/utils-services.js"></script> + <script src="js/services/device-services.js"></script> <script src="js/services/wallet-services.js"></script> <script src="js/services/bma-services.js"></script> <script src="js/services/market-services.js"></script> @@ -62,6 +63,7 @@ <script src="js/controllers/wot-controllers.js"></script> <script src="js/controllers/peer-controllers.js"></script> <script src="js/controllers/currency-controllers.js"></script> + <script src="js/controllers/currency-charts-controllers.js"></script> <script src="js/controllers/wallet-controllers.js"></script> <script src="js/controllers/transfer-controllers.js"></script> <script src="js/controllers/settings-controllers.js"></script> diff --git a/www/js/app.js b/www/js/app.js index 8ce2116efb0f641bb6cd124e90f0d0d40bf8b4e9..a2151dd804f784950afa7bf29d3bb6b3c121e474 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -193,18 +193,23 @@ angular.module('cesium', ['ionic', 'ngCordova', 'ionic-material', 'ngMessages', }; }]) -.run(function($ionicPlatform, $rootScope, amMoment, $translate) { +.run(function($ionicPlatform, $rootScope, amMoment, $translate, Device) { $ionicPlatform.ready(function() { - // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard - // for form inputs) - if (window.cordova && window.cordova.plugins.Keyboard) { - cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); - } - if (window.StatusBar) { - // org.apache.cordova.statusbar required - StatusBar.styleDefault(); - } - }); + // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard + // for form inputs) + if (window.cordova && window.cordova.plugins.Keyboard) { + cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); + } + if (window.StatusBar) { + // org.apache.cordova.statusbar required + StatusBar.styleDefault(); + } + + // Disable device services + if (!navigator.camera) { + Device.enable = false; + } + }); $rootScope.onLanguageChange = function() { var lang = $translate.use(); diff --git a/www/js/config.js b/www/js/config.js index 9525d199ab0a204fa30eee84f2b9622d7a3d3ed0..e4a8ead395f0580d25eb4f56d040d817e29b8ffd 100644 --- a/www/js/config.js +++ b/www/js/config.js @@ -14,8 +14,8 @@ angular.module("cesium.config", []) "TIMEOUT": 4000, "DEBUG": false, "NATIVE_TRANSITION": false, - "VERSION": "0.1.5", - "BUILD_DATE": "2016-05-30T07:08:26.918Z" + "VERSION": "0.1.6", + "BUILD_DATE": "2016-05-31T09:28:35.330Z" }) ; \ No newline at end of file diff --git a/www/js/controllers.js b/www/js/controllers.js index 5560427335bbeabcc6012005f46c8c2385341045..744eaaa9d79778ad70614ba4a9d6b42b7a52de62 100644 --- a/www/js/controllers.js +++ b/www/js/controllers.js @@ -4,6 +4,7 @@ angular.module('cesium.controllers', [ 'cesium.home.controllers', 'cesium.wallet.controllers', 'cesium.currency.controllers', + 'cesium.currency-charts.controllers', 'cesium.wot.controllers', 'cesium.transfer.controllers', 'cesium.settings.controllers', diff --git a/www/js/controllers/app-controllers.js b/www/js/controllers/app-controllers.js index 2b5c0edd1b3fcdfa9be000a21fcceea7bf5000e9..9714782dca994118a5fc71a1c98609e92a45c76d 100644 --- a/www/js/controllers/app-controllers.js +++ b/www/js/controllers/app-controllers.js @@ -68,7 +68,7 @@ function LoginModalController($scope, $rootScope, $ionicModal, Wallet, CryptoUti }, 2000); } }; - + // Login and load wallet $scope.loadWallet = function() { return $q(function(resolve, reject){ @@ -121,7 +121,7 @@ function LoginModalController($scope, $rootScope, $ionicModal, Wallet, CryptoUti var callback = $scope.loginData.callbacks.cancel; $scope.loginData = { // Reset login data rememberMe: Wallet.defaultSettings.rememberMe - }; + }; $scope.loginForm.$setPristine(); // Reset form $scope.loginModal.hide(); if (!!callback) { @@ -218,6 +218,18 @@ function LoginModalController($scope, $rootScope, $ionicModal, Wallet, CryptoUti return !Wallet.isLogin(); }; + $scope.scanQrCode = function(){ + if (Device.enable) { + Device.scan() + .then(function(result) { + if (result && result.text) { + $scope.search.text = result.text; + } + }) + .catch(UIUtils.onError('ERROR.SCAN_FAILED')); + } + }; + // TODO : for DEV only /*$timeout(function() { $scope.loginData = { @@ -231,7 +243,7 @@ function LoginModalController($scope, $rootScope, $ionicModal, Wallet, CryptoUti function AppController($scope, $rootScope, $ionicModal, $state, $ionicSideMenuDelegate, UIUtils, $q, $timeout, - CryptoUtils, BMA, Wallet, Registry, Market, APP_CONFIG, $ionicHistory, System, $translate + CryptoUtils, BMA, Wallet, Registry, Market, APP_CONFIG, $ionicHistory, Device, $translate ) { $scope.knownCurrencies = null; @@ -239,7 +251,6 @@ function AppController($scope, $rootScope, $ionicModal, $state, $ionicSideMenuDe $scope.isExpanded = false; $scope.hasHeaderFabLeft = false; $scope.hasHeaderFabRight = false; - $scope.system = System; $scope.config = APP_CONFIG; $scope.options = { market: { @@ -252,7 +263,7 @@ function AppController($scope, $rootScope, $ionicModal, $state, $ionicSideMenuDe LoginModalController.call(this, $scope, $rootScope, $ionicModal, Wallet, CryptoUtils, UIUtils, $q, $state, $timeout, $ionicSideMenuDelegate, $ionicHistory); - TransferModalController.call(this, $scope, $ionicModal, $state, BMA, Wallet, UIUtils, $timeout, System); + TransferModalController.call(this, $scope, $ionicModal, $state, BMA, Wallet, UIUtils, $timeout, Device); //////////////////////////////////////// // Load currencies @@ -260,21 +271,24 @@ function AppController($scope, $rootScope, $ionicModal, $state, $ionicSideMenuDe $scope.loadCurrencies = function() { return $q(function (resolve, reject){ - if (!!$scope.knownCurrencies) { + if (!!$scope.knownCurrencies) { // get list on once resolve($scope.knownCurrencies); return; } if (!!Registry) { + $scope.knownCurrencies = null; // reset Registry.currency.all() .then(function (res) { + var currencies = null; if (!!res.hits && res.hits.total > 0) { - $scope.knownCurrencies = res.hits.hits.reduce(function(res, hit) { + currencies = res.hits.hits.reduce(function(res, hit) { var peer = hit._source.peers.reduce(function(peers, peer){ return peers.concat(new Peer(peer)); }, [])[0]; - return res.concat({id: hit._id, peer: peer.host+':'+peer.port}); + return res.concat({name: hit._id, peer: peer.host+':'+peer.port}); }, []); } + $scope.knownCurrencies = currencies; $scope.search.looking = false; resolve($scope.knownCurrencies); }) @@ -283,10 +297,10 @@ function AppController($scope, $rootScope, $ionicModal, $state, $ionicSideMenuDe else { $scope.knownCurrencies = []; BMA.currency.parameters() - .then(function(params) { + .then(function(res) { $scope.knownCurrencies.push({ - id: params.currency, - peer: APP_CONFIG.DUNITER_NODE} + name: res.currency, + peer: BMA.node.url} ); $scope.search.looking = false; resolve($scope.knownCurrencies); @@ -296,6 +310,28 @@ function AppController($scope, $rootScope, $ionicModal, $state, $ionicSideMenuDe }); }; + //////////////////////////////////////// + // Device Methods + //////////////////////////////////////// + + $scope.isDeviceEnable = function() { + return Device.enable; + }; + + $scope.scanQrCodeAndGo = function() { + if (!Device.enable) { + return; + } + Device.camera.scan() + .then(function(result) { + if (result && result.text) { + // Go To this pubkey + $state.go('app.view_identity', {pub: result.text}); + } + }) + .catch(UIUtils.onError('ERROR.SCAN_FAILED')); + }; + //////////////////////////////////////// // Layout Methods //////////////////////////////////////// diff --git a/www/js/controllers/currency-charts-controllers.js b/www/js/controllers/currency-charts-controllers.js new file mode 100644 index 0000000000000000000000000000000000000000..d787dc541ee9534bd1013cd645efe055fc8dcef7 --- /dev/null +++ b/www/js/controllers/currency-charts-controllers.js @@ -0,0 +1,110 @@ + +angular.module('cesium.currency-charts.controllers', ['cesium.services']) + +.config(function($stateProvider, $urlRouterProvider) { + $stateProvider + + .state('app.currency_ud', { + url: "/currency/ud", + views: { + 'menuContent': { + templateUrl: "templates/currency/charts/ud.html", + controller: 'CurrencyUdCtrl' + } + } + }) + ; +}) + +.controller('CurrencyUdCtrl', CurrencyUdController) + +; + +function CurrencyUdController($scope, BMA, $q) { + + $scope.$on('$ionicView.enter', function(e, $state) { + $scope.loadUds() + .then(function (uds) { + if (uds.length) { + // alert + var x = uds.reduce(function(values, block) { + return values.concat(block.medianTime); + }, []); + var y = uds.reduce(function(values, block) { + return values.concat(block.dividend); + }, []); + + $scope.acData.data.x = x; + $scope.acData.data.y = y; + } + }); + }); + + $scope.loadUds = function() { + return $q(function(resolve, reject) { + BMA.blockchain.stats.ud() + .then(function (res) { + if (res.result.blocks.length) { + var uds = []; + var blockRequests = []; + res.result.blocks.forEach(function(number) { + blockRequests.push( + BMA.blockchain.block({ block: number }) + .then(function(block){ + uds.push({ + number: block.number, + dividend: block.dividend, + medianTime: block.medianTime + }); + }) + ); + }); + $q.all(blockRequests) + .then(function() { + _.sortBy(uds, function(b){return b.number}); + resolve(uds); + }) + } + else { + resolve([]); + } + }); + }); + } + + $scope.acData = { + series: ["UD"], + data: [{ + x: "Computers", + y: [54, 0, 879], + tooltip: "This is a tooltip" + }] + }; + $scope.chartType ='line'; + $scope.config = { + title: '', // chart title. If this is false, no title element will be created. + tooltips: true, + labels: false, // labels on data points + // exposed events + mouseover: function() {}, + mouseout: function() {}, + click: function() {}, + // legend config + legend: { + display: true, // can be either 'left' or 'right'. + position: 'left', + // you can have html in series name + htmlEnabled: false + }, + // override this array if you're not happy with default colors + colors: [], + innerRadius: 0, // Only on pie Charts + lineLegend: 'lineEnd', // Only on line Charts + lineCurveType: 'cardinal', // change this as per d3 guidelines to avoid smoothline + isAnimate: true, // run animations while rendering chart + yAxisTickFormat: 's', //refer tickFormats in d3 to edit this value + xAxisMaxTicks: 7, // Optional: maximum number of X axis ticks to show if data points exceed this number + yAxisTickFormat: 's', // refer tickFormats in d3 to edit this value + waitForHeightAndWidth: false // if true, it will not throw an error when the height or width are not defined (e.g. while creating a modal form), and it will be keep watching for valid height and width values + }; +} diff --git a/www/js/controllers/currency-controllers.js b/www/js/controllers/currency-controllers.js index d09db9cffc42c66a81b876155fd0783bdc707239..6403604b9c249c818db726c0671ed191881dd35b 100644 --- a/www/js/controllers/currency-controllers.js +++ b/www/js/controllers/currency-controllers.js @@ -15,7 +15,7 @@ angular.module('cesium.currency.controllers', ['cesium.services']) }) .state('app.currency_view', { - url: "/currency/view/:id", + url: "/currency/view/:name", views: { 'menuContent': { templateUrl: "templates/currency/view_currency.html", @@ -25,7 +25,7 @@ angular.module('cesium.currency.controllers', ['cesium.services']) }) .state('app.currency_view_lg', { - url: "/currency/view/lg/:id", + url: "/currency/view/lg/:name", views: { 'menuContent': { templateUrl: "templates/currency/view_currency_lg.html", @@ -76,19 +76,16 @@ function CurrencyLookupController($scope, $state, $q, $timeout, UIUtils, APP_CON $scope.selectCurrency = function(id, large) { $scope.selectedCurrency = id; if (large) { - $state.go('app.currency_view_lg', {id: id}); + $state.go('app.currency_view_lg', {name: id}); } else { - $state.go('app.currency_view', {id: id}); + $state.go('app.currency_view', {name: id}); } }; } -function CurrencyViewController($scope, $rootScope, $state, BMA, $q, UIUtils, $interval, $timeout, Registry) { +function CurrencyViewController($scope, $rootScope, $state, BMA, $q, UIUtils, $interval, $timeout, Registry, Wallet) { - var USE_RELATIVE_DEFAULT = true; - - WotLookupController.call(this, $scope, BMA, $state, UIUtils, $timeout); PeersController.call(this, $scope, $rootScope, BMA, UIUtils, $q, $interval, $timeout); $scope.search = { @@ -98,32 +95,33 @@ function CurrencyViewController($scope, $rootScope, $state, BMA, $q, UIUtils, $i listInset: true } }; - $scope.formData = { useRelative: false }; + $scope.formData = { + useRelative: Wallet.data.settings.useRelative + }; $scope.knownBlocks = []; - $scope.id = null; $scope.node = null; + $scope.loading = true; $scope.$on('$ionicView.enter', function(e, $state) { if (!!$scope.node) { $scope.node.websocket.block().close(); $scope.node = null; } - if ($state.stateParams && $state.stateParams.id) { // Load by id - $scope.id = $state.stateParams.id; - $scope.load($scope.id); + if ($state.stateParams && $state.stateParams.name) { // Load by name + $scope.load($scope.name); } else { if (Registry) { $state.go('app.currency_lookup'); } else { - UIUtils.loading.show(); $scope.loadCurrencies() - .then(function (res) { - $scope.load(res.id); - UIUtils.loading.hide(); - }) - .catch(UIUtils.onError('ERROR.GET_CURRENCY_FAILED')); + .then(function (currencies) { + if (currencies && currencies.length > 0) { + $scope.load(currencies[0]); + } + }) + .catch(UIUtils.onError('ERROR.GET_CURRENCY_FAILED')); } return; } @@ -133,11 +131,11 @@ function CurrencyViewController($scope, $rootScope, $state, BMA, $q, UIUtils, $i $scope.closeNode(); }); - $scope.load = function(id) { + $scope.load = function(name) { $scope.closeNode(); if (!!Registry) { - Registry.currency.get({ id: id }) + Registry.currency.get({ id: name }) .then(function(currency) { if (!!currency.peers && currency.peers.length > 0) { var peer = currency.peers.reduce(function (peers, peer){ @@ -157,7 +155,7 @@ function CurrencyViewController($scope, $rootScope, $state, BMA, $q, UIUtils, $i $scope.startListeningOnSocket(); $timeout(function() { if ((!$scope.search.peers || $scope.search.peers.length === 0) && $scope.search.lookingForPeers){ - $scope.updateExploreView(); + $scope.refresh(); } }, 2000); } @@ -175,7 +173,7 @@ function CurrencyViewController($scope, $rootScope, $state, BMA, $q, UIUtils, $i // We wait 2s when a new block is received, just to wait for network propagation var wait = $scope.knownBlocks.length === 1 ? 0 : 2000; $timeout(function() { - $scope.updateExploreView(); + $scope.refresh(); }, wait); } }); @@ -192,39 +190,38 @@ function CurrencyViewController($scope, $rootScope, $state, BMA, $q, UIUtils, $i $scope.node = null; }; - $scope.$watch('formData.useRelative', function() { - if ($scope.formData.useRelative) { - $scope.M = $scope.M / $scope.currentUD; - $scope.MoverN = $scope.MoverN / $scope.currentUD; - $scope.UD = $scope.UD / $scope.currentUD; - $scope.unit = 'universal_dividend'; - $scope.udUnit = $scope.baseUnit; - } else { - $scope.M = $scope.M * $scope.currentUD; - $scope.MoverN = $scope.MoverN * $scope.currentUD; - $scope.UD = $scope.UD * $scope.currentUD; - $scope.unit = $scope.baseUnit; - $scope.udUnit = ''; + $scope.onUseRelativeChanged = function() { + if (!$scope.loading) { + if ($scope.formData.useRelative) { + $scope.M = $scope.M / $scope.currentUD; + $scope.MoverN = $scope.MoverN / $scope.currentUD; + $scope.UD = $scope.UD / $scope.currentUD; + $scope.unit = 'universal_dividend'; + $scope.udUnit = $scope.baseUnit; + } else { + $scope.M = $scope.M * $scope.currentUD; + $scope.MoverN = $scope.MoverN * $scope.currentUD; + $scope.UD = $scope.UD * $scope.currentUD; + $scope.unit = $scope.baseUnit; + $scope.udUnit = ''; + } } - }, true); - - $scope.doUpdate = function() { - $scope.updateExploreView(); }; + $scope.$watch('formData.useRelative', $scope.onUseRelativeChanged, true); - $scope.updateExploreView = function() { + $scope.refresh = function() { if (!$scope.node) { return; } UIUtils.loading.show(); - $scope.formData.useRelative = false; $q.all([ // Get the currency parameters $scope.node.currency.parameters() .then(function(json){ + $scope.currency = json.currency; $scope.c = json.c; $scope.baseUnit = json.currency; $scope.unit = json.currency; @@ -259,14 +256,23 @@ function CurrencyViewController($scope, $rootScope, $state, BMA, $q, UIUtils, $i $scope.M = $scope.M - $scope.UD*$scope.Nprev; $scope.MoverN = $scope.M / $scope.Nprev; $scope.cactual = 100 * $scope.UD / $scope.MoverN; - $scope.formData.useRelative = USE_RELATIVE_DEFAULT; + //$scope.formData.useRelative = USE_RELATIVE_DEFAULT; // Set Ink UIUtils.ink({selector: '.peer-item'}); + $scope.loading = false; + + if ($scope.formData.useRelative) { + $scope.onUseRelativeChanged(); // convert to UD + } + UIUtils.loading.hide(); }) - .catch(UIUtils.onError('ERROR.LOAD_NODE_DATA_FAILED')) + .catch(function(err) { + $scope.loading = false; + UIUtils.onError('ERROR.LOAD_NODE_DATA_FAILED')(err); + }) .then(function(){ // Network $scope.searchPeers(); diff --git a/www/js/controllers/market-controllers.js b/www/js/controllers/market-controllers.js index 2401f6972b39fefaa9fb1824eb488fed618e33de..d77228e4819afa33459408aa5036eb99a1adc153 100644 --- a/www/js/controllers/market-controllers.js +++ b/www/js/controllers/market-controllers.js @@ -351,7 +351,7 @@ function MarketRecordViewController($scope, $ionicModal, Wallet, Market, UIUtils }; } -function MarketRecordEditController($scope, $ionicModal, Wallet, Market, UIUtils, $state, CryptoUtils, $q, $ionicPopup, System, $timeout) { +function MarketRecordEditController($scope, $ionicModal, Wallet, Market, UIUtils, $state, CryptoUtils, $q, $ionicPopup, Device, $timeout) { MarketCategoryModalController.call(this, $scope, Market, $state, $ionicModal, UIUtils); @@ -361,7 +361,6 @@ function MarketRecordEditController($scope, $ionicModal, Wallet, Market, UIUtils $scope.isMember = false; $scope.category = {}; $scope.pictures = []; - $scope.system = System; $scope.$on('$ionicView.enter', function(e, $state) { $scope.loadWallet() @@ -449,8 +448,8 @@ function MarketRecordEditController($scope, $ionicModal, Wallet, Market, UIUtils $scope.closeCategoryModal(); }; - $scope.takePicture = function() { - System.camera.take() + $scope.getPicture = function() { + Device.camera.getPicture() .then(function(imageData) { $scope.pictures.push({src: "data:image/png;base64," + imageData}); $scope.$apply(); @@ -462,7 +461,7 @@ function MarketRecordEditController($scope, $ionicModal, Wallet, Market, UIUtils UIUtils.loading.show(); return $q(function(resolve, reject) { var file = event.target.files[0]; - System.image.resize(file) + UIUtils.image.resize(file) .then(function(imageData) { $scope.pictures.push({src: imageData}); UIUtils.loading.hide(); diff --git a/www/js/controllers/registry-controllers.js b/www/js/controllers/registry-controllers.js index 299cd149a302cd681f2d534e3eed1dd5f5c80047..9da36f16c9ae7e4a98fbe3c5c11b0eb047fac871 100644 --- a/www/js/controllers/registry-controllers.js +++ b/www/js/controllers/registry-controllers.js @@ -422,7 +422,7 @@ function RegistryRecordViewController($scope, $ionicModal, Wallet, Registry, UIU } -function RegistryRecordEditController($scope, $ionicModal, Wallet, Registry, UIUtils, $state, CryptoUtils, $q, $ionicPopup, $translate, System, +function RegistryRecordEditController($scope, $ionicModal, Wallet, Registry, UIUtils, $state, CryptoUtils, $q, $ionicPopup, $translate, Device, $ionicHistory) { RegistryCategoryModalController.call(this, $scope, Registry, $state, $ionicModal, UIUtils); @@ -436,8 +436,6 @@ function RegistryRecordEditController($scope, $ionicModal, Wallet, Registry, UIU $scope.category = {}; $scope.pictures = []; - $scope.system = System; - $scope.setRecordForm = function(recordForm) { $scope.recordForm = recordForm; }; @@ -514,7 +512,7 @@ function RegistryRecordEditController($scope, $ionicModal, Wallet, Registry, UIU }; $scope.openPicturePopup = function() { - System.camera.take() + Device.camera.getPicture() .then(function(imageData) { $scope.pictures.push({src: "data:image/png;base64," + imageData}); $scope.$apply(); @@ -526,7 +524,7 @@ function RegistryRecordEditController($scope, $ionicModal, Wallet, Registry, UIU UIUtils.loading.show(); return $q(function(resolve, reject) { var file = event.target.files[0]; - System.image.resize(file) + UIUtils.image.resize(file) .then(function(imageData) { $scope.pictures.push({src: imageData}); UIUtils.loading.hide(); diff --git a/www/js/controllers/transfer-controllers.js b/www/js/controllers/transfer-controllers.js index 98f666639699ff22f6596336acb9a96e7b31d446..ae2d75ee4e9e03292f33a459d52be9c965980986 100644 --- a/www/js/controllers/transfer-controllers.js +++ b/www/js/controllers/transfer-controllers.js @@ -38,9 +38,9 @@ angular.module('cesium.transfer.controllers', ['cesium.services', 'cesium.curren .controller('TransferCtrl', TransferController) ; -function TransferController($scope, $ionicModal, $state, BMA, Wallet, UIUtils, $timeout, System) { +function TransferController($scope, $ionicModal, $state, BMA, Wallet, UIUtils, $timeout, Device) { - TransferModalController.call(this, $scope, $ionicModal, $state, BMA, Wallet, UIUtils, $timeout, System); + TransferModalController.call(this, $scope, $ionicModal, $state, BMA, Wallet, UIUtils, $timeout, Device); $scope.$on('$ionicView.enter', function(e, $state) { if (!!$state.stateParams && !!$state.stateParams.pubkey) { @@ -63,7 +63,7 @@ function TransferController($scope, $ionicModal, $state, BMA, Wallet, UIUtils, $ }); } -function TransferModalController($scope, $ionicModal, $state, BMA, Wallet, UIUtils, $timeout, System) { +function TransferModalController($scope, $ionicModal, $state, BMA, Wallet, UIUtils, $timeout, Device) { $scope.walletData = {}; $scope.convertedBalance = 0; @@ -78,7 +78,7 @@ function TransferModalController($scope, $ionicModal, $state, BMA, Wallet, UIUti $scope.udAmount = null; $scope.commentPattern = Wallet.regex.COMMENT; - WotLookupController.call(this, $scope, BMA, $state, UIUtils, $timeout, System); + WotLookupController.call(this, $scope, BMA, $state, UIUtils, $timeout, Device); // Create the login modal that we will use later $ionicModal.fromTemplateUrl('templates/wallet/modal_transfer.html', { diff --git a/www/js/controllers/wot-controllers.js b/www/js/controllers/wot-controllers.js index 2cd011df70fbc3cc8fafc788d45d9d069306325b..6bdba064849f1d91dd6420150e002e0aec6cad44 100644 --- a/www/js/controllers/wot-controllers.js +++ b/www/js/controllers/wot-controllers.js @@ -42,9 +42,7 @@ angular.module('cesium.wot.controllers', ['cesium.services']) .controller('WotCertificationsViewCtrl', WotCertificationsViewController) ; -function WotLookupController($scope, BMA, $state, UIUtils, $timeout, System) { - - $scope.system.camera = System; +function WotLookupController($scope, BMA, $state, UIUtils, $timeout, Device) { $scope.searchChanged = function() { $scope.search.looking = true; @@ -87,19 +85,20 @@ function WotLookupController($scope, BMA, $state, UIUtils, $timeout, System) { }; $scope.scanQrCode = function(){ - if (System.camera.enable) { - System.camera.scan() - .then(function(result) { - if (!result) { - $scope.search.text = result.text; - } - }) - .catch(UIUtils.onError('ERROR.SCAN_FAILED')); + if (!Device.enable) { + return; } + Device.camera.scan() + .then(function(result) { + if (!result) { + $scope.search.text = result.text; + } + }) + .catch(UIUtils.onError('ERROR.SCAN_FAILED')); }; } -function WotIdentityViewController($scope, $state, BMA, Wallet, UIUtils, $q, $timeout, System) { +function WotIdentityViewController($scope, $state, BMA, Wallet, UIUtils, $q, $timeout, Device) { $scope.identity = {}; $scope.hasSelf = false; @@ -222,8 +221,8 @@ function WotIdentityViewController($scope, $state, BMA, Wallet, UIUtils, $q, $ti // Copy $scope.copy = function(value) { - if (value && System.clipboard.enable) { - System.clipboard.copy(value); + if (value && Device.enable) { + Device.clipboard.copy(value); } }; @@ -244,7 +243,7 @@ function WotIdentityViewController($scope, $state, BMA, Wallet, UIUtils, $q, $ti $scope.showFab('fab-transfer'); } -function WotCertificationsViewController($scope, $state, BMA, Wallet, UIUtils, $q, $timeout, System) { +function WotCertificationsViewController($scope, $state, BMA, Wallet, UIUtils, $q, $timeout, Device) { $scope.certifications = []; $scope.identity = {}; diff --git a/www/js/services.js b/www/js/services.js index 650bb8320419e8dfbff7c1f83fe591a1a8accb6a..c7d9aeb3ed416f18b37825d5db80979e0b5ce9c7 100644 --- a/www/js/services.js +++ b/www/js/services.js @@ -3,6 +3,7 @@ angular.module('cesium.services', [ 'cesium.bma.services', 'cesium.crypto.services', 'cesium.utils.services', + 'cesium.device.services', 'cesium.wallet.services', 'cesium.market.services', 'cesium.registry.services' diff --git a/www/js/services/device-services.js b/www/js/services/device-services.js new file mode 100644 index 0000000000000000000000000000000000000000..3a11d105340e6125efbfdfada56d4053a63aa02e --- /dev/null +++ b/www/js/services/device-services.js @@ -0,0 +1,115 @@ + +angular.module('cesium.device.services', ['ngResource', 'cesium.utils.services']) + +.factory('Device', ['UIUtils', '$translate', '$ionicPopup', '$cordovaClipboard', '$cordovaBarcodeScanner', '$q', '$cordovaCamera', + function(UIUtils, $translate, $ionicPopup, $cordovaClipboard, $cordovaBarcodeScanner, $q, $cordovaCamera) { + + var CONST = { + MAX_HEIGHT: 400, + MAX_WIDTH: 400 + }, + enable = false; + + getPicture = function(sourceType) { + return $q(function (resolve, reject) { + if (!enable) { + reject('Camera not enable. Please set [Device.enable] to true before use.'); + return; + } + if (!sourceType) { + $translate(['SYSTEM.PICTURE_CHOOSE_TYPE', 'SYSTEM.BTN_PICTURE_GALLERY', 'SYSTEM.BTN_PICTURE_CAMERA']) + .then(function(translations){ + $ionicPopup.show({ + title: translations['SYSTEM.PICTURE_CHOOSE_TYPE'], + buttons: [ + { + text: translations['SYSTEM.BTN_PICTURE_GALLERY'], + type: 'button', + onTap: function(e) { + return navigator.camera.PictureSourceType.PHOTOLIBRARY; + } + }, + { + text: translations['SYSTEM.BTN_PICTURE_CAMERA'], + type: 'button button-positive', + onTap: function(e) { + return navigator.camera.PictureSourceType.CAMERA; + } + } + ] + }) + .then(function(sourceType){ + getPicture(sourceType); + }); + }); + } + else { + var options = { + quality: 50, + destinationType: navigator.camera.DestinationType.DATA_URL, + sourceType: sourceType, + encodingType: navigator.camera.EncodingType.PNG, + targetWidth : CONST.MAX_WIDTH, + targetHeight : CONST.MAX_HEIGHT + }; + $cordovaCamera.getPicture( + function (imageData) {resolve(imageData);}, + function(err){reject(err);}, + options + ); + } + }); + }; + + scan = function () { + return $q(function(resolve,reject){ + if (!enable) { + reject('Camera not enable. Please set [Device.enable] to true before use.'); + return; + } + $cordovaBarcodeScanner.scan() + .then(function(result) { + if (!result.cancelled) { + resolve(result); + } + else { + resolve(); + } + }, + function(error) {reject(error);}); + }); + }; + + copy = function (text, callback) { + if (!enable) { + return; // do nothing if not available + } + $cordovaClipboard + .copy(text) + .then(function () { + // success + if (callback) { + callback(); + } + else { + console.log("Copy text to clipboard: " + text); + } + }, function () { + // error + UIUtils.alert.error('ERROR.COPY_CLIPBOARD'); + }); + }; + + return { + enable: enable, + clipboard: { + copy: copy + }, + camera: { + getPicture : getPicture, + scan: scan + } + }; +}]) + +; diff --git a/www/js/services/utils-services.js b/www/js/services/utils-services.js index 624d5aea229f39d8f0fa3eca80960925773b937f..b3d60d41e07001bd80b73adb532627055e5db9be 100644 --- a/www/js/services/utils-services.js +++ b/www/js/services/utils-services.js @@ -82,6 +82,16 @@ angular.module('cesium.utils.services', ['ngResource']) }); } + function showToast(message, duration) { + if (!duration) { + duration = 2000; // 2s + } + $translate([message]) + .then(function(translations){ + $ionicLoading.show({ template: translations[message], noBackdrop: true, duration: duration }); + }); + } + function onError(msg, reject/*optional*/) { return function(err) { var fullMsg = msg; @@ -136,21 +146,73 @@ angular.module('cesium.utils.services', ['ngResource']) return selectedText; } + function resizeImageFromFile(file) { + return $q(function(resolve, reject) { + + var reader = new FileReader(); + + reader.onload = function(event){ + var img = document.createElement("img"); + + img.onload = function(event) { + var width = event.target.width; + var height = event.target.height; + + if (width > height) { + if (width > CONST.MAX_WIDTH) { + height *= CONST.MAX_WIDTH / width; + width = CONST.MAX_WIDTH; + } + } else { + if (height > CONST.MAX_HEIGHT) { + width *= CONST.MAX_HEIGHT / height; + height = CONST.MAX_HEIGHT; + } + } + var canvas = document.createElement("canvas"); + canvas.width = width; + canvas.height = height; + var ctx = canvas.getContext("2d"); + ctx.drawImage(event.target, 0, 0, canvas.width, canvas.height); + + var dataurl = canvas.toDataURL(); + + resolve(dataurl); + }; + + img.src = event.target.result; + }; + + if (file) { + reader.readAsDataURL(file); + } + else { + //reject("Not a file"); + } + }); + } + return { alert: { error: alertError, - info: alertInfo + info: alertInfo, }, loading: { show: showLoading, hide: hideLoading }, + toast: { + show: showToast + }, onError: onError, ink: ionicMaterialInk.displayEffect, motion: ionicMaterialMotion, selection: { select: selectElementText, get: getSelectionText + }, + image: { + resize: resizeImageFromFile } }; }]) @@ -173,7 +235,7 @@ angular.module('cesium.utils.services', ['ngResource']) }]) // See http://plnkr.co/edit/vJQXtsZiX4EJ6Uvw9xtG?p=preview -.factory('$focus', function($timeout, $window) { +.factory('$focus', ['$timeout', '$window', function($timeout, $window) { return function(id) { // timeout makes sure that it is invoked after any other event has been triggered. // e.g. click events that need to run before the focus or @@ -185,29 +247,27 @@ angular.module('cesium.utils.services', ['ngResource']) element.focus(); }); }; -}) +}]) -.factory('System', function($timeout, $window, UIUtils, $translate, $ionicPopup, $cordovaClipboard, $cordovaBarcodeScanner, $q) { +.factory('System', ['$timeout', '$window', 'UIUtils', '$translate', '$ionicPopup', '$cordovaClipboard', '$cordovaBarcodeScanner', '$q', '$cordovaCamera', + function($timeout, $window, UIUtils, $translate, $ionicPopup, $cordovaClipboard, $cordovaBarcodeScanner, $q, $cordovaCamera) { var CONST = { MAX_HEIGHT: 400, MAX_WIDTH: 400 }, camera = { - enable: false + enable: true }, clipboard = { - enable: false + enable: true }; - ionic.Platform.ready(function() { + function disable() { // Check if camera AND scan is enable - camera.enable = !!navigator.camera; - camera.handle = navigator.camera; - - // Check if clipboard is enable - clipboard.enable = camera.enable; - }); + camera.enable = false; + clipboard.enable = false; + } function resizeImageFromFile(file) { return $q(function(resolve, reject) { @@ -297,7 +357,7 @@ angular.module('cesium.utils.services', ['ngResource']) targetWidth : CONST.MAX_WIDTH, targetHeight : CONST.MAX_HEIGHT }; - camera.handle.camera.getPicture( + $cordovaCamera.getPicture( function (imageData) {resolve(imageData);}, function(err){reject(err);}, options @@ -308,7 +368,7 @@ angular.module('cesium.utils.services', ['ngResource']) camera.scan = function () { return $q(function(resolve,reject){ - if (!scan.enable) { + if (!camera.enable) { reject('Camera not enable. Please check [system.camera.enable] before use.'); return; } @@ -346,15 +406,16 @@ angular.module('cesium.utils.services', ['ngResource']) }; return { + disable: disable, image: { resize: resizeImageFromFile }, clipboard: clipboard, camera: camera }; -}) +}]) -.service('ModalService', function($ionicModal, $rootScope, $q, $controllers) { +.service('ModalService', ['$ionicModal', '$rootScope', '$q', '$controllers', function($ionicModal, $rootScope, $q, $controllers) { var show = function(tpl, $scope) { @@ -389,7 +450,7 @@ angular.module('cesium.utils.services', ['ngResource']) show: show }; -}) +}]) diff --git a/www/js/services/wallet-services.js b/www/js/services/wallet-services.js index e8d11add5f7add43f6234ba454e0f3b08cdd3178..8f4cb65dfb94aa26475a0de3f762f171b793adb7 100644 --- a/www/js/services/wallet-services.js +++ b/www/js/services/wallet-services.js @@ -29,7 +29,6 @@ angular.module('cesium.wallet.services', ['ngResource', 'cesium.bma.services', ' uid: null, balance: 0, sources: null, - useRelative: defaultSettings.useRelative, // TODO : a remplacer par settings.useRelative currency: null, parameters: null, currentUD: null, @@ -578,7 +577,7 @@ angular.module('cesium.wallet.services', ['ngResource', 'cesium.bma.services', ' reject({message:'ERROR.ALL_SOURCES_USED'}); } else { - console.error('Maximum transaction sources has been reached: ' + (data.useRelative ? (sourceAmount / data.currentUD)+' UD' : sourceAmount)); + console.error('Maximum transaction sources has been reached: ' + (data.settings.useRelative ? (sourceAmount / data.currentUD)+' UD' : sourceAmount)); reject({message:'ERROR.NOT_ENOUGH_SOURCES'}); } return; diff --git a/www/templates/currency/charts/ud.html b/www/templates/currency/charts/ud.html new file mode 100644 index 0000000000000000000000000000000000000000..8a3273ab41778f2985e7587694a19bc998fa748c --- /dev/null +++ b/www/templates/currency/charts/ud.html @@ -0,0 +1,13 @@ +<ion-view view-title="UD" left-buttons="leftButtons" class="pane"> + <ion-nav-buttons side="secondary"> + <button class="button button-icon button-clear icon ion-loop" ng-click="refresh()"> + </button> + </ion-nav-buttons> + + <ion-content class="has-header"> + <div class="scroll"> + <!-- TODO --> + </div> + <div class="scroll-bar scroll-bar-v"></div> + </ion-content> +</ion-view> diff --git a/www/templates/currency/tabs/view_parameters.html b/www/templates/currency/tabs/view_parameters.html index e453f4dec2aec93bf085f51f0686dc961eb3de46..862db1f1f1a1fdfaed83994a1f3af72e22db592c 100644 --- a/www/templates/currency/tabs/view_parameters.html +++ b/www/templates/currency/tabs/view_parameters.html @@ -4,7 +4,7 @@ <a href="#" class="item item-icon-left"> <i class="icon ion-android-bookmark"></i> <span translate>CURRENCY.VIEW.CURRENCY_NAME</span> - <span class="item-note">{{selectedCurrency}} super_currency ({{unit | abbreviate}}<sub>{{udUnit | abbreviate}}</sub>)</span> + <span class="item-note">{{currency}} ({{unit | abbreviate}}<sub>{{udUnit | abbreviate}}</sub>)</span> </a> <a class="item item-icon-left" href="#"> @@ -37,7 +37,7 @@ <span class="badge badge-energized">{{MoverN | formatInteger}} {{unit | abbreviate}}<sub>{{udUnit | abbreviate}}</span> </a> - <a class="item item-icon-left" href="#"> + <a class="item item-icon-left" href="#"> <!-- TODO : enable charts: ui-sref="app.currency_ud" --> <i class="icon ion-load-c"></i> <span translate>CURRENCY.VIEW.UD</span> <span class="badge badge-royal">{{UD | formatInteger}} {{unit | abbreviate}}<sub>{{udUnit | abbreviate}}</span> diff --git a/www/templates/currency/view_currency.html b/www/templates/currency/view_currency.html index 405e887e2911e65b87857a4ea8f3d56ee7817a55..6a395c613962f2e8d516a70e27b8790cf67c980a 100644 --- a/www/templates/currency/view_currency.html +++ b/www/templates/currency/view_currency.html @@ -1,6 +1,6 @@ <ion-view view-title="{{id}}" left-buttons="leftButtons" class="pane"> <ion-nav-buttons side="secondary"> - <button class="button button-icon button-clear icon ion-loop" ng-click="doUpdate()"> + <button class="button button-icon button-clear icon ion-loop" ng-click="refresh()"> </button> </ion-nav-buttons> <!-- diff --git a/www/templates/currency/view_currency_lg.html b/www/templates/currency/view_currency_lg.html index 0c12e99cab3d760ab1b3c7db1b231d31d2ed7e62..2cc9587a06fe362d91b5e38a4fb11cb0f44dae8a 100644 --- a/www/templates/currency/view_currency_lg.html +++ b/www/templates/currency/view_currency_lg.html @@ -1,6 +1,6 @@ <ion-view view-title="{{'CURRENCY.VIEW.TITLE' | translate}} {{id}}" left-buttons="leftButtons" class="pane"> <ion-nav-buttons side="secondary"> - <button class="button button-icon button-clear icon ion-loop" ng-click="doUpdate()"> + <button class="button button-icon button-clear icon ion-loop" ng-click="refresh()"> </button> </ion-nav-buttons> diff --git a/www/templates/market/edit_record.html b/www/templates/market/edit_record.html index 70bf4cf751ee7e77cb6d5bde506155ef74e334b6..c1c94bca2b85dbf3d387e99308050adb08497e65 100644 --- a/www/templates/market/edit_record.html +++ b/www/templates/market/edit_record.html @@ -32,14 +32,14 @@ <div class="list"> - <div class="item item-icon-right" ng-show="system.camera.enable"> + <div class="item item-icon-right" ng-if="isDeviceEnable()"> <span translate>MARKET.EDIT.BTN_ADD_PICTURES</span> <a class="dark" href="#" ng-click="openPicturePopup()"> <i class="icon ion-camera"></i> </a> </div> - <div class="item item-input item-icon-right" ng-show="!system.camera.enable" > + <div class="item item-input item-icon-right" ng-if="!isDeviceEnable()" > <span class="input-label has-input" translate>MARKET.EDIT.BTN_ADD_PICTURES</span> <input type="file" id="file" accept=".png,.jpeg,.jpg" onchange="angular.element(this).scope().fileChanged(event)"/> <!--a class="dark" href="#" ng-if="!camera" ng-click="addPictureFile()"> diff --git a/www/templates/menu.html b/www/templates/menu.html index 1dc0299dad53a7958a7119a906886cc27fca5a10..61fca36b0cbfb0617da72dd205cdef8c431475df 100644 --- a/www/templates/menu.html +++ b/www/templates/menu.html @@ -86,13 +86,13 @@ <i class="icon ion-paper-airplane"></i> </button> </ion-item> - <!-- scan QR code - ion-item menu-close class="item item-button-right" ng-if="isLogged()"> + <!-- scan QR code --> + <ion-item menu-close class="item item-button-right" ng-if="isLogged() && device.enable"> <span translate>Scan</span> - <button class="button button-energized-900" ng-click="scan()"> + <button class="button button-energized-900" ng-click="scanQrCodeAndGo()"> <i class="icon ion-qr-scanner"></i> </button> - </ion-item--> + </ion-item> <ion-item menu-close class="item item-button-right" ng-if="isLogged()"> <span translate>COMMON.BTN_LOGOUT</span> <button class="button button-energized-900" ng-click="logout()"> diff --git a/www/templates/registry/record_form.html b/www/templates/registry/record_form.html index 1b6c3b80f350f4a506b7f469276f725db91b851d..da276e376646a56456c839a3a9a837cdf4f2ed06 100644 --- a/www/templates/registry/record_form.html +++ b/www/templates/registry/record_form.html @@ -24,14 +24,14 @@ </div> </div> - <div class="item item-icon-right" ng-if="system.camera.enable"> + <div class="item item-icon-right" ng-if="isDeviceEnable()"> <span translate>REGISTRY.EDIT.BTN_ADD_PICTURES</span> <a class="dark" href="#" ng-click="openPicturePopup()"> <i class="icon ion-camera"></i> </a> </div> - <div class="item item-input item-icon-right" ng-if="!system.camera.enable" > + <div class="item item-input item-icon-right" ng-if="!isDeviceEnable()" > <span class="input-label has-input" translate>REGISTRY.EDIT.BTN_ADD_PICTURES</span> <input type="file" id="file" accept=".png,.jpeg,.jpg" onchange="angular.element(this).scope().fileChanged(event)"/> <!--a class="dark" href="#" ng-if="!camera" ng-click="addPictureFile()"> diff --git a/www/templates/wallet/transfer_form.html b/www/templates/wallet/transfer_form.html index e6ad5c9b260bbe6da329f2670af9d1de8d3790bb..622c84926217ee1f4bb86c63eb093aa24ec90b81 100644 --- a/www/templates/wallet/transfer_form.html +++ b/www/templates/wallet/transfer_form.html @@ -2,10 +2,10 @@ <div class="list" ng-init="setTransferForm(transferForm)"> - <a class="item item-button-right gray ink" ng-click="openWotLookup()"> + <a class="item item-icon-right gray ink" ng-click="openWotLookup()"> <span class="gray" translate>TRANSFER.TO</span> <span class="badge badge-royal">{{dest | formatPubkey}}</span> - <i class="button button-clear ion-chevron-right"></i> + <i class="gray icon ion-ios-arrow-right"></i> </a> <div class="form-errors" ng-show="transferForm.$submitted && !dest"> @@ -26,13 +26,13 @@ <div class="item item-input item-floating-label" ng-if="!formData.useRelative"> <span class="input-label">{{'TRANSFER.AMOUNT' | translate}} ({{unit | abbreviate}}<sub>{{udUnit | abbreviate}}</sub>)</span> - <input type="number" name="amount" placeholder="{{'TRANSFER.AMOUNT_HELP' | translate}} ({{unit | abbreviate}}{{udUnit | abbreviate}})" + <input type="number" name="amount" placeholder="{{'TRANSFER.AMOUNT_HELP' | translate}} ({{unit | abbreviate}})" ng-model="formData.amount" required> </div> <div class="item item-input item-floating-label" ng-if="formData.useRelative"> <span class="input-label">{{'TRANSFER.AMOUNT' | translate}} ({{unit | abbreviate}}<sub>{{udUnit | abbreviate}}</sub>)</span> - <input type="text" name="amount" placeholder="{{'TRANSFER.AMOUNT_HELP' | translate}} ({{unit | abbreviate}}{{udUnit | abbreviate}})" ng-model="formData.amount" + <input type="text" name="amount" placeholder="{{'TRANSFER.AMOUNT_HELP' | translate}} ({{unit | abbreviate}} {{udUnit | abbreviate}})" ng-model="formData.amount" required> </div> <div class="form-errors" @@ -57,7 +57,7 @@ <!-- Comment --> <label class="item item-input" ng-class="{'item-input-error': transferForm.$submitted && transferForm.comment.$invalid}"> - <textarea placeholder="{{'TRANSFER.COMMENT_HELP' | translate}}" + <textarea placeholder="{{'TRANSFER.COMMENT_HELP' | translate}}" name="comment" ng-model="formData.comment" ng-maxlength="255" diff --git a/www/templates/wallet/view_wallet.html b/www/templates/wallet/view_wallet.html index 4870cde52a7d09ceb832f12c3f798b28548e7730..94a72ae925429d169d03a6916ff6507941f0b982 100644 --- a/www/templates/wallet/view_wallet.html +++ b/www/templates/wallet/view_wallet.html @@ -2,7 +2,6 @@ view-title="" id="wallet"> - <ion-nav-buttons side="secondary"> <button class="button button-icon button-clear icon ion-loop" ng-click="doUpdate()"> </button> @@ -67,11 +66,12 @@ <div class="col list animate-fade-slide-in-right" > <!-- Certifications --> - <a class="item item-icon-left item-text-wrap ink" ng-if="walletData.isMember && walletData.requirements.certificationCount > 0" + <a class="item item-icon-left item-icon-right item-text-wrap ink" ng-if="walletData.isMember && walletData.requirements.certificationCount > 0" ui-sref="app.view_certifications({pub:walletData.pubkey})"> <i class="icon ion-ribbon-b"></i> {{'ACCOUNT.CERTIFICATION_COUNT'|translate}} <span class="badge" ng-class="{'badge-balanced': walletData.requirements.needCertificationCount==0 && walletData.requirements.willNeedCertificationCount==0, 'badge-assertive': walletData.requirements.needCertificationCount>0 || walletData.requirements.willNeedCertificationCount>0}">{{walletData.requirements.certificationCount}}</span> + <i class="gray icon ion-ios-arrow-right"></i> </a> <!-- Events --> diff --git a/www/templates/wot/lookup.html b/www/templates/wot/lookup.html index a7080e21ebc49d010ac552110524732cdc3eb81e..8c3c89ae300c85723ab1fe165c2abcb7e293ce25 100644 --- a/www/templates/wot/lookup.html +++ b/www/templates/wot/lookup.html @@ -1,4 +1,11 @@ <ion-view view-title="{{'WOT.LOOKUP.TITLE' | translate}}"> + <ion-nav-buttons side="secondary"> + <button class="button button-icon button-clear icon ion-qr-scanner" + ng-if="isDeviceEnable()" + ng-click="scanQrCode()"> + </button> + </ion-nav-buttons> + <ion-content class="padding no-padding-xs"> <ng-include src="'templates/wot/lookup_form.html'"/> </ion-content> diff --git a/www/templates/wot/modal_lookup.html b/www/templates/wot/modal_lookup.html index d4a26cfb41061d66d45a0e325c2ff8f6fe6588a5..a6e6397f8cc8870eec5c0dbac0af626603abd9a3 100644 --- a/www/templates/wot/modal_lookup.html +++ b/www/templates/wot/modal_lookup.html @@ -1,10 +1,10 @@ -<ion-modal-view id="wotLookup"> +<ion-view id="wotLookup" class="modal slide-in-up ng-enter active ng-enter-active">> <ion-header-bar class="bar-positive"> <button class="button button-clear" ng-click="closeLookup()" translate>COMMON.BTN_CANCEL</button> <h1 class="title" translate>WOT.MODAL.TITLE</h1> <button class="button button-icon button-clear icon ion-qr-scanner visible-xs" - ng-show="system.camera.enable" + ng-if="isDeviceEnable()" ng-click="scanQrCode()"> </button> </ion-header-bar> @@ -12,4 +12,4 @@ <ion-content> <ng-include src="'templates/wot/lookup_form.html'"></ng-include> </ion-content> -</ion-modal-view> +</ion-view> diff --git a/www/templates/wot/view_identity.html b/www/templates/wot/view_identity.html index cd3532d0621058e4bb6da690210a9d422f16b67f..b39d8307f717c5cd389104ac87a7868d3c9a0274 100644 --- a/www/templates/wot/view_identity.html +++ b/www/templates/wot/view_identity.html @@ -36,11 +36,12 @@ <div class="col list animate-fade-slide-in"> <!-- Certifications count --> - <a class="item item-icon-left item-text-wrap ink" ng-if="hasSelf && certificationCount > 0" + <a class="item item-icon-left item-text-wrap item-icon-right ink" ng-if="hasSelf && certificationCount > 0" ui-sref="app.view_certifications({pub:identity.pub})"> <i class="icon ion-ribbon-b"></i> <span>{{'ACCOUNT.CERTIFICATION_COUNT'|translate}}</span> <span class="badge" ng-class="{'badge-balanced': sigQty && certificationCount >= sigQty, 'badge-assertive': sigQty && certificationCount < sigQty}">{{::certificationCount}}</span> + <i class="gray icon ion-ios-arrow-right"></i> </a> <ion-item class="item-icon-left item-text-wrap" ng-if="hasSelf && certificationCount == 0"> <i class="icon ion-ribbon-b"></i>