Commit 37ad32e7 authored by ColdPaleLight's avatar ColdPaleLight

fix pop gesture problem

parent 3e46fc3a
...@@ -95,9 +95,19 @@ ...@@ -95,9 +95,19 @@
pageInfo[@"uniqueId"] = [FlutterBoostPlugin sharedInstance].fPageId; pageInfo[@"uniqueId"] = [FlutterBoostPlugin sharedInstance].fPageId;
if(result) result(pageInfo); if(result) result(pageInfo);
} else if([@"disablePopGesture" isEqualToString:call.method]) { } else if([@"disablePopGesture" isEqualToString:call.method]) {
[FlutterBoostPlugin sharedInstance].application.flutterViewController.navigationController.interactivePopGestureRecognizer.enabled = NO;
FLBFlutterViewContainer *flutterViewController = [FlutterBoostPlugin sharedInstance].application.flutterViewController;
if ([flutterViewController isKindOfClass:flutterViewController.class]) {
flutterViewController.navigationController.interactivePopGestureRecognizer.enabled = NO;
flutterViewController.disablePopGesture = @(YES);
}
} else if([@"enablePopGesture" isEqualToString:call.method]){ } else if([@"enablePopGesture" isEqualToString:call.method]){
[FlutterBoostPlugin sharedInstance].application.flutterViewController.navigationController.interactivePopGestureRecognizer.enabled = YES; FLBFlutterViewContainer *flutterViewController = [FlutterBoostPlugin sharedInstance].application.flutterViewController;
if ([flutterViewController isKindOfClass:flutterViewController.class]) {
flutterViewController.navigationController.interactivePopGestureRecognizer.enabled = YES;
flutterViewController.disablePopGesture = @(NO);
}
} else{ } else{
result(FlutterMethodNotImplemented); result(FlutterMethodNotImplemented);
} }
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface FLBFlutterViewContainer : FlutterViewController<FLBFlutterContainer> @interface FLBFlutterViewContainer : FlutterViewController<FLBFlutterContainer>
@property (nonatomic,copy,readwrite) NSString *name; @property (nonatomic,copy,readwrite) NSString *name;
@property (nonatomic, strong) NSNumber *disablePopGesture;
- (instancetype)init NS_DESIGNATED_INITIALIZER; - (instancetype)init NS_DESIGNATED_INITIALIZER;
- (void)surfaceUpdated:(BOOL)appeared; - (void)surfaceUpdated:(BOOL)appeared;
@end @end
......
...@@ -275,6 +275,14 @@ static NSUInteger kInstanceCounter = 0; ...@@ -275,6 +275,14 @@ static NSUInteger kInstanceCounter = 0;
[self surfaceUpdated:YES]; [self surfaceUpdated:YES];
[super viewDidAppear:animated]; [super viewDidAppear:animated];
// Enable or disable pop gesture
// note: if disablePopGesture is nil, do nothing
if (self.disablePopGesture) {
self.navigationController.interactivePopGestureRecognizer.enabled = ![self.disablePopGesture boolValue];
}
} }
- (void)viewWillDisappear:(BOOL)animated - (void)viewWillDisappear:(BOOL)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