From 1827a7f89dd3a38c4ac214751ddae0532835b2b3 Mon Sep 17 00:00:00 2001 From: blavenie <benoit.lavenier@e-is.pro> Date: Wed, 29 Aug 2018 11:29:00 +0200 Subject: [PATCH] =?UTF-8?q?[fix]=20Assistant=20de=20cr=C3=A9ation=20de=20c?= =?UTF-8?q?ompte=20>=20Message=20d'erreur=20furtif=20-=20FIX=20#715?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- www/js/controllers/join-controllers.js | 37 ++++++---- www/templates/join/modal_join_member.html | 86 ++++++++++++----------- 2 files changed, 66 insertions(+), 57 deletions(-) diff --git a/www/js/controllers/join-controllers.js b/www/js/controllers/join-controllers.js index 21a540154..dd8a3d1d2 100644 --- a/www/js/controllers/join-controllers.js +++ b/www/js/controllers/join-controllers.js @@ -185,12 +185,16 @@ function JoinModalController($scope, $state, $interval, $timeout, Device, UIUtil CryptoUtils.scryptKeypair($scope.formData.username, $scope.formData.password) .then(function(keypair) { $scope.formData.pubkey = CryptoUtils.util.encode_base58(keypair.signPk); - $scope.formData.computing=false; - $scope.checkAccountAvailable(); + return $scope.checkAccountAvailable(); + }) + .then(function() { + return $timeout(function(){ + $scope.formData.computing=false; + }, 400); }) .catch(function(err) { - $scope.formData.computing=false; $scope.formData.pubkey = undefined; + $scope.formData.computing=false; UIUtils.onError('ERROR.CRYPTO_UNKNOWN_ERROR')(err); }); }; @@ -301,6 +305,11 @@ function JoinModalController($scope, $state, $interval, $timeout, Device, UIUtil $scope.slideBehavior = $scope.computeSlideBehavior(); }; + $scope.doPrev = function() { + $scope.slidePrev(); + $scope.slideBehavior = $scope.computeSlideBehavior(); + }; + $scope.doNewAccount = function(confirm) { if (!confirm) { @@ -462,27 +471,25 @@ function JoinModalController($scope, $state, $interval, $timeout, Device, UIUtil $scope.checkAccountAvailable = function() { delete $scope.accountAvailable; // Search for tx source, from pubkey - BMA.tx.sources({ pubkey: $scope.formData.pubkey }) + return BMA.tx.sources({ pubkey: $scope.formData.pubkey }) .then(function(res) { - if(!res.sources.length) { - $scope.formData.computing=false; - $scope.accountAvailable = true; - } - else{ - $scope.formData.computing=false; - $scope.accountAvailable = false; - } + $scope.accountAvailable = !res || !res.sources.length; }) .catch(function(err) { console.error(err); - $scope.formData.computing=false; $scope.accountAvailable = false; }); }; $scope.identifierRecovery = function() { - for (var i = 0; i < 2; i++) - $scope.slidePrev(); + // Go back + $scope.slides.slider.unlockSwipes(); + for (var i = 0; i < 2; i++) { + $scope.slides.slider.slidePrev(); + } + $scope.slides.slider.lockSwipes(); + // Recompute behavior + $scope.slideBehavior = $scope.computeSlideBehavior(); }; // TODO: remove auto add account when done diff --git a/www/templates/join/modal_join_member.html b/www/templates/join/modal_join_member.html index 8fbde9841..43ed1663d 100644 --- a/www/templates/join/modal_join_member.html +++ b/www/templates/join/modal_join_member.html @@ -7,7 +7,7 @@ ng-click="closeModal()" translate>COMMON.BTN_CANCEL </button> <button class="button button-icon button-clear icon ion-ios-arrow-back buttons header-item" - ng-click="slidePrev()" + ng-click="doPrev()" ng-if="slides.slider.activeIndex && slideBehavior.hasPreviousButton"> </button> <button class="button button-icon button-clear icon ion-ios-help-outline visible-xs" @@ -356,60 +356,62 @@ </div> <!-- Account available --> - <div ng-if="accountAvailable && !formData.computing"> - <div class="padding text-center" translate>ACCOUNT.NEW.LAST_SLIDE_CONGRATULATION</div> + <ng-if ng-if="!formData.computing"> + <div class="animate-fade-in animate-show-hide ng-hide" ng-show="accountAvailable"> + <div class="padding text-center" translate>ACCOUNT.NEW.LAST_SLIDE_CONGRATULATION</div> - <div class="list"> + <div class="list"> - <ion-item class="item text-center item-text-wrap"> - <h3 class="gray" translate>LOGIN.ASSOCIATED_PUBKEY</h3> - <!-- do NOT add copy-on-click attribute here - see issue #470--> - <h3 class="dark bold"> - {{formData.pubkey}} - </h3> - </ion-item> - </div> + <ion-item class="item text-center item-text-wrap"> + <h3 class="gray" translate>LOGIN.ASSOCIATED_PUBKEY</h3> + <!-- do NOT add copy-on-click attribute here - see issue #470--> + <h3 class="dark bold"> + {{formData.pubkey}} + </h3> + </ion-item> + </div> - <div class="padding hidden-xs text-right"> - <button class="button button-clear button-dark ink" ng-click="closeModal()" type="button" translate>COMMON.BTN_CANCEL - </button> - <button class="button button-positive ink" ng-click="doNewAccount()" translate> - COMMON.BTN_SEND - <i class="icon ion-android-send"></i> - </button> + <div class="padding hidden-xs text-right"> + <button class="button button-clear button-dark ink" ng-click="closeModal()" type="button" translate>COMMON.BTN_CANCEL + </button> + <button class="button button-positive ink" ng-click="doNewAccount()" translate> + COMMON.BTN_SEND + <i class="icon ion-android-send"></i> + </button> + </div> </div> - </div> - <!-- Existing non-empty account --> - <div ng-if="!accountAvailable && !formData.computing"> + <!-- Existing non-empty account --> + <div class="animate-fade-in animate-show-hide ng-hide" ng-show="!accountAvailable"> + + <ion-item class="item-icon-left item-text-wrap text-center"> + <i class="icon ion-minus-circled assertive"></i> + <span id="modal-license" trust-as-html="'ERROR.EXISTING_ACCOUNT'|translate"></span> + </ion-item> - <ion-item class="item-icon-left item-text-wrap text-center"> - <i class="icon ion-minus-circled assertive"></i> - <span id="modal-license" trust-as-html="'ERROR.EXISTING_ACCOUNT'|translate"></span> - </ion-item> + <div class="list"> - <div class="list"> + <ion-item class="item item-text-wrap item-border"> + <div class="padding text-center"> + <span class="gray text-no-wrap"> + {{formData.pubkey}} + </span> + </div> + </ion-item> - <ion-item class="item item-text-wrap item-border"> <div class="padding text-center"> - <span class="gray text-no-wrap"> - {{formData.pubkey}} - </span> + <span translate>ERROR.EXISTING_ACCOUNT_REQUEST</span> </div> - </ion-item> - <div class="padding text-center"> - <span translate>ERROR.EXISTING_ACCOUNT_REQUEST</span> </div> - - </div> - <div class="padding hidden-xs text-left"> - <button class="button button-assertive icon-left ion-chevron-left ink" - ng-click="identifierRecovery()" translate> - COMMON.BTN_MODIFY - </button> + <div class="padding hidden-xs text-left"> + <button class="button button-assertive icon-left ion-chevron-left ink" + ng-click="identifierRecovery()" translate> + COMMON.BTN_MODIFY + </button> + </div> </div> - </div> + </ng-if> </ion-content> </ion-slide-page> -- GitLab