diff --git a/www/i18n/locale-en-GB.json b/www/i18n/locale-en-GB.json index 1cf2efc691f08cbf39d10bfb04e53fc560053231..adc1ddb8bb9c697863cd5677b322a9bc8ea2e165 100644 --- a/www/i18n/locale-en-GB.json +++ b/www/i18n/locale-en-GB.json @@ -146,6 +146,13 @@ "BTN_RESET": "Restore default values", "EXPERT_MODE": "Enable expert mode", "EXPERT_MODE_HELP": "Allow to see more details", + "BLOCK_VALIDITY_WINDOW": "Block uncertainty time", + "BLOCK_VALIDITY_WINDOW_SHORT": "Time of uncertainty", + "BLOCK_VALIDITY_WINDOW_HELP": "Time to wait before considering an information is validated", + "BLOCK_VALIDITY_OPTION": { + "NONE": "No delay", + "N": "{{time | formatDuration}} ({{count}} blocks)" + }, "POPUP_PEER": { "TITLE" : "Duniter peer", "HOST" : "Address", @@ -442,6 +449,7 @@ "SHOW_ALL_TX": "Show all", "TX_FROM_DATE": "(current limit to {{fromTime|formatFromNowShort}})", "PENDING_TX": "Pending transactions", + "VALIDATING_TX": "Transactions being validated", "ERROR_TX": "Transaction not executed", "ERROR_TX_SENT": "Sent transactions", "PENDING_TX_RECEIVED": "Transactions awaiting receipt", @@ -595,6 +603,8 @@ "COMMENT_HELP": "Comment (optional)", "BTN_SEND": "Send", "BTN_ADD_COMMENT": "Add a comment", + "REST": "Rest of account", + "REST_TO": "to", "WARN_COMMENT_IS_PUBLIC": "Please note that <b>comments are public</b> (not encrypted).", "MODAL": { "TITLE": "Transfer" @@ -719,6 +729,7 @@ "CERTIFY_RULES_TITLE_UID": "Certify {{uid}}", "CERTIFY_RULES": "<b class=\"assertive\">Don't certify an account</b> if you believe that: <ul><li>1.) the issuers identity might be faked.<li>2.) the issuer already has another certified account.<li>3.) the issuer purposely or carelessly violates rule 1 or 2 (he certifies faked or double accounts).</ul></small><br/>Are you sure you want to certify this identity?", "TRANSFER": "<b>Transfer summary:</b><br/><br/><ul><li> - From: <b>{{from}}</b></li><li> - To: <b>{{to}}</b></li><li> - Amount: <b>{{amount}} {{unit}}</b></li><li> - Comment: <i>{{comment}}</i></li></ul><br/><b>Are-you sure you want to do this transfer?</b>", + "TRANSFER_ALL": "<b>Transfer summary:</b><br/><br/><ul><li> - From: <b>{{from}}</b></li><li> - To: <b>{{to}}</b></li><li> - Amount: <b>{{amount}} {{unit}}</b></li><li> - Comment: <i>{{comment}}</i></li><br/><li> - Rest : <b>{{restAmount}} {{unit}}</b> to <b>{{restTo}}</b></li></ul><br/><b>Are-you sure you want to do this transfer?</b>", "MEMBERSHIP_OUT": "This operation is <b>irreversible</b>.<br/></br/><b>Are you sure you want to terminate your membership?</b>", "MEMBERSHIP_OUT_2": "This operation is <b>irreversible</b>!<br/><br/>Are you sure you want to <b>terminate your membership</b>?", "LOGIN_UNUSED_WALLET_TITLE": "Typing error?", diff --git a/www/i18n/locale-en.json b/www/i18n/locale-en.json index 48f0eee6ad456675e515222ff63d1ab4a8a36d0d..9f26d374dce30eab23b330d5709d7029a82c02dd 100644 --- a/www/i18n/locale-en.json +++ b/www/i18n/locale-en.json @@ -146,6 +146,13 @@ "BTN_RESET": "Restore default values", "EXPERT_MODE": "Enable expert mode", "EXPERT_MODE_HELP": "Allow to see more details", + "BLOCK_VALIDITY_WINDOW": "Block uncertainty time", + "BLOCK_VALIDITY_WINDOW_SHORT": "Time of uncertainty", + "BLOCK_VALIDITY_WINDOW_HELP": "Time to wait before considering an information is validated", + "BLOCK_VALIDITY_OPTION": { + "NONE": "No delay", + "N": "{{time | formatDuration}} ({{count}} blocks)" + }, "POPUP_PEER": { "TITLE" : "Duniter peer", "HOST" : "Address", @@ -442,6 +449,7 @@ "SHOW_ALL_TX": "Show all", "TX_FROM_DATE": "(current limit to {{fromTime|formatFromNowShort}})", "PENDING_TX": "Pending transactions", + "VALIDATING_TX": "Transactions being validated", "ERROR_TX": "Transaction not executed", "ERROR_TX_SENT": "Sent transactions", "PENDING_TX_RECEIVED": "Transactions awaiting receipt", @@ -595,6 +603,8 @@ "COMMENT_HELP": "Comment (optional)", "BTN_SEND": "Send", "BTN_ADD_COMMENT": "Add a comment", + "REST": "Rest of account", + "REST_TO": "to", "WARN_COMMENT_IS_PUBLIC": "Please note that <b>comments are public</b> (not encrypted).", "MODAL": { "TITLE": "Transfer" @@ -719,6 +729,7 @@ "CERTIFY_RULES_TITLE_UID": "Certify {{uid}}", "CERTIFY_RULES": "<b class=\"assertive\">Don't certify an account</b> if you believe that: <ul><li>1.) the issuers identity might be faked.<li>2.) the issuer already has another certified account.<li>3.) the issuer purposely or carelessly violates rule 1 or 2 (he certifies faked or double accounts).</ul></small><br/>Are you sure you want to certify this identity?", "TRANSFER": "<b>Transfer summary:</b><br/><br/><ul><li> - From: <b>{{from}}</b></li><li> - To: <b>{{to}}</b></li><li> - Amount: <b>{{amount}} {{unit}}</b></li><li> - Comment: <i>{{comment}}</i></li></ul><br/><b>Are-you sure you want to do this transfer?</b>", + "TRANSFER_ALL": "<b>Transfer summary:</b><br/><br/><ul><li> - From: <b>{{from}}</b></li><li> - To: <b>{{to}}</b></li><li> - Amount: <b>{{amount}} {{unit}}</b></li><li> - Comment: <i>{{comment}}</i></li><br/><li> - Rest : <b>{{restAmount}} {{unit}}</b> to <b>{{restTo}}</b></li></ul><br/><b>Are-you sure you want to do this transfer?</b>", "MEMBERSHIP_OUT": "This operation is <b>irreversible</b>.<br/></br/><b>Are you sure you want to terminate your membership?</b>", "MEMBERSHIP_OUT_2": "This operation is <b>irreversible</b>!<br/><br/>Are you sure you want to <b>terminate your membership</b>?", "LOGIN_UNUSED_WALLET_TITLE": "Typing error?", diff --git a/www/i18n/locale-fr-FR.json b/www/i18n/locale-fr-FR.json index 826fcac210c5f89202d1feb67cdcb6ab7d1aada7..a35a28af47ec94e723487b0c68e05e28610556ab 100644 --- a/www/i18n/locale-fr-FR.json +++ b/www/i18n/locale-fr-FR.json @@ -129,6 +129,8 @@ "ENABLE_UI_EFFECTS": "Activer les effets visuels", "HISTORY_SETTINGS": "Liste des opérations", "DISPLAY_UD_HISTORY": "Afficher les dividendes produits ?", + "TX_HISTORY_AUTO_REFRESH": "Activer le rafraichissement automatique ?", + "TX_HISTORY_AUTO_REFRESH_HELP": "Met à jour la liste des opérations à chaque nouveau bloc.", "AUTHENTICATION_SETTINGS": "Authentification", "KEEP_AUTH": "Expiration de l'authentification", "KEEP_AUTH_HELP": "Défini le moment où l'authentification est nettoyée de la mémoire", @@ -148,7 +150,7 @@ "EXPERT_MODE_HELP": "Permet un affichage plus détaillé", "BLOCK_VALIDITY_WINDOW": "Délai d'incertitude des blocs", "BLOCK_VALIDITY_WINDOW_SHORT": "Délai d'incertitude", - "BLOCK_VALIDITY_WINDOW_HELP": "Nombre de blocs à attentre, avant de considérer qu'une information est validée", + "BLOCK_VALIDITY_WINDOW_HELP": "Délai avant de considérer qu'une information est validée", "BLOCK_VALIDITY_OPTION": { "NONE": "Aucun délai", "N": "{{time | formatDuration}} ({{count}} blocs)" @@ -595,6 +597,7 @@ "TRANSFER": { "TITLE": "Virement", "SUB_TITLE": "Faire un virement", + "SUB_TITLE_ALL": "Vider le compte", "FROM": "De", "TO": "À", "AMOUNT": "Montant", diff --git a/www/i18n/locale-it-IT.json b/www/i18n/locale-it-IT.json index ae1c3365fc109e99be661364c33148772a3d1157..9fbd029432b300f45e873d02306bd29f838ed209 100644 --- a/www/i18n/locale-it-IT.json +++ b/www/i18n/locale-it-IT.json @@ -1,6 +1,6 @@ { "COMMON": { - "APP_NAME": "ğ<b>change</b>", + "APP_NAME": "Cesium", "APP_VERSION": "v{{version}}", "APP_BUILD": "build {{build}}", "PUBKEY": "Chiave privata", diff --git a/www/js/controllers/app-controllers.js b/www/js/controllers/app-controllers.js index 6ff04549a805bf1f89ca147cfd97c4961022faae..324281a831187a59e66f181c20c057d8a64e9009 100644 --- a/www/js/controllers/app-controllers.js +++ b/www/js/controllers/app-controllers.js @@ -90,6 +90,7 @@ function AppController($scope, $rootScope, $state, $ionicSideMenuDelegate, $q, $ options = options || {}; options.withSecret = angular.isDefined(options.withSecret) && options.withSecret || true; options.password = function() { + UIUtils.loading.hide(); return Modals.showPassword({ title: 'ACCOUNT.SECURITY.KEYFILE.PASSWORD_POPUP.TITLE', subTitle: 'ACCOUNT.SECURITY.KEYFILE.PASSWORD_POPUP.HELP', @@ -97,14 +98,16 @@ function AppController($scope, $rootScope, $state, $ionicSideMenuDelegate, $q, $ scope: $scope }) .then(function(password) { - if (password) UIUtils.loading.show(); // Timeout is need to force popup to be hide return $timeout(function() { + if (password) UIUtils.loading.show(); return password; }, 150); }); }; + UIUtils.loading.show(); + return CryptoUtils.parseWIF_or_EWIF(data, options) .catch(function(err) { if (err && err == 'CANCELLED') return; diff --git a/www/js/controllers/transfer-controllers.js b/www/js/controllers/transfer-controllers.js index 71bc10baa5bde32c3d4e37e2fb7e7d5da8f5c08d..4e74bf516819099f4f16ae7ce87550d2381afb07 100644 --- a/www/js/controllers/transfer-controllers.js +++ b/www/js/controllers/transfer-controllers.js @@ -74,6 +74,7 @@ function TransferController($scope, $controller, UIUtils, csWot, csWallet) { } else if (state.stateParams.all) { parameters.all = state.stateParams.all; + $scope.formData.all = state.stateParams.all; } } diff --git a/www/js/controllers/wallet-controllers.js b/www/js/controllers/wallet-controllers.js index 205e3bd5fc11c31d49cbe3c7106eba9a346ad908..a2bd0e330cd64e8f5f7f16175929d71ef952b51d 100644 --- a/www/js/controllers/wallet-controllers.js +++ b/www/js/controllers/wallet-controllers.js @@ -572,11 +572,38 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state, function WalletTxController($scope, $ionicPopover, $state, $timeout, $location, - UIUtils, Modals, BMA, csSettings, csWallet, csTx) { + UIUtils, Modals, BMA, csSettings, csCurrency, csWallet, csTx) { 'ngInject'; $scope.loading = true; $scope.settings = csSettings.data; + $scope.listeners = []; + + $scope.addListeners = function() { + if ($scope.settings.walletHistoryAutoRefresh) { + + $scope.listeners = [ + // Update on new block + csCurrency.api.data.on.newBlock($scope, function(block) { + if ($scope.loading) return; + console.debug("[wallet] Received new block. Will reload history."); + $timeout(function() { + $scope.doUpdate(true); + }, 300/*waiting for node cache propagation*/); + }) + ]; + } + else { + $scope.listeners = []; + } + }; + + $scope.removeListeners = function() { + _.forEach($scope.listeners, function(remove){ + remove(); + }); + $scope.listeners = []; + }; $scope.$on('$ionicView.enter', function(e, state) { $scope.loading = $scope.loading || (state.stateParams && state.stateParams.refresh); @@ -588,6 +615,7 @@ function WalletTxController($scope, $ionicPopover, $state, $timeout, $location, $scope.updateView(); $scope.showFab('fab-transfer'); $scope.showHelpTip(); + $scope.addListeners(); UIUtils.loading.hide(); // loading could have be open (e.g. new account) // remove the stateParams @@ -627,7 +655,9 @@ function WalletTxController($scope, $ionicPopover, $state, $timeout, $location, $scope.doUpdate = function(silent) { console.debug('[wallet] TX history reloading...'); return (silent ? + // If silent: just refresh csWallet.refreshData() : + // If not silent: show/hide loading indicator UIUtils.loading.show() .then(csWallet.refreshData) .then(UIUtils.loading.hide) diff --git a/www/js/services/http-services.js b/www/js/services/http-services.js index 71832c9985d77cd21ba248099307a2bf88d01a51..da79aa39581669f1f76ca7ce8c8f9d2163fbcf39 100644 --- a/www/js/services/http-services.js +++ b/www/js/services/http-services.js @@ -267,7 +267,7 @@ angular.module('cesium.http.services', ['cesium.cache.services']) var self = this; return _waitOpen(self) .then(function(){ - self.delegate && self.delegate.send(data); + if (self.delegate) self.delegate.send(data); }); }, close: function() { diff --git a/www/js/services/settings-services.js b/www/js/services/settings-services.js index 5c97559966ea29e90b3ec93a437b132b3ebf1d4c..d6571c64004b5014bd7dab23397facbcdd59aba6 100644 --- a/www/js/services/settings-services.js +++ b/www/js/services/settings-services.js @@ -60,6 +60,7 @@ angular.module('cesium.settings.services', ['ngApi', 'cesium.config']) useLocalStorage: true, // override to false if no device walletHistoryTimeSecond: 30 * 24 * 60 * 60 /*30 days*/, walletHistorySliceSecond: 5 * 24 * 60 * 60 /*download using 5 days slice*/, + walletHistoryAutoRefresh: true, rememberMe: true, keepAuthIdle: 10 * 60, // 10min - override to false if no device showUDHistory: true, @@ -72,7 +73,7 @@ angular.module('cesium.settings.services', ['ngApi', 'cesium.config']) userForumUrl: "https://forum.monnaie-libre.fr", latestReleaseUrl: "https://api.github.com/repos/duniter/cesium/releases/latest", duniterLatestReleaseUrl: "https://api.github.com/repos/duniter/duniter/releases/latest", - blockValidityWindow: 0, + blockValidityWindow: 6, helptip: { enable: true, installDocUrl: "https://duniter.org/en/wiki/duniter/install/", diff --git a/www/js/services/wallet-services.js b/www/js/services/wallet-services.js index d69916a2cedec6d55bf1e059f9224a81f4d3f9e8..f297709a628651bed169108ed2e5ba97368da30e 100644 --- a/www/js/services/wallet-services.js +++ b/www/js/services/wallet-services.js @@ -980,29 +980,16 @@ angular.module('cesium.wallet.services', ['ngApi', 'ngFileSaver', 'cesium.bma.se .then(function(block) { console.debug("[wallet] Using last valid block as TX reference (to avoid network fork): ", block); - data.sources.forEach(function(src) { - console.log(src); - }); - return transfer(destPub, amount, comments, useRelative, restPub, block) .then(function() { - - // If more money: transfer all to restPub if (data.balance > 0 && restPub) { - - console.debug("Sending the rest amount to {" + restPub + '}...'); - data.sources.forEach(function(src) { - console.debug(src); - }); - console.debug("[wallet] Wallet has some more money: transfering fund to [{0}]".format(restPub.substring(0,6))); return transfer(restPub, data.balance, undefined/*comments*/, false/*useRelative*/, restPub, block); } }); - }) - + }); }, diff --git a/www/templates/join/modal_join_member.html b/www/templates/join/modal_join_member.html index 12ea52553743f1b49aa8d44db215ab291dbad274..8fbde98418cf46e35c82c0f35cab8215736e915b 100644 --- a/www/templates/join/modal_join_member.html +++ b/www/templates/join/modal_join_member.html @@ -41,7 +41,7 @@ </ion-header-bar> - <ion-slides options="slides.options" slider="slides.slider" ng-init="console.log('START SLIDE');"> + <ion-slides options="slides.options" slider="slides.slider"> <!-- STEP 1: license --> <ion-slide-page ng-if="licenseFileUrl"> diff --git a/www/templates/settings/settings.html b/www/templates/settings/settings.html index 3638125de1e64361b5c3c507b8c2bf3ff9292973..b581e5ab12f08be0f8ae76523156816cafdff07a 100644 --- a/www/templates/settings/settings.html +++ b/www/templates/settings/settings.html @@ -130,6 +130,16 @@ </label> </div> + <div class="item item-toggle dark"> + <div class="input-label" translate>SETTINGS.TX_HISTORY_AUTO_REFRESH</div> + <label class="toggle toggle-royal"> + <input type="checkbox" ng-model="formData.walletHistoryAutoRefresh" > + <div class="track"> + <div class="handle"></div> + </div> + </label> + </div> + <!-- Allow extension here --> <cs-extension-point name="history"></cs-extension-point> diff --git a/www/templates/wallet/item_tx.html b/www/templates/wallet/item_tx.html index a1cfe652146cd7dbaa9a843724e96c59cd3a6bb7..cd56e4d5dd043fd2b9e7d76054ac35897133ede8 100644 --- a/www/templates/wallet/item_tx.html +++ b/www/templates/wallet/item_tx.html @@ -5,7 +5,8 @@ <div class="row no-padding"> <div class="col no-padding"> - <b class="ion-clock" ng-if="::(pending||validating)"> </b> + <b class="ion-clock" ng-if="::pending"> </b> + <b class="ion-clock" ng-if="::validating"> </b> <a class="" ui-sref="app.wot_identity({pubkey:tx.pubkey, uid:tx.uid})" ng-if="tx.uid"> {{::tx.name||tx.uid}} </a> diff --git a/www/templates/wallet/new_transfer.html b/www/templates/wallet/new_transfer.html index 13632341acf01999b0081db1963db2a969d05f4c..d1a6fc1d45f5cfaeb9a9ba7192f1dc911ebf3b98 100644 --- a/www/templates/wallet/new_transfer.html +++ b/www/templates/wallet/new_transfer.html @@ -13,8 +13,8 @@ <div class="row no-padding-xs"> <div class="col col-20 hidden-xs hidden-sm"> </div> <div class="col no-padding-xs"> - <h2 class="hidden-xs hidden-sm"> - {{'TRANSFER.SUB_TITLE'|translate}} + <h2 class="hidden-xs hidden-sm" ng-if="formData"> + {{(formData.all ? 'TRANSFER.SUB_TITLE_ALL' : 'TRANSFER.SUB_TITLE')|translate}} </h2> <h4 class="hidden-xs hidden-sm"> </h4> <ng-include src="'templates/wallet/transfer_form.html'"></ng-include> diff --git a/www/templates/wallet/transfer_form.html b/www/templates/wallet/transfer_form.html index 7c187d2c978575fce7000eae7af53ef43ea3c451..fedf8ae7cd8457a17f41be85e95c441f2daf221e 100644 --- a/www/templates/wallet/transfer_form.html +++ b/www/templates/wallet/transfer_form.html @@ -96,7 +96,7 @@ <a class="item item-icon-right gray ink" ng-class="{'item-input-error': form.$submitted && !formData.destPub}" ng-click="showWotLookupModal('restPub')" - ng-if="formData.all && formData.restAmount > 0"> + ng-if="formData.all && formData.restAmount"> <span class="gray"> <i translate>TRANSFER.REST</i> <ng-if ng-if="formData.restAmount">(<i ng-bind-html="formData.restAmount|formatAmount:{useRelative: formData.useRelative, currency:currency}"></i>)</ng-if> @@ -181,8 +181,10 @@ <button class="button button-clear button-dark ink" ng-click="cancel()" type="button" translate>COMMON.BTN_CANCEL </button> - <button class="button button-positive ink" type="submit"> - {{'TRANSFER.BTN_SEND' | translate}} + <button class="button ink" + ng-class="{'button-assertive': formData.all, 'button-positive': !formData.all}" + type="submit" translate> + TRANSFER.BTN_SEND </button> </div> </form> diff --git a/www/templates/wallet/view_wallet_tx.html b/www/templates/wallet/view_wallet_tx.html index 9e424f8a4ac6470045691e37478fc25ce7448d10..995d810d12bfb626d1c6add7e590ade61310fc53 100644 --- a/www/templates/wallet/view_wallet_tx.html +++ b/www/templates/wallet/view_wallet_tx.html @@ -96,6 +96,7 @@ <div class="item item-pending item-tx item-icon-left" ng-repeat="tx in formData.tx.validating" + ng-init="validating=true;" ng-include="'templates/wallet/item_tx.html'"> </div> @@ -109,8 +110,6 @@ <span class="gray">{{:locale:'ACCOUNT.NO_TX'|translate}}</span> </span> - - <div ng-repeat="tx in formData.tx.history" class="item item-tx item-icon-left" ng-include="::!tx.isUD ? 'templates/wallet/item_tx.html' : 'templates/wallet/item_ud.html'">