Commit 2290dfcc5e95a4a83bf2915f982e8271c21163fb
1 parent
d6ca3a6b
no message
Showing
5 changed files
with
66 additions
and
21 deletions
CNLiveScioLive/AppDelegate.h
| @@ -15,6 +15,8 @@ | @@ -15,6 +15,8 @@ | ||
| 15 | 15 | ||
| 16 | - (NSString *)showText:(NSString *)key; //用来替代以往的 NSString 方法 | 16 | - (NSString *)showText:(NSString *)key; //用来替代以往的 NSString 方法 |
| 17 | - (void)setApplicationLanguage; | 17 | - (void)setApplicationLanguage; |
| 18 | +- (void)initializeSDKConfiguration; | ||
| 19 | +- (void)initializeSDKConfigurationByLanguage:(BOOL)isChinese; | ||
| 18 | 20 | ||
| 19 | @end | 21 | @end |
| 20 | 22 |
CNLiveScioLive/AppDelegate.m
| @@ -35,22 +35,14 @@ | @@ -35,22 +35,14 @@ | ||
| 35 | [MobClick setLogEnabled:NO]; | 35 | [MobClick setLogEnabled:NO]; |
| 36 | [self regiestShareSDK]; | 36 | [self regiestShareSDK]; |
| 37 | 37 | ||
| 38 | + //语言 | ||
| 39 | + [self setApplicationLanguage]; | ||
| 40 | + | ||
| 38 | //推送 | 41 | //推送 |
| 39 | [self registerRemoteNotification]; | 42 | [self registerRemoteNotification]; |
| 40 | [self registerNotification:launchOptions]; | 43 | [self registerNotification:launchOptions]; |
| 41 | - | ||
| 42 | - //注册APP | ||
| 43 | - [CNLiveStat registerApp:CNLiveAppId appKey:CNLiveAppKey]; | ||
| 44 | - //初始化直播SDK | ||
| 45 | - [[CNLiveWebcastManager manager] initWithAppId:CNLiveAppId appKey:CNLiveAppKey]; | ||
| 46 | - //启动事件 | ||
| 47 | - [CNLiveStat event:@"start"]; | ||
| 48 | - //用户SDK初始化 | ||
| 49 | -// [CNLiveUserSystemCenter setAppId:CNLiveAppId appKey:CNLiveAppKey appSecret:CNLiveAppSecret]; | ||
| 50 | - [CNLiveUserSystemCenter setAppId:@"38_ivkou3xi05" appKey:@"a38d0547d9699d3c3b2cb4482c7166f313f484cc3262fe" appSecret:@"02243d3cdc1ee0650ee12fcf0cd4f1ec1ee9b8af018618"]; | ||
| 51 | 44 | ||
| 52 | - //语言 | ||
| 53 | - [self setApplicationLanguage]; | 45 | + [self initializeSDKConfiguration]; |
| 54 | 46 | ||
| 55 | if(IS_CHINESE){ | 47 | if(IS_CHINESE){ |
| 56 | CNHomeRightViewController *rightVC = [[CNHomeRightViewController alloc]init]; | 48 | CNHomeRightViewController *rightVC = [[CNHomeRightViewController alloc]init]; |
| @@ -281,6 +273,8 @@ | @@ -281,6 +273,8 @@ | ||
| 281 | if([self.window.rootViewController isKindOfClass:[UITabBarController class]] && self.window.rootViewController.childViewControllers.count > 0){ | 273 | if([self.window.rootViewController isKindOfClass:[UITabBarController class]] && self.window.rootViewController.childViewControllers.count > 0){ |
| 282 | UINavigationController *nav = self.window.rootViewController.childViewControllers[0]; | 274 | UINavigationController *nav = self.window.rootViewController.childViewControllers[0]; |
| 283 | 275 | ||
| 276 | + //判断推送消息是中文还是英文(初始化sdk配置) | ||
| 277 | + [self initializeSDKConfigurationByLanguage:YES]; | ||
| 284 | //视频 | 278 | //视频 |
| 285 | if([@"program" isEqualToString:dic[@"type"]]){ | 279 | if([@"program" isEqualToString:dic[@"type"]]){ |
| 286 | OldVideoDetailViewController *vc = [[OldVideoDetailViewController alloc] initWithDictionary:dic]; | 280 | OldVideoDetailViewController *vc = [[OldVideoDetailViewController alloc] initWithDictionary:dic]; |
| @@ -403,5 +397,46 @@ | @@ -403,5 +397,46 @@ | ||
| 403 | NSLog(@"token:%@",deviceToken); | 397 | NSLog(@"token:%@",deviceToken); |
| 404 | NSLog(@"%s, result %@, error %@", __FUNCTION__, error?@"NO":@"OK", error); | 398 | NSLog(@"%s, result %@, error %@", __FUNCTION__, error?@"NO":@"OK", error); |
| 405 | } | 399 | } |
| 400 | +- (void)initializeSDKConfiguration{ | ||
| 401 | + //注册APP | ||
| 402 | + [CNLiveStat registerApp:CNLiveAppId appKey:CNLiveAppKey]; | ||
| 403 | + //启动事件 | ||
| 404 | + [CNLiveStat event:@"start"]; | ||
| 405 | + | ||
| 406 | + //初始化直播SDK | ||
| 407 | + [[CNLiveWebcastManager manager] initWithAppId:CNLiveAppId appKey:CNLiveAppKey]; | ||
| 408 | + | ||
| 409 | + //用户SDK初始化 | ||
| 410 | +// [CNLiveUserSystemCenter setAppId:CNLiveAppId appKey:CNLiveAppKey appSecret:CNLiveAppSecret]; | ||
| 411 | + [CNLiveUserSystemCenter setAppId:@"38_ivkou3xi05" appKey:@"a38d0547d9699d3c3b2cb4482c7166f313f484cc3262fe" appSecret:@"02243d3cdc1ee0650ee12fcf0cd4f1ec1ee9b8af018618"]; | ||
| 412 | + | ||
| 413 | +} | ||
| 414 | +- (void)initializeSDKConfigurationByLanguage:(BOOL)isChinese{ | ||
| 415 | + if(isChinese){ | ||
| 416 | + //注册APP | ||
| 417 | + [CNLiveStat registerApp:@"38_ivkou3xi05" appKey:@"a38d0547d9699d3c3b2cb4482c7166f313f484cc3262fe"]; | ||
| 418 | + //启动事件 | ||
| 419 | + [CNLiveStat event:@"start"]; | ||
| 420 | + | ||
| 421 | + //初始化直播SDK | ||
| 422 | + [[CNLiveWebcastManager manager] initWithAppId:@"38_ivkou3xi05" appKey:@"a38d0547d9699d3c3b2cb4482c7166f313f484cc3262fe"]; | ||
| 423 | + | ||
| 424 | + //用户SDK初始化 | ||
| 425 | +// [CNLiveUserSystemCenter setAppId:@"38_ivkou3xi05" appKey:@"a38d0547d9699d3c3b2cb4482c7166f313f484cc3262fe" appSecret:@"02243d3cdc1ee0650ee12fcf0cd4f1ec1ee9b8af018618"]; | ||
| 426 | + | ||
| 427 | + }else{ | ||
| 428 | + //注册APP | ||
| 429 | + [CNLiveStat registerApp:@"858_jloqel8r83" appKey:@"84d2370e021b40bc41889d4011fce1fb8af85598a9fcae"]; | ||
| 430 | + //启动事件 | ||
| 431 | + [CNLiveStat event:@"start"]; | ||
| 432 | + | ||
| 433 | + //初始化直播SDK | ||
| 434 | + [[CNLiveWebcastManager manager] initWithAppId:@"858_jloqel8r83" appKey:@"84d2370e021b40bc41889d4011fce1fb8af85598a9fcae"]; | ||
| 435 | + | ||
| 436 | + //用户SDK初始化 | ||
| 437 | +// [CNLiveUserSystemCenter setAppId:@"858_jloqel8r83" appKey:@"84d2370e021b40bc41889d4011fce1fb8af85598a9fcae" appSecret:@"1d68c27291e847b3f4d8828420d8f5f2afbd77b492f1b8"]; | ||
| 438 | + } | ||
| 439 | + | ||
| 440 | +} | ||
| 406 | 441 | ||
| 407 | @end | 442 | @end |
CNLiveScioLive/Pages/Base/CNLiveBaseViewController.m
| @@ -108,7 +108,9 @@ | @@ -108,7 +108,9 @@ | ||
| 108 | UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"切换 Switch" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | 108 | UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"切换 Switch" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { |
| 109 | NSLog(@"点击了确定,进入确定的事件"); | 109 | NSLog(@"点击了确定,进入确定的事件"); |
| 110 | btn.selected = !btn.selected; | 110 | btn.selected = !btn.selected; |
| 111 | + | ||
| 111 | self->_appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; | 112 | self->_appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; |
| 113 | + | ||
| 112 | //本地存储语言版本 | 114 | //本地存储语言版本 |
| 113 | if (IS_CHINESE) { | 115 | if (IS_CHINESE) { |
| 114 | [[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@"en", nil] forKey:@"AppleLanguages"]; | 116 | [[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@"en", nil] forKey:@"AppleLanguages"]; |
| @@ -123,15 +125,15 @@ | @@ -123,15 +125,15 @@ | ||
| 123 | [User_Defaults synchronize]; | 125 | [User_Defaults synchronize]; |
| 124 | 126 | ||
| 125 | } | 127 | } |
| 126 | - //站点信息 | ||
| 127 | - //注册APP | ||
| 128 | - [CNLiveStat registerApp:CNLiveAppId appKey:CNLiveAppKey]; | ||
| 129 | - //初始化直播SDK | ||
| 130 | - [[CNLiveWebcastManager manager] initWithAppId:CNLiveAppId appKey:CNLiveAppKey]; | ||
| 131 | - //启动事件 | ||
| 132 | - [CNLiveStat event:@"start"]; | ||
| 133 | - //用户SDK初始化 | ||
| 134 | -// [CNLiveUserSystemCenter setAppId:CNLiveAppId appKey:CNLiveAppKey appSecret:CNLiveAppSecret]; | 128 | + |
| 129 | + [(AppDelegate *)[UIApplication sharedApplication].delegate initializeSDKConfiguration]; | ||
| 130 | +// if([[ZXWUserInformation shareZXWUserInformation] isLogin]){ | ||
| 131 | +// [[ZXWUserInformation shareZXWUserInformation] loginOut]; | ||
| 132 | +// // 取消第三方平台授权 | ||
| 133 | +// [ShareSDK cancelAuthorize:SSDKPlatformTypeWechat]; | ||
| 134 | +// [ShareSDK cancelAuthorize:SSDKPlatformTypeQQ]; | ||
| 135 | +// [ShareSDK cancelAuthorize:SSDKPlatformTypeSinaWeibo]; | ||
| 136 | +// } | ||
| 135 | 137 | ||
| 136 | //切换RootViewController | 138 | //切换RootViewController |
| 137 | if(IS_CHINESE){ | 139 | if(IS_CHINESE){ |
CNLiveScioLive/Pages/Home/新闻详情/OldController/OldArticleDetailViewController.m
| @@ -120,6 +120,11 @@ | @@ -120,6 +120,11 @@ | ||
| 120 | self.navigationItem.title = _dictionary[@"cmsColumnName"]; | 120 | self.navigationItem.title = _dictionary[@"cmsColumnName"]; |
| 121 | 121 | ||
| 122 | } | 122 | } |
| 123 | +- (void)goBack{ | ||
| 124 | + [(AppDelegate *)[UIApplication sharedApplication].delegate initializeSDKConfiguration]; | ||
| 125 | + [self.navigationController popViewControllerAnimated:YES]; | ||
| 126 | + | ||
| 127 | +} | ||
| 123 | - (void)loadShareView { | 128 | - (void)loadShareView { |
| 124 | UIImageView *lineImage = [[UIImageView alloc] init]; | 129 | UIImageView *lineImage = [[UIImageView alloc] init]; |
| 125 | if (iPhoneX) { | 130 | if (iPhoneX) { |
CNLiveScioLive/Pages/Home/新闻详情/OldController/OldVideoDetailViewController.m
| @@ -343,6 +343,7 @@ | @@ -343,6 +343,7 @@ | ||
| 343 | } | 343 | } |
| 344 | 344 | ||
| 345 | - (void)backButtonAction:(UIButton *)sender { | 345 | - (void)backButtonAction:(UIButton *)sender { |
| 346 | + [(AppDelegate *)[UIApplication sharedApplication].delegate initializeSDKConfiguration]; | ||
| 346 | [self.navigationController popViewControllerAnimated:YES]; | 347 | [self.navigationController popViewControllerAnimated:YES]; |
| 347 | } | 348 | } |
| 348 | 349 |