This commit is contained in:
Hillel Coren 2022-10-06 15:26:02 +03:00
parent 0674b0f688
commit f33581cbb7
1 changed files with 8 additions and 5 deletions

View File

@ -285,6 +285,7 @@ class _UpgradeDialogState extends State<UpgradeDialog> {
_purchasePending = false; _purchasePending = false;
}); });
final navigator = Navigator.of(context);
final store = StoreProvider.of<AppState>(context); final store = StoreProvider.of<AppState>(context);
final state = store.state; final state = store.state;
final url = (state.isStaging ? kAppStagingUrl : kAppProductionUrl) + final url = (state.isStaging ? kAppStagingUrl : kAppProductionUrl) +
@ -294,15 +295,17 @@ class _UpgradeDialogState extends State<UpgradeDialog> {
'inapp_transaction_id': purchaseDetails.purchaseID, 'inapp_transaction_id': purchaseDetails.purchaseID,
'key': state.account.key, 'key': state.account.key,
'plan': purchaseDetails.productID, 'plan': purchaseDetails.productID,
'plan_paid': 'plan_paid': (int.parse(purchaseDetails.transactionDate) / 1000).floor(),
(int.parse(purchaseDetails.transactionDate) / 1000).floor(),
}; };
await WebClient().post(url, state.credentials.token, await WebClient()
data: jsonEncode(data)); .post(url, state.credentials.token, data: jsonEncode(data));
store.dispatch(RefreshData()); store.dispatch(RefreshData());
if (navigator.canPop()) {
navigator.pop();
}
} }
void handleError(IAPError error) { void handleError(IAPError error) {