Commit 911794fd626c23df33810270e6b277a22d769859

Authored by 吴启风
1 parent 2187c85f

feat:审核控制增加ios平台条件判断

lib/common/core/app_config_helper.dart
@@ -2,6 +2,7 @@ import 'dart:ffi'; @@ -2,6 +2,7 @@ import 'dart:ffi';
2 import 'dart:io'; 2 import 'dart:io';
3 3
4 import 'package:flutter/cupertino.dart'; 4 import 'package:flutter/cupertino.dart';
  5 +import 'package:flutter/foundation.dart';
5 import 'package:flutter/services.dart'; 6 import 'package:flutter/services.dart';
6 import 'package:package_info_plus/package_info_plus.dart'; 7 import 'package:package_info_plus/package_info_plus.dart';
7 import 'package:wow_english/common/core/sp_const.dart'; 8 import 'package:wow_english/common/core/sp_const.dart';
@@ -29,9 +30,15 @@ class AppConfigHelper { @@ -29,9 +30,15 @@ class AppConfigHelper {
29 return configEntityEntity; 30 return configEntityEntity;
30 } 31 }
31 32
  33 + // 是否是iOS平台
  34 + static bool isIosPlatform() {
  35 + return defaultTargetPlatform == TargetPlatform.iOS;
  36 + }
  37 +
32 // 是否需要隐藏... 38 // 是否需要隐藏...
33 static bool shouldHidePay() { 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 // 获取app版本号 44 // 获取app版本号
lib/common/request/token_interceptor.dart
@@ -14,7 +14,7 @@ class TokenInterceptor extends Interceptor { @@ -14,7 +14,7 @@ class TokenInterceptor extends Interceptor {
14 // 在发送请求之前获取版本号 14 // 在发送请求之前获取版本号
15 String version = await AppConfigHelper.getAppVersion(); 15 String version = await AppConfigHelper.getAppVersion();
16 options.headers["version"] = version; 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 super.onRequest(options, handler); 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,16 +30,9 @@ class ModuleSelectBloc extends Bloc<HomeEvent, HomeState> {
30 return; 30 return;
31 } 31 }
32 Log.d("WQF _checkUpdate appVersionEntity: $appVersionEntity localVersion=$localVersion"); 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,6 +44,7 @@ class _HomePageView extends StatelessWidget {
44 }), 44 }),
45 BlocListener<ModuleSelectBloc, HomeState>( 45 BlocListener<ModuleSelectBloc, HomeState>(
46 listener: (context, state) { 46 listener: (context, state) {
  47 + Log.d("WQF HomePage listener state: $state");
47 if (state is UpdateDialogState) { 48 if (state is UpdateDialogState) {
48 _showUpdateDialog(context, state.forceUpdate, state.appVersionEntity); 49 _showUpdateDialog(context, state.forceUpdate, state.appVersionEntity);
49 } 50 }
@@ -199,7 +200,7 @@ class _HomePageView extends StatelessWidget { @@ -199,7 +200,7 @@ class _HomePageView extends StatelessWidget {
199 TextButton( 200 TextButton(
200 child: const Text('升级'), 201 child: const Text('升级'),
201 onPressed: () async { 202 onPressed: () async {
202 - if (defaultTargetPlatform == TargetPlatform.iOS) { 203 + if (AppConfigHelper.isIosPlatform()) {
203 _launchAppStore("6450870731"); 204 _launchAppStore("6450870731");
204 return; 205 return;
205 } 206 }