diff --git a/example/ios/Runner/MyFlutterBoostDelegate.m b/example/ios/Runner/MyFlutterBoostDelegate.m index 07c1a367..5aaf808f 100644 --- a/example/ios/Runner/MyFlutterBoostDelegate.m +++ b/example/ios/Runner/MyFlutterBoostDelegate.m @@ -26,7 +26,7 @@ - (void) pushNativeRoute:(NSString *) pageName arguments:(NSDictionary *) argume } } -- (void)pushFlutterRoute:(FlutterBoostPushOptions *)options { +- (void)pushFlutterRoute:(FlutterBoostRouteOptions *)options { FlutterEngine* engine = [[FlutterBoost instance] engine]; engine.viewController = nil; diff --git a/example/ios/Runner/UIViewControllerDemo.m b/example/ios/Runner/UIViewControllerDemo.m index c27a4308..50f3c417 100755 --- a/example/ios/Runner/UIViewControllerDemo.m +++ b/example/ios/Runner/UIViewControllerDemo.m @@ -25,43 +25,25 @@ - (void)viewDidLoad { - (IBAction)pushFlutterPage:(id)sender { - - [[FlutterBoost instance] open:@"flutterPage" arguments:@{@"animated":@(YES)} completion:^(BOOL completion) { + FlutterBoostRouteOptions* options = [[FlutterBoostRouteOptions alloc]init]; + options.pageName = @"flutterPage"; + options.arguments = @{@"animated":@(YES)}; + options.completion = ^(BOOL completion) { - } ]; - - -// [FlutterBoostPlugin open:@"first" urlParams:@{kPageCallBackId:@"MycallbackId#1"} exts:@{@"animated":@(YES)} onPageFinished:^(NSDictionary *result) { -// NSLog(@"call me when page finished, and your result is:%@", result); -// } completion:^(BOOL f) { -// NSLog(@"page is opened"); -// }]; - + }; + [[FlutterBoost instance]open:options]; } - (IBAction)present:(id)sender { - [[FlutterBoost instance] open:@"secondStateful" arguments:@{@"present":@(YES)} completion:^(BOOL completion) { - - - }]; - -// [FlutterBoostPlugin open:@"second" urlParams:@{@"present":@(YES),kPageCallBackId:@"MycallbackId#2"} exts:@{@"animated":@(YES)} onPageFinished:^(NSDictionary *result) { -// NSLog(@"call me when page finished, and your result is:%@", result); -// } completion:^(BOOL f) { -// NSLog(@"page is presented"); -// }]; -} + FlutterBoostRouteOptions* options = [[FlutterBoostRouteOptions alloc]init]; + options.pageName = @"secondStateful"; + options.arguments = @{@"present":@(YES)}; + options.completion = ^(BOOL completion) { -/* -#pragma mark - Navigation + }; -// In a storyboard-based application, you will often want to do a little preparation before navigation -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - // Get the new view controller using [segue destinationViewController]. - // Pass the selected object to the new view controller. + [[FlutterBoost instance]open:options]; } -*/ - @end diff --git a/ios/Classes/FlutterBoost.h b/ios/Classes/FlutterBoost.h index ae1448aa..ee9de7e0 100644 --- a/ios/Classes/FlutterBoost.h +++ b/ios/Classes/FlutterBoost.h @@ -67,6 +67,7 @@ /// @param uniqueId 关闭的页面唯一ID符 - (void)close:(NSString *)uniqueId; +/// ( 已废弃,之后有新参数可能不支持此方法 !!! ) /// 打开新页面(默认以push方式),混合栈推荐使用的用于操作页面的接口 /// 通过arguments可以设置为以present方式打开页面:arguments:@{@"present":@(YES)} /// @param pageName 打开的页面资源定位符 @@ -75,9 +76,9 @@ - (void)open:(NSString *)pageName arguments:(NSDictionary *)arguments completion:(void(^)(BOOL)) completion; -/// 利用启动参数配置开启新页面 +/// (推荐使用)利用启动参数配置开启新页面 /// @param options 配置参数 -- (void)open:(FlutterBoostPushOptions* )options; +- (void)open:(FlutterBoostRouteOptions* )options; /// 将原生页面的数据回传到flutter侧的页面的的方法 diff --git a/ios/Classes/FlutterBoost.m b/ios/Classes/FlutterBoost.m index 0e923026..d7e48aa0 100644 --- a/ios/Classes/FlutterBoost.m +++ b/ios/Classes/FlutterBoost.m @@ -106,7 +106,7 @@ - (FlutterViewController *) currentViewController{ #pragma mark - open/close Page - (void)open:(NSString *)pageName arguments:(NSDictionary *)arguments completion:(void(^)(BOOL)) completion { - FlutterBoostPushOptions* options = [[FlutterBoostPushOptions alloc]init]; + FlutterBoostRouteOptions* options = [[FlutterBoostRouteOptions alloc]init]; options.pageName = pageName; options.arguments = arguments; options.completion = completion; @@ -114,7 +114,7 @@ - (void)open:(NSString *)pageName arguments:(NSDictionary *)arguments completion [self.plugin.delegate pushFlutterRoute:options]; } -- (void)open:(FlutterBoostPushOptions* )options{ +- (void)open:(FlutterBoostRouteOptions* )options{ [self.plugin.delegate pushFlutterRoute:options]; } diff --git a/ios/Classes/FlutterBoostDelegate.h b/ios/Classes/FlutterBoostDelegate.h index 3ed5fc00..82ce767a 100644 --- a/ios/Classes/FlutterBoostDelegate.h +++ b/ios/Classes/FlutterBoostDelegate.h @@ -34,7 +34,7 @@ - (FlutterEngine*) engine; @required - (void) pushNativeRoute:(NSString *) pageName arguments:(NSDictionary *) arguments; -- (void) pushFlutterRoute:(FlutterBoostPushOptions*)options; +- (void) pushFlutterRoute:(FlutterBoostRouteOptions*)options; - (void) popRoute:(NSString *)uniqueId; @end diff --git a/ios/Classes/FlutterBoostPlugin.m b/ios/Classes/FlutterBoostPlugin.m index 8c8bf7b5..ed9c4d9d 100644 --- a/ios/Classes/FlutterBoostPlugin.m +++ b/ios/Classes/FlutterBoostPlugin.m @@ -73,7 +73,7 @@ -(void)pushNativeRoute:(FBCommonParams*)input error:(FlutterError *_Nullable *_N } -(void)pushFlutterRoute:(FBCommonParams*)input error:(FlutterError *_Nullable *_Nonnull)error { - FlutterBoostPushOptions* options = [[FlutterBoostPushOptions alloc]init]; + FlutterBoostRouteOptions* options = [[FlutterBoostRouteOptions alloc]init]; options.pageName = input.pageName; options.uniqueId = input.uniqueId; options.arguments = input.arguments; diff --git a/ios/Classes/Options.h b/ios/Classes/Options.h index 209acf1a..d3c407ae 100644 --- a/ios/Classes/Options.h +++ b/ios/Classes/Options.h @@ -45,8 +45,8 @@ @end -///新页面打开参数配置 -@interface FlutterBoostPushOptions : NSObject +///路由参数配置 +@interface FlutterBoostRouteOptions : NSObject ///页面在路由表中的名字 @property(nonatomic, strong) NSString* pageName; @@ -54,7 +54,7 @@ ///参数 @property(nonatomic, strong) NSDictionary* arguments; -///参数回传的回调,仅在原生->flutter页面的时候有用 +///参数回传的回调闭包,仅在原生->flutter页面的时候有用 @property(nonatomic, strong) void(^onPageFinished)(NSDictionary*); ///open方法完成后的回调,仅在原生->flutter页面的时候有用 diff --git a/ios/Classes/Options.m b/ios/Classes/Options.m index 4df8c787..319f6870 100644 --- a/ios/Classes/Options.m +++ b/ios/Classes/Options.m @@ -44,7 +44,7 @@ + (FlutterBoostSetupOptions*)createDefault{ @end -@implementation FlutterBoostPushOptions +@implementation FlutterBoostRouteOptions @end