admin
2023-04-21 0b3a4aaf99ea251bc8e27b96115288f0988fcffe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//
//  DYNovelController.m
//  BuWanVideo2.0
//
//  Created by aeline on 2022/1/15.
//  Copyright © 2022 com.yeshi.buwansheque.ios. All rights reserved.
//
#import "DYNovelController.h"
#import "BDNovelPublicConfig.h"
 
@interface DYNovelController ()
@end
 
@implementation DYNovelController
- (instancetype)init {
    self = [super init];
    if (self) {
        self.title = @"小说";
    }
    return self;
}
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:animated];
    self.navigationController.navigationBar.translucent = NO;
    
    [self uploadReadDuration];
}
 
- (void) viewDidLoad{
    [self buildCells];
}
 
- (void)buildCells {
    //@{kBDNovelPageUserInfoFullScreen : @YES}
    UIViewController *channel = [BDNovelPublicConfig novelViewControllerWithType:BDNovelPublicEnTranceTypeChannelPage                                                                                                                                                                                                      userInfo:nil];
    channel.view.frame=CGRectMake(0, 0, KScreenW, KScreenH   - ALTabBar_H);
    [self.view addSubview:channel.view];
    
    [self addChildViewController:channel];
    
    UIView *hidden=[[UIView alloc] init];
    hidden.backgroundColor=UIColor.whiteColor;
    hidden.frame=CGRectMake(0, kStatusBarH  , KScreenW/10, ALNavBarH);
    [self.view addSubview:hidden];
}
 
 
- (void) uploadReadDuration{
    NSUInteger duration=   [BDNovelPublicConfig getReadDuration];
    if(duration<=0){
        return;
    }
    
    dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
    // 创建全局并行
    dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
    dispatch_group_t group = dispatch_group_create();
    dispatch_group_async(group, queue, ^{
        
        [[YTHNetInterface startInterface] readNovelEvent:duration :^(BOOL isSuccessful, id result, NSString *error) {
            dispatch_semaphore_signal(semaphore);
        }];
        
    });
}
 
@end