Commit b4045960 authored by justin's avatar justin

Merge from v1.12.13-hotfixes

parent 64f35f92
## 1.12.13+2
Fixed bugs
## 1.12.13
Supported Flutter sdk 1.12.13
......
......@@ -27,6 +27,7 @@ You need to add Flutter to your project before moving on.The version of the flut
| --------------------- | --------------------------- | ------------------------------------------------------------ | ------------------ |
| 1.9.1+2 | 1.9.1-hotfixes | Rename the version number and start supporting androidx by default | Yes |
| 1.12.13+1 | 1.12.13-hotfixes | supporting androidx | Yes |
| 1.12.13+2 | 1.12.13-hotfixes | supporting androidx | Yes |
......@@ -36,6 +37,7 @@ You need to add Flutter to your project before moving on.The version of the flut
| --------------------- | --------------------------- | ------------------------------------------------------------ | ------------------ |
| v1.9.1-hotfixes | 1.9.1-hotfixes | for androidx | Yes |
| v1.12.13-hotfixes | 1.12.13-hotfixes | for androidx | Yes |
| v1.17.1-hotfixes | 1.17.1 | for androidx | Yes |
# Getting Started
......@@ -49,7 +51,7 @@ androidx branch
flutter_boost:
git:
url: 'https://github.com/alibaba/flutter_boost.git'
ref: '1.12.13+1'
ref: '1.12.13+2'
```
......
......@@ -26,6 +26,7 @@
| ----------------------- | ----------------------- | ------------------------------------------------------------ | ------------------- |
| 1.9.1+2 | 1.9.1-hotfixes | 版本号重新命名,开始默认支持androidx | Yes |
| 1.12.13+1 | 1.12.13 -hotfixes | 支持androidx | Yes |
| 1.12.13+2 | 1.17.1-hotfixes | 支持androidx | Yes |
......@@ -35,6 +36,7 @@
| --------------------- | --------------------------- | ------------------------------------------------------------ | ------------------ |
| v1.9.1-hotfixes | 1.9.1-hotfixes | for androidx | Yes |
| v1.12.13-hotfixes | 1.12.13-hotfixes | for androidx | Yes |
| v1.17.1-hotfixes | 1.17.1 | for androidx | Yes |
# 安装
......@@ -48,7 +50,7 @@ androidx branch
flutter_boost:
git:
url: 'https://github.com/alibaba/flutter_boost.git'
ref: '1.12.13+1'
ref: '1.12.13+2'
```
......
......@@ -30,7 +30,6 @@
@interface FLBFlutterEngine()
@property (nonatomic,strong) FlutterEngine *engine;
@property (nonatomic,strong) FLBFlutterViewContainer *dummy;
@end
@implementation FLBFlutterEngine
......@@ -53,10 +52,6 @@
}else{
[_engine runWithEntrypoint:nil];
}
// _dummy = [[FLBFlutterViewContainer alloc] initWithEngine:_engine
// nibName:nil
// bundle:nil];
// _dummy.name = kIgnoreMessageWithName;
}
return self;
......@@ -76,7 +71,9 @@
- (void)resume
{
[[_engine lifecycleChannel] sendMessage:@"AppLifecycleState.resumed"];
if([UIApplication sharedApplication].applicationState == UIApplicationStateActive){
[[_engine lifecycleChannel] sendMessage:@"AppLifecycleState.resumed"];
}
}
- (void)inactive
......@@ -108,9 +105,9 @@
- (void)detach
{
if(_engine.viewController != _dummy){
if(_engine.viewController != nil){
[(FLBFlutterViewContainer *)_engine.viewController surfaceUpdated:NO];
_engine.viewController = _dummy;
_engine.viewController = nil;
}
}
......
......@@ -38,6 +38,7 @@
- (void)flushOngoingTouches;
- (void)bridge_viewDidDisappear:(BOOL)animated;
- (void)bridge_viewWillAppear:(BOOL)animated;
- (void)surfaceUpdated:(BOOL)appeared;
@end
#pragma clang diagnostic push
......@@ -231,6 +232,12 @@ static NSUInteger kInstanceCounter = 0;
[FLUTTER_APP.flutterProvider detach];
}
- (void)surfaceUpdated:(BOOL)appeared {
if (self.engine && self.engine.viewController == self) {
[super surfaceUpdated:appeared];
}
}
#pragma mark - Life circle methods
- (void)viewDidLayoutSubviews
......@@ -272,8 +279,13 @@ static NSUInteger kInstanceCounter = 0;
pageName:_name
params:_params
uniqueId:self.uniqueIDString];
//NOTES:务必在show之后再update,否则有闪烁; 或导致侧滑返回时上一个页面会和top页面内容一样
[self surfaceUpdated:YES];
//根据淘宝特价版日志证明,即使在UIViewController的viewDidAppear下,application也可能在inactive模式,此时如果提交渲染会导致GPU后台渲染而crash
//参考:https://github.com/flutter/flutter/issues/57973
//https://github.com/flutter/engine/pull/18742
if([UIApplication sharedApplication].applicationState == UIApplicationStateActive){
//NOTES:务必在show之后再update,否则有闪烁; 或导致侧滑返回时上一个页面会和top页面内容一样
[self surfaceUpdated:YES];
}
[super viewDidAppear:animated];
}
......@@ -296,6 +308,10 @@ static NSUInteger kInstanceCounter = 0;
params:_params
uniqueId:self.uniqueIDString];
[super bridge_viewDidDisappear:animated];
if (self.engine.viewController == self) {
[self detatchFlutterEngine];
}
}
- (void)installSplashScreenViewIfNecessary {
......
......@@ -208,17 +208,15 @@ class ContainerCoordinator {
FlutterBoost.containerManager
?.showContainer(_createContainerSettings(name, params, pageId));
// Compatible to accessibility mode on Android.
if (Platform.isAndroid) {
try {
final SemanticsOwner owner =
WidgetsBinding.instance.pipelineOwner?.semanticsOwner;
final SemanticsNode root = owner?.rootSemanticsNode;
root?.detach();
root?.attach(owner);
} catch (e) {
assert(false, e.toString());
}
//对无障碍辅助模式的兼容
try {
final SemanticsOwner owner =
WidgetsBinding.instance.pipelineOwner?.semanticsOwner;
final SemanticsNode root = owner?.rootSemanticsNode;
root?.detach();
root?.attach(owner);
} catch (e) {
assert(false, e.toString());
}
performContainerLifeCycle(
......@@ -256,6 +254,12 @@ class ContainerCoordinator {
_createContainerSettings(name, params, pageId),
ContainerLifeCycle.Disappear,
);
Logger.log(
'native containner did disappear-$name,\n'
'manager dump:\n'
'${FlutterBoost.containerManager?.dump()}',
);
return true;
}
......@@ -268,6 +272,12 @@ class ContainerCoordinator {
_createContainerSettings(name, params, pageId),
ContainerLifeCycle.Init,
);
Logger.log(
'native containner did init-$name,\n'
'manager dump:\n'
'${FlutterBoost.containerManager?.dump()}',
);
return true;
}
......
......@@ -58,46 +58,38 @@ class FlutterBoost {
static FlutterBoost get singleton => _instance;
static ContainerManagerState get containerManager =>
_instance.containerManagerKey.currentState;
final GlobalKey<ContainerManagerState> containerManagerKey =
GlobalKey<ContainerManagerState>();
final ObserversHolder _observersHolder = ObserversHolder();
final BoostChannel _boostChannel = BoostChannel();
static ContainerManagerState get containerManager =>
_instance.containerManagerKey.currentState;
static void onPageStart() {
WidgetsBinding.instance.addPostFrameCallback((Duration _) {
singleton.channel
.invokeMethod<Map<dynamic, dynamic>>('pageOnStart')
.then((Map<dynamic, dynamic> _pageInfo) {
final Map<String, dynamic> pageInfo = _pageInfo?.cast<String, dynamic>();
if (pageInfo?.isEmpty ?? true) {
return;
}
if (pageInfo.containsKey('name') &&
pageInfo.containsKey('params') &&
pageInfo.containsKey('uniqueId')) {
WidgetsBinding.instance.addPostFrameCallback((_) {
singleton.channel.invokeMethod<Map>('pageOnStart').then((Map pageInfo) {
if (pageInfo == null || pageInfo.isEmpty) return;
if (pageInfo.containsKey("name") &&
pageInfo.containsKey("params") &&
pageInfo.containsKey("uniqueId")) {
ContainerCoordinator.singleton.nativeContainerDidShow(
pageInfo['name'] as String,
(pageInfo['params'] as Map<dynamic, dynamic>)
?.cast<String, dynamic>(),
pageInfo['uniqueId'] as String,
);
pageInfo["name"], pageInfo["params"], pageInfo["uniqueId"]);
}
});
});
}
static TransitionBuilder init({
TransitionBuilder builder,
PrePushRoute prePush,
PostPushRoute postPush,
}) {
static TransitionBuilder init(
{TransitionBuilder builder,
PrePushRoute prePush,
PostPushRoute postPush}) {
if (Platform.isAndroid) {
onPageStart();
} else if (Platform.isIOS) {
// TODO(AlexVincent525): 未解之谜
assert(() {
() async {
onPageStart();
......
name: flutter_boost
description: A next-generation Flutter-Native hybrid solution. FlutterBoost is a Flutter plugin which enables hybrid integration of Flutter for your existing native apps with minimum efforts.
version: 1.12.13+1
version: 1.12.13+2
author: Alibaba Xianyu
homepage: https://github.com/alibaba/flutter_boost
......
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