Commit aef7e019 authored by 余玠's avatar 余玠

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

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