Commit 1d512b0b authored by Jim's avatar Jim Committed by GitHub

Merge pull request #596 from xujim/flutter_1.5_upgrade_opt

fix page become disabled when presented a view controller in the top …
parents 7173964f c5bde26c
...@@ -45,6 +45,8 @@ ...@@ -45,6 +45,8 @@
if(self = [super initWithEngine:FLUTTER_APP.flutterProvider.engine if(self = [super initWithEngine:FLUTTER_APP.flutterProvider.engine
nibName:nil nibName:nil
bundle:nil]){ bundle:nil]){
//NOTES:在present页面时,默认是全屏,如此可以触发底层VC的页面事件。否则不会触发而导致异常
self.modalPresentationStyle = UIModalPresentationFullScreen;
[self _setup]; [self _setup];
} }
return self; return self;
...@@ -196,6 +198,12 @@ static NSUInteger kInstanceCounter = 0; ...@@ -196,6 +198,12 @@ static NSUInteger kInstanceCounter = 0;
uniqueId:self.uniqueIDString]; uniqueId:self.uniqueIDString];
[[[UIApplication sharedApplication] keyWindow] endEditing:YES]; [[[UIApplication sharedApplication] keyWindow] endEditing:YES];
[super viewWillDisappear:animated]; [super viewWillDisappear:animated];
//NOTES:因为UIViewController在present view后dismiss其页面的view disappear会发生在下一个页面view appear之后,从而让当前engine持有的vc inactive,此处可驱使其重新resume
if (![self.uniqueIDString isEqualToString:[(FLB2FlutterViewContainer*)FLUTTER_VC uniqueIDString]])
{
[FLUTTER_APP resume];
}
} }
...@@ -207,6 +215,13 @@ static NSUInteger kInstanceCounter = 0; ...@@ -207,6 +215,13 @@ static NSUInteger kInstanceCounter = 0;
uniqueId:self.uniqueIDString]; uniqueId:self.uniqueIDString];
[super viewDidDisappear:animated]; [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:[(FLB2FlutterViewContainer*)FLUTTER_VC uniqueIDString]])
{
[FLUTTER_APP resume];
[(FLB2FlutterViewContainer*)FLUTTER_VC surfaceUpdated:YES];
}
} }
- (void)installSplashScreenViewIfNecessary { - (void)installSplashScreenViewIfNecessary {
......
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