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