From 03ea7c9dad3f10588315c5ba43e743ad8bbf4a3d Mon Sep 17 00:00:00 2001
From: Benoit Lavenier <benoit.lavenier@e-is.pro>
Date: Fri, 10 Jan 2020 19:01:24 +0100
Subject: [PATCH] [fix] Fix misspelling ($timeout), and showPopupUid promise
 return [fix] ES network: do not open help tips

---
 platforms/android                             |  2 +-
 www/js/controllers/wallet-controllers.js      |  3 +++
 www/js/services/bma-services.js               |  4 +--
 www/js/services/crypto-services.js            |  6 ++---
 .../es/js/controllers/network-controllers.js  | 26 -------------------
 5 files changed, 9 insertions(+), 32 deletions(-)

diff --git a/platforms/android b/platforms/android
index 8995b191..197e3a8e 160000
--- a/platforms/android
+++ b/platforms/android
@@ -1 +1 @@
-Subproject commit 8995b1918fb5cb60b86e6ba53073d5fddb4d36c2
+Subproject commit 197e3a8e9162548461251a20ba3b99e1fc89c314
diff --git a/www/js/controllers/wallet-controllers.js b/www/js/controllers/wallet-controllers.js
index 9a5b5b0e..a7710f06 100644
--- a/www/js/controllers/wallet-controllers.js
+++ b/www/js/controllers/wallet-controllers.js
@@ -188,6 +188,7 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state,
             if (!uid) { // user cancel
               delete $scope.formData.uid;
               UIUtils.loading.hide();
+              reject('CANCELLED');
               return;
             }
             resolve(uid);
@@ -202,6 +203,8 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state,
 
     return $scope.showUidPopup()
     .then(function(uid) {
+      if (!uid) return;
+
       UIUtils.loading.show();
 
       return wallet.self(uid)
diff --git a/www/js/services/bma-services.js b/www/js/services/bma-services.js
index 14ee2a30..f7ec13f9 100644
--- a/www/js/services/bma-services.js
+++ b/www/js/services/bma-services.js
@@ -64,7 +64,7 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium.
         PROTOCOL_VERSION: 10,
         ROOT_BLOCK_HASH: 'E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855',
         LIMIT_REQUEST_COUNT: 5, // simultaneous async request to a Duniter node
-        LIMIT_REQUEST_DELAY: 1000, // time (in second) to wait between to call of a rest request
+        LIMIT_REQUEST_DELAY: 1000, // time (in ms) to wait between to call of a rest request
         regexp: regexp,
         api: api
       },
@@ -175,7 +175,7 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium.
         return request(params)
           .catch(function(err){
             // If node return too many requests error
-            if (err && err.ucode == exports.errorCodes.HTTP_LIMITATION) {
+            if (err && err.ucode === exports.errorCodes.HTTP_LIMITATION) {
               // If max number of retry not reach
               if (execCount <= exports.constants.LIMIT_REQUEST_COUNT) {
                 if (execCount === 1) {
diff --git a/www/js/services/crypto-services.js b/www/js/services/crypto-services.js
index e60613a0..f76be171 100644
--- a/www/js/services/crypto-services.js
+++ b/www/js/services/crypto-services.js
@@ -104,7 +104,7 @@ angular.module('cesium.crypto.services', ['cesium.utils.services'])
     CryptoAbstractService.prototype.async_load_base64 = function(on_ready) {
       var that = this;
       if (Base64 !== null) {on_ready(Base64);}
-      else {$timetout(function(){that.async_load_base64(on_ready);}, 100);}
+      else {$timeout(function(){that.async_load_base64(on_ready);}, 100);}
     };
 
     CryptoAbstractService.prototype.async_load_sha256 = function(on_ready) {
@@ -220,9 +220,9 @@ angular.module('cesium.crypto.services', ['cesium.utils.services'])
         return $q(function (resolve, reject) {
           try {
             // TODO: waiting for a new version of js-nacl, with missing functions expose
-            //resolve(that.nacl.crypto_box_keypair_from_sign_sk(signPk);
+            //resolve(that.nacl.crypto_box_keypair_from_sign_sk(signKeyPair.signSk);
 
-            resolve(crypto_box_keypair_from_sign_sk(signPk));
+            resolve(crypto_box_keypair_from_sign_sk(signKeyPair.signSk));
           }
           catch(err) {
             reject(err);
diff --git a/www/plugins/es/js/controllers/network-controllers.js b/www/plugins/es/js/controllers/network-controllers.js
index 57370f54..758b3247 100644
--- a/www/plugins/es/js/controllers/network-controllers.js
+++ b/www/plugins/es/js/controllers/network-controllers.js
@@ -186,14 +186,10 @@ function ESNetworkLookupController($scope,  $state, $location, $ionicPopover, $w
           }
         }));
     }
-
-    // Show help tip
-    $scope.showHelpTip();
   };
 
   $scope.updateView = function(data) {
     console.debug("[peers] Updating UI");
-    $scope.$broadcast('$$rebind::' + 'rebind'); // force data binding
     $scope.search.results = data.peers;
     $scope.search.memberPeersCount = data.memberPeersCount;
     // Always tru if network not started (e.g. after leave+renter the view)
@@ -352,28 +348,6 @@ function ESNetworkLookupController($scope,  $state, $location, $ionicPopover, $w
 
 
 
-  /* -- help tip -- */
-
-  // Show help tip
-  $scope.showHelpTip = function(index, isTour) {
-    index = angular.isDefined(index) ? index : csSettings.data.helptip.network;
-    isTour = angular.isDefined(isTour) ? isTour : false;
-    if (index < 0) return;
-
-    // Create a new scope for the tour controller
-    var helptipScope = $scope.createHelptipScope();
-    if (!helptipScope) return; // could be undefined, if a global tour already is already started
-    helptipScope.tour = isTour;
-
-    return helptipScope.startNetworkTour(index, false)
-      .then(function(endIndex) {
-        helptipScope.$destroy();
-        if (!isTour) {
-          csSettings.data.helptip.network = endIndex;
-          csSettings.store();
-        }
-      });
-  };
 }
 
 
-- 
GitLab