Skip to content

Commit

Permalink
修改release包报Attempt to execute code removed by Dart AOT compiler (TFA)问题
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzo committed Apr 27, 2020
1 parent 216bb46 commit c006420
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/connectivity-0.4.8+2/","dependencies":[]},{"name":"fluttertoast","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/fluttertoast-3.1.3/","dependencies":[]},{"name":"install_apk_plugin","path":"/Users/yuzo/yuzo/flutter/workspace/OpenGit_Flutter/flutter_common_lib/install_apk_plugin/","dependencies":[]},{"name":"package_info","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/package_info-0.4.0+17/","dependencies":[]},{"name":"path_provider","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/path_provider-1.6.7/","dependencies":[]},{"name":"permission_handler","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/permission_handler-3.3.0/","dependencies":[]},{"name":"share","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/share-0.6.4/","dependencies":[]},{"name":"shared_preferences","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences-0.5.7/","dependencies":[]},{"name":"sqflite","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/sqflite-1.3.0/","dependencies":[]},{"name":"url_launcher","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher-5.4.5/","dependencies":[]},{"name":"webview_flutter","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter-0.3.20+2/","dependencies":[]}],"android":[{"name":"connectivity","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/connectivity-0.4.8+2/","dependencies":[]},{"name":"fluttertoast","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/fluttertoast-3.1.3/","dependencies":[]},{"name":"install_apk_plugin","path":"/Users/yuzo/yuzo/flutter/workspace/OpenGit_Flutter/flutter_common_lib/install_apk_plugin/","dependencies":[]},{"name":"package_info","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/package_info-0.4.0+17/","dependencies":[]},{"name":"path_provider","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/path_provider-1.6.7/","dependencies":[]},{"name":"permission_handler","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/permission_handler-3.3.0/","dependencies":[]},{"name":"share","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/share-0.6.4/","dependencies":[]},{"name":"shared_preferences","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences-0.5.7/","dependencies":[]},{"name":"sqflite","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/sqflite-1.3.0/","dependencies":[]},{"name":"url_launcher","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher-5.4.5/","dependencies":[]},{"name":"webview_flutter","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter-0.3.20+2/","dependencies":[]}],"macos":[{"name":"connectivity_macos","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/connectivity_macos-0.1.0+2/","dependencies":[]},{"name":"path_provider_macos","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/path_provider_macos-0.0.4+1/","dependencies":[]},{"name":"shared_preferences_macos","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences_macos-0.0.1+7/","dependencies":[]},{"name":"sqflite","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/sqflite-1.3.0/","dependencies":[]},{"name":"url_launcher_macos","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher_macos-0.0.1+5/","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"shared_preferences_web","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences_web-0.1.2+4/","dependencies":[]},{"name":"url_launcher_web","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher_web-0.1.1+2/","dependencies":[]}]},"dependencyGraph":[{"name":"connectivity","dependencies":["connectivity_macos"]},{"name":"connectivity_macos","dependencies":[]},{"name":"fluttertoast","dependencies":[]},{"name":"install_apk_plugin","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"permission_handler","dependencies":[]},{"name":"share","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"sqflite","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_macos"]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"webview_flutter","dependencies":[]}],"date_created":"2020-04-26 16:07:03.251656","version":"1.15.21-pre.11"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/connectivity-0.4.8+2/","dependencies":[]},{"name":"fluttertoast","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/fluttertoast-3.1.3/","dependencies":[]},{"name":"install_apk_plugin","path":"/Users/yuzo/yuzo/flutter/workspace/OpenGit_Flutter/flutter_common_lib/install_apk_plugin/","dependencies":[]},{"name":"package_info","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/package_info-0.4.0+17/","dependencies":[]},{"name":"path_provider","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/path_provider-1.6.7/","dependencies":[]},{"name":"permission_handler","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/permission_handler-3.3.0/","dependencies":[]},{"name":"share","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/share-0.6.4/","dependencies":[]},{"name":"shared_preferences","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences-0.5.7/","dependencies":[]},{"name":"sqflite","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/sqflite-1.3.0/","dependencies":[]},{"name":"url_launcher","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher-5.4.5/","dependencies":[]},{"name":"webview_flutter","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter-0.3.20+2/","dependencies":[]}],"android":[{"name":"connectivity","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/connectivity-0.4.8+2/","dependencies":[]},{"name":"fluttertoast","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/fluttertoast-3.1.3/","dependencies":[]},{"name":"install_apk_plugin","path":"/Users/yuzo/yuzo/flutter/workspace/OpenGit_Flutter/flutter_common_lib/install_apk_plugin/","dependencies":[]},{"name":"package_info","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/package_info-0.4.0+17/","dependencies":[]},{"name":"path_provider","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/path_provider-1.6.7/","dependencies":[]},{"name":"permission_handler","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/permission_handler-3.3.0/","dependencies":[]},{"name":"share","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/share-0.6.4/","dependencies":[]},{"name":"shared_preferences","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences-0.5.7/","dependencies":[]},{"name":"sqflite","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/sqflite-1.3.0/","dependencies":[]},{"name":"url_launcher","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher-5.4.5/","dependencies":[]},{"name":"webview_flutter","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter-0.3.20+2/","dependencies":[]}],"macos":[{"name":"connectivity_macos","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/connectivity_macos-0.1.0+2/","dependencies":[]},{"name":"path_provider_macos","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/path_provider_macos-0.0.4+1/","dependencies":[]},{"name":"shared_preferences_macos","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences_macos-0.0.1+7/","dependencies":[]},{"name":"sqflite","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/sqflite-1.3.0/","dependencies":[]},{"name":"url_launcher_macos","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher_macos-0.0.1+5/","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"shared_preferences_web","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences_web-0.1.2+4/","dependencies":[]},{"name":"url_launcher_web","path":"/Users/yuzo/yuzo/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher_web-0.1.1+2/","dependencies":[]}]},"dependencyGraph":[{"name":"connectivity","dependencies":["connectivity_macos"]},{"name":"connectivity_macos","dependencies":[]},{"name":"fluttertoast","dependencies":[]},{"name":"install_apk_plugin","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"permission_handler","dependencies":[]},{"name":"share","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"sqflite","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_macos"]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"webview_flutter","dependencies":[]}],"date_created":"2020-04-27 10:57:54.421491","version":"1.15.21-pre.11"}
16 changes: 3 additions & 13 deletions lib/redux/login/login_middleware.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import 'package:flutter/widgets.dart';
import 'package:flutter_common_util/flutter_common_util.dart';
import 'package:open_git/bean/login_bean.dart';
import 'package:open_git/bean/user_bean.dart';
import 'package:open_git/manager/login_manager.dart';
import 'package:open_git/redux/app_state.dart';
import 'package:open_git/redux/common_actions.dart';
import 'package:open_git/redux/login/login_action.dart';
import 'package:open_git/route/navigator_util.dart';
import 'package:open_git/redux/user/user_action.dart';
import 'package:redux/redux.dart';

class LoginMiddleware extends MiddlewareClass<AppState> {
Expand All @@ -29,16 +27,8 @@ class LoginMiddleware extends MiddlewareClass<AppState> {
await LoginManager.instance.login(userName, password);
if (loginBean != null) {
String token = loginBean.token;
LoginManager.instance.setToken(loginBean.token, true);
UserBean userBean = await LoginManager.instance.getMyUserInfo();
if (userBean != null) {
next(InitCompleteAction(token, userBean, false));
next(ReceivedLoginAction(token, userBean));
NavigatorUtil.goMain(context);
} else {
ToastUtil.showMessgae('登录失败请重新登录');
LoginManager.instance.setToken(null, true);
}
LoginManager.instance.setToken(token, true);
next(FetchUserAction(context, token));
} else {
ToastUtil.showMessgae('登录失败请重新登录');
next(ErrorLoadingLoginAction());
Expand Down
7 changes: 7 additions & 0 deletions lib/redux/user/user_action.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,10 @@ class CountdownAction {

CountdownAction(this.countdown);
}

class FetchUserAction {
final String token;
final BuildContext context;

FetchUserAction(this.context, this.token);
}
26 changes: 20 additions & 6 deletions lib/redux/user/user_middleware.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:open_git/manager/login_manager.dart';
import 'package:open_git/manager/repos_manager.dart';
import 'package:open_git/redux/app_state.dart';
import 'package:open_git/redux/common_actions.dart';
import 'package:open_git/redux/login/login_action.dart';
import 'package:open_git/redux/user/user_action.dart';
import 'package:open_git/route/navigator_util.dart';
import 'package:open_git/status/status.dart';
Expand All @@ -18,16 +19,17 @@ import 'package:open_git/util/theme_util.dart';
import 'package:redux/redux.dart';

class UserMiddleware extends MiddlewareClass<AppState> {
static final String TAG = "UserMiddleware";

@override
void call(Store<AppState> store, action, NextDispatcher next) async {
if (action is InitAction) {
_init(store, next);
} else if (action is StartCountdownAction) {
startCountdown(store, next, action.context);
_startCountdown(store, next, action.context);
} else if (action is StopCountdownAction) {
TimerUtil.cancelCountdown();
} else if (action is FetchUserAction) {
_fetchUser(store, next, action.context, action.token);
} else {
next(action);
}
Expand All @@ -53,23 +55,22 @@ class UserMiddleware extends MiddlewareClass<AppState> {
}
//用户信息
String token = SpUtil.instance.getString(SP_KEY_TOKEN);
UserBean userBean = null;
UserBean userBean;
var user = SpUtil.instance.getObject(SP_KEY_USER_INFO);
if (user != null) {
LoginManager.instance.setUserBean(user, false);
userBean = UserBean.fromJson(user);
}
LoginManager.instance.setToken(token, false);
//引导页
String version =
SpUtil.instance.getString(SP_KEY_SHOW_GUIDE_VERSION);
String version = SpUtil.instance.getString(SP_KEY_SHOW_GUIDE_VERSION);
String currentVersion = Config.SHOW_GUIDE_VERSION;
next(InitCompleteAction(token, userBean, currentVersion != version));
//初始化本地数据
ReposManager.instance.initLanguageColors();
}

void startCountdown(
void _startCountdown(
Store<AppState> store, NextDispatcher next, BuildContext context) {
TimerUtil.startCountdown(5, (int count) {
next(CountdownAction(count));
Expand All @@ -90,4 +91,17 @@ class UserMiddleware extends MiddlewareClass<AppState> {
NavigatorUtil.goLogin(context);
}
}

Future<Null> _fetchUser(Store<AppState> store, NextDispatcher next, BuildContext context, String token) async {
UserBean userBean = await LoginManager.instance.getMyUserInfo();
if (userBean != null) {
next(InitCompleteAction(token, userBean, false));
next(ReceivedLoginAction(token, userBean));
NavigatorUtil.goMain(context);
} else {
ToastUtil.showMessgae('登录失败请重新登录');
LoginManager.instance.setToken(null, true);
next(ErrorLoadingLoginAction());
}
}
}
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ packages:
name: flutter_redux
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.5.4"
version: "0.6.0"
flutter_spinkit:
dependency: transitive
description:
Expand Down Expand Up @@ -587,7 +587,7 @@ packages:
name: redux
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.0"
version: "4.0.0"
rxdart:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dependencies:
#markdown
flutter_markdown: ^0.2.0
#redux
flutter_redux: ^0.5.3
flutter_redux: ^0.6.0
#router
fluro: ^1.5.1
#app package info
Expand Down

0 comments on commit c006420

Please sign in to comment.