ChadCSong

苹果订阅相关维护修改

...@@ -32,7 +32,7 @@ if (keystorePropertiesFile.exists()) { ...@@ -32,7 +32,7 @@ if (keystorePropertiesFile.exists()) {
32 } 32 }
33 33
34 android { 34 android {
35 - compileSdkVersion 32 35 + compileSdkVersion 33
36 buildToolsVersion "32" 36 buildToolsVersion "32"
37 37
38 compileOptions { 38 compileOptions {
......
...@@ -27,7 +27,7 @@ PODS: ...@@ -27,7 +27,7 @@ PODS:
27 - Flutter 27 - Flutter
28 - flutter_native_splash (0.0.1): 28 - flutter_native_splash (0.0.1):
29 - Flutter 29 - Flutter
30 - - flutter_secure_storage (3.3.1): 30 + - flutter_secure_storage (6.0.0):
31 - Flutter 31 - Flutter
32 - flutter_sound (9.2.13): 32 - flutter_sound (9.2.13):
33 - Flutter 33 - Flutter
...@@ -53,6 +53,7 @@ PODS: ...@@ -53,6 +53,7 @@ PODS:
53 - Flutter 53 - Flutter
54 - in_app_purchase_storekit (0.0.1): 54 - in_app_purchase_storekit (0.0.1):
55 - Flutter 55 - Flutter
56 + - FlutterMacOS
56 - integration_test (0.0.1): 57 - integration_test (0.0.1):
57 - Flutter 58 - Flutter
58 - JCore (3.2.5) 59 - JCore (3.2.5)
...@@ -220,7 +221,7 @@ SPEC CHECKSUMS: ...@@ -220,7 +221,7 @@ SPEC CHECKSUMS:
220 flutter_facebook_auth: c69f4e643b1d9cc9063ec87c9411bd9ec268108f 221 flutter_facebook_auth: c69f4e643b1d9cc9063ec87c9411bd9ec268108f
221 flutter_inapp_purchase: 5c6a1ac3f11b11d0c8c0321c0c41c1f05805e4c8 222 flutter_inapp_purchase: 5c6a1ac3f11b11d0c8c0321c0c41c1f05805e4c8
222 flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef 223 flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef
223 - flutter_secure_storage: 7953c38a04c3fdbb00571bcd87d8e3b5ceb9daec 224 + flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be
224 flutter_sound: c60effa2a350fb977885f0db2fbc4c1ad5160900 225 flutter_sound: c60effa2a350fb977885f0db2fbc4c1ad5160900
225 flutter_sound_core: 26c10e5832e76aaacfae252d8925232281c486ae 226 flutter_sound_core: 26c10e5832e76aaacfae252d8925232281c486ae
226 FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a 227 FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
...@@ -229,7 +230,7 @@ SPEC CHECKSUMS: ...@@ -229,7 +230,7 @@ SPEC CHECKSUMS:
229 image_cropper: 60c2789d1f1a78c873235d4319ca0c34a69f2d98 230 image_cropper: 60c2789d1f1a78c873235d4319ca0c34a69f2d98
230 image_gallery_saver: 259eab68fb271cfd57d599904f7acdc7832e7ef2 231 image_gallery_saver: 259eab68fb271cfd57d599904f7acdc7832e7ef2
231 image_picker_ios: b786a5dcf033a8336a657191401bfdf12017dabb 232 image_picker_ios: b786a5dcf033a8336a657191401bfdf12017dabb
232 - in_app_purchase_storekit: d7fcf4646136ec258e237872755da8ea6c1b6096 233 + in_app_purchase_storekit: 6b297e2b5eab9fa3251a492d57301722e4132a71
233 integration_test: a1e7d09bd98eca2fc37aefd79d4f41ad37bdbbe5 234 integration_test: a1e7d09bd98eca2fc37aefd79d4f41ad37bdbbe5
234 JCore: 4c9febdfdb1a5675ab361bc1f06c0905391d7b23 235 JCore: 4c9febdfdb1a5675ab361bc1f06c0905391d7b23
235 JPush: 2caabdb6d62d009bc07a9bd115d03c7c42512b5e 236 JPush: 2caabdb6d62d009bc07a9bd115d03c7c42512b5e
...@@ -252,4 +253,4 @@ SPEC CHECKSUMS: ...@@ -252,4 +253,4 @@ SPEC CHECKSUMS:
252 253
253 PODFILE CHECKSUM: 7d714a5ac7fda1315bc261738086cf00fa98c7e3 254 PODFILE CHECKSUM: 7d714a5ac7fda1315bc261738086cf00fa98c7e3
254 255
255 -COCOAPODS: 1.11.3 256 +COCOAPODS: 1.11.2
......
...@@ -380,14 +380,14 @@ ...@@ -380,14 +380,14 @@
380 CLANG_ENABLE_MODULES = YES; 380 CLANG_ENABLE_MODULES = YES;
381 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; 381 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
382 CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 382 CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
383 - DEVELOPMENT_TEAM = FLS6Y2LS7Z; 383 + DEVELOPMENT_TEAM = 5PX6JTCZ6G;
384 ENABLE_BITCODE = NO; 384 ENABLE_BITCODE = NO;
385 INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; 385 INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
386 LD_RUNPATH_SEARCH_PATHS = ( 386 LD_RUNPATH_SEARCH_PATHS = (
387 "$(inherited)", 387 "$(inherited)",
388 "@executable_path/Frameworks", 388 "@executable_path/Frameworks",
389 ); 389 );
390 - PRODUCT_BUNDLE_IDENTIFIER = pub.yiyan.parlando.Parlando; 390 + PRODUCT_BUNDLE_IDENTIFIER = ink.parlando.parlando;
391 PRODUCT_NAME = "$(TARGET_NAME)"; 391 PRODUCT_NAME = "$(TARGET_NAME)";
392 SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 392 SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
393 SWIFT_VERSION = 5.0; 393 SWIFT_VERSION = 5.0;
...@@ -509,14 +509,14 @@ ...@@ -509,14 +509,14 @@
509 CLANG_ENABLE_MODULES = YES; 509 CLANG_ENABLE_MODULES = YES;
510 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; 510 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
511 CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 511 CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
512 - DEVELOPMENT_TEAM = FLS6Y2LS7Z; 512 + DEVELOPMENT_TEAM = 5PX6JTCZ6G;
513 ENABLE_BITCODE = NO; 513 ENABLE_BITCODE = NO;
514 INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; 514 INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
515 LD_RUNPATH_SEARCH_PATHS = ( 515 LD_RUNPATH_SEARCH_PATHS = (
516 "$(inherited)", 516 "$(inherited)",
517 "@executable_path/Frameworks", 517 "@executable_path/Frameworks",
518 ); 518 );
519 - PRODUCT_BUNDLE_IDENTIFIER = pub.yiyan.parlando.Parlando; 519 + PRODUCT_BUNDLE_IDENTIFIER = ink.parlando.parlando;
520 PRODUCT_NAME = "$(TARGET_NAME)"; 520 PRODUCT_NAME = "$(TARGET_NAME)";
521 SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 521 SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
522 SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 522 SWIFT_OPTIMIZATION_LEVEL = "-Onone";
...@@ -533,14 +533,14 @@ ...@@ -533,14 +533,14 @@
533 CLANG_ENABLE_MODULES = YES; 533 CLANG_ENABLE_MODULES = YES;
534 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; 534 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
535 CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 535 CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
536 - DEVELOPMENT_TEAM = FLS6Y2LS7Z; 536 + DEVELOPMENT_TEAM = 5PX6JTCZ6G;
537 ENABLE_BITCODE = NO; 537 ENABLE_BITCODE = NO;
538 INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; 538 INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
539 LD_RUNPATH_SEARCH_PATHS = ( 539 LD_RUNPATH_SEARCH_PATHS = (
540 "$(inherited)", 540 "$(inherited)",
541 "@executable_path/Frameworks", 541 "@executable_path/Frameworks",
542 ); 542 );
543 - PRODUCT_BUNDLE_IDENTIFIER = pub.yiyan.parlando.Parlando; 543 + PRODUCT_BUNDLE_IDENTIFIER = ink.parlando.parlando;
544 PRODUCT_NAME = "$(TARGET_NAME)"; 544 PRODUCT_NAME = "$(TARGET_NAME)";
545 SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 545 SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
546 SWIFT_VERSION = 5.0; 546 SWIFT_VERSION = 5.0;
......
...@@ -2,12 +2,6 @@ ...@@ -2,12 +2,6 @@
2 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 2 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3 <plist version="1.0"> 3 <plist version="1.0">
4 <dict> 4 <dict>
5 - <key>NSLocalNetworkUsageDescription</key>
6 - <string>Allow flutter app</string>
7 - <key>NSBonjourServices</key>
8 - <array>
9 - <string>_dartobservatory._tcp</string>
10 - </array>
11 <key>CFBundleDevelopmentRegion</key> 5 <key>CFBundleDevelopmentRegion</key>
12 <string>$(DEVELOPMENT_LANGUAGE)</string> 6 <string>$(DEVELOPMENT_LANGUAGE)</string>
13 <key>CFBundleDisplayName</key> 7 <key>CFBundleDisplayName</key>
...@@ -35,6 +29,12 @@ ...@@ -35,6 +29,12 @@
35 <key>NSAllowsArbitraryLoads</key> 29 <key>NSAllowsArbitraryLoads</key>
36 <true/> 30 <true/>
37 </dict> 31 </dict>
32 + <key>NSBonjourServices</key>
33 + <array>
34 + <string>_dartobservatory._tcp</string>
35 + </array>
36 + <key>NSLocalNetworkUsageDescription</key>
37 + <string>Allow flutter app</string>
38 <key>NSMicrophoneUsageDescription</key> 38 <key>NSMicrophoneUsageDescription</key>
39 <string>打开话筒</string> 39 <string>打开话筒</string>
40 <key>UILaunchStoryboardName</key> 40 <key>UILaunchStoryboardName</key>
......
1 +import 'dart:async';
2 +
1 import 'package:flutter/material.dart'; 3 import 'package:flutter/material.dart';
2 import 'package:flutter_easyloading/flutter_easyloading.dart'; 4 import 'package:flutter_easyloading/flutter_easyloading.dart';
3 5
4 abstract class BaseState<T extends StatefulWidget> extends State<T> { 6 abstract class BaseState<T extends StatefulWidget> extends State<T> {
5 bool _isFirstBuild = true; 7 bool _isFirstBuild = true;
8 + List<Timer> delayTimers = [];
6 9
7 @override 10 @override
8 Widget build(BuildContext context) { 11 Widget build(BuildContext context) {
...@@ -13,6 +16,11 @@ abstract class BaseState<T extends StatefulWidget> extends State<T> { ...@@ -13,6 +16,11 @@ abstract class BaseState<T extends StatefulWidget> extends State<T> {
13 return buildBody(context); 16 return buildBody(context);
14 } 17 }
15 18
19 + postDelay(VoidCallback fn, int delayTime) {
20 + var delayTimer = Timer(Duration(milliseconds: delayTime), fn);
21 + delayTimers.add(delayTimer);
22 + }
23 +
16 Widget buildBody(BuildContext context); 24 Widget buildBody(BuildContext context);
17 25
18 void onFirstBuildBody(BuildContext context) {} 26 void onFirstBuildBody(BuildContext context) {}
...@@ -32,4 +40,12 @@ abstract class BaseState<T extends StatefulWidget> extends State<T> { ...@@ -32,4 +40,12 @@ abstract class BaseState<T extends StatefulWidget> extends State<T> {
32 Widget buildLoading() { 40 Widget buildLoading() {
33 return const Center(child: CircularProgressIndicator()); 41 return const Center(child: CircularProgressIndicator());
34 } 42 }
43 +
44 + @override
45 + void dispose() {
46 + super.dispose();
47 + for (var element in delayTimers) {
48 + element.cancel();
49 + }
50 + }
35 } 51 }
......
...@@ -68,6 +68,10 @@ MembershipData $MembershipDataFromJson(Map<String, dynamic> json) { ...@@ -68,6 +68,10 @@ MembershipData $MembershipDataFromJson(Map<String, dynamic> json) {
68 if (videoCover != null) { 68 if (videoCover != null) {
69 membershipData.videoCover = videoCover; 69 membershipData.videoCover = videoCover;
70 } 70 }
71 + final String? expireVipAt = jsonConvert.convert<String>(json['expire_vip_time']);
72 + if (videoCover != null) {
73 + membershipData.expireVipAt = expireVipAt;
74 + }
71 final String? terminal = jsonConvert.convert<String>(json['terminal']); 75 final String? terminal = jsonConvert.convert<String>(json['terminal']);
72 if (terminal != null) { 76 if (terminal != null) {
73 membershipData.terminal = terminal; 77 membershipData.terminal = terminal;
...@@ -105,6 +109,7 @@ Map<String, dynamic> $MembershipDataToJson(MembershipData entity) { ...@@ -105,6 +109,7 @@ Map<String, dynamic> $MembershipDataToJson(MembershipData entity) {
105 data['bg_images'] = entity.bgImages; 109 data['bg_images'] = entity.bgImages;
106 data['video_url'] = entity.videoUrl; 110 data['video_url'] = entity.videoUrl;
107 data['video_cover'] = entity.videoCover; 111 data['video_cover'] = entity.videoCover;
112 + data['expire_vip_time'] = entity.expireVipAt;
108 data['terminal'] = entity.terminal; 113 data['terminal'] = entity.terminal;
109 data['state'] = entity.state; 114 data['state'] = entity.state;
110 data['created_at'] = entity.createdAt; 115 data['created_at'] = entity.createdAt;
......
...@@ -42,6 +42,8 @@ class MembershipData { ...@@ -42,6 +42,8 @@ class MembershipData {
42 String? createdAt; 42 String? createdAt;
43 @JSONField(name: "updated_at") 43 @JSONField(name: "updated_at")
44 String? updatedAt; 44 String? updatedAt;
45 + @JSONField(name: "expire_vip_time")
46 + String? expireVipAt;
45 @JSONField(name: "is_vip") 47 @JSONField(name: "is_vip")
46 int? isVip; 48 int? isVip;
47 @JSONField(name: "goods_list") 49 @JSONField(name: "goods_list")
......
...@@ -41,12 +41,20 @@ class MembershipPageState extends BaseState<MembershipPage> with WidgetsBindingO ...@@ -41,12 +41,20 @@ class MembershipPageState extends BaseState<MembershipPage> with WidgetsBindingO
41 super.initState(); 41 super.initState();
42 PaymentSdk.instance.initState(onPaySuccess: () { 42 PaymentSdk.instance.initState(onPaySuccess: () {
43 hideLoading(); 43 hideLoading();
44 + toast("购买成功, 请等待订阅生效");
45 + postDelay(() {
46 + refreshData();
47 + }, 1000);
48 + print("onPaySuccess");
44 }, onCancel: () { 49 }, onCancel: () {
45 hideLoading(); 50 hideLoading();
51 + print("onCancel");
46 }, onFailed: () { 52 }, onFailed: () {
47 hideLoading(); 53 hideLoading();
54 + print("onFailed");
48 }, onPending: () { 55 }, onPending: () {
49 - toast("订单Pending"); 56 + showLoading();
57 + print("onPending");
50 }); 58 });
51 PaymentSdk.instance.queryProducts().then((value) { 59 PaymentSdk.instance.queryProducts().then((value) {
52 _products.clear(); 60 _products.clear();
...@@ -54,14 +62,18 @@ class MembershipPageState extends BaseState<MembershipPage> with WidgetsBindingO ...@@ -54,14 +62,18 @@ class MembershipPageState extends BaseState<MembershipPage> with WidgetsBindingO
54 setState(() {}); 62 setState(() {});
55 }); 63 });
56 if (SpUtil.containsKey(Constant.userToken)!) { 64 if (SpUtil.containsKey(Constant.userToken)!) {
57 - showLoading(); 65 + refreshData();
58 - Provider.of<MembershipViewProvider>(context, listen: false).setSelectedMembership(null);
59 - Provider.of<MembershipViewProvider>(context, listen: false).fetchMembershipData('0');
60 } else { 66 } else {
61 NavigatorUtils.push(context, LoginRouter.loginPage, replace: true); 67 NavigatorUtils.push(context, LoginRouter.loginPage, replace: true);
62 } 68 }
63 } 69 }
64 70
71 + void refreshData() {
72 + showLoading();
73 + Provider.of<MembershipViewProvider>(context, listen: false).setSelectedMembership(null);
74 + Provider.of<MembershipViewProvider>(context, listen: false).fetchMembershipData('0');
75 + }
76 +
65 @override 77 @override
66 Widget buildBody(BuildContext context) { 78 Widget buildBody(BuildContext context) {
67 ///响应数据 79 ///响应数据
...@@ -120,7 +132,7 @@ class MembershipPageState extends BaseState<MembershipPage> with WidgetsBindingO ...@@ -120,7 +132,7 @@ class MembershipPageState extends BaseState<MembershipPage> with WidgetsBindingO
120 children: [ 132 children: [
121 Text(mb?.title ?? "一言会员", style: TextStyle(fontSize: 18.px, color: Colors.white)), 133 Text(mb?.title ?? "一言会员", style: TextStyle(fontSize: 18.px, color: Colors.white)),
122 Gaps.vGap24, 134 Gaps.vGap24,
123 - mb?.goodsList?.isNotEmpty == true ? buildProductWidget(mb) : const GFLoader(), 135 + mb?.goodsList?.isNotEmpty == true ? buildProductWidget(mb) : buildLoadingOrSuccess(mb),
124 Gaps.vGap24, 136 Gaps.vGap24,
125 Text(mb?.intro ?? "一言介绍", style: TextStyle(fontSize: 14.px, color: Colors.white)), 137 Text(mb?.intro ?? "一言介绍", style: TextStyle(fontSize: 14.px, color: Colors.white)),
126 Gaps.vGap10, 138 Gaps.vGap10,
...@@ -208,7 +220,10 @@ class MembershipPageState extends BaseState<MembershipPage> with WidgetsBindingO ...@@ -208,7 +220,10 @@ class MembershipPageState extends BaseState<MembershipPage> with WidgetsBindingO
208 ), 220 ),
209 Container(width: 0.6, height: 15.0, color: Colours.line), 221 Container(width: 0.6, height: 15.0, color: Colours.line),
210 TextButton( 222 TextButton(
211 - onPressed: () {}, 223 + onPressed: () {
224 + PaymentSdk.instance.restore();
225 + showLoading();
226 + },
212 child: Text( 227 child: Text(
213 "恢复购买", 228 "恢复购买",
214 style: TextStyle(fontSize: 14.px, color: Colors.white), 229 style: TextStyle(fontSize: 14.px, color: Colors.white),
...@@ -223,4 +238,22 @@ class MembershipPageState extends BaseState<MembershipPage> with WidgetsBindingO ...@@ -223,4 +238,22 @@ class MembershipPageState extends BaseState<MembershipPage> with WidgetsBindingO
223 PaymentSdk.instance.dispose(); 238 PaymentSdk.instance.dispose();
224 super.dispose(); 239 super.dispose();
225 } 240 }
241 +
242 + buildLoadingOrSuccess(MembershipData? mb) {
243 + if (mb?.isVip == 1) {
244 + return Column(
245 + children: [
246 + Text(
247 + "过期时间:",
248 + style: TextStyle(fontSize: 14.px, color: Colors.white),
249 + ),
250 + Text(
251 + mb?.expireVipAt ?? "",
252 + style: TextStyle(fontSize: 14.px, color: Colors.white),
253 + )
254 + ],
255 + );
256 + }
257 + return const GFLoader();
258 + }
226 } 259 }
......
...@@ -109,7 +109,7 @@ class PaymentSdk { ...@@ -109,7 +109,7 @@ class PaymentSdk {
109 } 109 }
110 110
111 bool _isConsumable(ProductDetails details) { 111 bool _isConsumable(ProductDetails details) {
112 - return true; 112 + return false;
113 } 113 }
114 114
115 void restore() { 115 void restore() {
......
This diff is collapsed. Click to expand it.
...@@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev ...@@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
15 # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 15 # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
16 # Read more about iOS versioning at 16 # Read more about iOS versioning at
17 # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 17 # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
18 -version: 1.0.0+13 18 +version: 1.0.0+15
19 19
20 environment: 20 environment:
21 sdk: ">=2.16.2 <3.0.0" 21 sdk: ">=2.16.2 <3.0.0"
......