Commit 28f20da92b1ce541490a024a7e035adaa677abe5
1 parent
454dc387
feat:针对apple审核对支付相关信息特殊处理
Showing
10 changed files
with
231 additions
and
28 deletions
lib/app/splash_page.dart
| @@ -6,6 +6,7 @@ import 'package:flutter/foundation.dart'; | @@ -6,6 +6,7 @@ import 'package:flutter/foundation.dart'; | ||
| 6 | import 'package:flutter/material.dart'; | 6 | import 'package:flutter/material.dart'; |
| 7 | import 'package:flutter/services.dart'; | 7 | import 'package:flutter/services.dart'; |
| 8 | import 'package:limiting_direction_csx/limiting_direction_csx.dart'; | 8 | import 'package:limiting_direction_csx/limiting_direction_csx.dart'; |
| 9 | +import 'package:wow_english/common/core/app_config_helper.dart'; | ||
| 9 | import 'package:wow_english/common/core/user_util.dart'; | 10 | import 'package:wow_english/common/core/user_util.dart'; |
| 10 | import 'package:wow_english/common/extension/string_extension.dart'; | 11 | import 'package:wow_english/common/extension/string_extension.dart'; |
| 11 | import 'package:wow_english/common/request/config.dart'; | 12 | import 'package:wow_english/common/request/config.dart'; |
| @@ -44,6 +45,8 @@ class _TransitionViewState extends State<TransitionView> { | @@ -44,6 +45,8 @@ class _TransitionViewState extends State<TransitionView> { | ||
| 44 | //Log.d('Splash读当前页面:$currentPageName'); | 45 | //Log.d('Splash读当前页面:$currentPageName'); |
| 45 | Log.d('Splash读本地, userEntity: $userEntity'); | 46 | Log.d('Splash读本地, userEntity: $userEntity'); |
| 46 | int apartInMilliseconds = 0; | 47 | int apartInMilliseconds = 0; |
| 48 | + // 阻塞获取系统配置信息 | ||
| 49 | + await AppConfigHelper.getAppConfig(); | ||
| 47 | // 调一下接口判断一下有效性再往下 | 50 | // 调一下接口判断一下有效性再往下 |
| 48 | if (userEntity != null && userEntity.token != null) { | 51 | if (userEntity != null && userEntity.token != null) { |
| 49 | String token = userEntity.token!; | 52 | String token = userEntity.token!; |
lib/common/core/app_config_helper.dart
0 → 100644
| 1 | + | ||
| 2 | + | ||
| 3 | +import 'dart:ffi'; | ||
| 4 | + | ||
| 5 | +import 'package:wow_english/common/core/user_util.dart'; | ||
| 6 | + | ||
| 7 | +import '../../models/app_config_entity.dart'; | ||
| 8 | +import '../request/dao/system_dao.dart'; | ||
| 9 | + | ||
| 10 | +class AppConfigHelper { | ||
| 11 | + | ||
| 12 | + static AppConfigEntityEntity? configEntityEntity; | ||
| 13 | + | ||
| 14 | + /// 获取用户信息 | ||
| 15 | + static Future<Void?> getAppConfig() async { | ||
| 16 | + configEntityEntity = await SystemDao.getAppConfig(); | ||
| 17 | + return null; | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + // 是否需要隐藏... | ||
| 21 | + static bool shouldHidePay() { | ||
| 22 | + return configEntityEntity?.isAppReviewing() == true || UserUtil.getUser()?.phoneNum == "17730280759"; | ||
| 23 | + } | ||
| 24 | +} |
lib/common/core/user_util.dart
| @@ -76,4 +76,9 @@ class UserUtil { | @@ -76,4 +76,9 @@ class UserUtil { | ||
| 76 | static String getUserToken() { | 76 | static String getUserToken() { |
| 77 | return _userEntity?.token ?? ''; | 77 | return _userEntity?.token ?? ''; |
| 78 | } | 78 | } |
| 79 | + | ||
| 80 | + // (vip)剩余有效期 | ||
| 81 | + static int getRemainingValidity() { | ||
| 82 | + return _userEntity?.validDay ?? 0; | ||
| 83 | + } | ||
| 79 | } | 84 | } |
lib/common/request/dao/system_dao.dart
0 → 100644
lib/generated/json/app_config_entity.g.dart
0 → 100644
| 1 | +import 'package:wow_english/generated/json/base/json_convert_content.dart'; | ||
| 2 | +import 'package:wow_english/models/app_config_entity.dart'; | ||
| 3 | + | ||
| 4 | +AppConfigEntityEntity $AppConfigEntityEntityFromJson( | ||
| 5 | + Map<String, dynamic> json) { | ||
| 6 | + final AppConfigEntityEntity appConfigEntityEntity = AppConfigEntityEntity(); | ||
| 7 | + final bool? androidForceUpdate = jsonConvert.convert<bool>( | ||
| 8 | + json['androidForceUpdate']); | ||
| 9 | + if (androidForceUpdate != null) { | ||
| 10 | + appConfigEntityEntity.androidForceUpdate = androidForceUpdate; | ||
| 11 | + } | ||
| 12 | + final bool? androidRecommendUpdate = jsonConvert.convert<bool>( | ||
| 13 | + json['androidRecommendUpdate']); | ||
| 14 | + if (androidRecommendUpdate != null) { | ||
| 15 | + appConfigEntityEntity.androidRecommendUpdate = androidRecommendUpdate; | ||
| 16 | + } | ||
| 17 | + final String? androidUpdatePackageUrl = jsonConvert.convert<String>( | ||
| 18 | + json['androidUpdatePackageUrl']); | ||
| 19 | + if (androidUpdatePackageUrl != null) { | ||
| 20 | + appConfigEntityEntity.androidUpdatePackageUrl = androidUpdatePackageUrl; | ||
| 21 | + } | ||
| 22 | + final int? androidVersion = jsonConvert.convert<int>(json['androidVersion']); | ||
| 23 | + if (androidVersion != null) { | ||
| 24 | + appConfigEntityEntity.androidVersion = androidVersion; | ||
| 25 | + } | ||
| 26 | + final bool? iosForceUpdate = jsonConvert.convert<bool>( | ||
| 27 | + json['iosForceUpdate']); | ||
| 28 | + if (iosForceUpdate != null) { | ||
| 29 | + appConfigEntityEntity.iosForceUpdate = iosForceUpdate; | ||
| 30 | + } | ||
| 31 | + final bool? iosRecommendUpdate = jsonConvert.convert<bool>( | ||
| 32 | + json['iosRecommendUpdate']); | ||
| 33 | + if (iosRecommendUpdate != null) { | ||
| 34 | + appConfigEntityEntity.iosRecommendUpdate = iosRecommendUpdate; | ||
| 35 | + } | ||
| 36 | + final int? iosVersion = jsonConvert.convert<int>(json['iosVersion']); | ||
| 37 | + if (iosVersion != null) { | ||
| 38 | + appConfigEntityEntity.iosVersion = iosVersion; | ||
| 39 | + } | ||
| 40 | + final String? noticeBeforePurchaseUrl = jsonConvert.convert<String>( | ||
| 41 | + json['noticeBeforePurchaseUrl']); | ||
| 42 | + if (noticeBeforePurchaseUrl != null) { | ||
| 43 | + appConfigEntityEntity.noticeBeforePurchaseUrl = noticeBeforePurchaseUrl; | ||
| 44 | + } | ||
| 45 | + final String? safe = jsonConvert.convert<String>(json['safe']); | ||
| 46 | + if (safe != null) { | ||
| 47 | + appConfigEntityEntity.safe = safe; | ||
| 48 | + } | ||
| 49 | + return appConfigEntityEntity; | ||
| 50 | +} | ||
| 51 | + | ||
| 52 | +Map<String, dynamic> $AppConfigEntityEntityToJson( | ||
| 53 | + AppConfigEntityEntity entity) { | ||
| 54 | + final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 55 | + data['androidForceUpdate'] = entity.androidForceUpdate; | ||
| 56 | + data['androidRecommendUpdate'] = entity.androidRecommendUpdate; | ||
| 57 | + data['androidUpdatePackageUrl'] = entity.androidUpdatePackageUrl; | ||
| 58 | + data['androidVersion'] = entity.androidVersion; | ||
| 59 | + data['iosForceUpdate'] = entity.iosForceUpdate; | ||
| 60 | + data['iosRecommendUpdate'] = entity.iosRecommendUpdate; | ||
| 61 | + data['iosVersion'] = entity.iosVersion; | ||
| 62 | + data['noticeBeforePurchaseUrl'] = entity.noticeBeforePurchaseUrl; | ||
| 63 | + data['safe'] = entity.safe; | ||
| 64 | + return data; | ||
| 65 | +} | ||
| 66 | + | ||
| 67 | +extension AppConfigEntityEntityExtension on AppConfigEntityEntity { | ||
| 68 | + AppConfigEntityEntity copyWith({ | ||
| 69 | + bool? androidForceUpdate, | ||
| 70 | + bool? androidRecommendUpdate, | ||
| 71 | + String? androidUpdatePackageUrl, | ||
| 72 | + int? androidVersion, | ||
| 73 | + bool? iosForceUpdate, | ||
| 74 | + bool? iosRecommendUpdate, | ||
| 75 | + int? iosVersion, | ||
| 76 | + String? noticeBeforePurchaseUrl, | ||
| 77 | + String? safe, | ||
| 78 | + }) { | ||
| 79 | + return AppConfigEntityEntity() | ||
| 80 | + ..androidForceUpdate = androidForceUpdate ?? this.androidForceUpdate | ||
| 81 | + ..androidRecommendUpdate = androidRecommendUpdate ?? | ||
| 82 | + this.androidRecommendUpdate | ||
| 83 | + ..androidUpdatePackageUrl = androidUpdatePackageUrl ?? | ||
| 84 | + this.androidUpdatePackageUrl | ||
| 85 | + ..androidVersion = androidVersion ?? this.androidVersion | ||
| 86 | + ..iosForceUpdate = iosForceUpdate ?? this.iosForceUpdate | ||
| 87 | + ..iosRecommendUpdate = iosRecommendUpdate ?? this.iosRecommendUpdate | ||
| 88 | + ..iosVersion = iosVersion ?? this.iosVersion | ||
| 89 | + ..noticeBeforePurchaseUrl = noticeBeforePurchaseUrl ?? | ||
| 90 | + this.noticeBeforePurchaseUrl | ||
| 91 | + ..safe = safe ?? this.safe; | ||
| 92 | + } | ||
| 93 | +} | ||
| 0 | \ No newline at end of file | 94 | \ No newline at end of file |
lib/generated/json/base/json_convert_content.dart
| @@ -5,6 +5,7 @@ | @@ -5,6 +5,7 @@ | ||
| 5 | // This file is automatically generated. DO NOT EDIT, all your changes would be lost. | 5 | // This file is automatically generated. DO NOT EDIT, all your changes would be lost. |
| 6 | import 'package:flutter/material.dart' show debugPrint; | 6 | import 'package:flutter/material.dart' show debugPrint; |
| 7 | import 'package:wow_english/models/aliyun_oss_upload_sts_entity.dart'; | 7 | import 'package:wow_english/models/aliyun_oss_upload_sts_entity.dart'; |
| 8 | +import 'package:wow_english/models/app_config_entity.dart'; | ||
| 8 | import 'package:wow_english/models/course_entity.dart'; | 9 | import 'package:wow_english/models/course_entity.dart'; |
| 9 | import 'package:wow_english/models/course_module_entity.dart'; | 10 | import 'package:wow_english/models/course_module_entity.dart'; |
| 10 | import 'package:wow_english/models/course_process_entity.dart'; | 11 | import 'package:wow_english/models/course_process_entity.dart'; |
| @@ -154,6 +155,10 @@ class JsonConvert { | @@ -154,6 +155,10 @@ class JsonConvert { | ||
| 154 | Map<String, dynamic> e) => | 155 | Map<String, dynamic> e) => |
| 155 | AliyunOssUploadStsCallbackParam.fromJson(e)).toList() as M; | 156 | AliyunOssUploadStsCallbackParam.fromJson(e)).toList() as M; |
| 156 | } | 157 | } |
| 158 | + if (<AppConfigEntityEntity>[] is M) { | ||
| 159 | + return data.map<AppConfigEntityEntity>((Map<String, dynamic> e) => | ||
| 160 | + AppConfigEntityEntity.fromJson(e)).toList() as M; | ||
| 161 | + } | ||
| 157 | if (<CourseEntity>[] is M) { | 162 | if (<CourseEntity>[] is M) { |
| 158 | return data.map<CourseEntity>((Map<String, dynamic> e) => | 163 | return data.map<CourseEntity>((Map<String, dynamic> e) => |
| 159 | CourseEntity.fromJson(e)).toList() as M; | 164 | CourseEntity.fromJson(e)).toList() as M; |
| @@ -231,6 +236,7 @@ class JsonConvertClassCollection { | @@ -231,6 +236,7 @@ class JsonConvertClassCollection { | ||
| 231 | (AliyunOssUploadStsEntity).toString(): AliyunOssUploadStsEntity.fromJson, | 236 | (AliyunOssUploadStsEntity).toString(): AliyunOssUploadStsEntity.fromJson, |
| 232 | (AliyunOssUploadStsCallbackParam) | 237 | (AliyunOssUploadStsCallbackParam) |
| 233 | .toString(): AliyunOssUploadStsCallbackParam.fromJson, | 238 | .toString(): AliyunOssUploadStsCallbackParam.fromJson, |
| 239 | + (AppConfigEntityEntity).toString(): AppConfigEntityEntity.fromJson, | ||
| 234 | (CourseEntity).toString(): CourseEntity.fromJson, | 240 | (CourseEntity).toString(): CourseEntity.fromJson, |
| 235 | (CourseCourseLessons).toString(): CourseCourseLessons.fromJson, | 241 | (CourseCourseLessons).toString(): CourseCourseLessons.fromJson, |
| 236 | (CourseModuleEntity).toString(): CourseModuleEntity.fromJson, | 242 | (CourseModuleEntity).toString(): CourseModuleEntity.fromJson, |
lib/models/app_config_entity.dart
0 → 100644
| 1 | +import 'package:wow_english/generated/json/base/json_field.dart'; | ||
| 2 | +import 'dart:convert'; | ||
| 3 | + | ||
| 4 | +import '../generated/json/app_config_entity.g.dart'; | ||
| 5 | + | ||
| 6 | + | ||
| 7 | +@JsonSerializable() | ||
| 8 | +class AppConfigEntityEntity { | ||
| 9 | + | ||
| 10 | + // 安卓是否强制更新 | ||
| 11 | + bool? androidForceUpdate; | ||
| 12 | + | ||
| 13 | + // 安卓是否推荐更新 | ||
| 14 | + bool? androidRecommendUpdate; | ||
| 15 | + | ||
| 16 | + // 安卓更新包地址 | ||
| 17 | + String? androidUpdatePackageUrl; | ||
| 18 | + | ||
| 19 | + // 安卓当前版本号 | ||
| 20 | + int? androidVersion; | ||
| 21 | + | ||
| 22 | + bool? iosForceUpdate; | ||
| 23 | + | ||
| 24 | + bool? iosRecommendUpdate; | ||
| 25 | + | ||
| 26 | + // ios版本 | ||
| 27 | + int? iosVersion; | ||
| 28 | + | ||
| 29 | + // 购前须知图片 | ||
| 30 | + String? noticeBeforePurchaseUrl; | ||
| 31 | + | ||
| 32 | + // 当前是否安全,safe-安全 otherwise-隐藏pay | ||
| 33 | + String? safe; | ||
| 34 | + | ||
| 35 | + | ||
| 36 | + AppConfigEntityEntity(); | ||
| 37 | + | ||
| 38 | + factory AppConfigEntityEntity.fromJson(Map<String, dynamic> json) => $AppConfigEntityEntityFromJson(json); | ||
| 39 | + | ||
| 40 | + Map<String, dynamic> toJson() => $AppConfigEntityEntityToJson(this); | ||
| 41 | + | ||
| 42 | + @override | ||
| 43 | + String toString() { | ||
| 44 | + return jsonEncode(this); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + // 是否审核中(null或者非"safe"即不安全) | ||
| 48 | + bool isAppReviewing() { | ||
| 49 | + return safe != "safe"; | ||
| 50 | + } | ||
| 51 | +} | ||
| 0 | \ No newline at end of file | 52 | \ No newline at end of file |
lib/pages/home/widgets/home_tab_header_widget.dart
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | import 'package:flutter_bloc/flutter_bloc.dart'; | 2 | import 'package:flutter_bloc/flutter_bloc.dart'; |
| 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 4 | -import 'package:wow_english/common/core/user_util.dart'; | ||
| 5 | import 'package:wow_english/common/extension/string_extension.dart'; | 4 | import 'package:wow_english/common/extension/string_extension.dart'; |
| 6 | import 'package:wow_english/pages/user/bloc/user_bloc.dart'; | 5 | import 'package:wow_english/pages/user/bloc/user_bloc.dart'; |
| 7 | -import 'package:wow_english/utils/image_util.dart'; | ||
| 8 | 6 | ||
| 7 | +import '../../../common/core/app_config_helper.dart'; | ||
| 9 | import '../../../models/course_entity.dart'; | 8 | import '../../../models/course_entity.dart'; |
| 10 | import '../courese_module_model.dart'; | 9 | import '../courese_module_model.dart'; |
| 11 | 10 | ||
| @@ -123,13 +122,16 @@ class HomeTabHeaderWidget extends StatelessWidget { | @@ -123,13 +122,16 @@ class HomeTabHeaderWidget extends StatelessWidget { | ||
| 123 | } | 122 | } |
| 124 | }, | 123 | }, |
| 125 | icon: Image.asset('listen'.assetPng)), | 124 | icon: Image.asset('listen'.assetPng)), |
| 126 | - IconButton( | ||
| 127 | - onPressed: () { | ||
| 128 | - if (actionTap != null) { | ||
| 129 | - actionTap!(HeaderActionType.shop); | ||
| 130 | - } | ||
| 131 | - }, | ||
| 132 | - icon: Image.asset('shop'.assetPng)), | 125 | + Visibility( |
| 126 | + visible: !AppConfigHelper.shouldHidePay(), | ||
| 127 | + child: IconButton( | ||
| 128 | + onPressed: () { | ||
| 129 | + if (actionTap != null) { | ||
| 130 | + actionTap!(HeaderActionType.shop); | ||
| 131 | + } | ||
| 132 | + }, | ||
| 133 | + icon: Image.asset('shop'.assetPng)), | ||
| 134 | + ), | ||
| 133 | ScreenUtil().bottomBarHeight.horizontalSpace, | 135 | ScreenUtil().bottomBarHeight.horizontalSpace, |
| 134 | ], | 136 | ], |
| 135 | )); | 137 | )); |
lib/pages/moduleSelect/view.dart
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | import 'package:flutter_bloc/flutter_bloc.dart'; | 2 | import 'package:flutter_bloc/flutter_bloc.dart'; |
| 3 | +import 'package:wow_english/common/core/app_config_helper.dart'; | ||
| 3 | import 'package:wow_english/common/extension/string_extension.dart'; | 4 | import 'package:wow_english/common/extension/string_extension.dart'; |
| 4 | import 'package:wow_english/pages/moduleSelect/state.dart'; | 5 | import 'package:wow_english/pages/moduleSelect/state.dart'; |
| 5 | import 'package:wow_english/pages/moduleSelect/widgets/BaseHomeHeaderWidget.dart'; | 6 | import 'package:wow_english/pages/moduleSelect/widgets/BaseHomeHeaderWidget.dart'; |
| @@ -82,17 +83,21 @@ class _HomePageView extends StatelessWidget { | @@ -82,17 +83,21 @@ class _HomePageView extends StatelessWidget { | ||
| 82 | onTap: () { | 83 | onTap: () { |
| 83 | //如果没登录先登录 | 84 | //如果没登录先登录 |
| 84 | if (UserUtil.isLogined()) { | 85 | if (UserUtil.isLogined()) { |
| 85 | - if (UserUtil.hasGamePermission()) { | 86 | + if (AppConfigHelper.shouldHidePay()) { |
| 86 | pushNamed(AppRouteName.games); | 87 | pushNamed(AppRouteName.games); |
| 87 | } else { | 88 | } else { |
| 88 | - showTwoActionDialog( | ||
| 89 | - '提示', '忽略', '去续费', | ||
| 90 | - '您的课程已到期,请快快续费继续学习吧!', leftTap: () { | ||
| 91 | - popPage(); | ||
| 92 | - }, rightTap: () { | ||
| 93 | - popPage(); | ||
| 94 | - pushNamed(AppRouteName.shop); | ||
| 95 | - }); | 89 | + if (UserUtil.hasGamePermission()) { |
| 90 | + pushNamed(AppRouteName.games); | ||
| 91 | + } else { | ||
| 92 | + showTwoActionDialog( | ||
| 93 | + '提示', '忽略', '去续费', | ||
| 94 | + '您的课程已到期,请快快续费继续学习吧!', leftTap: () { | ||
| 95 | + popPage(); | ||
| 96 | + }, rightTap: () { | ||
| 97 | + popPage(); | ||
| 98 | + pushNamed(AppRouteName.shop); | ||
| 99 | + }); | ||
| 100 | + } | ||
| 96 | } | 101 | } |
| 97 | } else { | 102 | } else { |
| 98 | pushNamed(AppRouteName.login); | 103 | pushNamed(AppRouteName.login); |
lib/pages/moduleSelect/widgets/BaseHomeHeaderWidget.dart
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | import 'package:flutter_bloc/flutter_bloc.dart'; | 2 | import 'package:flutter_bloc/flutter_bloc.dart'; |
| 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 4 | +import 'package:wow_english/common/core/app_config_helper.dart'; | ||
| 4 | import 'package:wow_english/common/extension/string_extension.dart'; | 5 | import 'package:wow_english/common/extension/string_extension.dart'; |
| 5 | 6 | ||
| 6 | import '../../../common/core/user_util.dart'; | 7 | import '../../../common/core/user_util.dart'; |
| @@ -77,16 +78,19 @@ class BaseHomeHeaderWidget extends StatelessWidget { | @@ -77,16 +78,19 @@ class BaseHomeHeaderWidget extends StatelessWidget { | ||
| 77 | textAlign: TextAlign.left, | 78 | textAlign: TextAlign.left, |
| 78 | style: TextStyle(color: Colors.white, fontSize: 30.0), | 79 | style: TextStyle(color: Colors.white, fontSize: 30.0), |
| 79 | )), | 80 | )), |
| 80 | - Row(children: <Widget>[ | ||
| 81 | - Image( | ||
| 82 | - width: 20.0.w, | ||
| 83 | - height: 20.0.h, | ||
| 84 | - image: AssetImage('ic_countdown'.assetPng)), | ||
| 85 | - // 替换为你的图片资源路径 | ||
| 86 | - const SizedBox(width: 10.0), | ||
| 87 | - // 图片和文本之间的间隔 | ||
| 88 | - const Text('还剩29天'), | ||
| 89 | - ]), | 81 | + Visibility( |
| 82 | + visible: !AppConfigHelper.shouldHidePay(), | ||
| 83 | + child: Row(children: <Widget>[ | ||
| 84 | + Image( | ||
| 85 | + width: 20.0.w, | ||
| 86 | + height: 20.0.h, | ||
| 87 | + image: AssetImage('ic_countdown'.assetPng)), | ||
| 88 | + // 替换为你的图片资源路径 | ||
| 89 | + const SizedBox(width: 10.0), | ||
| 90 | + // 图片和文本之间的间隔 | ||
| 91 | + Text('还剩${UserUtil.getRemainingValidity()}天'), | ||
| 92 | + ]), | ||
| 93 | + ), | ||
| 90 | ScreenUtil().bottomBarHeight.horizontalSpace, | 94 | ScreenUtil().bottomBarHeight.horizontalSpace, |
| 91 | ], | 95 | ], |
| 92 | )); | 96 | )); |