Merge pull request #490 from gabrielbazan7/fix/modalTimeout

add timeout to backup needed modal
This commit is contained in:
Gustavo Maximiliano Cortez 2016-10-17 12:23:40 -03:00 committed by GitHub
commit f34409c093
3 changed files with 15 additions and 8 deletions

View File

@ -131,6 +131,7 @@ angular.module('copayApp.controllers').controller('backupController',
}
profileService.setBackupFlag(wallet.credentials.walletId);
profileService.setBackupNeededModalFlag(wallet.credentials.walletId);
return cb();
}, 1);
};

View File

@ -4,7 +4,7 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
$scope.isCordova = platformInfo.isCordova;
$scope.isNW = platformInfo.isNW;
var showModalTimeout;
$scope.shareAddress = function(addr) {
if ($scope.generatingAddress) return;
@ -14,19 +14,21 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
};
$scope.setAddress = function(forceNew) {
if ($scope.generatingAddress || !$scope.wallet.isComplete()) return;
if (!$scope.wallet || $scope.generatingAddress || !$scope.wallet.isComplete()) return;
$scope.addr = null;
$scope.generatingAddress = true;
walletService.getAddress($scope.wallet, forceNew, function(err, addr) {
$scope.generatingAddress = false;
if (err) popupService.showAlert(gettextCatalog.getString('Error'), err);
$scope.addr = addr;
if ($scope.wallet.showBackupNeededModal) $scope.openBackupNeededModal();
$timeout(function(){
if ($scope.wallet.showBackupNeededModal) {
showModalTimeout = $timeout(function() {
$scope.openBackupNeededModal();
}, 2000);
}
$timeout(function() {
$scope.$apply();
},10);
}, 10);
});
};
@ -88,6 +90,10 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
}, 100);
});
$scope.$on("$ionicView.leave", function(event, data) {
$timeout.cancel(showModalTimeout);
});
$scope.$on("$ionicView.beforeEnter", function(event, data) {
$scope.wallets = profileService.getWallets();
$scope.wallet = $scope.wallets[0];

View File

@ -59,7 +59,7 @@
<a ui-sref="tabs.add" ng-if="wallets[0]"><i class="icon ion-ios-plus-empty list-add-button"></i></a>
</div>
<div>
<a ng-if="!wallets[0]" ui-sref="tabs.add" class="item item-icon-left item-big-icon-left item-icon-right next-step ng-hide">
<a ng-if="!wallets[0]" ui-sref="tabs.add" class="item item-icon-left item-big-icon-left item-icon-right next-step">
<i class="icon big-icon-svg">
<div class="bg icon-create-wallet"></div>
</i>