Skip to content

Commit

Permalink
Update send & receive
Browse files Browse the repository at this point in the history
  • Loading branch information
romaroid committed Dec 22, 2017
1 parent b2e7e6f commit c4dd9eb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/js/modules/wallet/controllers/receive/receive.ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

function ReceiveCtrl($scope, walletsManagerService, settingsService, CurrencyConverter, $q, $cordovaClipboard, $cordovaEmailComposer,
$timeout, $btBackButtonDelegate, $translate, $cordovaSms, $log, $cordovaToast, CONFIG) {

var walletData = walletsManagerService.getActiveWalletReadOnlyData();

$scope.networkLong = CONFIG.NETWORKS[walletData.networkType].NETWORK_LONG;
Expand Down
22 changes: 12 additions & 10 deletions src/js/modules/wallet/controllers/send/send.ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
$timeout, $q, $btBackButtonDelegate, $state, settingsService, localSettingsService,
$rootScope, $translate, $cordovaDialogs, AppRateService,
launchService, CONFIG) {
var localSettingsData = localSettingsService.getReadOnlyLocalSettingsData();

var sdkWallet = walletsManagerService.getActiveSdkWallet();

$scope.OPTIMAL_FEE = 'optimal';
$scope.LOW_PRIORITY_FEE = 'low_priority';
$scope.PRIOBOOST = 'prioboost';
$scope.PRIOBOOST_MAX_SIZE = 1300;

$scope.settingsData = settingsService.getReadOnlySettingsData();
$scope.localSettingsData = localSettingsService.getReadOnlyLocalSettingsData();

$scope.fiatFirst = false;
$scope.prioboost = {
Expand Down Expand Up @@ -172,7 +174,7 @@

$scope.selectContact = function() {
// check if phone has been verified yet
if (!localSettingsData.isPhoneVerified) {
if (!$scope.localSettingsData.isPhoneVerified) {
$scope.getTranslations()
.then(function() {
return $cordovaDialogs.alert($scope.translations['MSG_PHONE_REQUIRE_VERIFY'].sentenceCase(), $scope.translations['SETTINGS_PHONE_REQUIRE_VERIFY'].sentenceCase(), $scope.translations['OK']);
Expand All @@ -181,7 +183,7 @@
$state.go('app.wallet.settings.phone', {goBackTo: 'app.wallet.send.contacts'});
});
return false;
} else if(!localSettingsData.isEnableContacts) {
} else if(!$scope.localSettingsData.isEnableContacts) {
$cordovaDialogs.alert(
$translate.instant('MSG_REQUIRE_CONTACTS_ACCESS').sentenceCase(),
$translate.instant('CONTACTS_DISABLED').sentenceCase(),
Expand All @@ -201,9 +203,9 @@
return _maxSpendablePromise;
} else {
_maxSpendablePromise = $q.all([
walletsManagerService.getActiveSdkWallet().maxSpendable($scope.useZeroConf, blocktrailSDK.Wallet.FEE_STRATEGY_OPTIMAL),
walletsManagerService.getActiveSdkWallet().maxSpendable($scope.useZeroConf, blocktrailSDK.Wallet.FEE_STRATEGY_LOW_PRIORITY),
walletsManagerService.getActiveSdkWallet().maxSpendable($scope.useZeroConf, blocktrailSDK.Wallet.FEE_STRATEGY_MIN_RELAY_FEE)
sdkWallet.maxSpendable($scope.useZeroConf, blocktrailSDK.Wallet.FEE_STRATEGY_OPTIMAL),
sdkWallet.maxSpendable($scope.useZeroConf, blocktrailSDK.Wallet.FEE_STRATEGY_LOW_PRIORITY),
sdkWallet.maxSpendable($scope.useZeroConf, blocktrailSDK.Wallet.FEE_STRATEGY_MIN_RELAY_FEE)
]).then(function (results) {
// set the local stored value
_maxSpendable = {};
Expand Down Expand Up @@ -236,7 +238,7 @@
$scope.prioboost.estSize = null;
$scope.prioboost.zeroConf = null;

return $q.when(walletsManagerService.getActiveSdkWallet()).then(function(sdkWallet) {
return $q.when(sdkWallet).then(function(sdkWallet) {
var localPay = {};
var amount = 0;

Expand Down Expand Up @@ -392,7 +394,7 @@
throw blocktrail.Error('MSG_MISSING_RECIPIENT');
}

return $scope.getSendingAddress(walletsManagerService.getActiveSdkWallet());
return $scope.getSendingAddress(sdkWallet);
}).then(function() {
//validate address
return walletsManagerService.getActiveWallet().validateAddress($scope.sendInput.recipientAddress);
Expand Down Expand Up @@ -435,7 +437,7 @@
$scope.getSendingAddress = function() {
var deferred = $q.defer();
if ($scope.sendInput.recipient && !$scope.sendInput.recipientAddress) {
Contacts.getSendingAddress(walletsManagerService.getActiveSdkWallet(), $scope.sendInput.recipient).then(function(result){
Contacts.getSendingAddress(sdkWallet, $scope.sendInput.recipient).then(function(result){
$scope.sendInput.recipientAddress = result.address;
deferred.resolve();
}, function(err) {
Expand Down Expand Up @@ -468,7 +470,7 @@
var trackingBtcValue = blocktrailSDK.toBTC(Math.ceil($scope.sendInput.btcValue / 1000000) * 1000000);

//get an address for the contact
$scope.getSendingAddress(walletsManagerService.getActiveSdkWallet())
$scope.getSendingAddress(sdkWallet)
.then(function() {
$scope.appControl.result = {working: true, message: 'MSG_INIT_WALLET'};

Expand Down

0 comments on commit c4dd9eb

Please sign in to comment.