Commit c647b2e97805765e0ddf8e001c716ad29f4514f7

Authored by zhangxiaowen
1 parent c0419aa5

no message

CNLiveScioLive/Pages/Live/Controller/CNLiveViewController.m
@@ -173,6 +173,8 @@ static NSString *indicatorTableViewCell = @"CNLiveIndicatorTableViewCell"; @@ -173,6 +173,8 @@ static NSString *indicatorTableViewCell = @"CNLiveIndicatorTableViewCell";
173 173
174 self.navigationController.navigationBar.barTintColor = [UIColor whiteColor]; 174 self.navigationController.navigationBar.barTintColor = [UIColor whiteColor];
175 self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:[UIColor whiteColor], NSFontAttributeName:[UIFont systemFontOfSize:18]}; 175 self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:[UIColor whiteColor], NSFontAttributeName:[UIFont systemFontOfSize:18]};
  176 + [self.navigationController setNavigationBarHidden:NO];
  177 +
176 } 178 }
177 179
178 - (void)viewDidLoad { 180 - (void)viewDidLoad {
CNLiveScioLive/Pages/Live/Controller/GraphicLiveViewController.h
@@ -54,5 +54,7 @@ typedef NS_ENUM(NSInteger, PlayerType) { @@ -54,5 +54,7 @@ typedef NS_ENUM(NSInteger, PlayerType) {
54 @property (nonatomic, assign) PlayerType type; 54 @property (nonatomic, assign) PlayerType type;
55 55
56 @property (nonatomic, strong) NSArray *relatedArray; 56 @property (nonatomic, strong) NSArray *relatedArray;
57 --(id)initWithDictionary:(NSDictionary*)dictionary; 57 +
  58 +- (id)initWithDictionary:(NSDictionary*)dictionary;
  59 +
58 @end 60 @end
CNLiveScioLive/Pages/Live/Controller/GraphicLiveViewController.m
@@ -16,7 +16,8 @@ @@ -16,7 +16,8 @@
16 [self.videoController stop]; 16 [self.videoController stop];
17 [self.navigationController popViewControllerAnimated:YES]; 17 [self.navigationController popViewControllerAnimated:YES];
18 } 18 }
19 -- (id)initWithDictionary:(NSDictionary*)dictionary { 19 +
  20 +- (id)initWithDictionary:(NSDictionary *)dictionary {
20 if (self = [super init]) { 21 if (self = [super init]) {
21 _dictionary = [NSDictionary dictionaryWithDictionary:dictionary]; 22 _dictionary = [NSDictionary dictionaryWithDictionary:dictionary];
22 int status = [_dictionary[@"status"] intValue]; 23 int status = [_dictionary[@"status"] intValue];
@@ -44,12 +45,14 @@ @@ -44,12 +45,14 @@
44 } 45 }
45 return self; 46 return self;
46 } 47 }
  48 +
47 - (NSString *)setHTMLString { 49 - (NSString *)setHTMLString {
48 NSString* htmlBody = [[NSString alloc] initWithFormat:@"<p><font style=\"font-size:%@px;\">%@</font></p>",fontArray[fontIndex],[_dic objectForKey:@"Content"]]; 50 NSString* htmlBody = [[NSString alloc] initWithFormat:@"<p><font style=\"font-size:%@px;\">%@</font></p>",fontArray[fontIndex],[_dic objectForKey:@"Content"]];
49 NSString* htmlFooter = @"</body></html>"; 51 NSString* htmlFooter = @"</body></html>";
50 NSString* strHtml = [[NSString alloc] initWithFormat:@"%@%@",htmlBody,htmlFooter]; 52 NSString* strHtml = [[NSString alloc] initWithFormat:@"%@%@",htmlBody,htmlFooter];
51 return strHtml; 53 return strHtml;
52 } 54 }
  55 +
53 - (void)loadData { 56 - (void)loadData {
54 if (![[Reachability reachabilityForInternetConnection] currentReachabilityStatus]) { 57 if (![[Reachability reachabilityForInternetConnection] currentReachabilityStatus]) {
55 [AlertViewTool showHUDViewText:CustomStr(@"NetworkiInterruption")]; 58 [AlertViewTool showHUDViewText:CustomStr(@"NetworkiInterruption")];
@@ -89,12 +92,14 @@ @@ -89,12 +92,14 @@
89 [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error: &error]; 92 [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error: &error];
90 [[AVAudioSession sharedInstance] setActive:YES error:nil]; 93 [[AVAudioSession sharedInstance] setActive:YES error:nil];
91 } 94 }
  95 +
92 - (void)viewWillDisappear:(BOOL)animated { 96 - (void)viewWillDisappear:(BOOL)animated {
93 [super viewWillDisappear:animated]; 97 [super viewWillDisappear:animated];
94 [self.liveController stop]; 98 [self.liveController stop];
95 self.liveController = nil; 99 self.liveController = nil;
96 [self.navigationController setNavigationBarHidden:NO]; 100 [self.navigationController setNavigationBarHidden:NO];
97 } 101 }
  102 +
98 - (void)viewDidLoad { 103 - (void)viewDidLoad {
99 [super viewDidLoad]; 104 [super viewDidLoad];
100 self.view.backgroundColor = [UIColor whiteColor]; 105 self.view.backgroundColor = [UIColor whiteColor];
@@ -168,7 +173,8 @@ @@ -168,7 +173,8 @@
168 - (void)loadMovieView { 173 - (void)loadMovieView {
169 [[NSUserDefaults standardUserDefaults] setObject:@0 forKey:@"GraphicLive_DidLockScreen"]; 174 [[NSUserDefaults standardUserDefaults] setObject:@0 forKey:@"GraphicLive_DidLockScreen"];
170 imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, iPhoneX ? 44 : 0, MainScreenWidth, videoHeight)]; 175 imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, iPhoneX ? 44 : 0, MainScreenWidth, videoHeight)];
171 - imageView.image = [UIImage imageNamed:@"cnlive_placeholder"]; 176 +// imageView.image = [UIImage imageNamed:@"cnlive_placeholder"];
  177 + [imageView sd_setImageWithURL:[NSURL URLWithString:_dictionary[@"poster"]] placeholderImage:[UIImage imageNamed:@"cnlive_placeholder"]];
172 [self.view addSubview:imageView]; 178 [self.view addSubview:imageView];
173 179
174 UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom]; 180 UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
CNLiveScioLive/Pages/Live/Controller/VideoPlayBackViewController.m
@@ -23,25 +23,35 @@ @@ -23,25 +23,35 @@
23 [self.videoController stop]; 23 [self.videoController stop];
24 [self.navigationController popToRootViewControllerAnimated:YES]; 24 [self.navigationController popToRootViewControllerAnimated:YES];
25 } 25 }
26 --(id)initWithDictionary:(NSDictionary*)dictionary{ 26 +- (id)initWithDictionary:(NSDictionary*)dictionary{
27 if (self = [super init]) { 27 if (self = [super init]) {
28 _dictionary = [NSDictionary dictionaryWithDictionary:dictionary]; 28 _dictionary = [NSDictionary dictionaryWithDictionary:dictionary];
29 - if (![_dictionary[@"videoUrl"] isEqualToString:@""]) {  
30 - isPlay = YES;  
31 - url = _dictionary[@"videoUrl"];  
32 - if (0 == [url length]) {  
33 - url = _dictionary[@"uploadVideoUrl"]; 29 + if ([_dictionary[@"videoFlag"] isEqualToString:@"1"]) {
  30 + if (![_dictionary[@"videoUrl"] isEqualToString:@""]) {
  31 + isPlay = YES;
  32 + url = _dictionary[@"videoUrl"];
  33 + if (0 == [url length]) {
  34 + url = _dictionary[@"uploadVideoUrl"];
  35 + }
  36 + url = [url stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
  37 + movieUrl = [NSURL URLWithString:url];
  38 +
  39 + } else {
  40 + isPlay = NO;
34 } 41 }
35 - url = [url stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];  
36 - movieUrl = [NSURL URLWithString:url]; 42 +
37 } else { 43 } else {
38 isPlay = NO; 44 isPlay = NO;
  45 +
39 } 46 }
  47 +
40 NSLog(@"movieUrl -> %@",movieUrl); 48 NSLog(@"movieUrl -> %@",movieUrl);
41 videoHeight = MainScreenWidth * (9.0 / 16.0); 49 videoHeight = MainScreenWidth * (9.0 / 16.0);
  50 +
42 } 51 }
43 return self; 52 return self;
44 } 53 }
  54 +
45 - (NSString *)setHTMLString { 55 - (NSString *)setHTMLString {
46 // NSString* htmlHeader = [[NSString alloc] initWithFormat:@"<html><p><font style=\"font-size:20px;\"><strong>%@</strong></font><br>%@</p><body>",[_dicArticle objectForKey:@"Tittle"],[_dicArticle objectForKey:@"PublishDateTime"]]; 56 // NSString* htmlHeader = [[NSString alloc] initWithFormat:@"<html><p><font style=\"font-size:20px;\"><strong>%@</strong></font><br>%@</p><body>",[_dicArticle objectForKey:@"Tittle"],[_dicArticle objectForKey:@"PublishDateTime"]];
47 NSString* htmlBody = [[NSString alloc] initWithFormat:@"<p><font style=\"font-size:%@px;\">%@</font></p>",fontArray[fontIndex],[_dicArticle objectForKey:@"Content"]]; 57 NSString* htmlBody = [[NSString alloc] initWithFormat:@"<p><font style=\"font-size:%@px;\">%@</font></p>",fontArray[fontIndex],[_dicArticle objectForKey:@"Content"]];
@@ -126,6 +136,7 @@ @@ -126,6 +136,7 @@
126 [shareButton addTarget:self action:@selector(shareButtonTaped:) forControlEvents:UIControlEventTouchUpInside]; 136 [shareButton addTarget:self action:@selector(shareButtonTaped:) forControlEvents:UIControlEventTouchUpInside];
127 [self.view addSubview:shareButton]; 137 [self.view addSubview:shareButton];
128 [shareButton setTag:30000]; 138 [shareButton setTag:30000];
  139 +
129 } 140 }
130 - (void)shareButtonTaped:(id)sender { 141 - (void)shareButtonTaped:(id)sender {
131 UIButton *btn = (UIButton *)sender; 142 UIButton *btn = (UIButton *)sender;
@@ -297,13 +308,13 @@ @@ -297,13 +308,13 @@
297 - (void)loadMovieView { 308 - (void)loadMovieView {
298 [[NSUserDefaults standardUserDefaults] setObject:@0 forKey:@"GraphicLive_DidLockScreen"]; 309 [[NSUserDefaults standardUserDefaults] setObject:@0 forKey:@"GraphicLive_DidLockScreen"];
299 imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, iPhoneX ? 44 : 0, MainScreenWidth, videoHeight)]; 310 imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, iPhoneX ? 44 : 0, MainScreenWidth, videoHeight)];
300 - imageView.image = [UIImage imageNamed:@"backDefault1"]; 311 + [imageView sd_setImageWithURL:[NSURL URLWithString:_dictionary[@"poster"]] placeholderImage:[UIImage imageNamed:@"cnlive_placeholder"]];
301 [self.view addSubview:imageView]; 312 [self.view addSubview:imageView];
302 313
303 UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom]; 314 UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
304 [backButton addTarget:self action:@selector(Pop:) forControlEvents:UIControlEventTouchUpInside]; 315 [backButton addTarget:self action:@selector(Pop:) forControlEvents:UIControlEventTouchUpInside];
305 - [backButton setImage:[UIImage imageNamed:@"navigationBack"] forState:UIControlStateNormal];  
306 - [backButton setFrame:CGRectMake(0, 20, 44, 44)]; 316 + [backButton setImage:[UIImage imageNamed:@"cnlive_white_back"] forState:UIControlStateNormal];
  317 + [backButton setFrame:CGRectMake(0, StatusBarHeight, 44, 44)];
307 [self.view addSubview:backButton]; 318 [self.view addSubview:backButton];
308 } 319 }
309 320
CNLiveScioLive/Pages/Live/Model/CNLiveModel.h
@@ -18,6 +18,12 @@ @@ -18,6 +18,12 @@
18 @property (nonatomic, copy) NSString *img; 18 @property (nonatomic, copy) NSString *img;
19 @property (nonatomic, copy) NSString *selectedImage; 19 @property (nonatomic, copy) NSString *selectedImage;
20 @property (nonatomic, copy) NSString *createDate; 20 @property (nonatomic, copy) NSString *createDate;
  21 +@property (nonatomic, copy) NSString *liveShow;//liveShow 展示标识 0:APP不展示 1:展示
  22 +
  23 +
  24 +@property (nonatomic, copy) NSString *liveFlag;//liveFlag 直播标识 0:视频直播 1:图文直播
  25 +
  26 +@property (nonatomic, copy) NSString *videoFlag;//videoFlag 0 图文回放 1视频回放
21 27
22 28
23 /* 29 /*
@@ -39,7 +45,6 @@ @@ -39,7 +45,6 @@
39 } 45 }
40 */ 46 */
41 47
42 -@property (nonatomic, copy) NSString *liveFlag;  
43 @property (nonatomic, copy) NSString *activityId; 48 @property (nonatomic, copy) NSString *activityId;
44 @property (nonatomic, copy) NSString *playbackId; 49 @property (nonatomic, copy) NSString *playbackId;
45 @property (nonatomic, copy) NSString *checkinfo; 50 @property (nonatomic, copy) NSString *checkinfo;
CNLiveScioLive/Pages/Live/View/CNLiveTableViewCell.m
@@ -67,6 +67,7 @@ @@ -67,6 +67,7 @@
67 _titleLabel.text = model.title; 67 _titleLabel.text = model.title;
68 _timeLabel.text = model.createDate; 68 _timeLabel.text = model.createDate;
69 [_picImage sd_setImageWithURL:[NSURL URLWithString:model.img] placeholderImage:[UIImage imageNamed:@"placeholder"]]; 69 [_picImage sd_setImageWithURL:[NSURL URLWithString:model.img] placeholderImage:[UIImage imageNamed:@"placeholder"]];
  70 + _playImage.hidden = [model.videoFlag isEqualToString:@"0"];
70 [self layoutSubviews]; 71 [self layoutSubviews];
71 72
72 } 73 }