Commit 1e98c3aa authored by yangwu.jia's avatar yangwu.jia

Merge branch 'task/task_v1.9.1_support_hotfixes' into task/task_v1.12.13_support_hotfixes

parents f008fd22 328160d1
......@@ -20,24 +20,23 @@ You need to add Flutter to your project before moving on.The version of the flut
# boost version description
1. 0.1.50 is based on the flutter v1.5.4-hotfixes branch, android if other flutter versions or branches will compile incorrectly
| Flutter Boost Version | Support Flutter SDK Version | Description | Support AndroidX? |
| --------------------- | --------------------------- | ------------------------------------------------------------ | ------------------ |
| 0.1.50 | 1.5.4-hotfixes | android if other flutter versions or branches will compile incorrectly. | No |
| 0.1.51-0.1.59 | 1.5.4-hotfixes | bugfix for 0.1.50. | No |
| 0.1.60 | 1.9.1-hotfixes | Android does not support andriodx if other flutter branches will compile incorrectly. | No |
| 0.1.61-0.1.69 | 1.9.1-hotfixes | bugfix for 0.1.60. | No |
| 0.1.63 | 1.9.1-hotfixes | If other branches will compile incorrectly. Synchronize with the 0.1.60 code, and bugfix also merge to this branch. | No |
| 1.9.1+1 | 1.9.1-hotfixes | Rename the version number and start supporting androidx by default | Yes |
2. 0.1.51--0.1.59 is a bugfix for 0.1.50
3. 0.1.60 is based on the flutter v1.9.1-hotfixes branch. Android does not support andriodx if other flutter branches will compile incorrectly
4. 0.1.61--0.1.69 is a bugfix for 0.1.60
5. Statement of support for androidx
Current androidx branch is v0.1.61-androidx-hotfixes
Is based on flutter v1.9.1-hotfixes branch, if other branches will compile incorrectly
Synchronize with the 0.1.63 code, and bugfix also merge to this branch.
| Flutter Boost branch | Support Flutter SDK Version | Description | Support AndroidX? |
| --------------------- | --------------------------- | ------------------------------------------------------------ | ------------------ |
| v1.9.1-hotfixes | 1.9.1-hotfixes | for androidx | Yes |
| task/task_v1.9.1_support_hotfixes| 1.9.1-hotfixes | for support | NO |
| v1.12.13-hotfixes | 1.12.13-hotfixes | for androidx | Yes |
| task/task_v1.12.13_support_hotfixes| 1.12.13-hotfixes | for support | NO |
# Getting Started
......@@ -47,19 +46,19 @@ You need to add Flutter to your project before moving on.The version of the flut
Open you pubspec.yaml and add the following line to dependencies:
support branch
androidx branch
```json
flutter_boost:
git:
url: 'https://github.com/alibaba/flutter_boost.git'
ref: '0.1.64'
ref: ' 1.9.1+1'
```
androidx branch
support branch
```json
flutter_boost:
git:
url: 'https://github.com/alibaba/flutter_boost.git'
ref: 'v0.1.61-androidx-hotfixes'
ref: 'task/task_v1.9.1_support_hotfixes'
```
......
......@@ -20,29 +20,27 @@
请阅读这篇文章:
<a href="Frequently Asked Question.md">FAQ</a>
# boost 版本说明
1. 0.1.50 是基于flutter v1.5.4-hotfixes 分支,android 如果其他flutter版本或者分支 会编译错误
2. 0.1.51--0.1.54 是对0.1.50的bugfix
3. 0.1.60 是基于flutter v1.9.1-hotfixes 分支,android如果其他flutter分支会编译错误,该版本不支持andriodx
4. 0.1.61-- 0.1.64 是对0.1.60 的bugfix
| Flutter Boost 版本 | 支持的 Flutter SDK 版本 | Description | 是否支持 AndroidX? |
| ----------------------- | ----------------------- | ------------------------------------------------------------ | ------------------- |
| 0.1.50 | 1.5.4-hotfixes | android 如果其他 flutter 版本或者分支会编译错误。 | No |
| 0.1.51-0.1.59 | 1.5.4-hotfixes | 0.1.50 的 bugfix。 | No |
| 0.1.60 | 1.9.1-hotfixes | android 如果其他 flutter 分支会编译错误。 | No |
| 0.1.63 | 1.9.1-hotfixes | 和 0.1.60 代码同步, bugfix 也会合入该分支,如果其他分支会编译错误。 | No |
| 0.1.61-0.1.69 | 1.9.1-hotfixes | 0.1.60 的 bugfix。 | No |
| 1.9.1+1 | 1.9.1-hotfixes | 版本号重新命名,开始默认支持androidx | Yes |
5. 关于androidx 的支持声明
目前androidx 分支为 v0.1.61-androidx-hotfixes
是基于flutter v1.9.1-hotfixes 分支,如果其他分支会编译错误
和0.1.60代码同步, bugfix 也会合入该分支。
| Flutter Boost 分支 | 支持的 Flutter SDK 版本 | Description | 是否支持 AndroidX? |
| v1.9.1-hotfixes | 1.9.1-hotfixes | 支持androidx,修复bug后会定期发布新版本 | Yes |
| task/task_v1.9.1_support_hotfixes| 1.9.1-hotfixes | 支持support包,不支持androidx | NO |
| v1.12.13-hotfixes | 1.12.13-hotfixes | 支持androidx,目前还没发布的版本,用分支形式引入 | Yes |
| task/task_v1.12.13_support_hotfixes| 1.12.13-hotfixes | 支持support包,不支持androidx | NO |
.
# 安装
......@@ -50,22 +48,19 @@
打开pubspec.yaml并将以下行添加到依赖项:
support分支
androidx branch
```json
flutter_boost:
git:
url: 'https://github.com/alibaba/flutter_boost.git'
ref: '0.1.64'
ref: ' 1.9.1+1'
```
androidx分支
support branch
```json
flutter_boost:
git:
url: 'https://github.com/alibaba/flutter_boost.git'
ref: 'v0.1.61-androidx-hotfixes'
ref: 'task/task_v1.9.1_support_hotfixes'
```
......
......@@ -26,6 +26,7 @@ public class FlutterBoost {
private FlutterEngine mEngine;
private Activity mCurrentActiveActivity;
private PluginRegistry mRegistry;
private boolean mEnterActivityCreate =false;
static FlutterBoost sInstance = null;
private long FlutterPostFrameCallTime = 0;
......@@ -56,6 +57,10 @@ public class FlutterBoost {
@Override
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
//fix crash:'FlutterBoostPlugin not register yet'
//case: initFlutter after Activity.OnCreate method,and then called start/stop crash
// In SplashActivity ,showDialog(in OnCreate method) to check permission, if authorized, then init sdk and jump homePage)
mEnterActivityCreate = true;
mCurrentActiveActivity = activity;
if (mPlatform.whenEngineStart() == ConfigBuilder.ANY_ACTIVITY_CREATED) {
doInitialFlutter();
......@@ -70,6 +75,9 @@ public class FlutterBoost {
@Override
public void onActivityStarted(Activity activity) {
if (!mEnterActivityCreate){
return;
}
if (mCurrentActiveActivity == null) {
Debuger.log("Application entry foreground");
......@@ -84,16 +92,24 @@ public class FlutterBoost {
@Override
public void onActivityResumed(Activity activity) {
if (!mEnterActivityCreate){
return;
}
mCurrentActiveActivity = activity;
}
@Override
public void onActivityPaused(Activity activity) {
if (!mEnterActivityCreate){
return;
}
}
@Override
public void onActivityStopped(Activity activity) {
if (!mEnterActivityCreate){
return;
}
if (mCurrentActiveActivity == activity) {
Debuger.log("Application entry background");
......@@ -108,11 +124,16 @@ public class FlutterBoost {
@Override
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
if (!mEnterActivityCreate){
return;
}
}
@Override
public void onActivityDestroyed(Activity activity) {
if (!mEnterActivityCreate){
return;
}
if (mCurrentActiveActivity == activity) {
Debuger.log("Application entry background");
......@@ -141,6 +162,9 @@ public class FlutterBoost {
if (mEngine != null) return;
if (mPlatform.lifecycleListener != null) {
mPlatform.lifecycleListener.beforeCreateEngine();
}
FlutterEngine flutterEngine = createEngine();
if (mPlatform.lifecycleListener != null) {
mPlatform.lifecycleListener.onEngineCreated();
......@@ -337,6 +361,9 @@ public class FlutterBoost {
public interface BoostLifecycleListener {
void beforeCreateEngine();
void onEngineCreated();
void onPluginsRegistered();
......
......@@ -11,7 +11,12 @@ class FirstRouteWidget extends StatelessWidget {
title: Text('First Route'),
),
body: Center(
child: RaisedButton(
child:
Column(
mainAxisAlignment: MainAxisAlignment.center,
children:
<Widget>[
RaisedButton(
child: Text('Open second route'),
onPressed: () {
print("open second page!");
......@@ -21,6 +26,19 @@ class FirstRouteWidget extends StatelessWidget {
});
},
),
RaisedButton(
child: Text('Present second route'),
onPressed: () {
print("Present second page!");
FlutterBoost.singleton.open("second",urlParams:{"present":true}).then((Map value) {
print(
"call me when page is finished. did recieve second route result $value");
});
},
),
],
),
),
);
}
......
......@@ -53,10 +53,10 @@
}else{
[_engine runWithEntrypoint:nil];
}
_dummy = [[FLBFlutterViewContainer alloc] initWithEngine:_engine
nibName:nil
bundle:nil];
_dummy.name = kIgnoreMessageWithName;
// _dummy = [[FLBFlutterViewContainer alloc] initWithEngine:_engine
// nibName:nil
// bundle:nil];
// _dummy.name = kIgnoreMessageWithName;
}
return self;
......@@ -100,7 +100,7 @@
- (void)atacheToViewController:(FlutterViewController *)vc
{
if(_engine.viewController != vc){
[(FLBFlutterViewContainer *)_engine.viewController surfaceUpdated:NO];
// [(FLBFlutterViewContainer *)_engine.viewController surfaceUpdated:NO];
_engine.viewController = vc;
}
}
......@@ -114,8 +114,8 @@
- (void)prepareEngineIfNeeded
{
[(FLBFlutterViewContainer *)_engine.viewController surfaceUpdated:NO];
NSLog(@"[XDEBUG]---surface changed--reset-");
// [(FLBFlutterViewContainer *)_engine.viewController surfaceUpdated:NO];
// NSLog(@"[XDEBUG]---surface changed--reset-");
// [self detach];
}
......
......@@ -51,6 +51,9 @@
if(self = [super initWithEngine:FLUTTER_APP.flutterProvider.engine
nibName:_flbNibName
bundle:_flbNibBundle]){
//NOTES:在present页面时,默认是全屏,如此可以触发底层VC的页面事件。否则不会触发而导致异常
self.modalPresentationStyle = UIModalPresentationFullScreen;
[self _setup];
}
return self;
......@@ -219,6 +222,13 @@ static NSUInteger kInstanceCounter = 0;
uniqueId:self.uniqueIDString];
[[[UIApplication sharedApplication] keyWindow] endEditing:YES];
[super viewWillDisappear:animated];
//NOTES:因为UIViewController在present view后dismiss其页面的view disappear会发生在下一个页面view appear之后,从而让当前engine持有的vc inactive,此处可驱使其重新resume
if (![self.uniqueIDString isEqualToString:[(FLBFlutterViewContainer*)FLUTTER_VC uniqueIDString]])
{
[FLUTTER_APP resume];
}
}
......@@ -229,6 +239,14 @@ static NSUInteger kInstanceCounter = 0;
params:_params
uniqueId:self.uniqueIDString];
[super viewDidDisappear:animated];
//NOTES:因为UIViewController在present view后dismiss其页面的view disappear会发生在下一个页面view appear之后,导致当前engine持有的VC被surfaceUpdate(NO),从而销毁底层的raster。此处是考虑到这种情形,重建surface
if (FLUTTER_VC.beingPresented || self.beingDismissed || ![self.uniqueIDString isEqualToString:[(FLBFlutterViewContainer*)FLUTTER_VC uniqueIDString]])
{
[FLUTTER_APP resume];
[(FLBFlutterViewContainer*)FLUTTER_VC surfaceUpdated:YES];
}
// instead of calling [super viewDidDisappear:animated];, call super's super
// struct objc_super target = {
// .super_class = class_getSuperclass([FlutterViewController class]),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment