requeriments to send
This commit is contained in:
parent
5527cccc38
commit
cb64e57e45
6 changed files with 112 additions and 63 deletions
|
|
@ -49,5 +49,5 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
<accept class="accept-slide" ng-if="!hideSlider"></accept>
|
<accept class="accept-slide"></accept>
|
||||||
</ion-view>
|
</ion-view>
|
||||||
|
|
|
||||||
|
|
@ -161,5 +161,5 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
<accept class="accept-slide" ng-if="tx.pendingForUs && canSign && !hideSlider && !loading && !paymentExpired"></accept>
|
<accept class="accept-slide" ng-if="tx.pendingForUs && canSign && !loading && !paymentExpired"></accept>
|
||||||
</ion-modal-view>
|
</ion-modal-view>
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
throw ('bad params');
|
throw ('bad params');
|
||||||
}
|
}
|
||||||
$scope.isCordova = platformInfo.isCordova;
|
$scope.isCordova = platformInfo.isCordova;
|
||||||
$scope.hideSlider = false;
|
|
||||||
$scope.data = {};
|
$scope.data = {};
|
||||||
|
|
||||||
var config = configService.getSync().wallet;
|
var config = configService.getSync().wallet;
|
||||||
|
|
@ -78,7 +77,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.$on('accepted', function(event) {
|
$scope.$on('accepted', function(event) {
|
||||||
$scope.hideSlider = true;
|
|
||||||
$scope.approve();
|
$scope.approve();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -268,17 +266,47 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
$state.go('tabs.home');
|
$state.go('tabs.home');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ongoingProcess.set('creatingTx', true);
|
ongoingProcess.set('creatingTx', true);
|
||||||
createTx(wallet, false, function(err, txp) {
|
createTx(wallet, false, function(err, txp) {
|
||||||
ongoingProcess.set('creatingTx', false);
|
ongoingProcess.set('creatingTx', false);
|
||||||
if (err) return;
|
if (err) return;
|
||||||
|
|
||||||
|
var config = configService.getSync();
|
||||||
|
var spendingPassEnabled = walletService.isEncrypted(wallet);
|
||||||
|
var touchIdEnabled = config.touchIdFor && !config.touchIdFor[wallet.id];
|
||||||
|
var isCordova = $scope.isCordova;
|
||||||
|
var bigAmount = parseFloat(txFormatService.formatToUSD(txp.amount)) > 20;
|
||||||
|
var message = gettextCatalog.getString('Sending {{fee}} from your {{name}} wallet', {
|
||||||
|
fee: $scope.fee,
|
||||||
|
name: wallet.name
|
||||||
|
});
|
||||||
|
var okText = gettextCatalog.getString('Confirm');
|
||||||
|
var cancelText = gettextCatalog.getString('Cancel');
|
||||||
|
|
||||||
|
if (!spendingPassEnabled && !touchIdEnabled) {
|
||||||
|
if (isCordova && bigAmount) {
|
||||||
|
popupService.showConfirm(null, message, okText, cancelText, function(ok) {
|
||||||
|
if (!ok) return;
|
||||||
|
publishAndSign(wallet, txp);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
popupService.showConfirm(null, message, okText, cancelText, function(ok) {
|
||||||
|
if (!ok) return;
|
||||||
|
publishAndSign(wallet, txp);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else publishAndSign(wallet, txp);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
function publishAndSign(wallet, txp) {
|
||||||
walletService.publishAndSign(wallet, txp, function(err, txp) {
|
walletService.publishAndSign(wallet, txp, function(err, txp) {
|
||||||
if (err) return setSendError(err);
|
if (err) return setSendError(err);
|
||||||
$ionicHistory.clearHistory();
|
$ionicHistory.clearHistory();
|
||||||
$state.go('tabs.home');
|
$state.go('tabs.home');
|
||||||
});
|
});
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.cancel = function() {
|
$scope.cancel = function() {
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
|
||||||
|
|
||||||
$scope.init = function() {
|
$scope.init = function() {
|
||||||
$scope.loading = null;
|
$scope.loading = null;
|
||||||
$scope.hideSlider = false;
|
|
||||||
$scope.copayerId = $scope.wallet.credentials.copayerId;
|
$scope.copayerId = $scope.wallet.credentials.copayerId;
|
||||||
$scope.isShared = $scope.wallet.credentials.n > 1;
|
$scope.isShared = $scope.wallet.credentials.n > 1;
|
||||||
$scope.canSign = $scope.wallet.canSign() || $scope.wallet.isPrivKeyExternal();
|
$scope.canSign = $scope.wallet.canSign() || $scope.wallet.isPrivKeyExternal();
|
||||||
|
|
@ -50,7 +49,6 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.$on('accepted', function(event) {
|
$scope.$on('accepted', function(event) {
|
||||||
$scope.hideSlider = true;
|
|
||||||
$scope.sign();
|
$scope.sign();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,10 @@ angular.module('copayApp.directives')
|
||||||
});
|
});
|
||||||
|
|
||||||
scope.$on("$ionicSlides.slideChangeEnd", function(event, data) {
|
scope.$on("$ionicSlides.slideChangeEnd", function(event, data) {
|
||||||
if (data.slider.activeIndex == 0) scope.$emit('accepted');
|
if (data.slider.activeIndex == 0) {
|
||||||
|
scope.slider.slideNext();
|
||||||
|
scope.$emit('accepted');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,26 @@ angular.module('copayApp.services').factory('txFormatService', function(bwcServi
|
||||||
return root.formatAmount(satoshis) + ' ' + config.unitName;
|
return root.formatAmount(satoshis) + ' ' + config.unitName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
root.formatToUSD = function(satoshis, cb) {
|
||||||
|
if (!satoshis) return;
|
||||||
|
var val = function() {
|
||||||
|
var v1 = rateService.toFiat(satoshis, 'USD');
|
||||||
|
if (!v1) return null;
|
||||||
|
|
||||||
|
return v1.toFixed(2);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Async version
|
||||||
|
if (cb) {
|
||||||
|
rateService.whenAvailable(function() {
|
||||||
|
return cb(val());
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if (!rateService.isAvailable()) return null;
|
||||||
|
return val();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
root.formatAlternativeStr = function(satoshis, cb) {
|
root.formatAlternativeStr = function(satoshis, cb) {
|
||||||
if (!satoshis) return;
|
if (!satoshis) return;
|
||||||
var config = configService.getSync().wallet.settings;
|
var config = configService.getSync().wallet.settings;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue