Commit 62d3504f authored by 余玠's avatar 余玠

新增present函数

parent f44b7392
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
completion:(void (^)(BOOL))completion; completion:(void (^)(BOOL))completion;
/** /**
* 打开新页面,混合栈推荐使用的用于操作页面的接口 * 打开新页面(默认以push方式),混合栈推荐使用的用于操作页面的接口;通过urlParams可以设置为以present方式打开页面:urlParams:@{@"present":@(YES)}
* *
* @param url 打开的页面资源定位符 * @param url 打开的页面资源定位符
* @param urlParams 传人页面的参数; 若有特殊逻辑,可以通过这个参数设置回调的id * @param urlParams 传人页面的参数; 若有特殊逻辑,可以通过这个参数设置回调的id
...@@ -80,4 +80,19 @@ ...@@ -80,4 +80,19 @@
exts:(NSDictionary *)exts exts:(NSDictionary *)exts
onPageFinished:(void (^)(NSDictionary *))resultCallback onPageFinished:(void (^)(NSDictionary *))resultCallback
completion:(void (^)(BOOL))completion; completion:(void (^)(BOOL))completion;
/**
* Present方式打开新页面,混合栈推荐使用的用于操作页面的接口
*
* @param url 打开的页面资源定位符
* @param urlParams 传人页面的参数; 若有特殊逻辑,可以通过这个参数设置回调的id
* @param exts 额外参数
* @param resultCallback 当页面结束返回时执行的回调,通过这个回调可以取得页面的返回数据,如close函数传入的resultData
* @param completion 打开页面的即时回调,页面一旦打开即回调
*/
+ (void)present:(NSString *)url
urlParams:(NSDictionary *)urlParams
exts:(NSDictionary *)exts
onPageFinished:(void (^)(NSDictionary *))resultCallback
completion:(void (^)(BOOL))completion;
@end @end
...@@ -168,6 +168,13 @@ ...@@ -168,6 +168,13 @@
[app open:url urlParams:urlParams exts:exts onPageFinished:resultCallback completion:completion]; [app open:url urlParams:urlParams exts:exts onPageFinished:resultCallback completion:completion];
} }
+ (void)present:(NSString *)url urlParams:(NSDictionary *)urlParams exts:(NSDictionary *)exts onPageFinished:(void (^)(NSDictionary *))resultCallback completion:(void (^)(BOOL))completion{
id<FLBFlutterApplicationInterface> app = [[FlutterBoostPlugin sharedInstance] application];
NSMutableDictionary *myParams = [[NSMutableDictionary alloc]initWithDictionary:urlParams];
[myParams setObject:@(YES) forKey:@"present"];
[app open:url urlParams:myParams exts:exts onPageFinished:resultCallback completion:completion];
}
+ (void)close:(NSString *)uniqueId result:(NSDictionary *)resultData exts:(NSDictionary *)exts completion:(void (^)(BOOL))completion{ + (void)close:(NSString *)uniqueId result:(NSDictionary *)resultData exts:(NSDictionary *)exts completion:(void (^)(BOOL))completion{
id<FLBFlutterApplicationInterface> app = [[FlutterBoostPlugin sharedInstance] application]; id<FLBFlutterApplicationInterface> app = [[FlutterBoostPlugin sharedInstance] application];
[app close:uniqueId result:resultData exts:exts completion:completion]; [app close:uniqueId result:resultData exts:exts completion:completion];
......
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