Commit 2290dfcc5e95a4a83bf2915f982e8271c21163fb
1 parent
d6ca3a6b
no message
Showing
5 changed files
with
66 additions
and
21 deletions
CNLiveScioLive/AppDelegate.h
CNLiveScioLive/AppDelegate.m
| ... | ... | @@ -35,22 +35,14 @@ |
| 35 | 35 | [MobClick setLogEnabled:NO]; |
| 36 | 36 | [self regiestShareSDK]; |
| 37 | 37 | |
| 38 | + //语言 | |
| 39 | + [self setApplicationLanguage]; | |
| 40 | + | |
| 38 | 41 | //推送 |
| 39 | 42 | [self registerRemoteNotification]; |
| 40 | 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 | 47 | if(IS_CHINESE){ |
| 56 | 48 | CNHomeRightViewController *rightVC = [[CNHomeRightViewController alloc]init]; |
| ... | ... | @@ -281,6 +273,8 @@ |
| 281 | 273 | if([self.window.rootViewController isKindOfClass:[UITabBarController class]] && self.window.rootViewController.childViewControllers.count > 0){ |
| 282 | 274 | UINavigationController *nav = self.window.rootViewController.childViewControllers[0]; |
| 283 | 275 | |
| 276 | + //判断推送消息是中文还是英文(初始化sdk配置) | |
| 277 | + [self initializeSDKConfigurationByLanguage:YES]; | |
| 284 | 278 | //视频 |
| 285 | 279 | if([@"program" isEqualToString:dic[@"type"]]){ |
| 286 | 280 | OldVideoDetailViewController *vc = [[OldVideoDetailViewController alloc] initWithDictionary:dic]; |
| ... | ... | @@ -403,5 +397,46 @@ |
| 403 | 397 | NSLog(@"token:%@",deviceToken); |
| 404 | 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 | 442 | @end | ... | ... |
CNLiveScioLive/Pages/Base/CNLiveBaseViewController.m
| ... | ... | @@ -108,7 +108,9 @@ |
| 108 | 108 | UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"切换 Switch" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { |
| 109 | 109 | NSLog(@"点击了确定,进入确定的事件"); |
| 110 | 110 | btn.selected = !btn.selected; |
| 111 | + | |
| 111 | 112 | self->_appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; |
| 113 | + | |
| 112 | 114 | //本地存储语言版本 |
| 113 | 115 | if (IS_CHINESE) { |
| 114 | 116 | [[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@"en", nil] forKey:@"AppleLanguages"]; |
| ... | ... | @@ -123,15 +125,15 @@ |
| 123 | 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 | 138 | //切换RootViewController |
| 137 | 139 | if(IS_CHINESE){ | ... | ... |
CNLiveScioLive/Pages/Home/新闻详情/OldController/OldArticleDetailViewController.m
| ... | ... | @@ -120,6 +120,11 @@ |
| 120 | 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 | 128 | - (void)loadShareView { |
| 124 | 129 | UIImageView *lineImage = [[UIImageView alloc] init]; |
| 125 | 130 | if (iPhoneX) { | ... | ... |
CNLiveScioLive/Pages/Home/新闻详情/OldController/OldVideoDetailViewController.m