Commit b3edc0ecd4e11d9c6f39bb3bb677e210089f3181

Authored by wdn127929
1 parent bdb253e0

华为隐私审核修改---同小米

@@ -13,14 +13,14 @@ class App { @@ -13,14 +13,14 @@ class App {
13 static double screenHeight; 13 static double screenHeight;
14 static double statusBarHeight; 14 static double statusBarHeight;
15 static double bottomBarHeight; 15 static double bottomBarHeight;
16 - static GetIt getIt = GetIt.instance; 16 + // static GetIt getIt = GetIt.instance;
17 static bool isInstallWx = false; 17 static bool isInstallWx = false;
18 18
19 static initSp() async { 19 static initSp() async {
20 sp = await SharedPreferences.getInstance(); 20 sp = await SharedPreferences.getInstance();
21 } 21 }
22 22
23 - static setupLocator() {  
24 - getIt.registerSingleton(NavigateService());  
25 - } 23 + // static setupLocator() {
  24 + // getIt.registerSingleton(NavigateService());
  25 + // }
26 } 26 }
@@ -46,21 +46,21 @@ import 'package:flutter/material.dart'; @@ -46,21 +46,21 @@ import 'package:flutter/material.dart';
46 import 'package:flutter/services.dart'; 46 import 'package:flutter/services.dart';
47 import 'package:permission_handler/permission_handler.dart'; 47 import 'package:permission_handler/permission_handler.dart';
48 48
49 -Future<bool> _requestPermissions() async {  
50 - Map<Permission, PermissionStatus> permissions = await [  
51 - Permission.photos,  
52 - Permission.location,  
53 - Permission.camera,  
54 - Permission.contacts,  
55 - Permission.storage,  
56 - Permission.notification  
57 - ].request();  
58 -  
59 - List<bool> results = permissions.values.toList().map((status) {  
60 - return status == PermissionStatus.granted;  
61 - }).toList();  
62 - print(results.toString());  
63 -} 49 +// Future<bool> _requestPermissions() async {
  50 +// Map<Permission, PermissionStatus> permissions = await [
  51 +// Permission.photos,
  52 +// Permission.location,
  53 +// Permission.camera,
  54 +// Permission.contacts,
  55 +// Permission.storage,
  56 +// Permission.notification
  57 +// ].request();
  58 +
  59 +// List<bool> results = permissions.values.toList().map((status) {
  60 +// return status == PermissionStatus.granted;
  61 +// }).toList();
  62 +// print(results.toString());
  63 +// }
64 64
65 Future<void> main() async { 65 Future<void> main() async {
66 FlutterBugly.postCatchedException(() async { 66 FlutterBugly.postCatchedException(() async {
@@ -68,12 +68,12 @@ Future<void> main() async { @@ -68,12 +68,12 @@ Future<void> main() async {
68 FluroRouter router = FluroRouter(); 68 FluroRouter router = FluroRouter();
69 Routes.configureRoutes(router); 69 Routes.configureRoutes(router);
70 App.router = router; 70 App.router = router;
71 - App.setupLocator();  
72 - LogUtil.init(isDebug: true, tag: 'ONE_KEY');  
73 - Provider.debugCheckInvalidValueType = null;  
74 - await initializeDateFormatting();  
75 - // _requestPermissions();  
76 - Utils.changeStatusColor(); 71 + // App.setupLocator();
  72 + // LogUtil.init(isDebug: true, tag: 'ONE_KEY');
  73 + // Provider.debugCheckInvalidValueType = null;
  74 + // await initializeDateFormatting();
  75 + // // _requestPermissions();
  76 + // Utils.changeStatusColor();
77 77
78 await App.initSp(); 78 await App.initSp();
79 SystemChrome.setPreferredOrientations( 79 SystemChrome.setPreferredOrientations(
@@ -122,18 +122,18 @@ Future<void> main() async { @@ -122,18 +122,18 @@ Future<void> main() async {
122 )); 122 ));
123 }); 123 });
124 // await App.initSp(); 124 // await App.initSp();
125 - await AmapLocation.instance.updatePrivacyShow(true);  
126 - await AmapLocation.instance.updatePrivacyAgree(true);  
127 - await AmapService.instance.init(  
128 - iosKey: '24fe3a700e69114a4328d4e46823dcda',  
129 - androidKey: '13464ddadd6a5d825e79f90e10ba72d2'); 125 + // await AmapLocation.instance.updatePrivacyShow(true);
  126 + // await AmapLocation.instance.updatePrivacyAgree(true);
  127 + // await AmapService.instance.init(
  128 + // iosKey: '24fe3a700e69114a4328d4e46823dcda',
  129 + // androidKey: '13464ddadd6a5d825e79f90e10ba72d2');
130 130
131 - await AmapLocation.instance.init(  
132 - iosKey: '24fe3a700e69114a4328d4e46823dcda',  
133 - ); 131 + // await AmapLocation.instance.init(
  132 + // iosKey: '24fe3a700e69114a4328d4e46823dcda',
  133 + // );
134 134
135 /// 如果你觉得引擎的日志太多, 可以关闭Fluttify引擎的日志 135 /// 如果你觉得引擎的日志太多, 可以关闭Fluttify引擎的日志
136 - await enableFluttifyLog(false); // 关闭log 136 + // await enableFluttifyLog(false); // 关闭log
137 // FlutterBugly.init(androidAppId: "f71a313f42", iOSAppId: "3089e4587e"); 137 // FlutterBugly.init(androidAppId: "f71a313f42", iOSAppId: "3089e4587e");
138 }); 138 });
139 } 139 }
@@ -154,13 +154,13 @@ class MyAppState extends State<MyApp> { @@ -154,13 +154,13 @@ class MyAppState extends State<MyApp> {
154 void initState() { 154 void initState() {
155 // TODO: implement initState 155 // TODO: implement initState
156 super.initState(); 156 super.initState();
157 - initDio();  
158 - _initFluwx(); 157 + // initDio();
  158 + // _initFluwx();
159 _isFirst(); 159 _isFirst();
160 - Utils.changeStatusColor(); 160 + // Utils.changeStatusColor();
161 // 设置EasyRefresh的默认样式 161 // 设置EasyRefresh的默认样式
162 - EasyRefresh.defaultHeader = MaterialHeader();  
163 - EasyRefresh.defaultFooter = BallPulseFooter(); 162 + // EasyRefresh.defaultHeader = MaterialHeader();
  163 + // EasyRefresh.defaultFooter = BallPulseFooter();
164 } 164 }
165 165
166 //初始化微信SDK 166 //初始化微信SDK
@@ -179,7 +179,7 @@ class MyAppState extends State<MyApp> { @@ -179,7 +179,7 @@ class MyAppState extends State<MyApp> {
179 LogUtil.v("is installed $result"); 179 LogUtil.v("is installed $result");
180 } 180 }
181 181
182 -//初始化dio 182 + //初始化dio
183 initDio() { 183 initDio() {
184 DioUtil.openDebug(); 184 DioUtil.openDebug();
185 BaseOptions options = DioUtil.getDefOptions(); 185 BaseOptions options = DioUtil.getDefOptions();
@@ -187,18 +187,46 @@ class MyAppState extends State<MyApp> { @@ -187,18 +187,46 @@ class MyAppState extends State<MyApp> {
187 HttpConfig config = new HttpConfig( 187 HttpConfig config = new HttpConfig(
188 options: options, status: "ret", code: "ret", msg: "msg", data: "data"); 188 options: options, status: "ret", code: "ret", msg: "msg", data: "data");
189 DioUtil().setConfig(config); 189 DioUtil().setConfig(config);
  190 + _initAmap();
  191 + }
  192 +
  193 + _initAmap() async {
  194 + await AmapLocation.instance.updatePrivacyShow(true);
  195 + await AmapLocation.instance.updatePrivacyAgree(true);
  196 + await AmapService.instance.init(
  197 + iosKey: '24fe3a700e69114a4328d4e46823dcda',
  198 + androidKey: '13464ddadd6a5d825e79f90e10ba72d2');
  199 +
  200 + await AmapLocation.instance.init(
  201 + iosKey: '24fe3a700e69114a4328d4e46823dcda',
  202 + );
190 } 203 }
191 204
192 //第一次打开应用 205 //第一次打开应用
193 - bool _isFirst() { 206 + _isFirst() async {
194 isFirst = App.sp.getBool("isFirst") ?? true; 207 isFirst = App.sp.getBool("isFirst") ?? true;
  208 +
195 if (!isFirst) { 209 if (!isFirst) {
196 - _isLogin(); 210 + await _ontherInit();
197 } 211 }
198 } 212 }
199 213
  214 + _ontherInit() async {
  215 + initDio();
  216 + await _initFluwx();
  217 + LogUtil.init(isDebug: true, tag: 'ONE_KEY');
  218 + Provider.debugCheckInvalidValueType = null;
  219 + await initializeDateFormatting();
  220 +
  221 + // 设置EasyRefresh的默认样式
  222 + EasyRefresh.defaultHeader = MaterialHeader();
  223 + EasyRefresh.defaultFooter = BallPulseFooter();
  224 + _isLogin();
  225 + // FlutterBugly.init(androidAppId: "f71a313f42", iOSAppId: "3089e4587e");
  226 + }
  227 +
200 //判断是否登录 228 //判断是否登录
201 - bool _isLogin() { 229 + _isLogin() {
202 UserModel userModel = Provider.of<UserModel>(context, listen: false); 230 UserModel userModel = Provider.of<UserModel>(context, listen: false);
203 userModel.initUser(); 231 userModel.initUser();
204 isLogin = App.sp.getBool("isLogin") ?? false; 232 isLogin = App.sp.getBool("isLogin") ?? false;
@@ -215,7 +243,7 @@ class MyAppState extends State<MyApp> { @@ -215,7 +243,7 @@ class MyAppState extends State<MyApp> {
215 return MaterialApp( 243 return MaterialApp(
216 debugShowCheckedModeBanner: false, 244 debugShowCheckedModeBanner: false,
217 title: '一键订', 245 title: '一键订',
218 - navigatorKey: App.getIt<NavigateService>().key, 246 + // navigatorKey: App.getIt<NavigateService>().key,
219 theme: ThemeData( 247 theme: ThemeData(
220 brightness: Brightness.light, 248 brightness: Brightness.light,
221 primaryColor: Colors.white, 249 primaryColor: Colors.white,
1 import 'dart:io'; 1 import 'dart:io';
2 2
  3 +import 'package:amap_map_fluttify/amap_map_fluttify.dart';
  4 +import 'package:common_utils/common_utils.dart';
  5 +import 'package:dio/dio.dart';
3 import 'package:flutter/material.dart'; 6 import 'package:flutter/material.dart';
  7 +import 'package:flutter_bugly/flutter_bugly.dart';
  8 +import 'package:flutter_easyrefresh/ball_pulse_footer.dart';
  9 +import 'package:flutter_easyrefresh/easy_refresh.dart';
  10 +import 'package:flutter_easyrefresh/material_header.dart';
4 import 'package:flutter_screenutil/flutter_screenutil.dart'; 11 import 'package:flutter_screenutil/flutter_screenutil.dart';
  12 +import 'package:fluwx/fluwx.dart';
5 import 'package:one_key/app.dart'; 13 import 'package:one_key/app.dart';
6 import 'package:one_key/res/colors.dart'; 14 import 'package:one_key/res/colors.dart';
7 import 'package:one_key/route/navigator_util.dart'; 15 import 'package:one_key/route/navigator_util.dart';
@@ -10,6 +18,11 @@ import 'package:one_key/utils/utils.dart'; @@ -10,6 +18,11 @@ import 'package:one_key/utils/utils.dart';
10 import 'package:one_key/widgets/MyDivider.dart'; 18 import 'package:one_key/widgets/MyDivider.dart';
11 import 'package:one_key/widgets/round_button.dart'; 19 import 'package:one_key/widgets/round_button.dart';
12 import 'package:one_key/widgets/v_empty_view.dart'; 20 import 'package:one_key/widgets/v_empty_view.dart';
  21 +import 'package:provider/provider.dart';
  22 +import 'package:intl/date_symbol_data_local.dart';
  23 +
  24 +import '../../net/dio_util.dart';
  25 +import '../../net/http_url.dart';
13 26
14 class FirstPage extends StatefulWidget { 27 class FirstPage extends StatefulWidget {
15 FirstPage({Key key}) : super(key: key); 28 FirstPage({Key key}) : super(key: key);
@@ -23,7 +36,62 @@ class _FirstPageState extends State<FirstPage> { @@ -23,7 +36,62 @@ class _FirstPageState extends State<FirstPage> {
23 void initState() { 36 void initState() {
24 // TODO: implement initState 37 // TODO: implement initState
25 super.initState(); 38 super.initState();
26 - Utils.changeStatusColor(color: MyColours.color_199095); 39 + // Utils.changeStatusColor(color: MyColours.color_199095);
  40 + }
  41 +
  42 + _ontherInit() async {
  43 + initDio();
  44 + await _initFluwx();
  45 + LogUtil.init(isDebug: true, tag: 'ONE_KEY');
  46 + Provider.debugCheckInvalidValueType = null;
  47 + await initializeDateFormatting();
  48 +
  49 + // 设置EasyRefresh的默认样式
  50 + EasyRefresh.defaultHeader = MaterialHeader();
  51 + EasyRefresh.defaultFooter = BallPulseFooter();
  52 + App.sp.setBool("isFirst", false);
  53 + //进入应用
  54 + NavigatorUtil.goLoginPage(context);
  55 + FlutterBugly.init(androidAppId: "f71a313f42", iOSAppId: "3089e4587e");
  56 + }
  57 +
  58 + //初始化微信SDK
  59 + _initFluwx() async {
  60 + await registerWxApi(
  61 + appId: "wx85aa3cdd0f791e65",
  62 + doOnAndroid: true,
  63 + doOnIOS: true,
  64 + universalLink: "https://xt04.colorcun.com/link/OneKey/");
  65 + var result = await isWeChatInstalled;
  66 + if (result != null && result) {
  67 + App.isInstallWx = true;
  68 + } else {
  69 + App.isInstallWx = false;
  70 + }
  71 + LogUtil.v("is installed $result");
  72 + }
  73 +
  74 +//初始化dio
  75 + initDio() {
  76 + DioUtil.openDebug();
  77 + BaseOptions options = DioUtil.getDefOptions();
  78 + options.baseUrl = HttpUrl.server_address;
  79 + HttpConfig config = new HttpConfig(
  80 + options: options, status: "ret", code: "ret", msg: "msg", data: "data");
  81 + DioUtil().setConfig(config);
  82 + _initAmap();
  83 + }
  84 +
  85 + _initAmap() async {
  86 + await AmapLocation.instance.updatePrivacyShow(true);
  87 + await AmapLocation.instance.updatePrivacyAgree(true);
  88 + await AmapService.instance.init(
  89 + iosKey: '24fe3a700e69114a4328d4e46823dcda',
  90 + androidKey: '13464ddadd6a5d825e79f90e10ba72d2');
  91 +
  92 + await AmapLocation.instance.init(
  93 + iosKey: '24fe3a700e69114a4328d4e46823dcda',
  94 + );
27 } 95 }
28 96
29 @override 97 @override
@@ -207,9 +275,10 @@ class _FirstPageState extends State<FirstPage> { @@ -207,9 +275,10 @@ class _FirstPageState extends State<FirstPage> {
207 gradientStart: MyColours.color_199095, 275 gradientStart: MyColours.color_199095,
208 gradientEnd: MyColours.color_199095, 276 gradientEnd: MyColours.color_199095,
209 onPressed: () { 277 onPressed: () {
210 - App.sp.setBool("isFirst", false);  
211 - //进入应用  
212 - NavigatorUtil.goLoginPage(context); 278 + _ontherInit();
  279 + // App.sp.setBool("isFirst", false);
  280 + // //进入应用
  281 + // NavigatorUtil.goLoginPage(context);
213 }), 282 }),
214 ], 283 ],
215 ), 284 ),
@@ -63,7 +63,7 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver { @@ -63,7 +63,7 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver {
63 super.initState(); 63 super.initState();
64 //第一次打开应用 64 //第一次打开应用
65 65
66 - _checkWechat(); 66 + // _checkWechat();
67 isLogin(); 67 isLogin();
68 WidgetsBinding.instance.addObserver(this); 68 WidgetsBinding.instance.addObserver(this);
69 WidgetsBinding.instance.addPostFrameCallback((_) { 69 WidgetsBinding.instance.addPostFrameCallback((_) {
@@ -134,9 +134,8 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver { @@ -134,9 +134,8 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver {
134 } 134 }
135 } 135 }
136 136
137 - //判断是否登录 137 + //判断是否登录
138 void isLogin() async { 138 void isLogin() async {
139 - await App.initSp();  
140 UserModel userModel = Provider.of<UserModel>(context, listen: false); 139 UserModel userModel = Provider.of<UserModel>(context, listen: false);
141 userModel.initUser(); 140 userModel.initUser();
142 if (App.sp.getBool("isLogin") ?? false) { 141 if (App.sp.getBool("isLogin") ?? false) {
@@ -144,6 +143,7 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver { @@ -144,6 +143,7 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver {
144 NavigatorUtil.goHomePage(context); 143 NavigatorUtil.goHomePage(context);
145 }); 144 });
146 } else { 145 } else {
  146 + _checkWechat();
147 _getWxCode(); 147 _getWxCode();
148 } 148 }
149 } 149 }
@@ -836,7 +836,10 @@ class Utils { @@ -836,7 +836,10 @@ class Utils {
836 } 836 }
837 837
838 static String showEndPhone(String phone) { 838 static String showEndPhone(String phone) {
839 - return '*' + phone.substring(phone.length - 4); 839 + if (phone.length > 4) {
  840 + return '*' + phone.substring(phone.length - 4);
  841 + }
  842 + return phone;
840 } 843 }
841 844
842 static List<String> stringToList(String str) { 845 static List<String> stringToList(String str) {