Commit 32788b18eef78b10bc23b119c1f3305c8cf75ac7
1 parent
35765882
no message
Showing
9 changed files
with
237 additions
and
86 deletions
CNLiveVideoClassifyKit/Classes/Controller/CNLiveClassifySegmentController.m
| @@ -43,6 +43,7 @@ static const CGFloat animationHeight = 15; | @@ -43,6 +43,7 @@ static const CGFloat animationHeight = 15; | ||
| 43 | @property (nonatomic, assign) BOOL hasChanged; | 43 | @property (nonatomic, assign) BOOL hasChanged; |
| 44 | @property (nonatomic, assign) BOOL isEditing; | 44 | @property (nonatomic, assign) BOOL isEditing; |
| 45 | @property (nonatomic, assign) BOOL oldStatusBar; | 45 | @property (nonatomic, assign) BOOL oldStatusBar; |
| 46 | +@property (nonatomic, assign) BOOL isLoading; | ||
| 46 | 47 | ||
| 47 | @end | 48 | @end |
| 48 | 49 | ||
| @@ -50,6 +51,8 @@ static const CGFloat animationHeight = 15; | @@ -50,6 +51,8 @@ static const CGFloat animationHeight = 15; | ||
| 50 | static CGFloat moveHeight = 50; | 51 | static CGFloat moveHeight = 50; |
| 51 | - (void)viewDidLoad { | 52 | - (void)viewDidLoad { |
| 52 | [super viewDidLoad]; | 53 | [super viewDidLoad]; |
| 54 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(classifyChannelsRequest:) name:CNWjjClassifyChannelsRequestStateNotifiName object:nil]; | ||
| 55 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(classifyChannelsRequestedHideLoading:) name:CNWjjClassifyChannelsRequestHideLoadingNotifiName object:nil]; | ||
| 53 | self.topBgImgHeight = kStatusHeight+100; | 56 | self.topBgImgHeight = kStatusHeight+100; |
| 54 | self.currentIndex = 0; | 57 | self.currentIndex = 0; |
| 55 | [self.view addSubview:self.topBgImg]; | 58 | [self.view addSubview:self.topBgImg]; |
| @@ -77,7 +80,10 @@ static CGFloat moveHeight = 50; | @@ -77,7 +80,10 @@ static CGFloat moveHeight = 50; | ||
| 77 | self.myCategoryView.cellWidthZoomScale = 1.3; | 80 | self.myCategoryView.cellWidthZoomScale = 1.3; |
| 78 | self.myCategoryView.imageSize = CGSizeMake(56, 18); | 81 | self.myCategoryView.imageSize = CGSizeMake(56, 18); |
| 79 | self.listContainerView.translatesAutoresizingMaskIntoConstraints = NO; | 82 | self.listContainerView.translatesAutoresizingMaskIntoConstraints = NO; |
| 80 | - [self uploadSubViews]; | 83 | + if (!self.isLoading) { |
| 84 | + [self uploadSubViews]; | ||
| 85 | + } | ||
| 86 | + | ||
| 81 | // Do any additional setup after loading the view. | 87 | // Do any additional setup after loading the view. |
| 82 | } | 88 | } |
| 83 | 89 | ||
| @@ -143,6 +149,23 @@ static CGFloat moveHeight = 50; | @@ -143,6 +149,23 @@ static CGFloat moveHeight = 50; | ||
| 143 | [self updateSelectColors:self.currentIndex]; | 149 | [self updateSelectColors:self.currentIndex]; |
| 144 | [self configCategoryViewWithType:JXCategoryTitleImageType_OnlyImage selectIndex:self.currentIndex unselectIndex:self.currentIndex]; | 150 | [self configCategoryViewWithType:JXCategoryTitleImageType_OnlyImage selectIndex:self.currentIndex unselectIndex:self.currentIndex]; |
| 145 | } | 151 | } |
| 152 | + | ||
| 153 | +#pragma mark - 通知的监听方法 Notification | ||
| 154 | +// 分类接口请求成功或者失败 | ||
| 155 | +- (void)classifyChannelsRequest:(NSNotification *)noti { | ||
| 156 | + | ||
| 157 | + [QMUITips hideAllTipsInView:self.view]; | ||
| 158 | + | ||
| 159 | + [self dataDivideIntoNormalAndOtherWithFirst:NO]; | ||
| 160 | + [self handleDateWithChannelsArray]; | ||
| 161 | + [self uploadSubViews]; | ||
| 162 | +} | ||
| 163 | +// 分类接口数据请求完毕隐藏loading | ||
| 164 | +- (void)classifyChannelsRequestedHideLoading:(NSNotification *)noti { | ||
| 165 | + | ||
| 166 | + [QMUITips hideAllTipsInView:self.view]; | ||
| 167 | +} | ||
| 168 | + | ||
| 146 | #pragma mark - Action | 169 | #pragma mark - Action |
| 147 | // 点击定制频道按钮进入定制 | 170 | // 点击定制频道按钮进入定制 |
| 148 | - (void)customAction:(UIButton *)sender { | 171 | - (void)customAction:(UIButton *)sender { |
| @@ -265,14 +288,14 @@ static CGFloat moveHeight = 50; | @@ -265,14 +288,14 @@ static CGFloat moveHeight = 50; | ||
| 265 | [[NSUserDefaults standardUserDefaults] setObject:newChannelVer forKey:CNWjjOldCategoryChannelVerKey]; | 288 | [[NSUserDefaults standardUserDefaults] setObject:newChannelVer forKey:CNWjjOldCategoryChannelVerKey]; |
| 266 | 289 | ||
| 267 | } else { // 从未请求到过数据 | 290 | } else { // 从未请求到过数据 |
| 268 | - | ||
| 269 | -// if (![CNTools manager].channelsRequested && first) { | ||
| 270 | -// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(classifyChannelsRequest:) name:CNWjjClassifyChannelsRequestStateNotifiName object:nil]; | ||
| 271 | -// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(classifyChannelsRequestedHideLoading:) name:CNWjjClassifyChannelsRequestHideLoadingNotifiName object:nil]; | ||
| 272 | -// [QMUITips showLoadingInView:self.view]; | ||
| 273 | -// self.isLoading = YES; | ||
| 274 | -// return; | ||
| 275 | -// } | 291 | + Class class = NSClassFromString(@"CNTools"); |
| 292 | + SEL manager = NSSelectorFromString(@"manager"); | ||
| 293 | + SEL sel = NSSelectorFromString(@"channelsRequested"); | ||
| 294 | + if (!(BOOL)[[class performSelector:manager] performSelector:sel]&& first) { | ||
| 295 | + [QMUITips showLoadingInView:self.view]; | ||
| 296 | + self.isLoading = YES; | ||
| 297 | + return; | ||
| 298 | + } | ||
| 276 | 299 | ||
| 277 | // 默认数据 | 300 | // 默认数据 |
| 278 | NSMutableArray *defaultArray = [NSMutableArray array]; | 301 | NSMutableArray *defaultArray = [NSMutableArray array]; |
| @@ -513,14 +536,14 @@ static CGFloat moveHeight = 50; | @@ -513,14 +536,14 @@ static CGFloat moveHeight = 50; | ||
| 513 | if (model.pageStyleList.count>0) { | 536 | if (model.pageStyleList.count>0) { |
| 514 | self.topBgImg.frame = CGRectMake(0, 0, KScreenWidth, self.topBgImgHeight); | 537 | self.topBgImg.frame = CGRectMake(0, 0, KScreenWidth, self.topBgImgHeight); |
| 515 | CNLiveSubSegmentController *subVC = [[CNLiveSubSegmentController alloc] initWithModel:model]; | 538 | CNLiveSubSegmentController *subVC = [[CNLiveSubSegmentController alloc] initWithModel:model]; |
| 516 | -// subVC.isBlack = isBlack; | ||
| 517 | -// weakself | ||
| 518 | -// subVC.scrollViewDidScrollBlock = ^(UIScrollView * _Nonnull scrollView) { | ||
| 519 | -// [weakSelf listScrollViewDidScroll:scrollView]; | ||
| 520 | -// }; | ||
| 521 | -// subVC.willBeginDragging = ^(CGFloat lastOffsetY) { | ||
| 522 | -// weakSelf.lastOffsetY = lastOffsetY; | ||
| 523 | -// }; | 539 | + subVC.isBlack = isBlack; |
| 540 | + weakself | ||
| 541 | + subVC.scrollViewDidScrollBlock = ^(UIScrollView * _Nonnull scrollView) { | ||
| 542 | + [weakSelf listScrollViewDidScroll:scrollView]; | ||
| 543 | + }; | ||
| 544 | + subVC.willBeginDragging = ^(CGFloat lastOffsetY) { | ||
| 545 | + weakSelf.lastOffsetY = lastOffsetY; | ||
| 546 | + }; | ||
| 524 | return subVC; | 547 | return subVC; |
| 525 | } | 548 | } |
| 526 | self.topBgImg.frame = CGRectMake(0, 0, KScreenWidth, self.topBgImgHeight - 50); | 549 | self.topBgImg.frame = CGRectMake(0, 0, KScreenWidth, self.topBgImgHeight - 50); |
CNLiveVideoClassifyKit/Classes/Header/CNLiveCommonDefines.h
| @@ -16,57 +16,20 @@ | @@ -16,57 +16,20 @@ | ||
| 16 | #endif | 16 | #endif |
| 17 | #define NormalChannelArray @"CNLiveNetAddNormalChannelArray" //常用频道 | 17 | #define NormalChannelArray @"CNLiveNetAddNormalChannelArray" //常用频道 |
| 18 | #define OtherChannelArray @"CNLiveNetAddOtherChannelArray" //其他频道 | 18 | #define OtherChannelArray @"CNLiveNetAddOtherChannelArray" //其他频道 |
| 19 | -//#define wjjLastAudioInfoSaveKey @"wjjLastAudioInfoSaveKey" | ||
| 20 | -//#define CNConnectSuccNotification @"CNConnectSuccNotification" | ||
| 21 | -// | ||
| 22 | -//// 本地存储音频信息KEY | ||
| 23 | -//#define wjjLastAudioInfoSaveKey @"wjjLastAudioInfoSaveKey" | ||
| 24 | -//#define wjjIsShowWitnessShadeKey @"wjjIsShowWitnessShadeKey" | ||
| 25 | -//#define wjjIsShowSportShadeKey @"wjjIsShowSportShadeKey" | ||
| 26 | -//#define wjjIsShowSupervisionShadeKey @"wjjIsShowSupervisionShadeKey"//监管 | ||
| 27 | -// | ||
| 28 | -//// 分类-听见中国-音频播放进度 | ||
| 29 | -//#ifndef WjjAudioPlayerScheduleNotification | ||
| 30 | -//#define WjjAudioPlayerScheduleNotification @"WjjAudioPlayerScheduleNotification" | ||
| 31 | -//#endif | ||
| 32 | -// | ||
| 33 | -// | ||
| 34 | -//#ifndef WjjAudioPlayerStatusNotification | ||
| 35 | -//#define WjjAudioPlayerStatusNotification @"WjjAudioPlayerStatusNotification" | ||
| 36 | -//#endif | ||
| 37 | -//// 分类-听见中国-播放哪一首音频(contenId) | ||
| 38 | -//#ifndef WjjAudioPlayerWhichPlayingNotification | ||
| 39 | -//#define WjjAudioPlayerWhichPlayingNotification @"WjjAudioPlayerWhichPlayingNotification" | ||
| 40 | -//#endif | ||
| 41 | -//// 分类-听见中国-自动切换下一首音频(selectedIndex)详情里面的列表 | ||
| 42 | -//#ifndef WjjAudioPlayerWhichPlayingListViewNotification | ||
| 43 | -//#define WjjAudioPlayerWhichPlayingListViewNotification @"WjjAudioPlayerWhichPlayingListViewNotification" | ||
| 44 | -//#endif | ||
| 45 | -//// 分类-听见中国-通知栏中切换上下首音频(Index) | ||
| 46 | -//#ifndef WjjNotificationBarChangeUpDownAudioNotification | ||
| 47 | -//#define WjjNotificationBarChangeUpDownAudioNotification @"WjjNotificationBarChangeUpDownAudioNotification" | ||
| 48 | -//#endif | ||
| 49 | -//// 分类-听见中国-一首音频播放完成 | ||
| 50 | -//#ifndef WjjAudioPlayDidFinishNotification | ||
| 51 | -//#define WjjAudioPlayDidFinishNotification @"WjjAudioPlayDidFinishNotification" | ||
| 52 | -//#endif | ||
| 53 | -// | 19 | + |
| 54 | //// 分类停止播放目击者列表中的视频 | 20 | //// 分类停止播放目击者列表中的视频 |
| 55 | #ifndef WjjH5StopVideoPlayerNotification | 21 | #ifndef WjjH5StopVideoPlayerNotification |
| 56 | #define WjjH5StopVideoPlayerNotification @"WjjH5StopVideoPlayerNotification" | 22 | #define WjjH5StopVideoPlayerNotification @"WjjH5StopVideoPlayerNotification" |
| 57 | #endif | 23 | #endif |
| 58 | -// | ||
| 59 | -//#define kCNLiveGeneralMargin 10*RATIO //通用间距 | ||
| 60 | -//#define kCNLiveNotGeneralMargin 10 //通用间距 | ||
| 61 | -//#define KCNLiveShortGeneralMargin 8.5*RATIO //小间距 | ||
| 62 | -//#define KCNLiveShortNotGeneralMargin 8.5 //间距 | ||
| 63 | -//#define kCNLiveCellTopMargin 10 * RATIO //cell 顶部灰色留白(添加扩大因数) | ||
| 64 | -//#define kCNLiveCellTopFactorMargin 10 //cell 顶部灰色留白(不添加扩大因数) | ||
| 65 | -//#define kCNLiveCellPaddingPic 5 // cell 多张图片中间留白 | ||
| 66 | -//#define TableViewDefaultOffestHeight 64.f | ||
| 67 | -// | ||
| 68 | -//static NSString *const CNLiveFirendCircleEmptyItemDesc = @"当前版本过低,暂不支持查看此动态,请升级网家家最新版本查看消息。"; | ||
| 69 | -// | 24 | + |
| 25 | + | ||
| 26 | +//分类-频道-频道数据是否请求完成 | ||
| 27 | +#ifndef CNWjjClassifyChannelsRequestStateNotifiName | ||
| 28 | +#define CNWjjClassifyChannelsRequestStateNotifiName @"CNWjjClassifyChannelsRequestStateNotifiName" | ||
| 29 | +#endif | ||
| 30 | +#ifndef CNWjjClassifyChannelsRequestHideLoadingNotifiName | ||
| 31 | +#define CNWjjClassifyChannelsRequestHideLoadingNotifiName @"CNWjjClassifyChannelsRequestHideLoadingNotifiName" | ||
| 32 | +#endif | ||
| 70 | 33 | ||
| 71 | #ifndef CNWjjClassifyChannelsRequestHideLoadingNotifiName | 34 | #ifndef CNWjjClassifyChannelsRequestHideLoadingNotifiName |
| 72 | #define CNWjjClassifyChannelsRequestHideLoadingNotifiName @"CNWjjClassifyChannelsRequestHideLoadingNotifiName" | 35 | #define CNWjjClassifyChannelsRequestHideLoadingNotifiName @"CNWjjClassifyChannelsRequestHideLoadingNotifiName" |
| @@ -84,10 +47,4 @@ | @@ -84,10 +47,4 @@ | ||
| 84 | #define kDSHappinessPageControlScrollEnableNotification @"kDSHappinessPageControlScrollEnableNotification" | 47 | #define kDSHappinessPageControlScrollEnableNotification @"kDSHappinessPageControlScrollEnableNotification" |
| 85 | #endif | 48 | #endif |
| 86 | 49 | ||
| 87 | - | ||
| 88 | -//#define cn_WjjH5_Host(url) [NSString stringWithFormat:@"%@%@",[CNLiveEnvironmentManager manager].kWjjH5_Host,url] | ||
| 89 | -// | ||
| 90 | -//#define RGBACOLOR(r,g,b,a) \ | ||
| 91 | -//[UIColor colorWithRed:r/256.f green:g/256.f blue:b/256.f alpha:a] | ||
| 92 | - | ||
| 93 | #endif /* CNLiveCommonDefines_h */ | 50 | #endif /* CNLiveCommonDefines_h */ |
CNLiveListManager.h renamed to CNLiveVideoClassifyKit/Classes/Manager/CNLiveListManager.h
CNLiveListManager.m renamed to CNLiveVideoClassifyKit/Classes/Manager/CNLiveListManager.m
CNLiveVideoClassifyKit/Classes/Manager/CNLiveVideoClassifyProtocol.h
0 → 100644
Example/CNLiveVideoClassifyKit.xcodeproj/project.pbxproj
| @@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
| 8 | 8 | ||
| 9 | /* Begin PBXBuildFile section */ | 9 | /* Begin PBXBuildFile section */ |
| 10 | 083CB9C326D4ED2000E21EBC /* CNliveCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 0816338E26BE298900B076D6 /* CNliveCollectionViewCell.m */; }; | 10 | 083CB9C326D4ED2000E21EBC /* CNliveCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 0816338E26BE298900B076D6 /* CNliveCollectionViewCell.m */; }; |
| 11 | + 08DAFBDE26E8A2660099999A /* CNTools.m in Sources */ = {isa = PBXBuildFile; fileRef = 08DAFBDC26E8A2660099999A /* CNTools.m */; }; | ||
| 11 | 14963F4E510A1E5865D15ED8 /* Pods_CNLiveVideoClassifyKit_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7743536FE5FB6796BFAA55B5 /* Pods_CNLiveVideoClassifyKit_Tests.framework */; }; | 12 | 14963F4E510A1E5865D15ED8 /* Pods_CNLiveVideoClassifyKit_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7743536FE5FB6796BFAA55B5 /* Pods_CNLiveVideoClassifyKit_Tests.framework */; }; |
| 12 | 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; | 13 | 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; |
| 13 | 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; }; | 14 | 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; }; |
| @@ -40,6 +41,8 @@ | @@ -40,6 +41,8 @@ | ||
| 40 | /* Begin PBXFileReference section */ | 41 | /* Begin PBXFileReference section */ |
| 41 | 0816338D26BE298900B076D6 /* CNliveCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNliveCollectionViewCell.h; sourceTree = "<group>"; }; | 42 | 0816338D26BE298900B076D6 /* CNliveCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNliveCollectionViewCell.h; sourceTree = "<group>"; }; |
| 42 | 0816338E26BE298900B076D6 /* CNliveCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CNliveCollectionViewCell.m; sourceTree = "<group>"; }; | 43 | 0816338E26BE298900B076D6 /* CNliveCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CNliveCollectionViewCell.m; sourceTree = "<group>"; }; |
| 44 | + 08DAFBDC26E8A2660099999A /* CNTools.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNTools.m; sourceTree = "<group>"; }; | ||
| 45 | + 08DAFBDD26E8A2660099999A /* CNTools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNTools.h; sourceTree = "<group>"; }; | ||
| 43 | 24BF123CDE580DC9CCCE1718 /* Pods-CNLiveVideoClassifyKit_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveVideoClassifyKit_Example.release.xcconfig"; path = "Target Support Files/Pods-CNLiveVideoClassifyKit_Example/Pods-CNLiveVideoClassifyKit_Example.release.xcconfig"; sourceTree = "<group>"; }; | 46 | 24BF123CDE580DC9CCCE1718 /* Pods-CNLiveVideoClassifyKit_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveVideoClassifyKit_Example.release.xcconfig"; path = "Target Support Files/Pods-CNLiveVideoClassifyKit_Example/Pods-CNLiveVideoClassifyKit_Example.release.xcconfig"; sourceTree = "<group>"; }; |
| 44 | 3A8AB8DB19B4EF9ACF33573D /* Pods-CNLiveVideoClassifyKit_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveVideoClassifyKit_Tests.release.xcconfig"; path = "Target Support Files/Pods-CNLiveVideoClassifyKit_Tests/Pods-CNLiveVideoClassifyKit_Tests.release.xcconfig"; sourceTree = "<group>"; }; | 47 | 3A8AB8DB19B4EF9ACF33573D /* Pods-CNLiveVideoClassifyKit_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveVideoClassifyKit_Tests.release.xcconfig"; path = "Target Support Files/Pods-CNLiveVideoClassifyKit_Tests/Pods-CNLiveVideoClassifyKit_Tests.release.xcconfig"; sourceTree = "<group>"; }; |
| 45 | 5793570C0C400C4B3B4942CE /* Pods-CNLiveVideoClassifyKit_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveVideoClassifyKit_Example.debug.xcconfig"; path = "Target Support Files/Pods-CNLiveVideoClassifyKit_Example/Pods-CNLiveVideoClassifyKit_Example.debug.xcconfig"; sourceTree = "<group>"; }; | 48 | 5793570C0C400C4B3B4942CE /* Pods-CNLiveVideoClassifyKit_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveVideoClassifyKit_Example.debug.xcconfig"; path = "Target Support Files/Pods-CNLiveVideoClassifyKit_Example/Pods-CNLiveVideoClassifyKit_Example.debug.xcconfig"; sourceTree = "<group>"; }; |
| @@ -142,6 +145,8 @@ | @@ -142,6 +145,8 @@ | ||
| 142 | 6003F5A6195388D20070C39A /* CNLIVEViewController.m */, | 145 | 6003F5A6195388D20070C39A /* CNLIVEViewController.m */, |
| 143 | 0816338D26BE298900B076D6 /* CNliveCollectionViewCell.h */, | 146 | 0816338D26BE298900B076D6 /* CNliveCollectionViewCell.h */, |
| 144 | 0816338E26BE298900B076D6 /* CNliveCollectionViewCell.m */, | 147 | 0816338E26BE298900B076D6 /* CNliveCollectionViewCell.m */, |
| 148 | + 08DAFBDD26E8A2660099999A /* CNTools.h */, | ||
| 149 | + 08DAFBDC26E8A2660099999A /* CNTools.m */, | ||
| 145 | 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */, | 150 | 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */, |
| 146 | 6003F5A8195388D20070C39A /* Images.xcassets */, | 151 | 6003F5A8195388D20070C39A /* Images.xcassets */, |
| 147 | 6003F594195388D20070C39A /* Supporting Files */, | 152 | 6003F594195388D20070C39A /* Supporting Files */, |
| @@ -421,6 +426,7 @@ | @@ -421,6 +426,7 @@ | ||
| 421 | 6003F59E195388D20070C39A /* CNLIVEAppDelegate.m in Sources */, | 426 | 6003F59E195388D20070C39A /* CNLIVEAppDelegate.m in Sources */, |
| 422 | 6003F5A7195388D20070C39A /* CNLIVEViewController.m in Sources */, | 427 | 6003F5A7195388D20070C39A /* CNLIVEViewController.m in Sources */, |
| 423 | 6003F59A195388D20070C39A /* main.m in Sources */, | 428 | 6003F59A195388D20070C39A /* main.m in Sources */, |
| 429 | + 08DAFBDE26E8A2660099999A /* CNTools.m in Sources */, | ||
| 424 | ); | 430 | ); |
| 425 | runOnlyForDeploymentPostprocessing = 0; | 431 | runOnlyForDeploymentPostprocessing = 0; |
| 426 | }; | 432 | }; |
Example/CNLiveVideoClassifyKit/CNLIVEViewController.m
| @@ -17,6 +17,7 @@ | @@ -17,6 +17,7 @@ | ||
| 17 | #import <CNLiveNetworking.h> | 17 | #import <CNLiveNetworking.h> |
| 18 | #import <CNLiveCommonCategory/CNLiveCommonCategory.h> | 18 | #import <CNLiveCommonCategory/CNLiveCommonCategory.h> |
| 19 | #import <MJExtension.h> | 19 | #import <MJExtension.h> |
| 20 | +#import "CNTools.h" | ||
| 20 | 21 | ||
| 21 | 22 | ||
| 22 | #ifndef CNTouristsId | 23 | #ifndef CNTouristsId |
| @@ -39,22 +40,7 @@ | @@ -39,22 +40,7 @@ | ||
| 39 | - (void)viewDidLoad | 40 | - (void)viewDidLoad |
| 40 | { | 41 | { |
| 41 | [super viewDidLoad]; | 42 | [super viewDidLoad]; |
| 42 | - NSLog(@"%@,%@",CNCategoryGetChannelUrl,CNLiveStringIsEmpty(CNUserShareModel.uid)?CNTouristsId:CNUserShareModel.uid); | ||
| 43 | - NSDictionary *dic = @{ | ||
| 44 | - @"plat":@"i" | ||
| 45 | - }; | ||
| 46 | -[CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:CNCategoryGetChannelUrl Param:dic CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | ||
| 47 | - if ([NSArray isArray:responseObject[@"data"]]) { | ||
| 48 | - NSMutableArray *jsonArray = [[NSMutableArray alloc] init]; | ||
| 49 | - for (NSDictionary *dic in responseObject[@"data"]) { | ||
| 50 | - NSString *jsonStr = CNLiveNSDictionaryDicToJson(dic); | ||
| 51 | - [jsonArray addObject:jsonStr]; | ||
| 52 | - } | ||
| 53 | - [[NSUserDefaults standardUserDefaults] setObject:jsonArray forKey:CNLiveNetAddGetCategoryChannels]; | ||
| 54 | - [[NSUserDefaults standardUserDefaults] synchronize]; | ||
| 55 | - } | ||
| 56 | - | ||
| 57 | -}]; | 43 | + [CNTools GetClassifyChannelsUrlsAndSave]; |
| 58 | self.title = @"首页"; | 44 | self.title = @"首页"; |
| 59 | segArr = @[@"分类"]; | 45 | segArr = @[@"分类"]; |
| 60 | [self.view addSubview:self.collectionView]; | 46 | [self.view addSubview:self.collectionView]; |
Example/CNLiveVideoClassifyKit/CNTools.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNTools.h | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by 张旭 on 2017/12/30. | ||
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <Foundation/Foundation.h> | ||
| 10 | +//#import <ImSDK/ImSDK.h> | ||
| 11 | +//#import "CNLiveLabel.h" | ||
| 12 | +//#import "OpenInstallSDK.h" | ||
| 13 | + | ||
| 14 | + | ||
| 15 | + | ||
| 16 | +NS_ASSUME_NONNULL_BEGIN | ||
| 17 | + | ||
| 18 | +@interface CNTools : NSObject | ||
| 19 | + | ||
| 20 | ++ (instancetype)manager; | ||
| 21 | + | ||
| 22 | +//+(BOOL)selectLinkAndPhoneNumber:(YYLabel *)yyLabel CurrentPoint:(CGPoint)point; | ||
| 23 | +/// 请求App配置信息 | ||
| 24 | ++ (void)requestAppSettingAndSaveAppInfoWithVersionMsgBlock:(void(^)())versionMsgBlock; | ||
| 25 | +/// 获取分类频道 | ||
| 26 | ++ (void)GetClassifyChannelsUrlsAndSave; | ||
| 27 | +// 获取广告信息 | ||
| 28 | ++ (void)GetAdvertisingDataSourceWithSuccessBlock:(void(^)(NSDictionary *openScreenAdv))successBlock; | ||
| 29 | +@property (nonatomic, assign) BOOL channelsRequesting; | ||
| 30 | +@property (nonatomic, assign) BOOL channelsRequested; | ||
| 31 | +@property (nonatomic, assign) BOOL appSettingRequesting; | ||
| 32 | + | ||
| 33 | ++ (void)createAlertView:(NSString *)phone; | ||
| 34 | + | ||
| 35 | +//alert | ||
| 36 | +typedef void(^ConfirmActionBlock)(void); | ||
| 37 | +//+ (id)showAlertWithTitle:(NSString *)title vc:(UIViewController *)vc cancelTitle:(NSString *)cancelTitle confirmTitle:(NSString *)confirmTitle confirmClick:(ConfirmActionBlock)confirmClick; | ||
| 38 | + | ||
| 39 | ++ (NSMutableAttributedString * _Nonnull)attributedStringWithText:(NSString *_Nonnull)text font:(CGFloat)font; | ||
| 40 | + | ||
| 41 | + | ||
| 42 | +#pragma mark - 计算字符数 | ||
| 43 | + | ||
| 44 | +//去识别url的正则表达式 | ||
| 45 | ++ (NSAttributedString *)recognizerLink:(NSMutableAttributedString *)attribut; | ||
| 46 | +#pragma mark 创建联系人 | ||
| 47 | ++ (void)createNewContactWithPhoneNum:(NSString *)phoneNum; | ||
| 48 | + | ||
| 49 | +/** | ||
| 50 | + 加密前的params转string | ||
| 51 | + | ||
| 52 | + @param parameters 要加密的params | ||
| 53 | + @return params对应的string | ||
| 54 | + */ | ||
| 55 | +//+ (nullable NSString *)CNENcryptRequestStringFromParameters:(nullable NSDictionary *)parameters; | ||
| 56 | + | ||
| 57 | + | ||
| 58 | +//设置朋友圈会话已读 | ||
| 59 | +//+ (void)readSysMomentConv; | ||
| 60 | + | ||
| 61 | +////文字转语音播放 | ||
| 62 | +//+ (AVSpeechSynthesizer *)startAVVoiceWithText:(NSString *)text; | ||
| 63 | + | ||
| 64 | +#pragma mark - Openinstall 取得参数 | ||
| 65 | +/*** 第一次安装获取渠道参数 ***/ | ||
| 66 | ++ (void)getOpenisntallFirstInstallParms; | ||
| 67 | + | ||
| 68 | +// 渠道id | ||
| 69 | ++ (NSString *)getFrmId; | ||
| 70 | + | ||
| 71 | +/*** 验证码获取渠道参数 ***/ | ||
| 72 | ++ (void)setFrmId; | ||
| 73 | + | ||
| 74 | +/*** 用户一键拉起 ***/ | ||
| 75 | +//+ (void)openInstallPullUpParams:(OpeninstallData *)appData urlStr:(NSString *)urlStr; | ||
| 76 | +// | ||
| 77 | +///*** Openisntall用户登录后跳转 ***/ | ||
| 78 | +//+ (void)openInstallLoginJumpStr:(NSString *)str; | ||
| 79 | +// | ||
| 80 | +///*** 跳转实现 ***/ | ||
| 81 | +//+ (void)jumpVCWithAvtivityUrl:(NSURL *)avtivityUrl; | ||
| 82 | + | ||
| 83 | + | ||
| 84 | + | ||
| 85 | +@end | ||
| 86 | +NS_ASSUME_NONNULL_END |
Example/CNLiveVideoClassifyKit/CNTools.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNTools.m | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by 张旭 on 2017/12/30. | ||
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNTools.h" | ||
| 10 | +#import <CNLiveEnvironment/CNLiveEnvironment.h> | ||
| 11 | +#import <MJExtension.h> | ||
| 12 | +#import <CNLiveRequestBastKit/CNLiveNetworking.h> | ||
| 13 | +#import <CNLiveBaseKit/CNLiveBaseKit.h> | ||
| 14 | +#import <NSString+CNLiveExtension.h> | ||
| 15 | +#import <CNUserInfoManager.h> | ||
| 16 | +#import <CNLiveCommonCategory/CNLiveCommonCategory.h> | ||
| 17 | +#import <CNLiveVideoClassifyKit/CNLivevideoClassifyPCH.h> | ||
| 18 | + | ||
| 19 | + | ||
| 20 | +static NSString * const CNDarenDownloadShareSourceUrl = @"CNDarenDownloadShareSourceUrl"; | ||
| 21 | +//24*60*60*1000 | ||
| 22 | +#define kTimerLength 24*60*60*1000 | ||
| 23 | + | ||
| 24 | +@interface CNTools () | ||
| 25 | + | ||
| 26 | +@property (nonatomic, assign) BOOL firstDownload; | ||
| 27 | +@property (nonatomic, assign) BOOL needToChange; | ||
| 28 | +@property (nonatomic, copy) NSString *channel; | ||
| 29 | + | ||
| 30 | +@end | ||
| 31 | + | ||
| 32 | +@implementation CNTools | ||
| 33 | + | ||
| 34 | ++ (instancetype)manager { | ||
| 35 | + static CNTools *manager; | ||
| 36 | + static dispatch_once_t onceToken; | ||
| 37 | + dispatch_once(&onceToken, ^{ | ||
| 38 | + manager = [[self alloc] init]; | ||
| 39 | + }); | ||
| 40 | + return manager; | ||
| 41 | +} | ||
| 42 | ++ (void)GetClassifyChannelsUrlsAndSave { | ||
| 43 | + | ||
| 44 | + if ([CNTools manager].channelsRequesting) { | ||
| 45 | + return; | ||
| 46 | + } | ||
| 47 | + [CNTools manager].channelsRequesting = YES; | ||
| 48 | + NSDictionary *dic = @{ | ||
| 49 | + @"plat":@"i" | ||
| 50 | + }; | ||
| 51 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:CNCategoryGetChannelUrl Param:dic CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | ||
| 52 | + NSMutableArray *jsonArray = [[NSMutableArray alloc] init]; | ||
| 53 | + if ([NSArray isArray:responseObject[@"data"]]) { | ||
| 54 | + | ||
| 55 | + for (NSDictionary *dic in responseObject[@"data"]) { | ||
| 56 | + NSString *jsonStr = CNLiveNSDictionaryDicToJson(dic); | ||
| 57 | + [jsonArray addObject:jsonStr]; | ||
| 58 | + } | ||
| 59 | + [[NSUserDefaults standardUserDefaults] setObject:jsonArray forKey:CNLiveNetAddGetCategoryChannels]; | ||
| 60 | + [[NSUserDefaults standardUserDefaults] synchronize]; | ||
| 61 | + } | ||
| 62 | + if (![NSArray isArray:jsonArray]) { | ||
| 63 | + [[NSNotificationCenter defaultCenter] postNotificationName:CNWjjClassifyChannelsRequestStateNotifiName object:nil userInfo:@{@"success":@"1"}]; | ||
| 64 | + } else { | ||
| 65 | + [[NSNotificationCenter defaultCenter] postNotificationName:CNWjjClassifyChannelsRequestHideLoadingNotifiName object:nil userInfo:nil]; | ||
| 66 | + } | ||
| 67 | + [CNTools manager].channelsRequesting = NO; | ||
| 68 | + [CNTools manager].channelsRequested = YES; | ||
| 69 | + }]; | ||
| 70 | + | ||
| 71 | +} | ||
| 72 | + | ||
| 73 | + | ||
| 74 | + | ||
| 75 | + | ||
| 76 | +@end |