Commit 911794fd626c23df33810270e6b277a22d769859
1 parent
2187c85f
feat:审核控制增加ios平台条件判断
Showing
4 changed files
with
14 additions
and
13 deletions
lib/common/core/app_config_helper.dart
| ... | ... | @@ -2,6 +2,7 @@ import 'dart:ffi'; |
| 2 | 2 | import 'dart:io'; |
| 3 | 3 | |
| 4 | 4 | import 'package:flutter/cupertino.dart'; |
| 5 | +import 'package:flutter/foundation.dart'; | |
| 5 | 6 | import 'package:flutter/services.dart'; |
| 6 | 7 | import 'package:package_info_plus/package_info_plus.dart'; |
| 7 | 8 | import 'package:wow_english/common/core/sp_const.dart'; |
| ... | ... | @@ -29,9 +30,15 @@ class AppConfigHelper { |
| 29 | 30 | return configEntityEntity; |
| 30 | 31 | } |
| 31 | 32 | |
| 33 | + // 是否是iOS平台 | |
| 34 | + static bool isIosPlatform() { | |
| 35 | + return defaultTargetPlatform == TargetPlatform.iOS; | |
| 36 | + } | |
| 37 | + | |
| 32 | 38 | // 是否需要隐藏... |
| 33 | 39 | static bool shouldHidePay() { |
| 34 | - return configEntityEntity?.isAppReviewing() == true || UserUtil.getUser()?.phoneNum == "17730280759"; | |
| 40 | + return isIosPlatform() && | |
| 41 | + (configEntityEntity?.isAppReviewing() == true || UserUtil.getUser()?.phoneNum == "17730280759"); | |
| 35 | 42 | } |
| 36 | 43 | |
| 37 | 44 | // 获取app版本号 | ... | ... |
lib/common/request/token_interceptor.dart
| ... | ... | @@ -14,7 +14,7 @@ class TokenInterceptor extends Interceptor { |
| 14 | 14 | // 在发送请求之前获取版本号 |
| 15 | 15 | String version = await AppConfigHelper.getAppVersion(); |
| 16 | 16 | options.headers["version"] = version; |
| 17 | - options.headers["User-Agent"] = defaultTargetPlatform == TargetPlatform.iOS ? "ios" : "android"; | |
| 17 | + options.headers["User-Agent"] = AppConfigHelper.isIosPlatform() ? "ios" : "android"; | |
| 18 | 18 | super.onRequest(options, handler); |
| 19 | 19 | } |
| 20 | 20 | } | ... | ... |
lib/pages/home/bloc.dart
| ... | ... | @@ -30,16 +30,9 @@ class ModuleSelectBloc extends Bloc<HomeEvent, HomeState> { |
| 30 | 30 | return; |
| 31 | 31 | } |
| 32 | 32 | Log.d("WQF _checkUpdate appVersionEntity: $appVersionEntity localVersion=$localVersion"); |
| 33 | - if (defaultTargetPlatform == TargetPlatform.iOS) { | |
| 34 | - if (localVersion < int.parse(appVersionEntity.version ?? '0')) { | |
| 35 | - emit(UpdateDialogState( | |
| 36 | - appVersionEntity.volType == UpdateStrategy.FORCE.name, appVersionEntity)); | |
| 37 | - } | |
| 38 | - } else { | |
| 39 | - if (localVersion < int.parse(appVersionEntity.version ?? '0')) { | |
| 40 | - emit(UpdateDialogState( | |
| 41 | - appVersionEntity.volType == UpdateStrategy.FORCE.name, appVersionEntity)); | |
| 42 | - } | |
| 33 | + if (localVersion < int.parse(appVersionEntity.version ?? '0')) { | |
| 34 | + emit(UpdateDialogState( | |
| 35 | + appVersionEntity.volType == UpdateStrategy.FORCE.name, appVersionEntity)); | |
| 43 | 36 | } |
| 44 | 37 | } |
| 45 | 38 | } | ... | ... |
lib/pages/home/view.dart
| ... | ... | @@ -44,6 +44,7 @@ class _HomePageView extends StatelessWidget { |
| 44 | 44 | }), |
| 45 | 45 | BlocListener<ModuleSelectBloc, HomeState>( |
| 46 | 46 | listener: (context, state) { |
| 47 | + Log.d("WQF HomePage listener state: $state"); | |
| 47 | 48 | if (state is UpdateDialogState) { |
| 48 | 49 | _showUpdateDialog(context, state.forceUpdate, state.appVersionEntity); |
| 49 | 50 | } |
| ... | ... | @@ -199,7 +200,7 @@ class _HomePageView extends StatelessWidget { |
| 199 | 200 | TextButton( |
| 200 | 201 | child: const Text('升级'), |
| 201 | 202 | onPressed: () async { |
| 202 | - if (defaultTargetPlatform == TargetPlatform.iOS) { | |
| 203 | + if (AppConfigHelper.isIosPlatform()) { | |
| 203 | 204 | _launchAppStore("6450870731"); |
| 204 | 205 | return; |
| 205 | 206 | } | ... | ... |