|
|
@@ -83,7 +83,9 @@ class MemberController extends BaseController implements PaymentStatusCallback {
|
|
|
bool _isPopBackInProgress = false; // 操作进行中标志
|
|
|
|
|
|
///检查续订的状态
|
|
|
- final Rx<SubscriptionCheckResponse> _checkResponse = Rx(SubscriptionCheckResponse(outTradeNo: ""));
|
|
|
+ final Rx<SubscriptionCheckResponse> _checkResponse =
|
|
|
+ Rx(SubscriptionCheckResponse(outTradeNo: ""));
|
|
|
+
|
|
|
SubscriptionCheckResponse? get requestCheckResponse => _checkResponse.value;
|
|
|
|
|
|
final List<MemberFunBean> funList = [
|
|
|
@@ -236,16 +238,21 @@ class MemberController extends BaseController implements PaymentStatusCallback {
|
|
|
}
|
|
|
|
|
|
void onPopBack() {
|
|
|
- back();
|
|
|
- if (accountRepository.memberIsExpired()) {
|
|
|
- showRetainDialog();
|
|
|
+ if (Platform.isIOS) {
|
|
|
+ back();
|
|
|
+ if (accountRepository.memberIsExpired()) {
|
|
|
+ showRetainDialog();
|
|
|
+ }
|
|
|
} else {
|
|
|
- //back();
|
|
|
+ if (accountRepository.memberIsExpired()) {
|
|
|
+ showRetainDialog();
|
|
|
+ } else {
|
|
|
+ back();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void showRetainDialog() {
|
|
|
- print("showRetainDialogsfsdf---");
|
|
|
if (_isPopBackInProgress) {
|
|
|
// 如果正在处理返回逻辑,直接跳过
|
|
|
return;
|
|
|
@@ -256,7 +263,9 @@ class MemberController extends BaseController implements PaymentStatusCallback {
|
|
|
_isPopBackInProgress = false;
|
|
|
}, cancelClick: () {
|
|
|
_isPopBackInProgress = false;
|
|
|
- //back();
|
|
|
+ if (!Platform.isIOS) {
|
|
|
+ back();
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@@ -295,10 +304,10 @@ class MemberController extends BaseController implements PaymentStatusCallback {
|
|
|
} else if (payWayType == PayWayType.paymentWayAlipayScan) {
|
|
|
_onAliScanPay(response.outTradeNo, response.alipayQrcodeHtml!,
|
|
|
buyPayWay, buyGoods);
|
|
|
- } else if (payWayType == PayWayType.paymentWayApple) {
|
|
|
- _onApplePay(response.outTradeNo, response.appAccountToken ?? "", buyPayWay, buyGoods);
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else if (payWayType == PayWayType.paymentWayApple) {
|
|
|
+ _onApplePay(response.outTradeNo, response.appAccountToken ?? "",
|
|
|
+ buyPayWay, buyGoods);
|
|
|
+ } else {
|
|
|
ToastUtil.show(StringName.payNotSupport);
|
|
|
}
|
|
|
}).catchError((error) {
|
|
|
@@ -321,12 +330,10 @@ class MemberController extends BaseController implements PaymentStatusCallback {
|
|
|
}
|
|
|
|
|
|
///发起购买请求
|
|
|
- Future<void> _onApplePay(
|
|
|
- String outTradeNo,
|
|
|
+ Future<void> _onApplePay(String outTradeNo,
|
|
|
String appAccountToken,
|
|
|
PayItemBean payWayInfo,
|
|
|
- GoodsBean goodsInfo,
|
|
|
- ) async {
|
|
|
+ GoodsBean goodsInfo,) async {
|
|
|
final result = await ApplePay().purchase(
|
|
|
productId: goodsInfo.appleGoodsId ?? "",
|
|
|
appAccountToken: appAccountToken,
|
|
|
@@ -409,16 +416,13 @@ class MemberController extends BaseController implements PaymentStatusCallback {
|
|
|
|
|
|
///查询订阅状态
|
|
|
Future<void> _requestCheckRestoreStatus(String? receiptData) async {
|
|
|
- memberRepository.subscriptionCheck(3, receiptData ?? "").then((value){
|
|
|
+ memberRepository.subscriptionCheck(3, receiptData ?? "").then((value) {
|
|
|
_checkResponse.value = value;
|
|
|
- }).catchError((error){
|
|
|
-
|
|
|
- });
|
|
|
+ }).catchError((error) {});
|
|
|
}
|
|
|
|
|
|
/// 点击了恢复订阅
|
|
|
Future<void> clickRecoverSubscribe() async {
|
|
|
- print("clickRecoverSubscribefsfds--");
|
|
|
PayItemBean? paymentWay = _selectedPayWay.value;
|
|
|
if (paymentWay == null) {
|
|
|
return;
|
|
|
@@ -464,16 +468,13 @@ class MemberController extends BaseController implements PaymentStatusCallback {
|
|
|
int payPlatform = paymentWay.payPlatform;
|
|
|
int payMethod = paymentWay.payMethod;
|
|
|
// var code = await storeRepository.resume(payPlatform, payMethod, receiptData);
|
|
|
- memberRepository
|
|
|
- .subscriptionResume(3, receiptData)
|
|
|
- .then((data) async {
|
|
|
+ memberRepository.subscriptionResume(3, receiptData).then((data) async {
|
|
|
CustomLoadingDialog.hide();
|
|
|
ToastUtil.show("恢复成功");
|
|
|
await AccountRepository.getInstance().getMemberStatus();
|
|
|
//accountRepository.refreshMemberStatus();
|
|
|
Get.back();
|
|
|
- })
|
|
|
- .catchError((error) {
|
|
|
+ }).catchError((error) {
|
|
|
CustomLoadingDialog.hide();
|
|
|
ToastUtil.show("恢复失败");
|
|
|
});
|