Commit 60ebd41fb56a876789e51dd2f5daf4968ef9d7be
1 parent
610b4f7e
跳转修改
Showing
3 changed files
with
26 additions
and
4 deletions
Example/CNLiveBBASMModule/CNLIVEViewController.m
| ... | ... | @@ -56,8 +56,7 @@ |
| 56 | 56 | { |
| 57 | 57 | NSString *urlStr = @"http://wjjh5test.cnlive.com/smartappLandingpage.html?title=%E5%85%B3%E4%BA%8E%E5%8A%A8%E7%89%A9%E7%9A%84%E8%B6%A3%E5%91%B3%E4%BF%9A%E8%AF%AD%E8%A1%A8%E8%BE%BE%EF%BD%9E&content=%E6%B2%AA%E6%B1%9F%E8%8B%B1%E8%AF%AD%E6%8F%90%E4%BE%9B%E8%8B%B1%E8%AF%AD%E5%9B%9B%E5%85%AD%E7%BA%A7%E3%80%81%E5%90%AC%E8%AF%B4%E8%AF%BB%E5%86%99%E3%80%81%E5%BD%B1%E8%A7%86%E5%A8%B1%E4%B9%90%E3%80%81%E5%85%A5%E9%97%A8%E5%AD%A6%E4%B9%A0%E8%B5%84%E8%AE%AF&imageUrl=https://b.bdstatic.com/searchbox/mappconsole/image/20181105/1541398769-33490.png&swanId=lDvbSAZzaa8xPTQ8M0EquG1xos75HGvU%2F%2Fpages%2FaudioDetail%2FaudioDetail%3Fshare%3D1%26contentId%3D1279583%26rowId%3D1%26pubDate%3D2021%2D11%2D10%26assignTag%3D%E5%B0%8F%E8%AF%8D%E5%A4%A7%E7%94%A8&type=smartapp"; |
| 58 | 58 | NSURL *url = [NSURL URLWithString:urlStr]; |
| 59 | - NSDictionary * paramDic = [self requestURLParameters:url]; | |
| 60 | - [CNLiveBBASMModuleService openBBASMModule:[NSString stringWithFormat :@"cnlive://swan/%@",[CNLiveEscpTools unesp:paramDic[@"swanId"]]]]; | |
| 59 | + [CNLiveBBASMModuleService skipOpenBBASMModule:url]; | |
| 61 | 60 | } |
| 62 | 61 | break; |
| 63 | 62 | case 3: | ... | ... |
Example/CNLiveBBASMModule/CNLiveBBASMModule/CNLiveBBASMModuleService.h
| ... | ... | @@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN |
| 19 | 19 | |
| 20 | 20 | @interface CNLiveBBASMModuleService : NSObject<CNliveBBASMModuleProtocol> |
| 21 | 21 | |
| 22 | - | |
| 22 | ++ (void)skipOpenBBASMModule:(NSURL *)url; | |
| 23 | 23 | + (void)registerBBASMManager:(NSDictionary *)launchOptions; |
| 24 | 24 | + (void)openBBASMModule:(NSString *)urlStr; |
| 25 | 25 | + (BOOL)cashierHandleOpenUrl:(NSURL *)url; | ... | ... |
Example/CNLiveBBASMModule/CNLiveBBASMModule/CNLiveBBASMModuleService.m
| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | |
| 9 | 9 | #import "CNLiveBBASMModuleService.h" |
| 10 | 10 | #import "CNLiveShareManager.h" |
| 11 | - | |
| 11 | +#import <CNLiveBusinessTools/CNLiveEscpTools.h> | |
| 12 | 12 | #import "BHRouter.h" |
| 13 | 13 | |
| 14 | 14 | //主要的跳转类型 |
| ... | ... | @@ -57,6 +57,10 @@ static NSString *const CNLiveAccountLogOut = @"accountLogout"; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | } |
| 60 | ++ (void)skipOpenBBASMModule:(NSURL *)url{ | |
| 61 | + NSDictionary * paramDic = [self requestURLParameters:url]; | |
| 62 | + [CNLiveBBASMModuleService openBBASMModule:[NSString stringWithFormat :@"cnlive://swan/%@",[CNLiveEscpTools unesp:paramDic[@"swanId"]]]]; | |
| 63 | +} | |
| 60 | 64 | + (void)openBBASMModule:(NSString *)urlStr{ |
| 61 | 65 | NSURL * url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@",CNLiveBBASMWithMainRouter,CNLiveOpenBBASMModule]]; |
| 62 | 66 | [BHRouter openURL:url withParams:@{@"CNBBASMJumpService":@{@"urlStr":urlStr}}]; |
| ... | ... | @@ -73,4 +77,23 @@ static NSString *const CNLiveAccountLogOut = @"accountLogout"; |
| 73 | 77 | NSURL * url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@",CNLiveBBASMWithMainRouter,CNLiveAccountLogOut]]; |
| 74 | 78 | [BHRouter openURL:url]; |
| 75 | 79 | } |
| 80 | + | |
| 81 | +//参数的跳转逻辑 | |
| 82 | ++ (NSDictionary *)requestURLParameters:(NSURL *)urlStr | |
| 83 | +{ | |
| 84 | + NSMutableDictionary *parm = [[NSMutableDictionary alloc]init]; | |
| 85 | + // Fallback on earlier versions | |
| 86 | + NSString * path = [urlStr.absoluteString componentsSeparatedByString:@"?"].lastObject; | |
| 87 | + NSArray * paramArray = [path componentsSeparatedByString:@"&"]; | |
| 88 | + [paramArray enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { | |
| 89 | + NSArray * tempArray = [obj componentsSeparatedByString:@"="]; | |
| 90 | + if ([tempArray.firstObject isEqualToString:@"//type"]) { | |
| 91 | + [parm setObject:tempArray.lastObject forKey:@"type"]; | |
| 92 | + }else{ | |
| 93 | + [parm setObject:tempArray.lastObject forKey:tempArray.firstObject]; | |
| 94 | + } | |
| 95 | + }]; | |
| 96 | + | |
| 97 | + return parm; | |
| 98 | +} | |
| 76 | 99 | @end | ... | ... |