Commit a94bbb447c04852ab3a0c3e5fd5c304c87f3a6ec
1 parent
d9f394cb
no message
Showing
6 changed files
with
38 additions
and
61 deletions
CNLiveUserAgreementManager.podspec
| @@ -48,6 +48,9 @@ TODO: 网家家-用户协议管理类. | @@ -48,6 +48,9 @@ TODO: 网家家-用户协议管理类. | ||
| 48 | # 类别 | 48 | # 类别 |
| 49 | s.dependency 'CNLiveCategory' | 49 | s.dependency 'CNLiveCategory' |
| 50 | 50 | ||
| 51 | + # 管理类 | ||
| 52 | + s.dependency 'CNLiveManager' | ||
| 53 | + | ||
| 51 | # 基类 | 54 | # 基类 |
| 52 | s.dependency 'CNLiveBaseClass' | 55 | s.dependency 'CNLiveBaseClass' |
| 53 | 56 |
CNLiveUserAgreementManager/Classes/CNLiveUserAgreementController.m
| @@ -15,7 +15,6 @@ | @@ -15,7 +15,6 @@ | ||
| 15 | @end | 15 | @end |
| 16 | 16 | ||
| 17 | @implementation CNLiveUserAgreementController | 17 | @implementation CNLiveUserAgreementController |
| 18 | - | ||
| 19 | #pragma mark - 交互 | 18 | #pragma mark - 交互 |
| 20 | - (void)interaction { | 19 | - (void)interaction { |
| 21 | [super interaction]; | 20 | [super interaction]; |
| @@ -41,7 +40,7 @@ | @@ -41,7 +40,7 @@ | ||
| 41 | 40 | ||
| 42 | #pragma mark - CNLiveWebViewDelegate | 41 | #pragma mark - CNLiveWebViewDelegate |
| 43 | - (void)webView:(CNLiveWebView *)webView didFinishLoadWithURL:(NSURL *)url { | 42 | - (void)webView:(CNLiveWebView *)webView didFinishLoadWithURL:(NSURL *)url { |
| 44 | - NSLog(@"CNLIVEViewController - didFinishLoad"); | 43 | + NSLog(@"CNLiveUserAgreementController - didFinishLoad"); |
| 45 | if(self.title.length == 0){ | 44 | if(self.title.length == 0){ |
| 46 | self.title = webView.title; | 45 | self.title = webView.title; |
| 47 | } | 46 | } |
CNLiveUserAgreementManager/Classes/CNLiveUserAgreementManager.h
| @@ -29,7 +29,7 @@ typedef NS_ENUM(NSUInteger, CNLiveGetAgreementH5Type) { | @@ -29,7 +29,7 @@ typedef NS_ENUM(NSUInteger, CNLiveGetAgreementH5Type) { | ||
| 29 | 29 | ||
| 30 | }; | 30 | }; |
| 31 | 31 | ||
| 32 | -typedef void(^SuccessBlock)(NSString *h5, NSString *title, BOOL isShow); | 32 | +typedef void(^SuccessBlock)(NSString *h5, NSString *title, BOOL closeHidden); |
| 33 | typedef void(^FailureBlock)(NSError *error); | 33 | typedef void(^FailureBlock)(NSError *error); |
| 34 | 34 | ||
| 35 | @interface CNLiveUserAgreementManager : NSObject | 35 | @interface CNLiveUserAgreementManager : NSObject |
CNLiveUserAgreementManager/Classes/CNLiveUserAgreementManager.m
| @@ -9,6 +9,7 @@ | @@ -9,6 +9,7 @@ | ||
| 9 | #import <CNLiveRequestBastKit/CNLiveNetworking.h> | 9 | #import <CNLiveRequestBastKit/CNLiveNetworking.h> |
| 10 | #import "CNLiveEnvironment.h" | 10 | #import "CNLiveEnvironment.h" |
| 11 | #import "CNLiveUserAgreementController.h" | 11 | #import "CNLiveUserAgreementController.h" |
| 12 | +#import "CNLiveManager.h" | ||
| 12 | 13 | ||
| 13 | @interface CNLiveUserAgreementManager() | 14 | @interface CNLiveUserAgreementManager() |
| 14 | 15 | ||
| @@ -63,7 +64,7 @@ static CNLiveUserAgreementManager *_instance = nil; | @@ -63,7 +64,7 @@ static CNLiveUserAgreementManager *_instance = nil; | ||
| 63 | } | 64 | } |
| 64 | else{ | 65 | else{ |
| 65 | if ([responseObject isKindOfClass:[NSArray class]]) { | 66 | if ([responseObject isKindOfClass:[NSArray class]]) { |
| 66 | - | 67 | + BOOL closeHidden = NO; |
| 67 | for (NSDictionary *dic in responseObject) { | 68 | for (NSDictionary *dic in responseObject) { |
| 68 | 69 | ||
| 69 | switch (type) { | 70 | switch (type) { |
| @@ -71,7 +72,7 @@ static CNLiveUserAgreementManager *_instance = nil; | @@ -71,7 +72,7 @@ static CNLiveUserAgreementManager *_instance = nil; | ||
| 71 | { | 72 | { |
| 72 | if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"yhxy"]) { | 73 | if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"yhxy"]) { |
| 73 | if (success) { | 74 | if (success) { |
| 74 | - success(dic[@"detailUrl"], dic[@"title"], YES); | 75 | + success(dic[@"detailUrl"], dic[@"title"], closeHidden); |
| 75 | return ; | 76 | return ; |
| 76 | } | 77 | } |
| 77 | } | 78 | } |
| @@ -81,7 +82,7 @@ static CNLiveUserAgreementManager *_instance = nil; | @@ -81,7 +82,7 @@ static CNLiveUserAgreementManager *_instance = nil; | ||
| 81 | { | 82 | { |
| 82 | if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"yszc"]) { | 83 | if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"yszc"]) { |
| 83 | if (success) { | 84 | if (success) { |
| 84 | - success(dic[@"detailUrl"], dic[@"title"], YES); | 85 | + success(dic[@"detailUrl"], dic[@"title"], closeHidden); |
| 85 | return ; | 86 | return ; |
| 86 | } | 87 | } |
| 87 | } | 88 | } |
| @@ -91,7 +92,7 @@ static CNLiveUserAgreementManager *_instance = nil; | @@ -91,7 +92,7 @@ static CNLiveUserAgreementManager *_instance = nil; | ||
| 91 | { | 92 | { |
| 92 | if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"bzfk"]) { | 93 | if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"bzfk"]) { |
| 93 | if (success) { | 94 | if (success) { |
| 94 | - success(dic[@"detailUrl"], dic[@"title"], YES); | 95 | + success(dic[@"detailUrl"], dic[@"title"], closeHidden); |
| 95 | return ; | 96 | return ; |
| 96 | } | 97 | } |
| 97 | } | 98 | } |
| @@ -101,7 +102,7 @@ static CNLiveUserAgreementManager *_instance = nil; | @@ -101,7 +102,7 @@ static CNLiveUserAgreementManager *_instance = nil; | ||
| 101 | { | 102 | { |
| 102 | if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"ljwjj"]) { | 103 | if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:@"ljwjj"]) { |
| 103 | if (success) { | 104 | if (success) { |
| 104 | - success(dic[@"detailUrl"], dic[@"title"], YES); | 105 | + success(dic[@"detailUrl"], dic[@"title"], closeHidden); |
| 105 | return ; | 106 | return ; |
| 106 | } | 107 | } |
| 107 | } | 108 | } |
| @@ -111,7 +112,7 @@ static CNLiveUserAgreementManager *_instance = nil; | @@ -111,7 +112,7 @@ static CNLiveUserAgreementManager *_instance = nil; | ||
| 111 | { | 112 | { |
| 112 | if ([[NSString stringWithFormat:@"%@", dic[@"type"]] isEqualToString:@"yyjj"]) { | 113 | if ([[NSString stringWithFormat:@"%@", dic[@"type"]] isEqualToString:@"yyjj"]) { |
| 113 | if (success) { | 114 | if (success) { |
| 114 | - success(dic[@"detailUrl"], dic[@"title"], YES); | 115 | + success(dic[@"detailUrl"], dic[@"title"], closeHidden); |
| 115 | return ; | 116 | return ; |
| 116 | } | 117 | } |
| 117 | } | 118 | } |
| @@ -121,7 +122,7 @@ static CNLiveUserAgreementManager *_instance = nil; | @@ -121,7 +122,7 @@ static CNLiveUserAgreementManager *_instance = nil; | ||
| 121 | { | 122 | { |
| 122 | if ([[NSString stringWithFormat:@"%@", dic[@"type"]] isEqualToString:@"bqxx"]) { | 123 | if ([[NSString stringWithFormat:@"%@", dic[@"type"]] isEqualToString:@"bqxx"]) { |
| 123 | if (success) { | 124 | if (success) { |
| 124 | - success(dic[@"detailUrl"], dic[@"title"], YES); | 125 | + success(dic[@"detailUrl"], dic[@"title"], closeHidden); |
| 125 | return ; | 126 | return ; |
| 126 | } | 127 | } |
| 127 | } | 128 | } |
| @@ -131,7 +132,7 @@ static CNLiveUserAgreementManager *_instance = nil; | @@ -131,7 +132,7 @@ static CNLiveUserAgreementManager *_instance = nil; | ||
| 131 | { | 132 | { |
| 132 | if ([[NSString stringWithFormat:@"%@", dic[@"type"]] isEqualToString:@"rjxkxy"]) { | 133 | if ([[NSString stringWithFormat:@"%@", dic[@"type"]] isEqualToString:@"rjxkxy"]) { |
| 133 | if (success) { | 134 | if (success) { |
| 134 | - success(dic[@"detailUrl"], dic[@"title"], YES); | 135 | + success(dic[@"detailUrl"], dic[@"title"], closeHidden); |
| 135 | return ; | 136 | return ; |
| 136 | } | 137 | } |
| 137 | } | 138 | } |
| @@ -141,7 +142,7 @@ static CNLiveUserAgreementManager *_instance = nil; | @@ -141,7 +142,7 @@ static CNLiveUserAgreementManager *_instance = nil; | ||
| 141 | { | 142 | { |
| 142 | if ([[NSString stringWithFormat:@"%@", dic[@"type"]] isEqualToString:@"jfgz"]) { | 143 | if ([[NSString stringWithFormat:@"%@", dic[@"type"]] isEqualToString:@"jfgz"]) { |
| 143 | if (success) { | 144 | if (success) { |
| 144 | - success(dic[@"detailUrl"], dic[@"title"], YES); | 145 | + success(dic[@"detailUrl"], dic[@"title"], closeHidden); |
| 145 | return ; | 146 | return ; |
| 146 | } | 147 | } |
| 147 | } | 148 | } |
| @@ -151,7 +152,7 @@ static CNLiveUserAgreementManager *_instance = nil; | @@ -151,7 +152,7 @@ static CNLiveUserAgreementManager *_instance = nil; | ||
| 151 | { | 152 | { |
| 152 | if ([[NSString stringWithFormat:@"%@", dic[@"type"]] isEqualToString:@"jfjlgz"]) { | 153 | if ([[NSString stringWithFormat:@"%@", dic[@"type"]] isEqualToString:@"jfjlgz"]) { |
| 153 | if (success) { | 154 | if (success) { |
| 154 | - success(dic[@"detailUrl"], dic[@"title"], YES); | 155 | + success(dic[@"detailUrl"], dic[@"title"], closeHidden); |
| 155 | return ; | 156 | return ; |
| 156 | } | 157 | } |
| 157 | } | 158 | } |
| @@ -161,7 +162,7 @@ static CNLiveUserAgreementManager *_instance = nil; | @@ -161,7 +162,7 @@ static CNLiveUserAgreementManager *_instance = nil; | ||
| 161 | { | 162 | { |
| 162 | if ([[NSString stringWithFormat:@"%@", dic[@"type"]] isEqualToString:@"shsqxy"]) { | 163 | if ([[NSString stringWithFormat:@"%@", dic[@"type"]] isEqualToString:@"shsqxy"]) { |
| 163 | if (success) { | 164 | if (success) { |
| 164 | - success(dic[@"detailUrl"], dic[@"title"], YES); | 165 | + success(dic[@"detailUrl"], dic[@"title"], closeHidden); |
| 165 | return ; | 166 | return ; |
| 166 | } | 167 | } |
| 167 | } | 168 | } |
| @@ -171,7 +172,7 @@ static CNLiveUserAgreementManager *_instance = nil; | @@ -171,7 +172,7 @@ static CNLiveUserAgreementManager *_instance = nil; | ||
| 171 | { | 172 | { |
| 172 | if ([[NSString stringWithFormat:@"%@", dic[@"type"]] isEqualToString:@"zxxz"]) { | 173 | if ([[NSString stringWithFormat:@"%@", dic[@"type"]] isEqualToString:@"zxxz"]) { |
| 173 | if (success) { | 174 | if (success) { |
| 174 | - success(dic[@"detailUrl"], dic[@"title"], YES); | 175 | + success(dic[@"detailUrl"], dic[@"title"], closeHidden); |
| 175 | return ; | 176 | return ; |
| 176 | } | 177 | } |
| 177 | } | 178 | } |
| @@ -181,7 +182,7 @@ static CNLiveUserAgreementManager *_instance = nil; | @@ -181,7 +182,7 @@ static CNLiveUserAgreementManager *_instance = nil; | ||
| 181 | { | 182 | { |
| 182 | if ([[NSString stringWithFormat:@"%@", dic[@"type"]] isEqualToString:@"fwsm"]) { | 183 | if ([[NSString stringWithFormat:@"%@", dic[@"type"]] isEqualToString:@"fwsm"]) { |
| 183 | if (success) { | 184 | if (success) { |
| 184 | - success(dic[@"detailUrl"], dic[@"title"], YES); | 185 | + success(dic[@"detailUrl"], dic[@"title"], closeHidden); |
| 185 | return ; | 186 | return ; |
| 186 | } | 187 | } |
| 187 | } | 188 | } |
| @@ -191,7 +192,7 @@ static CNLiveUserAgreementManager *_instance = nil; | @@ -191,7 +192,7 @@ static CNLiveUserAgreementManager *_instance = nil; | ||
| 191 | { | 192 | { |
| 192 | if ([[NSString stringWithFormat:@"%@", dic[@"type"]] isEqualToString:@"tssm"]) { | 193 | if ([[NSString stringWithFormat:@"%@", dic[@"type"]] isEqualToString:@"tssm"]) { |
| 193 | if (success) { | 194 | if (success) { |
| 194 | - success(dic[@"detailUrl"], dic[@"title"], YES); | 195 | + success(dic[@"detailUrl"], dic[@"title"], closeHidden); |
| 195 | return ; | 196 | return ; |
| 196 | } | 197 | } |
| 197 | } | 198 | } |
| @@ -201,7 +202,7 @@ static CNLiveUserAgreementManager *_instance = nil; | @@ -201,7 +202,7 @@ static CNLiveUserAgreementManager *_instance = nil; | ||
| 201 | { | 202 | { |
| 202 | if ([[NSString stringWithFormat:@"%@", dic[@"type"]] isEqualToString:@"qyzz"]) { | 203 | if ([[NSString stringWithFormat:@"%@", dic[@"type"]] isEqualToString:@"qyzz"]) { |
| 203 | if (success) { | 204 | if (success) { |
| 204 | - success(dic[@"detailUrl"], dic[@"title"], YES); | 205 | + success(dic[@"detailUrl"], dic[@"title"], closeHidden); |
| 205 | return ; | 206 | return ; |
| 206 | } | 207 | } |
| 207 | } | 208 | } |
| @@ -211,7 +212,7 @@ static CNLiveUserAgreementManager *_instance = nil; | @@ -211,7 +212,7 @@ static CNLiveUserAgreementManager *_instance = nil; | ||
| 211 | { | 212 | { |
| 212 | if ([[NSString stringWithFormat:@"%@", dic[@"type"]] isEqualToString:@"ypxy"]) { | 213 | if ([[NSString stringWithFormat:@"%@", dic[@"type"]] isEqualToString:@"ypxy"]) { |
| 213 | if (success) { | 214 | if (success) { |
| 214 | - success(dic[@"detailUrl"], dic[@"title"], YES); | 215 | + success(dic[@"detailUrl"], dic[@"title"], closeHidden); |
| 215 | return ; | 216 | return ; |
| 216 | } | 217 | } |
| 217 | } | 218 | } |
| @@ -239,8 +240,8 @@ static CNLiveUserAgreementManager *_instance = nil; | @@ -239,8 +240,8 @@ static CNLiveUserAgreementManager *_instance = nil; | ||
| 239 | * @param failure 请求失败回调 | 240 | * @param failure 请求失败回调 |
| 240 | */ | 241 | */ |
| 241 | + (void)getAgreementH5WithType:(CNLiveGetAgreementH5Type)type success:(SuccessBlock)success failure:(FailureBlock)failure { | 242 | + (void)getAgreementH5WithType:(CNLiveGetAgreementH5Type)type success:(SuccessBlock)success failure:(FailureBlock)failure { |
| 242 | - [[CNLiveUserAgreementManager manager] getAgreementH5WithType:type success:^(NSString * _Nonnull h5, NSString * _Nonnull title, BOOL isShow) { | ||
| 243 | - success?success(h5, title, isShow):@""; | 243 | + [[CNLiveUserAgreementManager manager] getAgreementH5WithType:type success:^(NSString * _Nonnull h5, NSString * _Nonnull title, BOOL closeHidden) { |
| 244 | + success?success(h5, title, closeHidden):@""; | ||
| 244 | 245 | ||
| 245 | } failure:^(NSError * _Nonnull error) { | 246 | } failure:^(NSError * _Nonnull error) { |
| 246 | failure?failure(error):@""; | 247 | failure?failure(error):@""; |
| @@ -255,10 +256,10 @@ static CNLiveUserAgreementManager *_instance = nil; | @@ -255,10 +256,10 @@ static CNLiveUserAgreementManager *_instance = nil; | ||
| 255 | */ | 256 | */ |
| 256 | + (void)jumpToAgreementH5WithType:(CNLiveGetAgreementH5Type)type{ | 257 | + (void)jumpToAgreementH5WithType:(CNLiveGetAgreementH5Type)type{ |
| 257 | __weak typeof(self) weakSelf = self; | 258 | __weak typeof(self) weakSelf = self; |
| 258 | - [CNLiveUserAgreementManager getAgreementH5WithType:type success:^(NSString *h5, NSString *title, BOOL isShow) { | 259 | + [CNLiveUserAgreementManager getAgreementH5WithType:type success:^(NSString *h5, NSString *title, BOOL closeHidden) { |
| 259 | __strong typeof(weakSelf) strongSelf = weakSelf; | 260 | __strong typeof(weakSelf) strongSelf = weakSelf; |
| 260 | if(!strongSelf) return; | 261 | if(!strongSelf) return; |
| 261 | - [strongSelf pushToWebControllerUrl:h5 name:title showCloseBtn:isShow]; | 262 | + [strongSelf pushToWebControllerUrl:h5 name:title closeHidden:closeHidden]; |
| 262 | 263 | ||
| 263 | } failure:^(NSError *error) { | 264 | } failure:^(NSError *error) { |
| 264 | if(TestEnvironment){ | 265 | if(TestEnvironment){ |
| @@ -276,10 +277,10 @@ static CNLiveUserAgreementManager *_instance = nil; | @@ -276,10 +277,10 @@ static CNLiveUserAgreementManager *_instance = nil; | ||
| 276 | */ | 277 | */ |
| 277 | + (void)jumpToAgreementH5WithString:(NSString *)string { | 278 | + (void)jumpToAgreementH5WithString:(NSString *)string { |
| 278 | __weak typeof(self) weakSelf = self; | 279 | __weak typeof(self) weakSelf = self; |
| 279 | - [CNLiveUserAgreementManager getAgreementH5WithString:string success:^(NSString *h5, NSString *title, BOOL isShow) { | 280 | + [CNLiveUserAgreementManager getAgreementH5WithString:string success:^(NSString *h5, NSString *title, BOOL closeHidden) { |
| 280 | __strong typeof(weakSelf) strongSelf = weakSelf; | 281 | __strong typeof(weakSelf) strongSelf = weakSelf; |
| 281 | if(!strongSelf) return; | 282 | if(!strongSelf) return; |
| 282 | - [strongSelf pushToWebControllerUrl:h5 name:title showCloseBtn:isShow]; | 283 | + [strongSelf pushToWebControllerUrl:h5 name:title closeHidden:closeHidden]; |
| 283 | 284 | ||
| 284 | } failure:^(NSError *error) { | 285 | } failure:^(NSError *error) { |
| 285 | if(TestEnvironment){ | 286 | if(TestEnvironment){ |
| @@ -297,8 +298,8 @@ static CNLiveUserAgreementManager *_instance = nil; | @@ -297,8 +298,8 @@ static CNLiveUserAgreementManager *_instance = nil; | ||
| 297 | * @param failure 请求失败回调 | 298 | * @param failure 请求失败回调 |
| 298 | */ | 299 | */ |
| 299 | + (void)getAgreementH5WithString:(NSString *)string success:(SuccessBlock)success failure:(FailureBlock)failure{ | 300 | + (void)getAgreementH5WithString:(NSString *)string success:(SuccessBlock)success failure:(FailureBlock)failure{ |
| 300 | - [[CNLiveUserAgreementManager manager] getAgreementH5WithString:string success:^(NSString *h5, NSString *title, BOOL isShow) { | ||
| 301 | - success?success(h5, title, isShow):@""; | 301 | + [[CNLiveUserAgreementManager manager] getAgreementH5WithString:string success:^(NSString *h5, NSString *title, BOOL closeHidden) { |
| 302 | + success?success(h5, title, closeHidden):@""; | ||
| 302 | 303 | ||
| 303 | } failure:^(NSError *error) { | 304 | } failure:^(NSError *error) { |
| 304 | failure?failure(error):@""; | 305 | failure?failure(error):@""; |
| @@ -319,15 +320,12 @@ static CNLiveUserAgreementManager *_instance = nil; | @@ -319,15 +320,12 @@ static CNLiveUserAgreementManager *_instance = nil; | ||
| 319 | if ([responseObject isKindOfClass:[NSArray class]]) { | 320 | if ([responseObject isKindOfClass:[NSArray class]]) { |
| 320 | for (NSDictionary *dic in responseObject) { | 321 | for (NSDictionary *dic in responseObject) { |
| 321 | if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:string]) { | 322 | if ([[NSString stringWithFormat:@"%@",dic[@"type"]] isEqualToString:string]) { |
| 322 | - success?success(dic[@"detailUrl"], dic[@"title"], YES):@""; | 323 | + success?success(dic[@"detailUrl"], dic[@"title"], NO):@""; |
| 323 | return; | 324 | return; |
| 324 | } | 325 | } |
| 325 | - | ||
| 326 | } | 326 | } |
| 327 | - | ||
| 328 | } | 327 | } |
| 329 | failure?failure(error):@""; | 328 | failure?failure(error):@""; |
| 330 | - | ||
| 331 | 329 | ||
| 332 | }else{ | 330 | }else{ |
| 333 | failure?failure(error):@""; | 331 | failure?failure(error):@""; |
| @@ -337,34 +335,9 @@ static CNLiveUserAgreementManager *_instance = nil; | @@ -337,34 +335,9 @@ static CNLiveUserAgreementManager *_instance = nil; | ||
| 337 | } | 335 | } |
| 338 | 336 | ||
| 339 | #pragma mark - 跳转控制器 | 337 | #pragma mark - 跳转控制器 |
| 340 | -+ (void)pushToWebControllerUrl:(NSString *)url name:(NSString *)name showCloseBtn:(BOOL)isShow{ | ||
| 341 | - UIViewController *root = [UIApplication sharedApplication].delegate.window.rootViewController; | ||
| 342 | - | ||
| 343 | - //跟控制器是Navigation | ||
| 344 | - if ([root isKindOfClass:[UINavigationController class]]){ | ||
| 345 | - UINavigationController *nav = (UINavigationController *)root; | ||
| 346 | - CNLiveUserAgreementController *vc = [[CNLiveUserAgreementController alloc] initWithUrl:url title:name closeHidden:isShow]; | ||
| 347 | - [nav pushViewController:vc animated:YES]; | ||
| 348 | - | ||
| 349 | - } | ||
| 350 | - //跟控制器是TabBar | ||
| 351 | - else if ([root isKindOfClass:[UITabBarController class]]){ | ||
| 352 | - UITabBarController *tab = (UITabBarController *)root; | ||
| 353 | - UIViewController *selected = tab.selectedViewController; | ||
| 354 | - if ([selected isKindOfClass:[UINavigationController class]]){ | ||
| 355 | - UINavigationController *nav = (UINavigationController *)selected; | ||
| 356 | - CNLiveUserAgreementController *vc = [[CNLiveUserAgreementController alloc] initWithUrl:url title:name closeHidden:isShow]; | ||
| 357 | - [nav pushViewController:vc animated:YES]; | ||
| 358 | - }else{ | ||
| 359 | - CNLiveUserAgreementController *vc = [[CNLiveUserAgreementController alloc] initWithUrl:url title:name closeHidden:isShow]; | ||
| 360 | - [root presentViewController:vc animated:YES completion:nil]; | ||
| 361 | - } | ||
| 362 | - | ||
| 363 | - }else{ | ||
| 364 | - CNLiveUserAgreementController *vc = [[CNLiveUserAgreementController alloc] initWithUrl:url title:name closeHidden:isShow]; | ||
| 365 | - [root presentViewController:vc animated:YES completion:nil]; | ||
| 366 | - | ||
| 367 | - } | 338 | ++ (void)pushToWebControllerUrl:(NSString *)url name:(NSString *)name closeHidden:(BOOL)closeHidden{ |
| 339 | + CNLiveUserAgreementController *vc = [[CNLiveUserAgreementController alloc] initWithUrl:url title:name closeHidden:closeHidden]; | ||
| 340 | + [CNLivePageJumpManager jumpViewController:vc]; | ||
| 368 | 341 | ||
| 369 | } | 342 | } |
| 370 | 343 |
Example/CNLiveUserAgreementManager.xcodeproj/project.pbxproj
| @@ -354,6 +354,7 @@ | @@ -354,6 +354,7 @@ | ||
| 354 | "${BUILT_PRODUCTS_DIR}/CNLiveCategory/CNLiveCategory.framework", | 354 | "${BUILT_PRODUCTS_DIR}/CNLiveCategory/CNLiveCategory.framework", |
| 355 | "${BUILT_PRODUCTS_DIR}/CNLiveCustomControl/CNLiveCustomControl.framework", | 355 | "${BUILT_PRODUCTS_DIR}/CNLiveCustomControl/CNLiveCustomControl.framework", |
| 356 | "${BUILT_PRODUCTS_DIR}/CNLiveEnvironment/CNLiveEnvironment.framework", | 356 | "${BUILT_PRODUCTS_DIR}/CNLiveEnvironment/CNLiveEnvironment.framework", |
| 357 | + "${BUILT_PRODUCTS_DIR}/CNLiveManager/CNLiveManager.framework", | ||
| 357 | "${BUILT_PRODUCTS_DIR}/CNLiveRequestBastKit/CNLiveRequestBastKit.framework", | 358 | "${BUILT_PRODUCTS_DIR}/CNLiveRequestBastKit/CNLiveRequestBastKit.framework", |
| 358 | "${BUILT_PRODUCTS_DIR}/CNLiveTripartiteManagement/CNLiveTripartiteManagement.framework", | 359 | "${BUILT_PRODUCTS_DIR}/CNLiveTripartiteManagement/CNLiveTripartiteManagement.framework", |
| 359 | "${BUILT_PRODUCTS_DIR}/CNLiveUserAgreementManager/CNLiveUserAgreementManager.framework", | 360 | "${BUILT_PRODUCTS_DIR}/CNLiveUserAgreementManager/CNLiveUserAgreementManager.framework", |
| @@ -368,6 +369,7 @@ | @@ -368,6 +369,7 @@ | ||
| 368 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCategory.framework", | 369 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCategory.framework", |
| 369 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCustomControl.framework", | 370 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCustomControl.framework", |
| 370 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveEnvironment.framework", | 371 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveEnvironment.framework", |
| 372 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveManager.framework", | ||
| 371 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveRequestBastKit.framework", | 373 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveRequestBastKit.framework", |
| 372 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveTripartiteManagement.framework", | 374 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveTripartiteManagement.framework", |
| 373 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveUserAgreementManager.framework", | 375 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveUserAgreementManager.framework", |
Example/CNLiveUserAgreementManager/CNLiveViewController.m
| @@ -35,11 +35,11 @@ | @@ -35,11 +35,11 @@ | ||
| 35 | 35 | ||
| 36 | } | 36 | } |
| 37 | - (void)testButtonClicked { | 37 | - (void)testButtonClicked { |
| 38 | -// [CNLiveUserAgreementManager jumpToAgreementH5WithType:CNLiveUserAgreementCancellation]; | 38 | + [CNLiveUserAgreementManager jumpToAgreementH5WithType:CNLiveUserAgreementCancellation]; |
| 39 | // [CNLiveUserAgreementManager jumpToAgreementH5WithString:@"yhxy"]; | 39 | // [CNLiveUserAgreementManager jumpToAgreementH5WithString:@"yhxy"]; |
| 40 | [CNLiveUserAgreementManager getAgreementH5WithType:CNLiveUserAgreementCancellation success:^(NSString * _Nonnull h5, NSString * _Nonnull title, BOOL isShow) { | 40 | [CNLiveUserAgreementManager getAgreementH5WithType:CNLiveUserAgreementCancellation success:^(NSString * _Nonnull h5, NSString * _Nonnull title, BOOL isShow) { |
| 41 | CNLiveUserAgreementController *vc = [[CNLiveUserAgreementController alloc] initWithUrl:h5 title:title closeHidden:NO]; | 41 | CNLiveUserAgreementController *vc = [[CNLiveUserAgreementController alloc] initWithUrl:h5 title:title closeHidden:NO]; |
| 42 | - [self.navigationController pushViewController:vc animated:YES]; | 42 | +// [self.navigationController pushViewController:vc animated:YES]; |
| 43 | 43 | ||
| 44 | } failure:^(NSError * _Nonnull error) { | 44 | } failure:^(NSError * _Nonnull error) { |
| 45 | 45 |