Toast messages in payment request (#2010)

* Hide toast messages in print

Fixes #2009.

* Optimize payment request toast messages
This commit is contained in:
Dennis Reimann 2020-10-24 10:20:19 +02:00 committed by GitHub
parent da864f4c6c
commit b1b3ce48ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 39 deletions

View file

@ -304,6 +304,9 @@ html[data-devenv]:before {
a {
text-decoration: none !important;
}
.toasted-container {
display: none !important;
}
}
/* Richtext editor */

View file

@ -135,30 +135,27 @@ addLoadEvent(function (ev) {
this.customAmount = (this.srvModel.amountDue || 0).noExponents();
hubListener.connect();
var self = this;
var toastOptions = {
iconPack: "fontawesome",
theme: "bubble",
duration: 10000
};
eventAggregator.$on("invoice-created", function (invoiceId) {
self.setLoading(false);
btcpay.showInvoice(invoiceId);
btcpay.showFrame();
});
eventAggregator.$on("invoice-cancelled", function(){
eventAggregator.$on("invoice-cancelled", function (){
self.setLoading(false);
Vue.toasted.show('Payment cancelled', {
iconPack: "fontawesome",
icon: "check",
duration: 10000
Vue.toasted.info('Payment cancelled', Object.assign({}, toastOptions), {
icon: "check"
});
});
eventAggregator.$on("cancel-invoice-error", function (error) {
eventAggregator.$on("cancel-invoice-error", function () {
self.setLoading(false);
Vue.toasted.show("Error cancelling payment", {
iconPack: "fontawesome",
icon: "exclamation-triangle",
fullWidth: false,
theme: "bubble",
type: "error",
position: "top-center",
duration: 10000
Vue.toasted.error("Error cancelling payment", Object.assign({}, toastOptions), {
icon: "exclamation-triangle"
});
});
eventAggregator.$on("invoice-error", function (error) {
@ -171,35 +168,16 @@ addLoadEvent(function (ev) {
} else {
msg = JSON.stringify(error);
}
Vue.toasted.show("Error creating invoice: " + msg, {
iconPack: "fontawesome",
icon: "exclamation-triangle",
fullWidth: false,
theme: "bubble",
type: "error",
position: "top-center",
duration: 10000
Vue.toasted.error("Error creating invoice: " + msg, Object.assign({}, toastOptions), {
icon: "exclamation-triangle"
});
});
eventAggregator.$on("payment-received", function (amount, cryptoCode, type) {
var onChain = type.toLowerCase() === "btclike";
amount = parseFloat(amount).noExponents();
if (onChain) {
Vue.toasted.show('New payment of ' + amount + " " + cryptoCode + " " + (onChain ? "On Chain" : "LN "), {
iconPack: "fontawesome",
icon: "plus",
duration: 10000
});
} else {
Vue.toasted.show('New payment of ' + amount + " " + cryptoCode + " " + (onChain ? "On Chain" : "LN "), {
iconPack: "fontawesome",
icon: "bolt",
duration: 10000
});
}
var amountFormatted = parseFloat(amount).noExponents();
var icon = onChain ? "plus" : "bolt";
var title = "New payment of " + amountFormatted + " " + cryptoCode + " " + (onChain ? "On Chain" : "LN");
Vue.toasted.success(title, Object.assign({}, toastOptions), { icon });
});
eventAggregator.$on("info-updated", function (model) {
console.warn("UPDATED", self.srvModel, arguments);