Commit aef7e019 authored by 余玠's avatar 余玠

尝试支持present非fUIModalPresentationFullScreen样式的VC,但会闪烁

parent ac1f354d
......@@ -52,6 +52,7 @@
// [self.flutterContainer.view layoutIfNeeded];
}
//NOTES: embed情景下必须实现!!!
- (void)didMoveToParentViewController:(UIViewController *)parent {
[self.flutterContainer didMoveToParentViewController:parent];
[super didMoveToParentViewController:parent];
......
......@@ -66,6 +66,7 @@ NS_ASSUME_NONNULL_BEGIN
onPageFinished:(void (^)(NSDictionary *))resultCallback
completion:(void (^)(BOOL))completion;
- (void)attachToPreviousContainer;
- (void)didInitPageContainer:(NSString *)url
params:(NSDictionary *)urlParams
......
......@@ -31,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN
@protocol FLBFlutterProvider <NSObject>
@required
- (FlutterEngine *)engine;
- (void)atacheToViewController:(FlutterViewController *)vc;
- (BOOL)atacheToViewController:(FlutterViewController *)vc;
- (void)detach;
- (void)prepareEngineIfNeeded;
- (void)pause;
......
......@@ -31,6 +31,7 @@
@interface FLBFlutterApplication()
@property (nonatomic,strong) FLBFlutterContainerManager *manager;
@property (nonatomic,strong) id<FLBFlutterProvider> viewProvider;
@property (nonatomic, weak, readonly)FlutterViewController * previousViewController;
@property (nonatomic,assign) BOOL isRunning;
@property (nonatomic,strong) NSMutableDictionary *pageResultCallbacks;
@property (nonatomic,strong) NSMutableDictionary *callbackCache;
......@@ -157,6 +158,13 @@
return self.flutterProvider.engine.viewController;
}
- (void)attachToPreviousContainer{
if([self.viewProvider atacheToViewController:self.previousViewController]){
[self.previousViewController.view setNeedsLayout];
[(FLBFlutterViewContainer*)self.previousViewController surfaceUpdated:YES];
}
}
- (void)close:(NSString *)uniqueId
result:(NSDictionary *)resultData
exts:(NSDictionary *)exts
......@@ -190,7 +198,7 @@
[newParams setObject:cid?cid:@"__default#0__" forKey:kPageCallBackId];
urlParams = newParams;
}
_previousViewController = [self flutterViewController];
_callbackCache[cid] = resultCallback;
if([urlParams[@"present"]respondsToSelector:@selector(boolValue)] && [urlParams[@"present"] boolValue] && [self.platform respondsToSelector:@selector(present:urlParams:exts:completion:)]){
[self.platform present:url
......
......@@ -97,12 +97,13 @@
arguments:@{@"type":@"foreground"}];
}
- (void)atacheToViewController:(FlutterViewController *)vc
- (BOOL)atacheToViewController:(FlutterViewController *)vc
{
if(_engine.viewController != vc){
// [(FLBFlutterViewContainer *)_engine.viewController surfaceUpdated:NO];
_engine.viewController = vc;
return YES;
}
return NO;
}
- (void)detach
......
......@@ -287,11 +287,6 @@ static NSUInteger kInstanceCounter = 0;
pageName:_name
params:_params
uniqueId:self.uniqueIDString];
// 如果当前不可见vc和engine所持有的vc一致。在FlutterVC在混合栈中是最后一张页面,如tab中的页面
// if (self == FLUTTER_VC)
// {
// [self surfaceUpdated:NO];
// }
[super bridge_viewDidDisappear:animated];
}
......
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