Commit 818f52357f2fefa9ffc12c555645467d434e91b3

Authored by yanglingyu
1 parent 60ebd41f

与主工程同步交互

Example/CNLiveBBASMModule/CNLIVEViewController.m
... ... @@ -54,9 +54,8 @@
54 54 break;
55 55 case 2:
56 56 {
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   - NSURL *url = [NSURL URLWithString:urlStr];
59   - [CNLiveBBASMModuleService skipOpenBBASMModule:url];
  57 + NSString *urlStr = @"https://wjjh5.cnlive.com/smartappLandingpage.html?title=%E6%B2%AA%E6%B1%9F%E8%8B%B1%E8%AF%AD%E5%AD%A6%E4%B9%A0&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%3A%2F%2Fb.bdstatic.com%2Fsearchbox%2Fmappconsole%2Fimage%2F20181105%2F1541398769-33490.png&swanId=lDvbSAZzaa8xPTQ8M0EquG1xos75HGvU%2F%2Fpages%2Fsubcate%2Fsubcate%3Fcatename%3D%E8%81%8C%E5%9C%BA%E8%8B%B1%E8%AF%AD&type=smartapp";
  58 + [CNLiveBBASMModuleService skipOpenBBASMModule:urlStr];
60 59 }
61 60 break;
62 61 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   -+ (void)skipOpenBBASMModule:(NSURL *)url;
  22 ++ (void)skipOpenBBASMModule:(NSString *)url;
23 23 + (void)registerBBASMManager:(NSDictionary *)launchOptions;
24 24 + (void)openBBASMModule:(NSString *)urlStr;
25 25 + (BOOL)cashierHandleOpenUrl:(NSURL *)url;
... ...
Example/CNLiveBBASMModule/CNLiveBBASMModule/CNLiveBBASMModuleService.m
... ... @@ -9,6 +9,7 @@
9 9 #import "CNLiveBBASMModuleService.h"
10 10 #import "CNLiveShareManager.h"
11 11 #import <CNLiveBusinessTools/CNLiveEscpTools.h>
  12 +#import <YYCategories/YYCategories.h>
12 13 #import "BHRouter.h"
13 14  
14 15 //主要的跳转类型
... ... @@ -57,9 +58,10 @@ static NSString *const CNLiveAccountLogOut = @&quot;accountLogout&quot;;
57 58 }
58 59  
59 60 }
60   -+ (void)skipOpenBBASMModule:(NSURL *)url{
61   - NSDictionary * paramDic = [self requestURLParameters:url];
62   - [CNLiveBBASMModuleService openBBASMModule:[NSString stringWithFormat :@"cnlive://swan/%@",[CNLiveEscpTools unesp:paramDic[@"swanId"]]]];
  61 ++ (void)skipOpenBBASMModule:(NSString *)url{
  62 + NSDictionary * paramDic = [CNLiveBBASMModuleService requestBBASMURLParameters:url];
  63 + NSString *swanId = [paramDic[@"swanId"] stringByURLDecode];
  64 + [CNLiveBBASMModuleService openBBASMModule:[NSString stringWithFormat :@"cnlive://swan/%@",swanId]];
63 65 }
64 66 + (void)openBBASMModule:(NSString *)urlStr{
65 67 NSURL * url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@",CNLiveBBASMWithMainRouter,CNLiveOpenBBASMModule]];
... ... @@ -79,11 +81,11 @@ static NSString *const CNLiveAccountLogOut = @&quot;accountLogout&quot;;
79 81 }
80 82  
81 83 //参数的跳转逻辑
82   -+ (NSDictionary *)requestURLParameters:(NSURL *)urlStr
  84 ++ (NSDictionary *)requestBBASMURLParameters:(NSString *)urlStr
83 85 {
84 86 NSMutableDictionary *parm = [[NSMutableDictionary alloc]init];
85 87 // Fallback on earlier versions
86   - NSString * path = [urlStr.absoluteString componentsSeparatedByString:@"?"].lastObject;
  88 + NSString * path = [urlStr componentsSeparatedByString:@"?"].lastObject;
87 89 NSArray * paramArray = [path componentsSeparatedByString:@"&"];
88 90 [paramArray enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
89 91 NSArray * tempArray = [obj componentsSeparatedByString:@"="];
... ...