//
//  CODownloadCell.m
//  classonline
//
//  Created by hyz on 2019/2/27.
//  Copyright © 2019 offcn. All rights reserved.
//

#import "CODownloadCell.h"

@interface CODownloadCell ()

@end

@implementation CODownloadCell

#pragma mark - Init

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
    }
    return self;
}

#pragma mark - Public Methods

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)prepareForReuse {
    [super prepareForReuse];
    [self.downloadObject removeDownloadCellDelegate:self];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

- (void)updateDownloadStatusInfo {
    
}

#pragma mark - CODownloadObjectDelegate

- (void)downloadWillBeRemoved {
    self.downloadObject = nil;
    [self updateCells];
}

- (void)updateCells {
    [self updateDownloadStatusInfo];
}

#pragma mark - getter setter

- (void)setDownloadObject:(CODownloadObject *)downloadObject {
    if (downloadObject != nil) {
        [downloadObject addDownloadCellDelegate:self];
        [self updateDownloadStatusInfo];
    }
    
    if (_downloadObject == downloadObject) {
        return;
    }
    
    _downloadObject = downloadObject;
}

@end
