Show toast when subscription refresh is triggered/failed
This commit is contained in:
parent
65036a015c
commit
00988de60c
|
@ -163,8 +163,8 @@ class _PaymentWebPage extends State<PaymentWebPage> {
|
|||
|
||||
Future<void> handlePaymentResponse(Uri uri) async {
|
||||
var queryParams = uri.queryParameters;
|
||||
// success or fail
|
||||
var paymentStatus = uri.queryParameters['status'] ?? '';
|
||||
_logger.fine('handle payment response with status $paymentStatus');
|
||||
if ('fail' == paymentStatus) {
|
||||
var reason = queryParams['reason'] ?? '';
|
||||
showDialog(
|
||||
|
@ -223,12 +223,14 @@ class _PaymentWebPage extends State<PaymentWebPage> {
|
|||
Future<dynamic> _showExitPageDialog({String title, String content}) {
|
||||
return showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text(title),
|
||||
content: Text(content),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: Text('ok'),
|
||||
child: Text('ok',
|
||||
style: TextStyle(color: Theme.of(context).buttonColor),),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop('dialog');
|
||||
Navigator.of(context).pop(true);
|
||||
|
|
|
@ -95,14 +95,17 @@ class _SubscriptionPageState extends State<SubscriptionPage> {
|
|||
}).toList();
|
||||
}
|
||||
|
||||
FutureOr onWebPaymentGoBack(dynamic value) {
|
||||
// refresh subscription
|
||||
FutureOr onWebPaymentGoBack(dynamic value) async {
|
||||
if (widget.isOnboarding) {
|
||||
Navigator.of(context).popUntil((route) => route.isFirst);
|
||||
} else {
|
||||
_dialog
|
||||
.show()
|
||||
.then((value) => _fetchSub().then((value) => _dialog.hide()));
|
||||
// refresh subscription
|
||||
try {
|
||||
showToast("refreshing subscription status");
|
||||
await _fetchSub();
|
||||
} catch (e) {
|
||||
showToast("failed to refresh subscription");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue