Commit 7b2ee58508cccb1d2dec1998338ca65ac4726676

Authored by zhangxiaowen
1 parent 409d1ac9

no message

CNLiveServices.podspec
@@ -57,7 +57,6 @@ TODO: Add long description of the pod here. @@ -57,7 +57,6 @@ TODO: Add long description of the pod here.
57 ss.source_files = 'CNLiveServices/Classes/Found/*.{h,m}' 57 ss.source_files = 'CNLiveServices/Classes/Found/*.{h,m}'
58 end 58 end
59 59
60 -  
61 # 登录 60 # 登录
62 s.subspec 'Login' do |ss| 61 s.subspec 'Login' do |ss|
63 ss.source_files = 'CNLiveServices/Classes/Login/*.{h,m}' 62 ss.source_files = 'CNLiveServices/Classes/Login/*.{h,m}'
CNLiveServices/Classes/UserAgreement/CNLiveUserAgreementServiceProtocol.h
@@ -8,30 +8,32 @@ @@ -8,30 +8,32 @@
8 8
9 #import <Foundation/Foundation.h> 9 #import <Foundation/Foundation.h>
10 #import "BHServiceProtocol.h" 10 #import "BHServiceProtocol.h"
11 -typedef void(^SuccessBlock)(NSString *h5,NSString *title); 11 +typedef void(^SuccessBlock)(NSString *h5, NSString *title);
12 typedef void(^FailureBlock)(NSError *error); 12 typedef void(^FailureBlock)(NSError *error);
13 typedef enum { 13 typedef enum {
14 - CNAgreementUser = 1001,//用户协议  
15 - CNAgreementPrivacy = 1002,//隐私政策  
16 - CNAgreementHelp = 1003,//帮助与反馈  
17 - CNAgreementUnderstand = 1004,//使用手册  
18 - CNAgreementIntroduction = 1005,//应用简介  
19 - CNAgreementCopyright = 1006,//版权信息  
20 - CNAgreementPermission = 1007,//软件许可及服务协议  
21 - CNAgreementIntegralRules = 1008,//积分规则  
22 - CNAgreementSigninRules = 1009,//签到奖励规则  
23 - CNAgreementReviewApply = 1010,//复核申请  
24 - CNAgreementCancellation = 1011,//注销协议  
25 - CNAgreementEmojiService = 1012,//表情包服务说明  
26 - CNAgreementEmojiComplaints = 1013,//表情包投诉说明 14 + CNAgreementUser    = 1001,//用户协议
  15 + CNAgreementPrivacy    = 1002,//隐私政策
  16 + CNAgreementHelp    = 1003,//帮助与反馈
  17 + CNAgreementUnderstand    = 1004,//使用手册
  18 + CNAgreementIntroduction    = 1005,//应用简介
  19 + CNAgreementCopyright    = 1006,//版权信息
  20 + CNAgreementPermission    = 1007,//软件许可及服务协议
  21 + CNAgreementIntegralRules    = 1008,//积分规则
  22 + CNAgreementSigninRules    = 1009,//签到奖励规则
  23 + CNAgreementReviewApply    = 1010,//复核申请
  24 + CNAgreementCancellation    = 1011,//注销协议
  25 + CNAgreementEmojiService    = 1012,//表情包服务说明
  26 + CNAgreementEmojiComplaints    = 1013,//表情包投诉说明
27 CNAgreementEnterpriseQualification = 1014,//企业资质 27 CNAgreementEnterpriseQualification = 1014,//企业资质
28 28
29 } CNGetAgreementH5Type; 29 } CNGetAgreementH5Type;
30 30
31 @protocol CNLiveUserAgreementServiceProtocol <NSObject, BHServiceProtocol> 31 @protocol CNLiveUserAgreementServiceProtocol <NSObject, BHServiceProtocol>
32 32
33 -- (void)getAgreementH5WithType:(CNGetAgreementH5Type)type success:(SuccessBlock)success failure:(FailureBlock)failure; 33 ++ (void)jumpToAgreementH5WithType:(CNGetAgreementH5Type)type;
34 34
35 + (void)getAgreementH5WithType:(CNGetAgreementH5Type)type success:(SuccessBlock)success failure:(FailureBlock)failure; 35 + (void)getAgreementH5WithType:(CNGetAgreementH5Type)type success:(SuccessBlock)success failure:(FailureBlock)failure;
36 36
  37 +- (void)getAgreementH5WithType:(CNGetAgreementH5Type)type success:(SuccessBlock)success failure:(FailureBlock)failure;
  38 +
37 @end 39 @end
Example/CNLiveServices/CNLiveAppDelegate.m
@@ -21,9 +21,9 @@ @@ -21,9 +21,9 @@
21 // Override point for customization after application launch. 21 // Override point for customization after application launch.
22 [BHContext shareInstance].application = application; 22 [BHContext shareInstance].application = application;
23 [BHContext shareInstance].launchOptions = launchOptions; 23 [BHContext shareInstance].launchOptions = launchOptions;
24 - // [BHContext shareInstance].moduleConfigName = @"BeeHive.bundle/BeeHive";//可选,默认为BeeHive.bundle/BeeHive.plist  
25 - // [BHContext shareInstance].serviceConfigName = @"BeeHive.bundle/BHService";  
26 -// [BeeHive shareInstance].enableException = YES; 24 + [BHContext shareInstance].moduleConfigName = @"BeeHive.bundle/BeeHive";//可选,默认为BeeHive.bundle/BeeHive.plist
  25 + [BHContext shareInstance].serviceConfigName = @"BeeHive.bundle/BHService";
  26 + [BeeHive shareInstance].enableException = YES;
27 [[BeeHive shareInstance] setContext:[BHContext shareInstance]]; 27 [[BeeHive shareInstance] setContext:[BHContext shareInstance]];
28 [[BHTimeProfiler sharedTimeProfiler] recordEventTime:@"BeeHive::super start launch"]; 28 [[BHTimeProfiler sharedTimeProfiler] recordEventTime:@"BeeHive::super start launch"];
29 29
@@ -32,7 +32,6 @@ @@ -32,7 +32,6 @@
32 32
33 // id<CNLiveLoginServiceProtocol> login = [[BeeHive shareInstance] createService:@protocol(CNLiveLoginServiceProtocol)]; 33 // id<CNLiveLoginServiceProtocol> login = [[BeeHive shareInstance] createService:@protocol(CNLiveLoginServiceProtocol)];
34 // UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:[login getLoginViewController]]; 34 // UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:[login getLoginViewController]];
35 -//  
36 35
37 id<CNLiveHomeServiceProtocol> home = [[BeeHive shareInstance] createService:@protocol(CNLiveHomeServiceProtocol)]; 36 id<CNLiveHomeServiceProtocol> home = [[BeeHive shareInstance] createService:@protocol(CNLiveHomeServiceProtocol)];
38 UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:[home getHomeViewController]]; 37 UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:[home getHomeViewController]];
Example/CNLiveServices/Home/CNLiveHomeViewController.m
@@ -35,6 +35,14 @@ @@ -35,6 +35,14 @@
35 [btn0 addTarget:self action:@selector(testButtonClicked) forControlEvents:UIControlEventTouchUpInside]; 35 [btn0 addTarget:self action:@selector(testButtonClicked) forControlEvents:UIControlEventTouchUpInside];
36 [self.view addSubview:btn0]; 36 [self.view addSubview:btn0];
37 37
  38 + UIButton *btn1 = [UIButton buttonWithType:UIButtonTypeCustom];
  39 + btn1.frame = CGRectMake(0, 0, 100, 100);
  40 + btn1.center = CGPointMake(self.view.center.x, self.view.center.y-120);
  41 + btn1.backgroundColor = [UIColor redColor];
  42 + [btn1 setTitle:@"进入协议" forState:UIControlStateNormal];
  43 + [btn1 addTarget:self action:@selector(testButtonClicked1) forControlEvents:UIControlEventTouchUpInside];
  44 + [self.view addSubview:btn1];
  45 +
38 } 46 }
39 47
40 - (void)testButtonClicked { 48 - (void)testButtonClicked {
@@ -46,8 +54,13 @@ @@ -46,8 +54,13 @@
46 54
47 } 55 }
48 }]; 56 }];
49 -// id<CNLiveFoundServiceProtocol> found = [[BeeHive shareInstance] createService:@protocol(CNLiveFoundServiceProtocol)];  
50 -// [found pushToFoundViewControllerByName:@"itemID" url:@"" delegate:self]; 57 +
  58 +}
  59 +
  60 +- (void)testButtonClicked1 {
  61 + id<CNLiveUserAgreementServiceProtocol> agreement = [[BeeHive shareInstance] createService:@protocol(CNLiveUserAgreementServiceProtocol)];
  62 + [[agreement class] jumpToAgreementH5WithType:CNAgreementUser];
  63 +
51 } 64 }
52 65
53 /* 66 /*
Example/CNLiveServices/Images.xcassets/Contents.json 0 → 100644
  1 +{
  2 + "info" : {
  3 + "version" : 1,
  4 + "author" : "xcode"
  5 + }
  6 +}
0 \ No newline at end of file 7 \ No newline at end of file
Example/CNLiveServices/Images.xcassets/black_back.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "filename" : "black_back.png",
  6 + "scale" : "1x"
  7 + },
  8 + {
  9 + "idiom" : "universal",
  10 + "filename" : "black_back@2x.png",
  11 + "scale" : "2x"
  12 + },
  13 + {
  14 + "idiom" : "universal",
  15 + "filename" : "black_back@3x.png",
  16 + "scale" : "3x"
  17 + }
  18 + ],
  19 + "info" : {
  20 + "version" : 1,
  21 + "author" : "xcode"
  22 + }
  23 +}
0 \ No newline at end of file 24 \ No newline at end of file
Example/CNLiveServices/Images.xcassets/black_back.imageset/black_back.png 0 → 100644

346 Bytes

Example/CNLiveServices/Images.xcassets/black_back.imageset/black_back@2x.png 0 → 100644

628 Bytes

Example/CNLiveServices/Images.xcassets/black_back.imageset/black_back@3x.png 0 → 100644

1.15 KB

Example/CNLiveServices/Login/Controller/CNLoginViewController.m
@@ -34,9 +34,9 @@ @@ -34,9 +34,9 @@
34 34
35 // UIButton *btn0 = [UIButton buttonWithType:UIButtonTypeCustom]; 35 // UIButton *btn0 = [UIButton buttonWithType:UIButtonTypeCustom];
36 // btn0.frame = CGRectMake(0, 0, 100, 100); 36 // btn0.frame = CGRectMake(0, 0, 100, 100);
37 -// btn0.center = self.view.center; 37 +// btn0.center = CGPointMake(self.view.center.x, self.view.center.y-120);
38 // btn0.backgroundColor = [UIColor redColor]; 38 // btn0.backgroundColor = [UIColor redColor];
39 -// [btn0 setTitle:@"进入首页" forState:UIControlStateNormal]; 39 +// [btn0 setTitle:@"进入协议" forState:UIControlStateNormal];
40 // [btn0 addTarget:self action:@selector(testButtonClicked) forControlEvents:UIControlEventTouchUpInside]; 40 // [btn0 addTarget:self action:@selector(testButtonClicked) forControlEvents:UIControlEventTouchUpInside];
41 // [self.view addSubview:btn0]; 41 // [self.view addSubview:btn0];
42 42
@@ -50,10 +50,14 @@ @@ -50,10 +50,14 @@
50 50
51 } 51 }
52 52
53 -//- (void)testButtonClicked { 53 +- (void)testButtonClicked {
54 // id<CNLiveHomeServiceProtocol> home = [[BeeHive shareInstance] createService:@protocol(CNLiveHomeServiceProtocol)]; 54 // id<CNLiveHomeServiceProtocol> home = [[BeeHive shareInstance] createService:@protocol(CNLiveHomeServiceProtocol)];
55 // [home pushToHomeViewController]; 55 // [home pushToHomeViewController];
56 -//} 56 +
  57 + id<CNLiveUserAgreementServiceProtocol> agreement = [[BeeHive shareInstance] createService:@protocol(CNLiveUserAgreementServiceProtocol)];
  58 + [agreement jumpToAgreementH5WithType:CNAgreementUser];
  59 +
  60 +}
57 61
58 - (void)testButtonClicked1 { 62 - (void)testButtonClicked1 {
59 [CNLiveUserInfoManager manager].isLogin = YES; 63 [CNLiveUserInfoManager manager].isLogin = YES;
Example/CNLiveServices/UserAgreement/CNUserAgreementManager.h
@@ -7,11 +7,19 @@ @@ -7,11 +7,19 @@
7 // 7 //
8 8
9 #import <Foundation/Foundation.h> 9 #import <Foundation/Foundation.h>
  10 +#import "CNLiveServices.h"
10 11
11 NS_ASSUME_NONNULL_BEGIN 12 NS_ASSUME_NONNULL_BEGIN
12 13
13 @interface CNUserAgreementManager : NSObject 14 @interface CNUserAgreementManager : NSObject
14 15
  16 ++ (instancetype)manager;
  17 +
  18 ++ (void)jumpToAgreementH5WithType:(CNGetAgreementH5Type)type;
  19 +
  20 ++ (void)getAgreementH5WithType:(CNGetAgreementH5Type)type success:(SuccessBlock)success failure:(FailureBlock)failure;
  21 +
  22 +- (void)getAgreementH5WithType:(CNGetAgreementH5Type)type success:(SuccessBlock)success failure:(FailureBlock)failure;
15 23
16 @end 24 @end
17 25
Example/CNLiveServices/UserAgreement/CNUserAgreementManager.m
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 // 7 //
8 8
9 #import "CNUserAgreementManager.h" 9 #import "CNUserAgreementManager.h"
10 -#import "CNLiveServices.h" 10 +#import "CNUserAgreementWebController.h"
11 11
12 @BeeHiveService(CNLiveUserAgreementServiceProtocol,CNUserAgreementManager) 12 @BeeHiveService(CNLiveUserAgreementServiceProtocol,CNUserAgreementManager)
13 @interface CNUserAgreementManager ()<CNLiveUserAgreementServiceProtocol> 13 @interface CNUserAgreementManager ()<CNLiveUserAgreementServiceProtocol>
@@ -16,182 +16,66 @@ @@ -16,182 +16,66 @@
16 16
17 @implementation CNUserAgreementManager 17 @implementation CNUserAgreementManager
18 18
19 -+ (BOOL)singleton{  
20 - return YES;  
21 - 19 +static CNUserAgreementManager *_instance = nil;
  20 +
  21 +/**
  22 + * @abstract 单例初始化
  23 + */
  24 ++ (instancetype)manager{
  25 + static dispatch_once_t once;
  26 + dispatch_once(&once, ^{
  27 + _instance = [[CNUserAgreementManager alloc]init];
  28 + });
  29 + return _instance;
22 } 30 }
23 31
24 -- (void)getAgreementH5WithType:(CNGetAgreementH5Type)type success:(SuccessBlock)success failure:(FailureBlock)failure {  
25 -// [CNLiveNetworking setAllowRequestDefaultArgument:NO];  
26 -// [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:CNGetAgreementH5Url Param:@{} CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {  
27 -// if (error) {  
28 -// if (failure) {  
29 -// failure(error);  
30 -// }  
31 -// }  
32 -// else{  
33 -// if ([responseObject isKindOfClass:[NSArray class]]) {  
34 -//  
35 -// for (NSDictionary *dic in responseObject) {  
36 -//  
37 -// switch (type) {  
38 -// case CNAgreementUser:  
39 -// {  
40 -// if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"yhxy"]) {  
41 -// if (success) {  
42 -// success(dic[@"detailUrl"],dic[@"title"]);  
43 -// return ;  
44 -// }  
45 -// }  
46 -// }  
47 -// break;  
48 -// case CNAgreementPrivacy:  
49 -// {  
50 -// if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"yszc"]) {  
51 -// if (success) {  
52 -// success(dic[@"detailUrl"],dic[@"title"]);  
53 -// return ;  
54 -// }  
55 -// }  
56 -// }  
57 -// break;  
58 -// case CNAgreementHelp:  
59 -// {  
60 -// if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"bzfk"]) {  
61 -// if (success) {  
62 -// success(dic[@"detailUrl"],dic[@"title"]);  
63 -// return ;  
64 -// }  
65 -// }  
66 -// }  
67 -// break;  
68 -// case CNAgreementUnderstand:  
69 -// {  
70 -// if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"ljwjj"]) {  
71 -// if (success) {  
72 -// success(dic[@"detailUrl"],dic[@"title"]);  
73 -// return ;  
74 -// }  
75 -// }  
76 -// }  
77 -// break;  
78 -// case CNAgreementIntroduction:  
79 -// {  
80 -// if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"yyjj"]) {  
81 -// if (success) {  
82 -// success(dic[@"detailUrl"],dic[@"title"]);  
83 -// return ;  
84 -// }  
85 -// }  
86 -// }  
87 -// break;  
88 -// case CNAgreementCopyright:  
89 -// {  
90 -// if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"bqxx"]) {  
91 -// if (success) {  
92 -// success(dic[@"detailUrl"],dic[@"title"]);  
93 -// return ;  
94 -// }  
95 -// }  
96 -// }  
97 -// break;  
98 -// case CNAgreementPermission:  
99 -// {  
100 -// if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"rjxkxy"]) {  
101 -// if (success) {  
102 -// success(dic[@"detailUrl"],dic[@"title"]);  
103 -// return ;  
104 -// }  
105 -// }  
106 -// }  
107 -// break;  
108 -// case CNAgreementIntegralRules:  
109 -// {  
110 -// if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"jfgz"]) {  
111 -// if (success) {  
112 -// success(dic[@"detailUrl"],dic[@"title"]);  
113 -// return ;  
114 -// }  
115 -// }  
116 -// }  
117 -// break;  
118 -// case CNAgreementSigninRules:  
119 -// {  
120 -// if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"jfjlgz"]) {  
121 -// if (success) {  
122 -// success(dic[@"detailUrl"],dic[@"title"]);  
123 -// return ;  
124 -// }  
125 -// }  
126 -// }  
127 -// break;  
128 -// case CNAgreementReviewApply:  
129 -// {  
130 -// if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"shsqxy"]) {  
131 -// if (success) {  
132 -// success(dic[@"detailUrl"],dic[@"title"]);  
133 -// return ;  
134 -// }  
135 -// }  
136 -// }  
137 -// break;  
138 -// case CNAgreementCancellation:  
139 -// {  
140 -// if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"zxxz"]) {  
141 -// if (success) {  
142 -// success(dic[@"detailUrl"],dic[@"title"]);  
143 -// return ;  
144 -// }  
145 -// }  
146 -// }  
147 -// break;  
148 -// case CNAgreementEmojiService:  
149 -// {  
150 -// if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"fwsm"]) {  
151 -// if (success) {  
152 -// success(dic[@"detailUrl"],dic[@"title"]);  
153 -// return ;  
154 -// }  
155 -// }  
156 -// }  
157 -// break;  
158 -// case CNAgreementEmojiComplaints:  
159 -// {  
160 -// if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"tssm"]) {  
161 -// if (success) {  
162 -// success(dic[@"detailUrl"],dic[@"title"]);  
163 -// return ;  
164 -// }  
165 -// }  
166 -// }  
167 -// break;  
168 -// case CNAgreementEnterpriseQualification:  
169 -// {  
170 -// if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"qyzz"]) {  
171 -// if (success) {  
172 -// success(dic[@"detailUrl"],dic[@"title"]);  
173 -// return ;  
174 -// }  
175 -// }  
176 -// }  
177 -// break;  
178 -// default:  
179 -// break;  
180 -// }  
181 -//  
182 -// }  
183 -//  
184 -// }  
185 -// if (failure) {  
186 -// failure(error);  
187 -// }  
188 -// }  
189 -// }]; 32 ++ (id)allocWithZone:(struct _NSZone *)zone{
  33 + static dispatch_once_t onceToken;
  34 + dispatch_once(&onceToken, ^{
  35 + _instance = [super allocWithZone:zone];
  36 + });
  37 + return _instance;
  38 +}
  39 +
  40 +- (nonnull id)copyWithZone:(nullable NSZone *)zone {
  41 + return _instance;
  42 +}
  43 +
  44 +- (nonnull id)mutableCopyWithZone:(nullable NSZone *)zone {
  45 + return _instance;
  46 +}
  47 +
  48 ++ (void)jumpToAgreementH5WithType:(CNGetAgreementH5Type)type {
  49 + [CNUserAgreementManager getAgreementH5WithType:type success:^(NSString *h5, NSString *title) {
  50 + UIViewController *root = [UIApplication sharedApplication].delegate.window.rootViewController;
  51 +
  52 + //跟控制器是Navigation
  53 + if ([root isKindOfClass:[UINavigationController class]]){
  54 + UINavigationController *nav = (UINavigationController *)root;
  55 + CNUserAgreementWebController *vc = [[CNUserAgreementWebController alloc] initWithUrl:h5 name:title];
  56 + [nav pushViewController:vc animated:YES];
  57 +
  58 + }
  59 + //跟控制器是TabBar
  60 + else if ([root isKindOfClass:[UITabBarController class]]){
  61 + UITabBarController *tab = (UITabBarController *)root;
  62 + UINavigationController *nav = tab.selectedViewController;
  63 + CNUserAgreementWebController *vc = [[CNUserAgreementWebController alloc] initWithUrl:h5 name:title];
  64 + [nav pushViewController:vc animated:YES];
  65 +
  66 + }else{
  67 + CNUserAgreementWebController *vc = [[CNUserAgreementWebController alloc] initWithUrl:h5 name:title];
  68 + [root presentViewController:vc animated:YES completion:nil];
  69 + }
  70 +
  71 + } failure:^(NSError *error) {
  72 +
  73 + }];
190 74
191 } 75 }
192 76
193 + (void)getAgreementH5WithType:(CNGetAgreementH5Type)type success:(SuccessBlock)success failure:(FailureBlock)failure { 77 + (void)getAgreementH5WithType:(CNGetAgreementH5Type)type success:(SuccessBlock)success failure:(FailureBlock)failure {
194 - [[CNUserAgreementManager shareInstance] getAgreementH5WithType:type success:^(NSString * _Nonnull h5, NSString * _Nonnull title) { 78 + [[CNUserAgreementManager manager] getAgreementH5WithType:type success:^(NSString * _Nonnull h5, NSString * _Nonnull title) {
195 success(h5, title); 79 success(h5, title);
196 80
197 } failure:^(NSError * _Nonnull error) { 81 } failure:^(NSError * _Nonnull error) {
@@ -201,4 +85,174 @@ @@ -201,4 +85,174 @@
201 85
202 } 86 }
203 87
  88 +- (void)getAgreementH5WithType:(CNGetAgreementH5Type)type success:(SuccessBlock)success failure:(FailureBlock)failure {
  89 + // [CNLiveNetworking setAllowRequestDefaultArgument:NO];
  90 + // [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:CNGetAgreementH5Url Param:@{} CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {
  91 + // if (error) {
  92 + // if (failure) {
  93 + // failure(error);
  94 + // }
  95 + // }
  96 + // else{
  97 + // if ([responseObject isKindOfClass:[NSArray class]]) {
  98 + //
  99 + // for (NSDictionary *dic in responseObject) {
  100 + //
  101 + // switch (type) {
  102 + // case CNAgreementUser:
  103 + // {
  104 + // if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"yhxy"]) {
  105 + // if (success) {
  106 + // success(dic[@"detailUrl"],dic[@"title"]);
  107 + // return ;
  108 + // }
  109 + // }
  110 + // }
  111 + // break;
  112 + // case CNAgreementPrivacy:
  113 + // {
  114 + // if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"yszc"]) {
  115 + // if (success) {
  116 + // success(dic[@"detailUrl"],dic[@"title"]);
  117 + // return ;
  118 + // }
  119 + // }
  120 + // }
  121 + // break;
  122 + // case CNAgreementHelp:
  123 + // {
  124 + // if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"bzfk"]) {
  125 + // if (success) {
  126 + // success(dic[@"detailUrl"],dic[@"title"]);
  127 + // return ;
  128 + // }
  129 + // }
  130 + // }
  131 + // break;
  132 + // case CNAgreementUnderstand:
  133 + // {
  134 + // if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"ljwjj"]) {
  135 + // if (success) {
  136 + // success(dic[@"detailUrl"],dic[@"title"]);
  137 + // return ;
  138 + // }
  139 + // }
  140 + // }
  141 + // break;
  142 + // case CNAgreementIntroduction:
  143 + // {
  144 + // if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"yyjj"]) {
  145 + // if (success) {
  146 + // success(dic[@"detailUrl"],dic[@"title"]);
  147 + // return ;
  148 + // }
  149 + // }
  150 + // }
  151 + // break;
  152 + // case CNAgreementCopyright:
  153 + // {
  154 + // if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"bqxx"]) {
  155 + // if (success) {
  156 + // success(dic[@"detailUrl"],dic[@"title"]);
  157 + // return ;
  158 + // }
  159 + // }
  160 + // }
  161 + // break;
  162 + // case CNAgreementPermission:
  163 + // {
  164 + // if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"rjxkxy"]) {
  165 + // if (success) {
  166 + // success(dic[@"detailUrl"],dic[@"title"]);
  167 + // return ;
  168 + // }
  169 + // }
  170 + // }
  171 + // break;
  172 + // case CNAgreementIntegralRules:
  173 + // {
  174 + // if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"jfgz"]) {
  175 + // if (success) {
  176 + // success(dic[@"detailUrl"],dic[@"title"]);
  177 + // return ;
  178 + // }
  179 + // }
  180 + // }
  181 + // break;
  182 + // case CNAgreementSigninRules:
  183 + // {
  184 + // if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"jfjlgz"]) {
  185 + // if (success) {
  186 + // success(dic[@"detailUrl"],dic[@"title"]);
  187 + // return ;
  188 + // }
  189 + // }
  190 + // }
  191 + // break;
  192 + // case CNAgreementReviewApply:
  193 + // {
  194 + // if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"shsqxy"]) {
  195 + // if (success) {
  196 + // success(dic[@"detailUrl"],dic[@"title"]);
  197 + // return ;
  198 + // }
  199 + // }
  200 + // }
  201 + // break;
  202 + // case CNAgreementCancellation:
  203 + // {
  204 + // if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"zxxz"]) {
  205 + // if (success) {
  206 + // success(dic[@"detailUrl"],dic[@"title"]);
  207 + // return ;
  208 + // }
  209 + // }
  210 + // }
  211 + // break;
  212 + // case CNAgreementEmojiService:
  213 + // {
  214 + // if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"fwsm"]) {
  215 + // if (success) {
  216 + // success(dic[@"detailUrl"],dic[@"title"]);
  217 + // return ;
  218 + // }
  219 + // }
  220 + // }
  221 + // break;
  222 + // case CNAgreementEmojiComplaints:
  223 + // {
  224 + // if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"tssm"]) {
  225 + // if (success) {
  226 + // success(dic[@"detailUrl"],dic[@"title"]);
  227 + // return ;
  228 + // }
  229 + // }
  230 + // }
  231 + // break;
  232 + // case CNAgreementEnterpriseQualification:
  233 + // {
  234 + // if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"qyzz"]) {
  235 + // if (success) {
  236 + // success(dic[@"detailUrl"],dic[@"title"]);
  237 + // return ;
  238 + // }
  239 + // }
  240 + // }
  241 + // break;
  242 + // default:
  243 + // break;
  244 + // }
  245 + //
  246 + // }
  247 + //
  248 + // }
  249 + // if (failure) {
  250 + // failure(error);
  251 + // }
  252 + // }
  253 + // }];
  254 + success(@"https://www.baidu.com", @"用户注册协议");
  255 +
  256 +}
  257 +
204 @end 258 @end
Example/CNLiveServices/UserAgreement/CNUserAgreementWebController.m
@@ -93,14 +93,14 @@ @@ -93,14 +93,14 @@
93 93
94 UIButton *leftBtn = [UIButton buttonWithType:UIButtonTypeSystem]; 94 UIButton *leftBtn = [UIButton buttonWithType:UIButtonTypeSystem];
95 leftBtn.frame = CGRectMake(0, 0, 44, 44); 95 leftBtn.frame = CGRectMake(0, 0, 44, 44);
96 - [leftBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];  
97 - leftBtn.titleLabel.font = [UIFont systemFontOfSize:16];  
98 - [leftBtn setImage:[[UIImage imageNamed:@"web_close"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal]; 96 + [leftBtn setImage:[[UIImage imageNamed:@"black_back"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
  97 + [leftBtn setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft];
  98 + leftBtn.imageEdgeInsets = UIEdgeInsetsMake(0,15,0,0);
99 [leftBtn addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside]; 99 [leftBtn addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside];
100 [navView addSubview:leftBtn]; 100 [navView addSubview:leftBtn];
101 101
102 - UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(([[UIScreen mainScreen] bounds].size.width - 150)/2.0, 0, 150, 44)];  
103 - titleLabel.font = [UIFont systemFontOfSize:16]; 102 + UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(([[UIScreen mainScreen] bounds].size.width - 200)/2.0, 0, 200, 44)];
  103 + titleLabel.font = [UIFont boldSystemFontOfSize:17];
104 titleLabel.textColor = [UIColor blackColor]; 104 titleLabel.textColor = [UIColor blackColor];
105 titleLabel.text = self.name; 105 titleLabel.text = self.name;
106 titleLabel.textAlignment = NSTextAlignmentCenter; 106 titleLabel.textAlignment = NSTextAlignmentCenter;
@@ -123,9 +123,9 @@ @@ -123,9 +123,9 @@
123 _webView.allowsBackForwardNavigationGestures = YES; 123 _webView.allowsBackForwardNavigationGestures = YES;
124 _webView.allowsLinkPreview = NO; 124 _webView.allowsLinkPreview = NO;
125 [self.view addSubview:self.webView]; 125 [self.view addSubview:self.webView];
126 - 126 +
127 self.processView = [[UIProgressView alloc] initWithFrame:CGRectMake(0, ([UIApplication sharedApplication].statusBarFrame.size.height+44)+0.5, [[UIScreen mainScreen] bounds].size.width, 1)]; 127 self.processView = [[UIProgressView alloc] initWithFrame:CGRectMake(0, ([UIApplication sharedApplication].statusBarFrame.size.height+44)+0.5, [[UIScreen mainScreen] bounds].size.width, 1)];
128 - _processView.progressTintColor = [UIColor colorWithRed:0.0 green:1.0 blue:0.0 alpha:1.0]; 128 + _processView.progressTintColor = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
129 _processView.trackTintColor = [UIColor whiteColor]; 129 _processView.trackTintColor = [UIColor whiteColor];
130 [self.view addSubview:self.processView]; 130 [self.view addSubview:self.processView];
131 131
@@ -159,7 +159,7 @@ @@ -159,7 +159,7 @@
159 159
160 // 当内容开始返回时调用 160 // 当内容开始返回时调用
161 - (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation{ 161 - (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation{
162 - // NSLog(@"%@",webView.URL); 162 +
163 } 163 }
164 164
165 // 页面加载完成之后调用 165 // 页面加载完成之后调用
@@ -179,8 +179,8 @@ @@ -179,8 +179,8 @@
179 } 179 }
180 180
181 #pragma mark - 响应方法 181 #pragma mark - 响应方法
182 -//回退goback  
183 -- (void)goback { 182 +//回退goBack
  183 +- (void)goBack {
184 if ([self.webView canGoBack]) { 184 if ([self.webView canGoBack]) {
185 [self.webView goBack]; 185 [self.webView goBack];
186 } 186 }
README.md
@@ -11,8 +11,8 @@ UserAgreement - 用户协议模块 @@ -11,8 +11,8 @@ UserAgreement - 用户协议模块
11 | 注意:对外只提供一个类的时候,可以这样写 11 | 注意:对外只提供一个类的时候,可以这样写
12 12
13 13
14 -Home - 发现模块  
15 -Found - 首页模块 14 +Home - 首页模块
  15 +Found - 发现模块
16 16
17 17
18 Login - 登录注册模块 18 Login - 登录注册模块