PurchaseWidget: Mark the strings as translatable

Also show a dialog to a user so they don't keep trying to click again
and again.
This commit is contained in:
Vishesh Handa
2020-09-07 21:46:03 +02:00
parent c229b7c2e8
commit 1fff957c8b
2 changed files with 10 additions and 2 deletions

View File

@ -201,6 +201,8 @@ widgets:
PurchaseButton: PurchaseButton:
text: Purchase for {price} text: Purchase for {price}
fail: Failed to Load fail: Failed to Load
failSend: Failed to send purchase request
failPurchase: Failed to Purchase - {}
FolderView: FolderView:
noteDeleted: Note Deleted noteDeleted: Note Deleted
undo: Undo undo: Undo

View File

@ -49,8 +49,7 @@ class PurchaseButton extends StatelessWidget {
.buyNonConsumable(purchaseParam: purchaseParam); .buyNonConsumable(purchaseParam: purchaseParam);
if (!sentSuccess) { if (!sentSuccess) {
var err = "Failed to send purchase request"; var dialog = PurchaseFailedDialog(tr("widgets.PurchaseButton.failSend"));
var dialog = PurchaseFailedDialog(err);
await showDialog(context: context, builder: (context) => dialog); await showDialog(context: context, builder: (context) => dialog);
} }
} }
@ -60,6 +59,13 @@ class PurchaseButton extends StatelessWidget {
await _initPurchase(context); await _initPurchase(context);
} catch (err, stackTrace) { } catch (err, stackTrace) {
logException(err, stackTrace); logException(err, stackTrace);
var errStr = tr(
"widgets.PurchaseButton.failPurchase",
args: [err.toString()],
);
var dialog = PurchaseFailedDialog(errStr);
await showDialog(context: context, builder: (context) => dialog);
} }
} }
} }