Browse Source

[fix]修改苹果支付查询失败的问题

Destiny 1 year ago
parent
commit
b7c168097f

+ 6 - 0
ios/Podfile.lock

@@ -1,4 +1,6 @@
 PODS:
+  - app_tracking_transparency (0.0.1):
+    - Flutter
   - audio_session (0.0.1):
     - Flutter
   - connectivity_plus (0.0.1):
@@ -94,6 +96,7 @@ PODS:
     - Flutter
 
 DEPENDENCIES:
+  - app_tracking_transparency (from `.symlinks/plugins/app_tracking_transparency/ios`)
   - audio_session (from `.symlinks/plugins/audio_session/ios`)
   - connectivity_plus (from `.symlinks/plugins/connectivity_plus/darwin`)
   - device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
@@ -125,6 +128,8 @@ SPEC REPOS:
     - SwiftyGif
 
 EXTERNAL SOURCES:
+  app_tracking_transparency:
+    :path: ".symlinks/plugins/app_tracking_transparency/ios"
   audio_session:
     :path: ".symlinks/plugins/audio_session/ios"
   connectivity_plus:
@@ -167,6 +172,7 @@ EXTERNAL SOURCES:
     :path: ".symlinks/plugins/wechat_kit/ios"
 
 SPEC CHECKSUMS:
+  app_tracking_transparency: e169b653478da7bb15a6c61209015378ca73e375
   audio_session: 088d2483ebd1dc43f51d253d4a1c517d9a2e7207
   connectivity_plus: ddd7f30999e1faaef5967c23d5b6d503d10434db
   device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d

+ 9 - 0
ios/Runner.xcodeproj/project.pbxproj

@@ -485,8 +485,11 @@
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PROVISIONING_PROFILE_SPECIFIER = "";
 				"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = xiaoting_dev;
+				SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
+				SUPPORTS_MACCATALYST = NO;
 				SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
 				SWIFT_VERSION = 5.0;
+				TARGETED_DEVICE_FAMILY = 1;
 				VERSIONING_SYSTEM = "apple-generic";
 			};
 			name = Profile;
@@ -674,9 +677,12 @@
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PROVISIONING_PROFILE_SPECIFIER = "";
 				"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = xiaoting_dev;
+				SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
+				SUPPORTS_MACCATALYST = NO;
 				SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
 				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
 				SWIFT_VERSION = 5.0;
+				TARGETED_DEVICE_FAMILY = 1;
 				VERSIONING_SYSTEM = "apple-generic";
 			};
 			name = Debug;
@@ -703,8 +709,11 @@
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PROVISIONING_PROFILE_SPECIFIER = "";
 				"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = xiaoting_dev;
+				SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
+				SUPPORTS_MACCATALYST = NO;
 				SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
 				SWIFT_VERSION = 5.0;
+				TARGETED_DEVICE_FAMILY = 1;
 				VERSIONING_SYSTEM = "apple-generic";
 			};
 			name = Release;

+ 14 - 3
ios/Runner/Info.plist

@@ -2,12 +2,19 @@
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
+	<key>ITSAppUsesNonExemptEncryption</key>
+	<false/>
+	<key>NSAppTransportSecurity</key>
+	<dict>
+		<key>NSAllowsArbitraryLoads</key>
+		<true/>
+	</dict>
 	<key>CADisableMinimumFrameDurationOnPhone</key>
 	<true/>
 	<key>CFBundleDevelopmentRegion</key>
 	<string>$(DEVELOPMENT_LANGUAGE)</string>
 	<key>CFBundleDisplayName</key>
-	<string>Electronic Assistant</string>
+	<string>小听</string>
 	<key>CFBundleExecutable</key>
 	<string>$(EXECUTABLE_NAME)</string>
 	<key>CFBundleIdentifier</key>
@@ -27,11 +34,15 @@
 	<key>LSRequiresIPhoneOS</key>
 	<true/>
 	<key>NSMicrophoneUsageDescription</key>
-	<string>谈话录音功能</string>
+	<string>小听需要麦克风权限用于会议录音功能</string>
 	<key>NSUserTrackingUsageDescription</key>
-	<string>此应用使用您的数据来提供个性化广告体验。</string>
+	<string>小听需要使用您的广告标识符以显示个性化广告</string>
 	<key>UIApplicationSupportsIndirectInputEvents</key>
 	<true/>
+	<key>UIBackgroundModes</key>
+	<array>
+		<string>audio</string>
+	</array>
 	<key>UILaunchStoryboardName</key>
 	<string>LaunchScreen</string>
 	<key>UIMainStoryboardFile</key>

+ 1 - 1
lib/data/consts/constants.dart

@@ -7,7 +7,7 @@ import '../../utils/common_utils.dart';
 class Constants {
   Constants._();
 
-  static const String env = envTest;
+  static const String env = envProd;
 
   static const String envDev = 'dev';
 

+ 6 - 3
lib/module/store/controller.dart

@@ -113,7 +113,8 @@ class StoreController extends BaseController implements PaymentStatusCallback {
       }
       AgilePay.startPay(payInfo, success: (String? result) {
         LoadingDialog.show(StringName.storeQueryPayState.tr);
-        checkPaymentStatus(outTradeNo, paymentWay, storeItem);
+        checkPaymentStatus(outTradeNo, paymentWay, storeItem,
+            receiptData: result);
         Future.delayed(const Duration(seconds: 30), () {
           LoadingDialog.hide();
         });
@@ -151,9 +152,11 @@ class StoreController extends BaseController implements PaymentStatusCallback {
   }
 
   void checkPaymentStatus(
-      String orderNo, PaymentWay paymentWay, StoreItem storeItemBean) {
+      String orderNo, PaymentWay paymentWay, StoreItem storeItemBean,
+      {String? receiptData}) {
     paymentStatusManager.registerPaymentSuccessCallback(orderNo, this);
-    paymentStatusManager.checkPaymentStatus(orderNo, paymentWay, storeItemBean);
+    paymentStatusManager.checkPaymentStatus(orderNo, paymentWay, storeItemBean,
+        receiptData: receiptData);
   }
 
   @override

+ 11 - 6
lib/module/store/payment_status_manager.dart

@@ -29,13 +29,16 @@ class PaymentStatusManager {
   final _lock = Lock();
 
   void _startCheckPolling(
-      String orderNo, PaymentWay paymentWay, StoreItem storeItemBean) async {
+      String orderNo, PaymentWay paymentWay, StoreItem storeItemBean,
+      {String? receiptData}) async {
     await _lock.synchronized(() async {
       pollingSubscriptionMap[orderNo]?.cancel();
       debugPrint('开始轮询支付状态: orderNo = $orderNo');
       CancelableFuture orderFuture = AsyncUtil.retryWithExponentialBackoff(
           () {
-            return storeRepository.orderStatus(orderNo).then((status) {
+            return storeRepository
+                .orderStatus(orderNo, receiptData: receiptData)
+                .then((status) {
               if (status == payStatusSuccess) {
                 return true;
               } else {
@@ -68,15 +71,17 @@ class PaymentStatusManager {
     });
   }
 
-  void reportPaySuccess(int price, String orderId, String itemName,
-      int paymentWay) {
+  void reportPaySuccess(
+      int price, String orderId, String itemName, int paymentWay) {
     GravityHelper.reportPay(price, orderId, itemName, paymentWay);
   }
 
   void checkPaymentStatus(
-      String orderNo, PaymentWay paymentWay, StoreItem storeItemBean) {
+      String orderNo, PaymentWay paymentWay, StoreItem storeItemBean,
+      {String? receiptData}) {
     // recordKeyInfoToDisk(orderNo, paymentWay, storeItemBean);
-    _startCheckPolling(orderNo, paymentWay, storeItemBean);
+    _startCheckPolling(orderNo, paymentWay, storeItemBean,
+        receiptData: receiptData);
   }
 
   void registerPaymentSuccessCallback(

+ 1 - 1
pubspec.yaml

@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
 # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
 # In Windows, build-name is used as the major, minor, and patch parts
 # of the product and file versions while build-number is used as the build suffix.
-version: 1.0.0+1
+version: 1.0.1+5
 
 
 environment: