Commit 31b906394691d92e391dccdca4ac92c3bdd8dd20
1 parent
250ff698
no message
Showing
50 changed files
with
4270 additions
and
1 deletions
CNLiveGifFace.podspec
0 → 100644
| 1 | +# | ||
| 2 | +# Be sure to run `pod lib lint CNLiveGifFace.podspec' to ensure this is a | ||
| 3 | +# valid spec before submitting. | ||
| 4 | +# | ||
| 5 | +# Any lines starting with a # are optional, but their use is encouraged | ||
| 6 | +# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html | ||
| 7 | +# | ||
| 8 | + | ||
| 9 | +Pod::Spec.new do |s| | ||
| 10 | + s.name = 'CNLiveGifFace' | ||
| 11 | + s.version = '0.0.1' | ||
| 12 | + s.summary = 'A short description of CNLiveGifFace.' | ||
| 13 | + | ||
| 14 | +# This description is used to generate tags and improve search results. | ||
| 15 | +# * Think: What does it do? Why did you write it? What is the focus? | ||
| 16 | +# * Try to keep it short, snappy and to the point. | ||
| 17 | +# * Write the description between the DESC delimiters below. | ||
| 18 | +# * Finally, don't worry about the indent, CocoaPods strips it! | ||
| 19 | + | ||
| 20 | + s.description = <<-DESC | ||
| 21 | +TODO: Add long description of the pod here. | ||
| 22 | + DESC | ||
| 23 | + | ||
| 24 | + s.homepage = 'http://bj.gitlab.cnlive.com/ios-team/CNLiveGifFace' | ||
| 25 | + # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' | ||
| 26 | + s.license = { :type => 'MIT', :file => 'LICENSE' } | ||
| 27 | + s.author = { '153993236@qq.com' => 'zhangxiaowen@cnlive.com' } | ||
| 28 | + s.source = { :git => 'http://bj.gitlab.cnlive.com/ios-team/CNLiveGifFace.git', :tag => s.version.to_s } | ||
| 29 | + # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>' | ||
| 30 | + | ||
| 31 | + s.ios.deployment_target = '9.0' | ||
| 32 | + | ||
| 33 | + s.source_files = 'CNLiveGifFace/Classes/**/*' | ||
| 34 | + | ||
| 35 | + # s.resource_bundles = { | ||
| 36 | + # 'CNLiveGifFace' => ['CNLiveGifFace/Assets/*.png'] | ||
| 37 | + # } | ||
| 38 | + | ||
| 39 | + # s.public_header_files = 'Pod/Classes/**/*.h' | ||
| 40 | + s.frameworks = 'UIKit', 'Foundation' | ||
| 41 | + s.dependency 'Masonry' | ||
| 42 | + s.dependency 'MJRefresh' | ||
| 43 | + s.dependency 'QMUIKit' | ||
| 44 | + s.dependency 'CNLiveBaseKit' | ||
| 45 | + s.dependency 'CNLiveUserManagement' | ||
| 46 | + s.dependency 'MJExtension' | ||
| 47 | + s.dependency 'CNLiveCommonClass' | ||
| 48 | + s.dependency 'CNLiveCustomUI' | ||
| 49 | + s.dependency 'WebViewJavascriptBridge' | ||
| 50 | + s.dependency 'SSZipArchive' | ||
| 51 | + | ||
| 52 | +end |
CNLiveGifFace/Assets/.gitkeep
0 → 100644
CNLiveGifFace/Classes/.gitkeep
0 → 100644
CNLiveGifFace/Classes/Controller/CNChatGifDetailsViewController.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNChatGifDetailsViewController.h | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2018/10/22. | ||
| 6 | +// Copyright © 2018年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNCommonViewController.h" | ||
| 10 | +#import "CNChatViewController.h" | ||
| 11 | +NS_ASSUME_NONNULL_BEGIN | ||
| 12 | + | ||
| 13 | +@interface CNChatGifDetailsViewController : CNCommonViewController | ||
| 14 | +@property (nonatomic, copy) NSString *url; | ||
| 15 | +@property (nonatomic, strong) IMAMsg *msg;//需要转发的消息 | ||
| 16 | +@property (nonatomic, strong) IMAConversation *conversation; | ||
| 17 | +@property (nonatomic, weak) CNChatViewController *chatVc; | ||
| 18 | + | ||
| 19 | +@end | ||
| 20 | + | ||
| 21 | +NS_ASSUME_NONNULL_END |
CNLiveGifFace/Classes/Controller/CNChatGifDetailsViewController.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNChatGifDetailsViewController.m | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2018/10/22. | ||
| 6 | +// Copyright © 2018年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNChatGifDetailsViewController.h" | ||
| 10 | +#import "CNAttentionViewController.h" | ||
| 11 | +#import "CNGifFaceAlbumViewController.h" | ||
| 12 | +#import "CNLiveDownLoadManager.h" | ||
| 13 | +#import "CNLiveArchiveManager.h" | ||
| 14 | +#import "UIColor+CNLiveExtension.h" | ||
| 15 | +#import "CNMessageForwardingController.h" | ||
| 16 | +#import "CNGifFaceModel.h" | ||
| 17 | + | ||
| 18 | +@interface CNChatGifDetailsViewController ()<UIGestureRecognizerDelegate> | ||
| 19 | +@property (nonatomic, strong) YYAnimatedImageView *webImageView; | ||
| 20 | +@property (nonatomic, strong) UILabel *nameLabel; | ||
| 21 | +@property (nonatomic, strong) UIActivityIndicatorView *activityIndicator; | ||
| 22 | + | ||
| 23 | +@property (nonatomic, strong) UIView *bottomView; | ||
| 24 | +@property (nonatomic, strong) UIView *line; | ||
| 25 | +@property (nonatomic, strong) UIImageView *coverImage; | ||
| 26 | +@property (nonatomic, strong) UILabel *coverTitle; | ||
| 27 | +@property (nonatomic, strong) UIButton *coverBtn; | ||
| 28 | +@property (nonatomic, strong) UIProgressView *processView; | ||
| 29 | + | ||
| 30 | + | ||
| 31 | +@property (nonatomic, strong) CNGifFaceModel *model; | ||
| 32 | + | ||
| 33 | +@end | ||
| 34 | + | ||
| 35 | +@implementation CNChatGifDetailsViewController | ||
| 36 | +static const NSInteger margin = 10; | ||
| 37 | +static const NSInteger ImageWidthHeight = 60; | ||
| 38 | + | ||
| 39 | +#pragma mark - Data | ||
| 40 | +//显示底部专辑 | ||
| 41 | +- (void)getData{ | ||
| 42 | + TIMCustomElem *elem = (TIMCustomElem *)[self.msg.msg getElem:0]; | ||
| 43 | + NSError *err; | ||
| 44 | + NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:elem.data | ||
| 45 | + options:NSJSONReadingMutableContainers | ||
| 46 | + error:&err]; | ||
| 47 | + NSString *sectionId = dic[@"gifEmojiData"][@"groupId"]; | ||
| 48 | + if (!sectionId || [sectionId isEqualToString:@""]) { | ||
| 49 | + _bottomView.hidden = YES; | ||
| 50 | + return; | ||
| 51 | + } | ||
| 52 | + NSDictionary *params = @{@"sectionId":sectionId}; | ||
| 53 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | ||
| 54 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNGetGifFacePackageUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | ||
| 55 | + if (!error) { | ||
| 56 | + self.model = [CNGifFaceModel mj_objectWithKeyValues:responseObject[@"data"][@"section"]]; | ||
| 57 | + dispatch_async(dispatch_get_main_queue(), ^{ | ||
| 58 | + [_coverImage sd_setImageWithURL:[NSURL URLWithString:_model.coverPic] completed:nil]; | ||
| 59 | + _coverTitle.text = _model.title; | ||
| 60 | + | ||
| 61 | + }); | ||
| 62 | + | ||
| 63 | + }else{ | ||
| 64 | + dispatch_async(dispatch_get_main_queue(), ^{ | ||
| 65 | + //底部图片 | ||
| 66 | + [_coverImage sd_setImageWithURL:[NSURL URLWithString:self.url] completed:nil]; | ||
| 67 | + _bottomView.hidden = YES; | ||
| 68 | + }); | ||
| 69 | + | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + }]; | ||
| 73 | + | ||
| 74 | +} | ||
| 75 | +//已下载 -> 已缓存 -> 下载 | ||
| 76 | +- (void)showGifFaceData { | ||
| 77 | + //表情名字 | ||
| 78 | + TIMCustomElem *elem = (TIMCustomElem *)[self.msg.msg getElem:0]; | ||
| 79 | + NSError *err; | ||
| 80 | + NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:elem.data | ||
| 81 | + options:NSJSONReadingMutableContainers | ||
| 82 | + error:&err]; | ||
| 83 | + if (dic[@"gifEmojiData"][@"faceName"]) { | ||
| 84 | + _nameLabel.text = dic[@"gifEmojiData"][@"faceName"]; | ||
| 85 | + | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + //表情GIF | ||
| 89 | + NSString *docPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; | ||
| 90 | + NSArray *names = [dic[@"gifEmojiData"][@"faceId"] componentsSeparatedByString:@"_"]; | ||
| 91 | + | ||
| 92 | + NSFileManager *fileManager = [NSFileManager defaultManager]; | ||
| 93 | + if(names.count >= 2){ | ||
| 94 | + NSString *filePath1 = [docPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@/GifFace/Download/%@/gif/%@.gif",[UserInformationModel manager].uid,names[0],dic[@"gifEmojiData"][@"faceId"]]]; | ||
| 95 | + | ||
| 96 | + BOOL isDownoad = [fileManager fileExistsAtPath:filePath1]; | ||
| 97 | + _coverBtn.selected = isDownoad; | ||
| 98 | + _coverBtn.layer.borderColor = isDownoad? CNLiveColorWithHexString(@"D9D9D9").CGColor:CNLiveColorWithHexString(@"23D41E").CGColor; | ||
| 99 | + _coverBtn.userInteractionEnabled = !isDownoad; | ||
| 100 | + | ||
| 101 | + //本地存在 已下载 | ||
| 102 | + if(isDownoad){ | ||
| 103 | + NSData *imageData = [NSData dataWithContentsOfFile:filePath1]; | ||
| 104 | + _webImageView.image = [YYImage imageWithData:imageData]; | ||
| 105 | + [self.activityIndicator stopAnimating]; | ||
| 106 | + self.activityIndicator.hidden = YES; | ||
| 107 | + return; | ||
| 108 | + | ||
| 109 | + } | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + NSString *filePath2 = [[CNTools newChatGifFacePath] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.gif",dic[@"gifEmojiData"][@"faceId"]]]; | ||
| 113 | + BOOL isCahce = [fileManager fileExistsAtPath:filePath2]; | ||
| 114 | + //本地存在 已缓存 | ||
| 115 | + if(isCahce){ | ||
| 116 | + NSData *imageData = [NSData dataWithContentsOfFile:filePath2]; | ||
| 117 | + _webImageView.image = [YYImage imageWithData:imageData]; | ||
| 118 | + [self.activityIndicator stopAnimating]; | ||
| 119 | + self.activityIndicator.hidden = YES; | ||
| 120 | + return; | ||
| 121 | + | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + //本地不存在 | ||
| 125 | + [self.activityIndicator startAnimating]; | ||
| 126 | + self.activityIndicator.hidden = NO; | ||
| 127 | + __block CNChatGifDetailsViewController *blockSelf = self; | ||
| 128 | + | ||
| 129 | + [self.webImageView setImageWithURL:dic[@"gifEmojiData"][@"faceGifUrl"] placeholder:nil options:YYWebImageOptionProgressiveBlur|YYWebImageOptionShowNetworkActivity progress:^(NSInteger receivedSize, NSInteger expectedSize) { | ||
| 130 | + if (receivedSize > 0 && expectedSize > 0) { | ||
| 131 | + CGFloat progress = (CGFloat)receivedSize / expectedSize; | ||
| 132 | + NSLog(@"-----fff%.2f",progress); | ||
| 133 | + | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + } transform:nil completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) { | ||
| 137 | + if (stage == YYWebImageStageFinished) { | ||
| 138 | + [blockSelf.activityIndicator stopAnimating]; | ||
| 139 | + blockSelf.activityIndicator.hidden = YES; | ||
| 140 | + for (UIGestureRecognizer *ges in blockSelf.webImageView.gestureRecognizers) { | ||
| 141 | + ges.delegate = blockSelf; | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + } | ||
| 145 | + }]; | ||
| 146 | + | ||
| 147 | +} | ||
| 148 | + | ||
| 149 | +- (void)viewDidLoad { | ||
| 150 | + [super viewDidLoad]; | ||
| 151 | + self.view.backgroundColor = [UIColor whiteColor]; | ||
| 152 | + //底部专辑数据 | ||
| 153 | + [self getData]; | ||
| 154 | + | ||
| 155 | + //导航栏 | ||
| 156 | + [self createNavigationBar]; | ||
| 157 | + //UI | ||
| 158 | + [self createUI]; | ||
| 159 | + | ||
| 160 | + //GIF表情数据 | ||
| 161 | + [self showGifFaceData]; | ||
| 162 | + | ||
| 163 | + // Do any additional setup after loading the view. | ||
| 164 | +} | ||
| 165 | + | ||
| 166 | +#pragma mark - UI | ||
| 167 | +- (void)createNavigationBar{ | ||
| 168 | + UIBarButtonItem *rightBtn = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"xx_liaotianshezhi"] style:UIBarButtonItemStylePlain target:self action:@selector(moreButton:)]; | ||
| 169 | + self.navigationItem.rightBarButtonItem = rightBtn; | ||
| 170 | + | ||
| 171 | +} | ||
| 172 | + | ||
| 173 | +//改变导航栏颜色 | ||
| 174 | +- (UIImage *)navigationBarBackgroundImage{ | ||
| 175 | + return [UIImage imageWithColor:kWeChatBgColor]; | ||
| 176 | +} | ||
| 177 | +- (void)createUI{ | ||
| 178 | + [self.view addSubview:self.webImageView]; | ||
| 179 | + [self.webImageView addSubview:self.activityIndicator]; | ||
| 180 | + [self.view addSubview:self.nameLabel]; | ||
| 181 | + | ||
| 182 | + [self.view addSubview:self.bottomView]; | ||
| 183 | + | ||
| 184 | + [self.bottomView addSubview:self.line]; | ||
| 185 | + [self.bottomView addSubview:self.coverImage]; | ||
| 186 | + [self.bottomView addSubview:self.coverTitle]; | ||
| 187 | + [self.bottomView addSubview:self.coverBtn]; | ||
| 188 | + [self.bottomView addSubview:self.processView]; | ||
| 189 | + | ||
| 190 | +} | ||
| 191 | + | ||
| 192 | +/* | ||
| 193 | +#pragma mark - Navigation | ||
| 194 | + | ||
| 195 | +// In a storyboard-based application, you will often want to do a little preparation before navigation | ||
| 196 | +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | ||
| 197 | + // Get the new view controller using [segue destinationViewController]. | ||
| 198 | + // Pass the selected object to the new view controller. | ||
| 199 | +} | ||
| 200 | +*/ | ||
| 201 | + | ||
| 202 | +#pragma mark - Private Methods | ||
| 203 | +//下载 | ||
| 204 | +- (void)download:(NSString *)downloadUrl{ | ||
| 205 | +// NSString *downloadUrl = @"https://wjj.ys1.cnliveimg.com/769/emoticon/archive/section0.zip"; | ||
| 206 | + NSLog(@"%@",downloadUrl); | ||
| 207 | + [[CNLiveDownLoadManager sharedInstance] downLoadWithURL:downloadUrl progress:^(NSString *url, float progress) { | ||
| 208 | + dispatch_async(dispatch_get_main_queue(), ^{ | ||
| 209 | + // UI更新代码 | ||
| 210 | + [_processView setProgress:progress animated:YES]; | ||
| 211 | + | ||
| 212 | + }); | ||
| 213 | + | ||
| 214 | + } success:^(NSString *url, NSString *fileStorePath) { | ||
| 215 | + ///var/mobile/Containers/Data/Application/27248574-1177-4075-B200-7E8B2D052FB5/Library/Caches/0e3a18a25dcf490bfcab448fc362e82e | ||
| 216 | + //下载结束储存地址 | ||
| 217 | + NSLog(@"fileStorePath----%@",fileStorePath); | ||
| 218 | + [self releaseZip:fileStorePath]; | ||
| 219 | + [self refreshUI]; | ||
| 220 | + | ||
| 221 | + } faile:^(NSString *url, NSError *error) { | ||
| 222 | + | ||
| 223 | + }]; | ||
| 224 | +} | ||
| 225 | +//解压 | ||
| 226 | +- (void)releaseZip:(NSString *)fileStorePath{ | ||
| 227 | + NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]; | ||
| 228 | + | ||
| 229 | + [CNLiveArchiveManager sharedInstance].cachesPath = [path stringByAppendingPathComponent:[UserInformationModel manager].uid]; | ||
| 230 | + | ||
| 231 | + //下载 | ||
| 232 | + ///var/mobile/Containers/Data/Application/1DFB750A-35BE-4FE0-9CDC-E0DB6E84F7FB/Documents/10514405/GifFace/DownLoad | ||
| 233 | + | ||
| 234 | + //缓存 | ||
| 235 | + ///var/mobile/Containers/Data/Application/1DFB750A-35BE-4FE0-9CDC-E0DB6E84F7FB/Documents/10514405/GifFace/Cache | ||
| 236 | + | ||
| 237 | + //GIF本地管理plist | ||
| 238 | + ///var/mobile/Containers/Data/Application/94E0C70B-9F4D-4716-8EAF-7BF0C53AEAEE/Documents/10514405/GifFace/GifFaceList.plist | ||
| 239 | + | ||
| 240 | + [[CNLiveArchiveManager sharedInstance]releaseZipWithLocalPath:fileStorePath folderName:@"GifFace/Download" releaseZipFolderName:[[self.model.downloadUrl lastPathComponent] stringByDeletingPathExtension] resultBlock:^(NSString *hostPath, NSArray *array) { | ||
| 241 | + | ||
| 242 | + NSString *totalLengthPlist = [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"totalLength.plist"]; | ||
| 243 | + NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithContentsOfFile:totalLengthPlist]; | ||
| 244 | + [dict removeObjectForKey:self.model.downloadUrl.md5String]; | ||
| 245 | + [dict writeToFile:totalLengthPlist atomically:YES]; | ||
| 246 | + | ||
| 247 | + //解压结束储存地址 | ||
| 248 | + NSLog(@"hostPath----%@",hostPath); | ||
| 249 | + | ||
| 250 | + //创建文件 | ||
| 251 | + NSString *docPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; | ||
| 252 | + NSString *filePath = [docPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@/GifFace/%@",[UserInformationModel manager].uid,@"GifFaceList.plist"]]; | ||
| 253 | + ///var/mobile/Containers/Data/Application/94E0C70B-9F4D-4716-8EAF-7BF0C53AEAEE/Documents/10514405/GifFace/GifFaceList.plist | ||
| 254 | + NSFileManager *fileManager = [NSFileManager defaultManager]; | ||
| 255 | + | ||
| 256 | + //移除下载表情包 | ||
| 257 | + [fileManager removeItemAtPath:fileStorePath error:nil]; | ||
| 258 | + | ||
| 259 | + BOOL result = [fileManager fileExistsAtPath:filePath]; | ||
| 260 | + if(result){ | ||
| 261 | + //读取已存在的表情包列表 | ||
| 262 | + NSMutableArray *data = [NSMutableArray arrayWithContentsOfFile:filePath]; | ||
| 263 | + NSString *str = [[self.model.downloadUrl lastPathComponent] stringByDeletingPathExtension]; | ||
| 264 | + if([data containsObject:str]){//存在 | ||
| 265 | + return ; | ||
| 266 | + }else{//不存在 | ||
| 267 | + [data addObject:str]; | ||
| 268 | + } | ||
| 269 | + if([data writeToFile:filePath atomically:YES]){ | ||
| 270 | + NSLog(@"写入成功"); | ||
| 271 | + [[NSNotificationCenter defaultCenter] postNotificationName:@"GifFaceDownLoadSuccess" object:nil]; | ||
| 272 | + } | ||
| 273 | + | ||
| 274 | + }else{ | ||
| 275 | + //不存在的表情包列表 | ||
| 276 | + NSMutableArray *data = [NSMutableArray array]; | ||
| 277 | + [data addObject:[[self.model.downloadUrl lastPathComponent] stringByDeletingPathExtension]]; | ||
| 278 | + if([data writeToFile:filePath atomically:YES]){ | ||
| 279 | + NSLog(@"写入成功"); | ||
| 280 | + [[NSNotificationCenter defaultCenter] postNotificationName:@"GifFaceDownLoadSuccess" object:nil]; | ||
| 281 | + } | ||
| 282 | + } | ||
| 283 | + | ||
| 284 | + }]; | ||
| 285 | +} | ||
| 286 | +- (void)refreshUI{ | ||
| 287 | + dispatch_async(dispatch_get_main_queue(), ^{ | ||
| 288 | + // UI更新代码 | ||
| 289 | + _processView.hidden = YES; | ||
| 290 | + _coverBtn.hidden = NO; | ||
| 291 | + | ||
| 292 | + _coverBtn.selected = YES; | ||
| 293 | + _coverBtn.layer.borderColor = CNLiveColorWithHexString(@"D9D9D9").CGColor; | ||
| 294 | + _coverBtn.userInteractionEnabled = NO; | ||
| 295 | + | ||
| 296 | + }); | ||
| 297 | +} | ||
| 298 | +#pragma mark - Methods | ||
| 299 | +- (void)moreButton:(UIButton *)btn{ | ||
| 300 | + [self.view createAlertViewTitleArray:@[@"发送给朋友"] textColor:UIColorMake(11, 190, 6) font:[UIFont systemFontOfSize:18] actionBlock:^(UIButton *button, NSInteger didRow) { | ||
| 301 | + if(didRow == 0){ | ||
| 302 | + CNMessageForwardingController *vc= [[CNMessageForwardingController alloc] init]; | ||
| 303 | + vc.msgsArray = @[self.msg]; | ||
| 304 | + vc.conversation = self.conversation; | ||
| 305 | + vc.chatVc = self.chatVc; | ||
| 306 | + [self.navigationController pushViewController:vc animated:YES]; | ||
| 307 | + } | ||
| 308 | + | ||
| 309 | + }]; | ||
| 310 | + | ||
| 311 | +} | ||
| 312 | +- (void)clickAddBtn:(UIButton *)btn{ | ||
| 313 | + if(!_coverBtn.selected){ | ||
| 314 | + _processView.hidden = NO; | ||
| 315 | + _coverBtn.hidden = YES; | ||
| 316 | + //下载 | ||
| 317 | + [self download:self.model.downloadUrl]; | ||
| 318 | + } | ||
| 319 | + | ||
| 320 | +} | ||
| 321 | +- (void)bottomViewTap:(UITapGestureRecognizer *)tap{ | ||
| 322 | + CNGifFaceAlbumViewController *vc = [[CNGifFaceAlbumViewController alloc]init]; | ||
| 323 | + [self.navigationController pushViewController:vc animated:YES]; | ||
| 324 | + | ||
| 325 | +} | ||
| 326 | + | ||
| 327 | +#pragma mark - Getter and Setter | ||
| 328 | +- (YYAnimatedImageView *)webImageView{ | ||
| 329 | + if (!_webImageView) { | ||
| 330 | + _webImageView = [[YYAnimatedImageView alloc] initWithFrame:CGRectMake(0, 0, 140, 140)]; | ||
| 331 | + _webImageView.centerX = self.view.centerX; | ||
| 332 | + _webImageView.centerY = self.view.centerY-15; | ||
| 333 | + _webImageView.contentMode = UIViewContentModeScaleToFill; | ||
| 334 | + _webImageView.clipsToBounds = YES; | ||
| 335 | + _webImageView.backgroundColor = [UIColor clearColor]; | ||
| 336 | + | ||
| 337 | + } | ||
| 338 | + return _webImageView; | ||
| 339 | +} | ||
| 340 | +- (UILabel *)nameLabel{ | ||
| 341 | + if(_nameLabel == nil){ | ||
| 342 | + _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, _webImageView.bottom, kMainScreenWidth, 30)]; | ||
| 343 | + _nameLabel.centerX = self.view.centerX; | ||
| 344 | + _nameLabel.textColor = CNLiveColorWithHexString(@"888888"); | ||
| 345 | + _nameLabel.font = UIFontCNMake(16); | ||
| 346 | + _nameLabel.textAlignment = NSTextAlignmentCenter; | ||
| 347 | + _nameLabel.userInteractionEnabled = YES; | ||
| 348 | + | ||
| 349 | + } | ||
| 350 | + return _nameLabel; | ||
| 351 | + | ||
| 352 | +} | ||
| 353 | +- (UIActivityIndicatorView *)activityIndicator { | ||
| 354 | + if (!_activityIndicator) { | ||
| 355 | + _activityIndicator = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:(UIActivityIndicatorViewStyleWhiteLarge)]; | ||
| 356 | + //设置小菊花颜色 | ||
| 357 | + _activityIndicator.color = [UIColor lightGrayColor]; | ||
| 358 | + //设置背景颜色 | ||
| 359 | + _activityIndicator.backgroundColor = [UIColor clearColor]; | ||
| 360 | + _activityIndicator.frame= CGRectMake(0, 0, 100, 100); | ||
| 361 | + _activityIndicator.center = self.view.center; | ||
| 362 | + | ||
| 363 | + } | ||
| 364 | + return _activityIndicator; | ||
| 365 | +} | ||
| 366 | +- (UIView *)bottomView{ | ||
| 367 | + if (!_bottomView) { | ||
| 368 | + _bottomView = [[UIView alloc]initWithFrame:CGRectMake(0, kMainScreenHeight-ImageWidthHeight-kVerticalBottomSafeHeight, kMainScreenWidth, ImageWidthHeight)]; | ||
| 369 | + _bottomView.backgroundColor = [UIColor whiteColor]; | ||
| 370 | +// UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(bottomViewTap:)]; | ||
| 371 | +// [_bottomView addGestureRecognizer:tap]; | ||
| 372 | + } | ||
| 373 | + return _bottomView; | ||
| 374 | +} | ||
| 375 | +- (UIView *)line{ | ||
| 376 | + if (!_line) { | ||
| 377 | + _line = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kMainScreenWidth, 0.5)]; | ||
| 378 | + _line.backgroundColor = CNLiveColorWithHexString(@"D9D9D9"); | ||
| 379 | + | ||
| 380 | + } | ||
| 381 | + return _line; | ||
| 382 | +} | ||
| 383 | +- (UIImageView *)coverImage{ | ||
| 384 | + if (!_coverImage) { | ||
| 385 | + _coverImage = [[UIImageView alloc] initWithFrame:CGRectMake(margin, _line.bottom+margin, (ImageWidthHeight-2*margin)*3/4.0, ImageWidthHeight-2*margin)]; | ||
| 386 | + _coverImage.contentMode = UIViewContentModeScaleToFill; | ||
| 387 | + _coverImage.clipsToBounds = YES; | ||
| 388 | + | ||
| 389 | + } | ||
| 390 | + return _coverImage; | ||
| 391 | +} | ||
| 392 | +- (UIButton *)coverBtn{ | ||
| 393 | + if(_coverBtn == nil){ | ||
| 394 | + _coverBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 395 | + _coverBtn.frame = CGRectMake(kMainScreenWidth-2*margin-60, _line.bottom+(_bottomView.height-25)/2.0, 60, 25); | ||
| 396 | + _coverBtn.titleLabel.font = UIFontCNMake(13); | ||
| 397 | + _coverBtn.layer.cornerRadius = 5; | ||
| 398 | + _coverBtn.layer.masksToBounds = YES; | ||
| 399 | + _coverBtn.layer.borderWidth = 1; | ||
| 400 | + [_coverBtn addTarget:self action:@selector(clickAddBtn:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 401 | + | ||
| 402 | + [_coverBtn setTitle:@"添加" forState:UIControlStateNormal]; | ||
| 403 | + [_coverBtn setTitleColor:CNLiveColorWithHexString(@"23D41E") forState:UIControlStateNormal]; | ||
| 404 | + _coverBtn.layer.borderColor = CNLiveColorWithHexString(@"23D41E").CGColor; | ||
| 405 | + | ||
| 406 | + [_coverBtn setTitle:@"已添加" forState:UIControlStateSelected]; | ||
| 407 | + [_coverBtn setTitleColor:CNLiveColorWithHexString(@"D9D9D9") forState:UIControlStateSelected]; | ||
| 408 | + | ||
| 409 | + | ||
| 410 | + } | ||
| 411 | + return _coverBtn; | ||
| 412 | + | ||
| 413 | +} | ||
| 414 | +- (UILabel *)coverTitle{ | ||
| 415 | + if (!_coverTitle) { | ||
| 416 | + _coverTitle = [[UILabel alloc]initWithFrame:CGRectMake(_coverImage.right+margin, _coverImage.top, kMainScreenWidth-3*margin-_coverImage.right-_coverBtn.width, _coverImage.height)]; | ||
| 417 | + _coverTitle.font = UIFontCNMake(16); | ||
| 418 | + _coverTitle.textColor = [UIColor blackColor]; | ||
| 419 | + } | ||
| 420 | + return _coverTitle; | ||
| 421 | +} | ||
| 422 | +- (UIProgressView *)processView{ | ||
| 423 | + if(_processView == nil){ | ||
| 424 | + _processView = [[UIProgressView alloc]initWithProgressViewStyle:UIProgressViewStyleDefault]; | ||
| 425 | + _processView.frame = CGRectMake(0, 0, 60, 10); | ||
| 426 | + _processView.center = _coverBtn.center; | ||
| 427 | + _processView.trackTintColor = CNLiveColorWithHexString(@"D9D9D9"); | ||
| 428 | + _processView.progressTintColor = CNLiveColorWithHexString(@"23D41E"); | ||
| 429 | + _processView.hidden = YES; | ||
| 430 | + } | ||
| 431 | + return _processView; | ||
| 432 | +} | ||
| 433 | + | ||
| 434 | +@end |
CNLiveGifFace/Classes/Controller/CNGifFaceAlbumViewController.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNGifFaceAlbumViewController.h | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2019/2/18. | ||
| 6 | +// Copyright © 2019年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNCommonViewController.h" | ||
| 10 | + | ||
| 11 | +NS_ASSUME_NONNULL_BEGIN | ||
| 12 | + | ||
| 13 | +@interface CNGifFaceAlbumViewController : CNCommonViewController | ||
| 14 | + | ||
| 15 | +@end | ||
| 16 | + | ||
| 17 | +NS_ASSUME_NONNULL_END |
CNLiveGifFace/Classes/Controller/CNGifFaceAlbumViewController.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNGifFaceAlbumViewController.m | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2019/2/18. | ||
| 6 | +// Copyright © 2019年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNGifFaceAlbumViewController.h" | ||
| 10 | + | ||
| 11 | +@interface CNGifFaceAlbumViewController () | ||
| 12 | + | ||
| 13 | +@end | ||
| 14 | + | ||
| 15 | +@implementation CNGifFaceAlbumViewController | ||
| 16 | + | ||
| 17 | +- (void)viewDidLoad { | ||
| 18 | + [super viewDidLoad]; | ||
| 19 | + // Do any additional setup after loading the view. | ||
| 20 | +} | ||
| 21 | + | ||
| 22 | +/* | ||
| 23 | +#pragma mark - Navigation | ||
| 24 | + | ||
| 25 | +// In a storyboard-based application, you will often want to do a little preparation before navigation | ||
| 26 | +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | ||
| 27 | + // Get the new view controller using [segue destinationViewController]. | ||
| 28 | + // Pass the selected object to the new view controller. | ||
| 29 | +} | ||
| 30 | +*/ | ||
| 31 | + | ||
| 32 | +@end |
CNLiveGifFace/Classes/Controller/CNGifFaceListViewController.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNGifFaceListViewController.h | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2019/1/26. | ||
| 6 | +// Copyright © 2019年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNCommonViewController.h" | ||
| 10 | + | ||
| 11 | +NS_ASSUME_NONNULL_BEGIN | ||
| 12 | + | ||
| 13 | +@interface CNGifFaceListViewController : CNCommonViewController | ||
| 14 | + | ||
| 15 | +@end | ||
| 16 | + | ||
| 17 | +NS_ASSUME_NONNULL_END |
CNLiveGifFace/Classes/Controller/CNGifFaceListViewController.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNGifFaceListViewController.m | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2019/1/26. | ||
| 6 | +// Copyright © 2019年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNGifFaceListViewController.h" | ||
| 10 | +#import "CNMyGifFaceViewController.h" | ||
| 11 | +#import "CNGifFaceListHeaderView.h" | ||
| 12 | +#import "CNGifFaceListTableViewCell.h" | ||
| 13 | +#import "CNGifFaceModel.h" | ||
| 14 | +#import "CNLiveDownLoadManager.h" | ||
| 15 | +#import "CNLiveArchiveManager.h" | ||
| 16 | +#import <AFNetworking/AFNetworking.h> | ||
| 17 | +#import "CNUserAgreementRequst.h" | ||
| 18 | +#import "CNReportAndComplaintWebController.h" | ||
| 19 | +#import "UIColor+CNLiveExtension.h" | ||
| 20 | +#import "CNNavigationController.h" | ||
| 21 | + | ||
| 22 | +@interface CNGifFaceListViewController ()<UITableViewDelegate, UITableViewDataSource, CNGifFaceListTableViewCellDelegate>{ | ||
| 23 | + BOOL _isDownload; | ||
| 24 | +} | ||
| 25 | +@property (nonatomic, strong) UITableView *tableView; | ||
| 26 | +@property (nonatomic, strong) NSMutableArray *data; | ||
| 27 | +@property (nonatomic, strong) NSMutableArray *datas; | ||
| 28 | +//@property (nonatomic, weak) UIImageView *logo; | ||
| 29 | + | ||
| 30 | +@property (nonatomic, weak) UILabel *author; | ||
| 31 | +@property (nonatomic, weak) YYLabel *version; | ||
| 32 | + | ||
| 33 | +@end | ||
| 34 | + | ||
| 35 | +@implementation CNGifFaceListViewController | ||
| 36 | +#pragma mark - Data | ||
| 37 | +- (void)loadData{ | ||
| 38 | + NSDictionary *params = @{@"appId":AppId, | ||
| 39 | + @"plat":@"i", | ||
| 40 | + @"sid":[UserInformationModel manager].uid}; | ||
| 41 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | ||
| 42 | + [QMUITips showLoadingInView:AppKeyWindow]; | ||
| 43 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNGifFaceShopListUrl Param:params CacheType:CNLiveNetworkCacheTypeCacheNetwork CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | ||
| 44 | + [QMUITips hideAllTipsInView:AppKeyWindow]; | ||
| 45 | + [self hideEmptyView]; | ||
| 46 | + if (error) { | ||
| 47 | + if (self.data.count == 0) { | ||
| 48 | + if (error.code == -1001) { | ||
| 49 | + [self showEmptyViewWithImage:[UIImage imageNamed:@"dd_wlcw"] text:@"无法连接网络" detailText:@"别紧张,试试看刷新页面~" buttonTitle:@" 重试 " buttonAction:@selector(loadData)]; | ||
| 50 | + [self setCNAPIErrorEmptyView]; | ||
| 51 | + }else{ | ||
| 52 | + [self showEmptyViewWithImage:[UIImage imageNamed:@"wufalianjie"] text:@"接口请求错误" detailText:@"别紧张,试试看刷新页面~" buttonTitle:@" 重试 " buttonAction:@selector(loadData)]; | ||
| 53 | + [self setCNAPIErrorEmptyView]; | ||
| 54 | + } | ||
| 55 | + } | ||
| 56 | + return; | ||
| 57 | + } | ||
| 58 | + self.data = [CNGifFaceModel mj_objectArrayWithKeyValuesArray:responseObject[@"data"][@"sections"]]; | ||
| 59 | + [self checkForDownload]; | ||
| 60 | + [self.tableView reloadData]; | ||
| 61 | + if (self.data.count == 0) {//显示empty | ||
| 62 | + [self showEmptyViewWithImage:[UIImage imageNamed:@"zhuangtai_kong"] text:@"您现在没有相关内容哦" detailText:@"" buttonTitle:@"" buttonAction:nil]; | ||
| 63 | + [self setCNNoDataEmptyView]; | ||
| 64 | + self.tableView.tableFooterView = nil; | ||
| 65 | + } | ||
| 66 | + }]; | ||
| 67 | + | ||
| 68 | +} | ||
| 69 | +//检查是否下载 | ||
| 70 | +- (void)checkForDownload{ | ||
| 71 | + NSFileManager *fileManager = [NSFileManager defaultManager]; | ||
| 72 | + NSString *docPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; | ||
| 73 | + NSString *filePath = [docPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@/GifFace/%@",[UserInformationModel manager].uid,@"GifFaceList.plist"]]; | ||
| 74 | + ///var/mobile/Containers/Data/Application/94E0C70B-9F4D-4716-8EAF-7BF0C53AEAEE/Documents/10514405/GifFace/GifFaceList.plist | ||
| 75 | + BOOL result = [fileManager fileExistsAtPath:filePath]; | ||
| 76 | + if(result){ | ||
| 77 | + //读取已存在的表情包列表 | ||
| 78 | + NSMutableArray *arr = [NSMutableArray arrayWithContentsOfFile:filePath]; | ||
| 79 | + if(arr.count > 0){ | ||
| 80 | + [arr enumerateObjectsUsingBlock:^(NSString *str, NSUInteger idx, BOOL * _Nonnull stop) { | ||
| 81 | + [self.data enumerateObjectsUsingBlock:^(CNGifFaceModel *model, NSUInteger idx, BOOL * _Nonnull stop) { | ||
| 82 | + if([str isEqualToString:model.sectionId]){ | ||
| 83 | + model.isDownload = @"1"; | ||
| 84 | + *stop = YES; | ||
| 85 | + } | ||
| 86 | + }]; | ||
| 87 | + }]; | ||
| 88 | + } | ||
| 89 | + } | ||
| 90 | +} | ||
| 91 | + | ||
| 92 | +//未下载完成,继续下载 | ||
| 93 | +- (void)continueToDownload{ | ||
| 94 | + _isDownload = NO; | ||
| 95 | + NSFileManager *fileManager = [NSFileManager defaultManager]; | ||
| 96 | + NSString *docPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; | ||
| 97 | + NSString *filePath = [docPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@/GifFace/%@",[UserInformationModel manager].uid,@"GifFaceNotList.plist"]]; | ||
| 98 | + BOOL result = [fileManager fileExistsAtPath:filePath]; | ||
| 99 | + if(result){ | ||
| 100 | + self.datas = [NSMutableArray arrayWithContentsOfFile:filePath]; | ||
| 101 | + } | ||
| 102 | + if(_datas.count > 0){ | ||
| 103 | + for(NSString *url in self.datas){ | ||
| 104 | + [self clickedAddBtn:url]; | ||
| 105 | + } | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | +} | ||
| 109 | + | ||
| 110 | +- (void)viewDidLoad { | ||
| 111 | + [super viewDidLoad]; | ||
| 112 | + // Do any additional setup after loading the view. | ||
| 113 | + _isDownload = NO; | ||
| 114 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshTableView:) name:@"RemoveGifFacePackageSuccess" object:nil]; | ||
| 115 | + [self loadData]; | ||
| 116 | + [self createUI]; | ||
| 117 | + | ||
| 118 | + //网络监听 | ||
| 119 | + [self listenNetwork]; | ||
| 120 | + | ||
| 121 | +} | ||
| 122 | +- (void)dealloc{ | ||
| 123 | + NSLog(@"CNGifFaceListViewController -- dealloc"); | ||
| 124 | + [[NSNotificationCenter defaultCenter] removeObserver:self]; | ||
| 125 | + | ||
| 126 | +} | ||
| 127 | +- (void)refreshTableView:(NSNotification *)infoNotification{ | ||
| 128 | + NSDictionary *dic = [infoNotification userInfo]; | ||
| 129 | + NSString *sectionId = [dic objectForKey:@"sectionId"]; | ||
| 130 | + [self.data enumerateObjectsUsingBlock:^(CNGifFaceModel *model, NSUInteger idx, BOOL * _Nonnull stop) { | ||
| 131 | + if([sectionId isEqualToString:model.sectionId]){ | ||
| 132 | + model.isDownload = @"0"; | ||
| 133 | + *stop = YES; | ||
| 134 | + } | ||
| 135 | + }]; | ||
| 136 | + [self.tableView reloadData]; | ||
| 137 | + | ||
| 138 | +} | ||
| 139 | +#pragma mark - UI | ||
| 140 | +- (void)createUI { | ||
| 141 | + self.title = @"表情管理"; | ||
| 142 | + | ||
| 143 | + UIButton *closeButton = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 144 | + closeButton.frame = CGRectMake(0, 0, 30, 44); | ||
| 145 | + [closeButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; | ||
| 146 | + [closeButton setTitle:@"关闭" forState:UIControlStateNormal]; | ||
| 147 | + closeButton.titleLabel.font = UIFontCNMake(16*KScreenWidth/375.0); | ||
| 148 | + [closeButton addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside]; | ||
| 149 | + | ||
| 150 | + UIBarButtonItem *leftItem = [[UIBarButtonItem alloc]initWithCustomView:closeButton]; | ||
| 151 | + self.navigationItem.leftBarButtonItem = leftItem; | ||
| 152 | + | ||
| 153 | + UIButton *settingButton = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 154 | + settingButton.frame = CGRectMake(0, 0, 30, 44); | ||
| 155 | + [settingButton setImage:[UIImage imageNamed:@"xx_liaotianshezhi"] forState:UIControlStateNormal]; | ||
| 156 | + [settingButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; | ||
| 157 | + [settingButton addTarget:self action:@selector(settingButtonClicked) forControlEvents:UIControlEventTouchUpInside]; | ||
| 158 | + | ||
| 159 | + UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithCustomView:settingButton]; | ||
| 160 | + self.navigationItem.rightBarButtonItem = rightItem; | ||
| 161 | + [self.view addSubview:self.tableView]; | ||
| 162 | + | ||
| 163 | +// UIImageView *logo = [[UIImageView alloc]init]; | ||
| 164 | +// logo.image = [UIImage imageNamed:@"gif_logo_version"]; | ||
| 165 | +// [self.view addSubview:logo]; | ||
| 166 | +// _logo = logo; | ||
| 167 | + UILabel *author = [[UILabel alloc] init]; | ||
| 168 | + author.textAlignment = NSTextAlignmentCenter; | ||
| 169 | + author.font = UIFontMake(12*KScreenWidth/375.0); | ||
| 170 | + author.textColor = CNLiveColorWithHexString(@"9F9F9F"); | ||
| 171 | + author.text = @"Copyright © 网家家"; | ||
| 172 | + [self.view addSubview:author]; | ||
| 173 | + _author = author; | ||
| 174 | + | ||
| 175 | + YYLabel *version = [[YYLabel alloc] init]; | ||
| 176 | + version.textAlignment = NSTextAlignmentCenter; | ||
| 177 | + | ||
| 178 | + NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:@"服务声明 侵权投诉"]; | ||
| 179 | + NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; | ||
| 180 | + style.alignment = NSTextAlignmentCenter;//对齐方式 | ||
| 181 | + [text addAttribute:NSParagraphStyleAttributeName value:style range:NSMakeRange(0, text.length)]; | ||
| 182 | + | ||
| 183 | + text.color = CNLiveColorWithHexString(@"23D41E"); | ||
| 184 | + text.font = UIFontMake(12*KScreenWidth/375.0); | ||
| 185 | + [version sizeToFit]; | ||
| 186 | + | ||
| 187 | + MJWeakSelf | ||
| 188 | + [text setTextHighlightRange:NSMakeRange(0, 4) color:CNLiveColorWithHexString(@"23D41E") backgroundColor:kClearColor tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { | ||
| 189 | + CNUserAgreementRequst *requst = [[CNUserAgreementRequst alloc] init]; | ||
| 190 | + [requst getAgreementH5WithType:CNAgreementEmojiService success:^(NSString *h5, NSString *title) { | ||
| 191 | + CNReportAndComplaintWebController *webVC = [[CNReportAndComplaintWebController alloc] initWithUrl:h5 webType:CNFeedbackWebType pageTitle:title]; | ||
| 192 | + CNNavigationController *nav = [[CNNavigationController alloc] initWithRootViewController:webVC]; | ||
| 193 | + [weakSelf presentViewController:nav animated:NO completion:NULL]; | ||
| 194 | + | ||
| 195 | + } failure:^(NSError *error) { | ||
| 196 | + [QMUITips showError:error.localizedDescription inView:self.view hideAfterDelay:1.5]; | ||
| 197 | + }]; | ||
| 198 | + | ||
| 199 | + }]; | ||
| 200 | + | ||
| 201 | + [text setTextHighlightRange:NSMakeRange(text.length-4, 4) color:CNLiveColorWithHexString(@"23D41E") backgroundColor:kClearColor tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { | ||
| 202 | + CNUserAgreementRequst *requst = [[CNUserAgreementRequst alloc] init]; | ||
| 203 | + [requst getAgreementH5WithType:CNAgreementEmojiComplaints success:^(NSString *h5, NSString *title) { | ||
| 204 | + CNReportAndComplaintWebController *webVC = [[CNReportAndComplaintWebController alloc] initWithUrl:h5 webType:CNFeedbackWebType pageTitle:title]; | ||
| 205 | + CNNavigationController *nav = [[CNNavigationController alloc] initWithRootViewController:webVC]; | ||
| 206 | + [weakSelf presentViewController:nav animated:NO completion:NULL]; | ||
| 207 | + | ||
| 208 | + } failure:^(NSError *error) { | ||
| 209 | + [QMUITips showError:error.localizedDescription inView:weakSelf.view hideAfterDelay:1.5]; | ||
| 210 | + | ||
| 211 | + }]; | ||
| 212 | + | ||
| 213 | + }]; | ||
| 214 | + version.attributedText = text; | ||
| 215 | + [self.view addSubview:version]; | ||
| 216 | + _version = version; | ||
| 217 | +} | ||
| 218 | +- (void)viewDidLayoutSubviews { | ||
| 219 | + [super viewDidLayoutSubviews]; | ||
| 220 | + [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 221 | + make.left.right.bottom.equalTo(self.view); | ||
| 222 | + make.top.equalTo(self.view).offset(kNavigationBarHeight); | ||
| 223 | + make.bottom.equalTo(self.view.mas_bottom).offset(0); | ||
| 224 | + | ||
| 225 | + }]; | ||
| 226 | + [_version mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 227 | + make.bottom.equalTo(self.view.mas_bottom).offset(-(kVerticalBottomSafeHeight+10)); | ||
| 228 | + make.left.right.bottom.equalTo(self.view); | ||
| 229 | + make.height.offset(18); | ||
| 230 | + | ||
| 231 | + }]; | ||
| 232 | + [_author mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 233 | + make.bottom.equalTo(_version.mas_top).offset(-5); | ||
| 234 | + make.centerX.equalTo(self.view); | ||
| 235 | + make.height.offset(30); | ||
| 236 | + make.width.offset(200); | ||
| 237 | + | ||
| 238 | + }]; | ||
| 239 | +// [_logo mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 240 | +// make.bottom.equalTo(_version.mas_top).offset(-5); | ||
| 241 | +// make.centerX.equalTo(self.view); | ||
| 242 | +// make.height.offset(30); | ||
| 243 | +// make.width.offset(80); | ||
| 244 | +// | ||
| 245 | +// }]; | ||
| 246 | + | ||
| 247 | +} | ||
| 248 | +#pragma mark - UITableViewDataSource | ||
| 249 | +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | ||
| 250 | + return self.data.count; | ||
| 251 | + | ||
| 252 | +} | ||
| 253 | + | ||
| 254 | +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | ||
| 255 | + CNGifFaceListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCNGifFaceListTableViewCell forIndexPath:indexPath]; | ||
| 256 | + cell.model = self.data[indexPath.row]; | ||
| 257 | + cell.delegate = self; | ||
| 258 | + cell.selectionStyle = UITableViewCellSelectionStyleNone; | ||
| 259 | + return cell; | ||
| 260 | + | ||
| 261 | +} | ||
| 262 | + | ||
| 263 | +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { | ||
| 264 | + return 20+60*RATIO; | ||
| 265 | + | ||
| 266 | +} | ||
| 267 | +- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ | ||
| 268 | + return 0.1; // 注意要设置为0.1,不能设置为0 | ||
| 269 | +} | ||
| 270 | +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ | ||
| 271 | + return 45*RATIO; // 注意要设置为0.1,不能设置为0 | ||
| 272 | +} | ||
| 273 | + | ||
| 274 | +#pragma mark - UITableViewDelegate | ||
| 275 | +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { | ||
| 276 | + | ||
| 277 | + | ||
| 278 | +} | ||
| 279 | +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ | ||
| 280 | + CNGifFaceListHeaderView *header = [tableView dequeueReusableHeaderFooterViewWithIdentifier:kCNGifFaceListHeaderView]; | ||
| 281 | + header.text = @"推荐表情"; | ||
| 282 | + header.textColor = @"000000"; | ||
| 283 | + header.backgroundColor = @"FFFFFF"; | ||
| 284 | + header.textSize = 17; | ||
| 285 | + return header; | ||
| 286 | +} | ||
| 287 | +/* | ||
| 288 | +#pragma mark - Navigation | ||
| 289 | + | ||
| 290 | +// In a storyboard-based application, you will often want to do a little preparation before navigation | ||
| 291 | +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | ||
| 292 | + // Get the new view controller using [segue destinationViewController]. | ||
| 293 | + // Pass the selected object to the new view controller. | ||
| 294 | +} | ||
| 295 | +*/ | ||
| 296 | + | ||
| 297 | +#pragma mark - Action | ||
| 298 | +- (void)goBack{ | ||
| 299 | + [self.navigationController popViewControllerAnimated:YES]; | ||
| 300 | + | ||
| 301 | +} | ||
| 302 | +- (void)settingButtonClicked{ | ||
| 303 | + CNMyGifFaceViewController *vc = [[CNMyGifFaceViewController alloc]init]; | ||
| 304 | + [[AppDelegate sharedAppDelegate] pushViewController:vc withBackTitle:@"返回"]; | ||
| 305 | + | ||
| 306 | +} | ||
| 307 | + | ||
| 308 | +#pragma mark - Lazy loading | ||
| 309 | +- (UITableView *)tableView { | ||
| 310 | + if (!_tableView) { | ||
| 311 | + _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]; | ||
| 312 | + _tableView.backgroundColor = RGB(242, 242, 242); | ||
| 313 | + _tableView.delegate = self; | ||
| 314 | + _tableView.dataSource = self; | ||
| 315 | + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; | ||
| 316 | + _tableView.showsVerticalScrollIndicator = NO; | ||
| 317 | + _tableView.showsHorizontalScrollIndicator = NO; | ||
| 318 | + [_tableView registerClass:[CNGifFaceListTableViewCell class] forCellReuseIdentifier:kCNGifFaceListTableViewCell]; | ||
| 319 | + [_tableView registerClass:[CNGifFaceListHeaderView class] forHeaderFooterViewReuseIdentifier:kCNGifFaceListHeaderView]; | ||
| 320 | + | ||
| 321 | + } | ||
| 322 | + return _tableView; | ||
| 323 | +} | ||
| 324 | + | ||
| 325 | +- (NSMutableArray *)data{ | ||
| 326 | + if (!_data) { | ||
| 327 | + _data = [[NSMutableArray alloc] init]; | ||
| 328 | + } | ||
| 329 | + return _data; | ||
| 330 | +} | ||
| 331 | + | ||
| 332 | +- (NSMutableArray *)datas{ | ||
| 333 | + if (!_datas) { | ||
| 334 | + _datas = [[NSMutableArray alloc] init]; | ||
| 335 | + | ||
| 336 | + } | ||
| 337 | + return _datas; | ||
| 338 | +} | ||
| 339 | + | ||
| 340 | +#pragma mark - 下载 | ||
| 341 | +- (void)clickedAddBtn:(NSString *)url{ | ||
| 342 | + | ||
| 343 | + [self createGifFaceNotList:url]; | ||
| 344 | + | ||
| 345 | + if(![[CNLiveDownLoadManager sharedInstance].downloads containsObject:url]){ | ||
| 346 | + [[CNLiveDownLoadManager sharedInstance].downloads addObject:url]; | ||
| 347 | + | ||
| 348 | + } | ||
| 349 | + | ||
| 350 | + if(!_isDownload){ | ||
| 351 | + _isDownload = YES; | ||
| 352 | + [self download:url]; | ||
| 353 | + | ||
| 354 | + } | ||
| 355 | +} | ||
| 356 | + | ||
| 357 | +#pragma mark - Private Methods | ||
| 358 | +//网络监听 | ||
| 359 | +- (void)listenNetwork { | ||
| 360 | + __weak typeof(self) weakSelf = self; | ||
| 361 | + AFNetworkReachabilityManager *manager = [AFNetworkReachabilityManager sharedManager]; | ||
| 362 | + [manager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) { | ||
| 363 | + weakSelf.netStatus = status; | ||
| 364 | + switch (status) { | ||
| 365 | + case AFNetworkReachabilityStatusUnknown: | ||
| 366 | + NSLog(@"未识别的网络"); | ||
| 367 | + | ||
| 368 | + break; | ||
| 369 | + case AFNetworkReachabilityStatusNotReachable: | ||
| 370 | + NSLog(@"不可达的网络(未连接)"); | ||
| 371 | + break; | ||
| 372 | + case AFNetworkReachabilityStatusReachableViaWWAN: | ||
| 373 | + NSLog(@"4G网络"); | ||
| 374 | + [weakSelf continueToDownload]; | ||
| 375 | + | ||
| 376 | + break; | ||
| 377 | + case AFNetworkReachabilityStatusReachableViaWiFi: | ||
| 378 | + NSLog(@"wifi网络"); | ||
| 379 | + [weakSelf continueToDownload]; | ||
| 380 | + | ||
| 381 | + break; | ||
| 382 | + default: | ||
| 383 | + break; | ||
| 384 | + } | ||
| 385 | + }]; | ||
| 386 | + [manager startMonitoring]; | ||
| 387 | +} | ||
| 388 | +- (void)createGifFaceNotList:(NSString *)url{ | ||
| 389 | + //创建文件管理 | ||
| 390 | + NSFileManager *fileManager = [NSFileManager defaultManager]; | ||
| 391 | + NSString *docPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; | ||
| 392 | + NSString *filePath = [docPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@/GifFace/%@",[UserInformationModel manager].uid,@"GifFaceNotList.plist"]]; | ||
| 393 | + ///var/mobile/Containers/Data/Application/94E0C70B-9F4D-4716-8EAF-7BF0C53AEAEE/Documents/10514405/GifFace/GifFaceList.plist | ||
| 394 | + BOOL result = [fileManager fileExistsAtPath:filePath]; | ||
| 395 | + if(result){ | ||
| 396 | + //读取已存在的表情包未下载列表 | ||
| 397 | + NSMutableArray *data = [NSMutableArray arrayWithContentsOfFile:filePath]; | ||
| 398 | + if([data containsObject:url]){//存在 | ||
| 399 | + | ||
| 400 | + }else{//不存在 | ||
| 401 | + [data addObject:url]; | ||
| 402 | + } | ||
| 403 | + if([data writeToFile:filePath atomically:YES]){ | ||
| 404 | + | ||
| 405 | + } | ||
| 406 | + | ||
| 407 | + }else{ | ||
| 408 | + //不存在的表情包未下载列表 | ||
| 409 | + NSMutableArray *data = [NSMutableArray array]; | ||
| 410 | + [data addObject:url]; | ||
| 411 | + if([data writeToFile:filePath atomically:YES]){ | ||
| 412 | + } | ||
| 413 | + } | ||
| 414 | +} | ||
| 415 | +//下载 | ||
| 416 | +- (void)download:(NSString *)downloadUrl{ | ||
| 417 | + MJWeakSelf | ||
| 418 | + [[CNLiveDownLoadManager sharedInstance] downLoadWithURL:downloadUrl progress:^(NSString *url, float progress) { | ||
| 419 | + [weakSelf.data enumerateObjectsUsingBlock:^(CNGifFaceModel *model, NSUInteger idx, BOOL * _Nonnull stop) { | ||
| 420 | + if ([model.downloadUrl isEqualToString:downloadUrl]) { | ||
| 421 | + // 主线程更新cell进度 | ||
| 422 | + dispatch_async(dispatch_get_main_queue(), ^{ | ||
| 423 | + CNGifFaceListTableViewCell *cell = [weakSelf.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:idx inSection:0]]; | ||
| 424 | + cell.addBtn.hidden = YES; | ||
| 425 | + cell.processView.hidden = NO; | ||
| 426 | + [cell.processView setProgress:progress]; | ||
| 427 | + if(progress >= 1.0f){ | ||
| 428 | + [cell refreshCell]; | ||
| 429 | + } | ||
| 430 | + }); | ||
| 431 | + | ||
| 432 | + *stop = YES; | ||
| 433 | + } | ||
| 434 | + }]; | ||
| 435 | + | ||
| 436 | + } success:^(NSString *url, NSString *fileStorePath) { | ||
| 437 | + ///var/mobile/Containers/Data/Application/27248574-1177-4075-B200-7E8B2D052FB5/Library/Caches/0e3a18a25dcf490bfcab448fc362e82e | ||
| 438 | + //下载结束储存地址 | ||
| 439 | + NSLog(@"fileStorePath----%@",fileStorePath); | ||
| 440 | + | ||
| 441 | + [weakSelf releaseZip:fileStorePath downloadUrl:downloadUrl]; | ||
| 442 | + | ||
| 443 | + _isDownload = NO; | ||
| 444 | + NSMutableArray *data = [CNLiveDownLoadManager sharedInstance].downloads; | ||
| 445 | + if(data.count > 0){ | ||
| 446 | + [data removeObjectAtIndex:0]; | ||
| 447 | + | ||
| 448 | + } | ||
| 449 | + if(data.count > 0 && !_isDownload){ | ||
| 450 | + _isDownload = YES; | ||
| 451 | + [weakSelf download:data[0]]; | ||
| 452 | + | ||
| 453 | + } | ||
| 454 | + | ||
| 455 | + } faile:^(NSString *url, NSError *error) { | ||
| 456 | + _isDownload = NO; | ||
| 457 | + NSMutableArray *data = [CNLiveDownLoadManager sharedInstance].downloads; | ||
| 458 | + if(data.count > 0){ | ||
| 459 | + [data removeObjectAtIndex:0]; | ||
| 460 | + | ||
| 461 | + } | ||
| 462 | + if(data.count > 0 && !_isDownload){ | ||
| 463 | + _isDownload = YES; | ||
| 464 | + [weakSelf download:data[0]]; | ||
| 465 | + | ||
| 466 | + } | ||
| 467 | + }]; | ||
| 468 | + | ||
| 469 | +} | ||
| 470 | + | ||
| 471 | +//解压 | ||
| 472 | +- (void)releaseZip:(NSString *)fileStorePath downloadUrl:(NSString *)downloadUrl{ | ||
| 473 | + NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]; | ||
| 474 | + | ||
| 475 | + [CNLiveArchiveManager sharedInstance].cachesPath = [path stringByAppendingPathComponent:[UserInformationModel manager].uid]; | ||
| 476 | + | ||
| 477 | + //下载 | ||
| 478 | + ///var/mobile/Containers/Data/Application/1DFB750A-35BE-4FE0-9CDC-E0DB6E84F7FB/Documents/10514405/GifFace/DownLoad | ||
| 479 | + | ||
| 480 | + //缓存 | ||
| 481 | + ///var/mobile/Containers/Data/Application/1DFB750A-35BE-4FE0-9CDC-E0DB6E84F7FB/Documents/10514405/GifFace/Cache | ||
| 482 | + | ||
| 483 | + ///var/mobile/Containers/Data/Application/94E0C70B-9F4D-4716-8EAF-7BF0C53AEAEE/Documents/10514405/GifFace/GifFaceList.plist | ||
| 484 | + | ||
| 485 | + [[CNLiveArchiveManager sharedInstance]releaseZipWithLocalPath:fileStorePath folderName:@"GifFace/Download" releaseZipFolderName:[[downloadUrl lastPathComponent] stringByDeletingPathExtension] resultBlock:^(NSString *hostPath, NSArray *array) { | ||
| 486 | + //解压结束储存地址 | ||
| 487 | + NSLog(@"hostPath----%@",hostPath); | ||
| 488 | + | ||
| 489 | + //下载成功删除点断续传的已下载长度 | ||
| 490 | + NSString *totalLengthPlist = [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"totalLength.plist"]; | ||
| 491 | + NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithContentsOfFile:totalLengthPlist]; | ||
| 492 | + [dict removeObjectForKey:downloadUrl.md5String]; | ||
| 493 | + [dict writeToFile:totalLengthPlist atomically:YES]; | ||
| 494 | + | ||
| 495 | + //创建文件管理 | ||
| 496 | + NSFileManager *fileManager = [NSFileManager defaultManager]; | ||
| 497 | + NSString *docPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; | ||
| 498 | + | ||
| 499 | + //下载成功删除表情压缩包 | ||
| 500 | + [fileManager removeItemAtPath:fileStorePath error:nil]; | ||
| 501 | + | ||
| 502 | + //下载成功删除url | ||
| 503 | + NSString *filePathNot = [docPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@/GifFace/%@",[UserInformationModel manager].uid,@"GifFaceNotList.plist"]]; | ||
| 504 | + NSMutableArray *data = [NSMutableArray arrayWithContentsOfFile:filePathNot]; | ||
| 505 | + [data removeObject:downloadUrl]; | ||
| 506 | + [data writeToFile:filePathNot atomically:YES]; | ||
| 507 | + | ||
| 508 | + //下载成功添加本地已下载列表 | ||
| 509 | + NSString *filePath = [docPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@/GifFace/%@",[UserInformationModel manager].uid,@"GifFaceList.plist"]]; | ||
| 510 | + | ||
| 511 | + ///var/mobile/Containers/Data/Application/94E0C70B-9F4D-4716-8EAF-7BF0C53AEAEE/Documents/10514405/GifFace/GifFaceList.plist | ||
| 512 | + BOOL result = [fileManager fileExistsAtPath:filePath]; | ||
| 513 | + if(result){ | ||
| 514 | + //读取已存在的表情包列表 | ||
| 515 | + NSMutableArray *data = [NSMutableArray arrayWithContentsOfFile:filePath]; | ||
| 516 | + NSString *str = [[downloadUrl lastPathComponent] stringByDeletingPathExtension]; | ||
| 517 | + if([data containsObject:str]){//存在 | ||
| 518 | + return ; | ||
| 519 | + }else{//不存在 | ||
| 520 | + [data addObject:str]; | ||
| 521 | + } | ||
| 522 | + if([data writeToFile:filePath atomically:YES]){ | ||
| 523 | + NSLog(@"写入成功"); | ||
| 524 | + [[NSNotificationCenter defaultCenter] postNotificationName:@"GifFaceDownLoadSuccess" object:nil]; | ||
| 525 | + } | ||
| 526 | + | ||
| 527 | + }else{ | ||
| 528 | + //不存在的表情包列表 | ||
| 529 | + NSMutableArray *data = [NSMutableArray array]; | ||
| 530 | + [data addObject:[[downloadUrl lastPathComponent] stringByDeletingPathExtension]]; | ||
| 531 | + if([data writeToFile:filePath atomically:YES]){ | ||
| 532 | + NSLog(@"写入成功"); | ||
| 533 | + [[NSNotificationCenter defaultCenter] postNotificationName:@"GifFaceDownLoadSuccess" object:nil]; | ||
| 534 | + } | ||
| 535 | + } | ||
| 536 | + | ||
| 537 | + }]; | ||
| 538 | +} | ||
| 539 | + | ||
| 540 | +@end |
CNLiveGifFace/Classes/Controller/CNMyGifFaceViewController.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNMyGifFaceViewController.h | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2019/2/18. | ||
| 6 | +// Copyright © 2019年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNCommonViewController.h" | ||
| 10 | + | ||
| 11 | +NS_ASSUME_NONNULL_BEGIN | ||
| 12 | + | ||
| 13 | +@interface CNMyGifFaceViewController : CNCommonViewController | ||
| 14 | + | ||
| 15 | +@end | ||
| 16 | + | ||
| 17 | +NS_ASSUME_NONNULL_END |
CNLiveGifFace/Classes/Controller/CNMyGifFaceViewController.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNMyGifFaceViewController.m | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2019/2/18. | ||
| 6 | +// Copyright © 2019年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNMyGifFaceViewController.h" | ||
| 10 | +#import "CNGifFaceListHeaderView.h" | ||
| 11 | +#import "CNMyGifFaceTableViewCell.h" | ||
| 12 | +#import "CNGifFaceModel.h" | ||
| 13 | + | ||
| 14 | + | ||
| 15 | +@interface CNMyGifFaceViewController ()<UITableViewDelegate,UITableViewDataSource,CNMyGifFaceTableViewCellDelegate> | ||
| 16 | +@property (nonatomic, strong) UITableView *tableView; | ||
| 17 | +@property (nonatomic, strong) NSMutableArray *data; | ||
| 18 | + | ||
| 19 | +@end | ||
| 20 | + | ||
| 21 | +@implementation CNMyGifFaceViewController | ||
| 22 | +#pragma mark - Data | ||
| 23 | +- (void)reloadDatas{ | ||
| 24 | + dispatch_async(dispatch_get_main_queue(), ^{ | ||
| 25 | + _data = nil; | ||
| 26 | + [self.tableView reloadData]; | ||
| 27 | + | ||
| 28 | + }); | ||
| 29 | + | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | +- (void)viewDidLoad { | ||
| 33 | + [super viewDidLoad]; | ||
| 34 | + // Do any additional setup after loading the view. | ||
| 35 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadDatas) name:@"GifFaceDownLoadSuccess" object:nil]; | ||
| 36 | + | ||
| 37 | + [self createUI]; | ||
| 38 | + | ||
| 39 | +} | ||
| 40 | + | ||
| 41 | +- (void)dealloc{ | ||
| 42 | + [[NSNotificationCenter defaultCenter] removeObserver:self name:@"GifFaceDownLoadSuccess" object:nil]; | ||
| 43 | + | ||
| 44 | +} | ||
| 45 | + | ||
| 46 | +#pragma mark - UI | ||
| 47 | +- (void)createUI { | ||
| 48 | + self.title = @"我的表情"; | ||
| 49 | + [self.view addSubview:self.tableView]; | ||
| 50 | + | ||
| 51 | +} | ||
| 52 | +- (void)viewDidLayoutSubviews { | ||
| 53 | + [super viewDidLayoutSubviews]; | ||
| 54 | + [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 55 | + make.left.right.bottom.equalTo(self.view); | ||
| 56 | + make.top.equalTo(self.view).offset(kNavigationBarHeight); | ||
| 57 | + make.bottom.equalTo(self.view.mas_bottom).offset(0); | ||
| 58 | + | ||
| 59 | + }]; | ||
| 60 | + | ||
| 61 | +} | ||
| 62 | +#pragma mark - CNMyGifFaceTableViewCellDelegate | ||
| 63 | +- (void)refreshGifFaceTableView:(CNMyGifFaceTableViewCell *)cell{ | ||
| 64 | + if(self.data.count > 0){ | ||
| 65 | + [self.data removeObject:cell.groupName]; | ||
| 66 | + [self.tableView reloadData]; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | +} | ||
| 70 | +#pragma mark - UITableViewDataSource | ||
| 71 | +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | ||
| 72 | + return self.data.count; | ||
| 73 | + | ||
| 74 | +} | ||
| 75 | + | ||
| 76 | +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | ||
| 77 | + CNMyGifFaceTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCNMyGifFaceTableViewCell forIndexPath:indexPath]; | ||
| 78 | + cell.groupName = self.data[indexPath.row]; | ||
| 79 | + cell.selectionStyle = UITableViewCellSelectionStyleNone; | ||
| 80 | + cell.delegate = self; | ||
| 81 | + return cell; | ||
| 82 | + | ||
| 83 | +} | ||
| 84 | + | ||
| 85 | +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { | ||
| 86 | + return 20+40*RATIO; | ||
| 87 | + | ||
| 88 | +} | ||
| 89 | + | ||
| 90 | +- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ | ||
| 91 | + return 0.1; // 注意要设置为0.1,不能设置为0 | ||
| 92 | +} | ||
| 93 | + | ||
| 94 | +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ | ||
| 95 | + return 45*RATIO; // 注意要设置为0.1,不能设置为0 | ||
| 96 | +} | ||
| 97 | + | ||
| 98 | +#pragma mark - UITableViewDelegate | ||
| 99 | +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { | ||
| 100 | + | ||
| 101 | + | ||
| 102 | +} | ||
| 103 | +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ | ||
| 104 | + CNGifFaceListHeaderView *header = [tableView dequeueReusableHeaderFooterViewWithIdentifier:kCNGifFaceListHeaderView]; | ||
| 105 | + header.text = @"聊天面板中的整套表情"; | ||
| 106 | + header.textColor = @"999999"; | ||
| 107 | + header.backgroundColor = @"F2F2F2"; | ||
| 108 | + header.textSize = 14; | ||
| 109 | + return header; | ||
| 110 | +} | ||
| 111 | +/* | ||
| 112 | + #pragma mark - Navigation | ||
| 113 | + | ||
| 114 | + // In a storyboard-based application, you will often want to do a little preparation before navigation | ||
| 115 | + - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | ||
| 116 | + // Get the new view controller using [segue destinationViewController]. | ||
| 117 | + // Pass the selected object to the new view controller. | ||
| 118 | + } | ||
| 119 | + */ | ||
| 120 | + | ||
| 121 | +#pragma mark - Action | ||
| 122 | +- (void)clickedVersionBtn:(UIButton *)btn{ | ||
| 123 | + | ||
| 124 | +} | ||
| 125 | + | ||
| 126 | +#pragma mark - Lazy loading | ||
| 127 | +- (UITableView *)tableView { | ||
| 128 | + if (!_tableView) { | ||
| 129 | + _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]; | ||
| 130 | + _tableView.backgroundColor = RGB(242, 242, 242); | ||
| 131 | + _tableView.delegate = self; | ||
| 132 | + _tableView.dataSource = self; | ||
| 133 | + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; | ||
| 134 | + _tableView.showsVerticalScrollIndicator = NO; | ||
| 135 | + _tableView.showsHorizontalScrollIndicator = NO; | ||
| 136 | + [_tableView registerClass:[CNMyGifFaceTableViewCell class] forCellReuseIdentifier:kCNMyGifFaceTableViewCell]; | ||
| 137 | + [_tableView registerClass:[CNGifFaceListHeaderView class] forHeaderFooterViewReuseIdentifier:kCNGifFaceListHeaderView]; | ||
| 138 | + | ||
| 139 | + } | ||
| 140 | + return _tableView; | ||
| 141 | +} | ||
| 142 | + | ||
| 143 | +- (NSMutableArray *)data{ | ||
| 144 | + if (!_data) { | ||
| 145 | + _data = [[NSMutableArray alloc] init]; | ||
| 146 | + NSFileManager *fileManager = [NSFileManager defaultManager]; | ||
| 147 | + NSString *docPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; | ||
| 148 | + NSString *filePath = [docPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@/GifFace/%@",[UserInformationModel manager].uid,@"GifFaceList.plist"]]; | ||
| 149 | + ///var/mobile/Containers/Data/Application/94E0C70B-9F4D-4716-8EAF-7BF0C53AEAEE/Documents/10514405/GifFace/GifFaceList.plist | ||
| 150 | + BOOL result = [fileManager fileExistsAtPath:filePath]; | ||
| 151 | + if(result){ | ||
| 152 | + //读取已存在的表情包列表 | ||
| 153 | + _data = [NSMutableArray arrayWithContentsOfFile:filePath]; | ||
| 154 | + } | ||
| 155 | + } | ||
| 156 | + return _data; | ||
| 157 | +} | ||
| 158 | + | ||
| 159 | +@end |
CNLiveGifFace/Classes/Model/CNFaceThemeModel.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNFaceThemeModel.h | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2018/10/15. | ||
| 6 | +// Copyright © 2018年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <Foundation/Foundation.h> | ||
| 10 | + | ||
| 11 | +NS_ASSUME_NONNULL_BEGIN | ||
| 12 | +typedef NS_ENUM(NSInteger, FaceThemeStyle) | ||
| 13 | +{ | ||
| 14 | + FaceThemeStyleSystemEmoji, //30*30 | ||
| 15 | + FaceThemeStyleCustomEmoji, //40*40 | ||
| 16 | + FaceThemeStyleGif //60*60 | ||
| 17 | +}; | ||
| 18 | + | ||
| 19 | +@interface CNFaceModel : NSObject | ||
| 20 | + | ||
| 21 | +/** 表情图片 */ | ||
| 22 | +@property (nonatomic, copy) NSString *themeId;//主题id | ||
| 23 | +@property (nonatomic, copy) NSString *faceId;//表情id | ||
| 24 | +@property (nonatomic, copy) NSString *faceName;//表情名字 | ||
| 25 | +@property (nonatomic, copy) NSString *faceDesc;//表情描述 | ||
| 26 | + | ||
| 27 | +@property (nonatomic, copy) NSString *faceGifUrl;//表情gif url | ||
| 28 | +@property (nonatomic, copy) NSString *facePngUrl;//表情png url | ||
| 29 | + | ||
| 30 | +@property (nonatomic, copy) NSString *faceIconGif;//表情gif 本地 | ||
| 31 | +@property (nonatomic, copy) NSString *faceIconPng;//表情png 本地 | ||
| 32 | + | ||
| 33 | +@property (nonatomic, copy) NSString *faceProgress; | ||
| 34 | +@property (nonatomic, copy) NSString *type; | ||
| 35 | +@property (nonatomic, assign) FaceThemeStyle themeStyle; | ||
| 36 | + | ||
| 37 | +@end | ||
| 38 | + | ||
| 39 | +/** 表情标题 */ | ||
| 40 | +@interface CNFaceThemeModel : NSObject | ||
| 41 | +@property (nonatomic, copy) NSString *themeId; | ||
| 42 | +@property (nonatomic, copy) NSString *themeIcon; | ||
| 43 | +@property (nonatomic, copy) NSString *themeName; | ||
| 44 | +@property (nonatomic, copy) NSString *themeDesc; | ||
| 45 | +@property (nonatomic, copy) NSString *themeAuther; | ||
| 46 | +@property (nonatomic, copy) NSString *downLoadUrl; | ||
| 47 | +@property (nonatomic, copy) NSString *number; | ||
| 48 | +@property (nonatomic, strong) NSArray *faceModels; | ||
| 49 | +@property (nonatomic, assign) FaceThemeStyle themeStyle; | ||
| 50 | + | ||
| 51 | + | ||
| 52 | +@end | ||
| 53 | + | ||
| 54 | +NS_ASSUME_NONNULL_END |
CNLiveGifFace/Classes/Model/CNFaceThemeModel.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNFaceThemeModel.m | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2018/10/15. | ||
| 6 | +// Copyright © 2018年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNFaceThemeModel.h" | ||
| 10 | +@interface CNFaceModel()<NSCoding> | ||
| 11 | + | ||
| 12 | +@end | ||
| 13 | + | ||
| 14 | +@implementation CNFaceModel | ||
| 15 | +- (void)encodeWithCoder:(NSCoder *)enCoder{ | ||
| 16 | + | ||
| 17 | +} | ||
| 18 | +- (id)initWithCoder:(NSCoder *)decoder{ | ||
| 19 | + self = [super init]; | ||
| 20 | + if(self){ | ||
| 21 | + | ||
| 22 | + } | ||
| 23 | + return self; | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | +@end | ||
| 27 | + | ||
| 28 | +@implementation CNFaceThemeModel | ||
| 29 | + | ||
| 30 | +- (NSString *)description | ||
| 31 | +{ | ||
| 32 | + return [NSString stringWithFormat:@"%@ %@", self.themeIcon, self.themeDesc]; | ||
| 33 | +} | ||
| 34 | ++ (NSDictionary *)mj_objectClassInArray{ | ||
| 35 | + return @{ | ||
| 36 | + @"faceModels" : @"CNFaceModel" | ||
| 37 | + }; | ||
| 38 | +} | ||
| 39 | ++(NSDictionary *)mj_replacedKeyFromPropertyName | ||
| 40 | +{ | ||
| 41 | + return @{@"faceModels":@"faces"}; | ||
| 42 | +} | ||
| 43 | +@end |
CNLiveGifFace/Classes/Model/CNGifFaceModel.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNGifFaceModel.h | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2019/1/26. | ||
| 6 | +// Copyright © 2019年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <Foundation/Foundation.h> | ||
| 10 | + | ||
| 11 | +NS_ASSUME_NONNULL_BEGIN | ||
| 12 | + | ||
| 13 | +@interface CNGifFaceModel : NSObject | ||
| 14 | +@property (nonatomic, copy) NSString *sectionId; | ||
| 15 | +@property (nonatomic, copy) NSString *coverPic; | ||
| 16 | +@property (nonatomic, copy) NSString *title; | ||
| 17 | +@property (nonatomic, copy) NSString *desc; | ||
| 18 | +@property (nonatomic, copy) NSString *downloadUrl; | ||
| 19 | +@property (nonatomic, copy) NSString *isDownload; | ||
| 20 | + | ||
| 21 | +@end | ||
| 22 | + | ||
| 23 | +NS_ASSUME_NONNULL_END |
CNLiveGifFace/Classes/Model/CNGifFaceModel.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNGifFaceModel.m | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2019/1/26. | ||
| 6 | +// Copyright © 2019年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNGifFaceModel.h" | ||
| 10 | + | ||
| 11 | +@implementation CNGifFaceModel | ||
| 12 | ++(NSDictionary *)mj_replacedKeyFromPropertyName | ||
| 13 | +{ | ||
| 14 | + return @{@"Id":@"id"}; | ||
| 15 | +} | ||
| 16 | +@end |
CNLiveGifFace/Classes/Tools/CNGifManager.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNGifManager.h | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2019/2/26. | ||
| 6 | +// Copyright © 2019年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <Foundation/Foundation.h> | ||
| 10 | +#import <CoreGraphics/CoreGraphics.h> | ||
| 11 | +#import <ImageIO/ImageIO.h> | ||
| 12 | +#import <AVFoundation/AVFoundation.h> | ||
| 13 | + | ||
| 14 | +#if TARGET_OS_IPHONE | ||
| 15 | +#import <MobileCoreServices/MobileCoreServices.h> | ||
| 16 | +#import <UIKit/UIKit.h> | ||
| 17 | +#elif TARGET_OS_MAC | ||
| 18 | +#import <CoreServices/CoreServices.h> | ||
| 19 | +#import <WebKit/WebKit.h> | ||
| 20 | +#endif | ||
| 21 | + | ||
| 22 | +NS_ASSUME_NONNULL_BEGIN | ||
| 23 | + | ||
| 24 | +@interface CNGifManager : NSObject | ||
| 25 | +/** | ||
| 26 | + * 将本地视频转换成Gif图 | ||
| 27 | + * | ||
| 28 | + * @param videoURL 本地视频的url 使用系统 + (NSURL *)fileURLWithPath:(NSString *)path;将本地path转url | ||
| 29 | + * @param frameCount 一共切多少张 | ||
| 30 | + * @param delayTime 每一张几秒钟显示 | ||
| 31 | + * @param loopCount 是否循环 | ||
| 32 | + * @param isNeedCompression 是否需要压缩 | ||
| 33 | + * @param compressionWidth 压缩尺寸 宽 | ||
| 34 | + * @param compressionHeight 压缩尺寸 高 | ||
| 35 | + * @param fileName 生成gif 的文件名 | ||
| 36 | + * @param completionBlock 成功回调 会返回 gif tmp文件下本地路径 | ||
| 37 | + */ | ||
| 38 | ++ (void)makingGIFWithURL:(NSURL*)videoURL frameCount:(int)frameCount delayTime:(float)delayTime loopCount:(int)loopCount needCompression:(BOOL)isNeedCompression compressionWidth:(float)compressionWidth compressionHeight:(float)compressionHeight fileName:(NSString*)fileName completion:(void(^)(NSString *GifPath))completionBlock; | ||
| 39 | + | ||
| 40 | + | ||
| 41 | +//设置 | ||
| 42 | +//demo 中video.mp4 为18s 视频 希望gif 帧数位8, 所以 FrameCount = 18 * 8 ; delayTime = 1/8; | ||
| 43 | + | ||
| 44 | +//位置 | ||
| 45 | +///var/mobile/Containers/Data/Application/3EAE8373-82FF-49C0-A700-89C73303E4D7/Documents/123456/GifFace/DownLoad/Personal/1551168120065.gif | ||
| 46 | ++ (void)makingGIFWithURL:(NSURL*)videoURL frameCount:(int)frameCount delayTime:(float)delayTime loopCount:(int)loopCount needCompression:(BOOL)isNeedCompression compressionWidth:(float)compressionWidth compressionHeight:(float)compressionHeight completion:(void(^)(NSString *GifPath))completionBlock; | ||
| 47 | + | ||
| 48 | + | ||
| 49 | +@end | ||
| 50 | + | ||
| 51 | +NS_ASSUME_NONNULL_END |
CNLiveGifFace/Classes/Tools/CNGifManager.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNGifManager.m | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2019/2/26. | ||
| 6 | +// Copyright © 2019年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNGifManager.h" | ||
| 10 | +#define timeInterval @(600) | ||
| 11 | +#define tolerance @(0.01) | ||
| 12 | + | ||
| 13 | +typedef NS_ENUM(NSInteger, GIFSize) { | ||
| 14 | + GIFSizeVeryLow = 2, | ||
| 15 | + GIFSizeLow = 3, | ||
| 16 | + GIFSizeMedium = 5, | ||
| 17 | + GIFSizeHigh = 7, | ||
| 18 | + GIFSizeOriginal = 10 | ||
| 19 | +}; | ||
| 20 | +@implementation CNGifManager | ||
| 21 | + | ||
| 22 | ++ (void)makingGIFWithURL:(NSURL*)videoURL frameCount:(int)frameCount delayTime:(float)delayTime loopCount:(int)loopCount needCompression:(BOOL)isNeedCompression compressionWidth:(float)compressionWidth compressionHeight:(float)compressionHeight fileName:(NSString*)fileName completion:(void(^)(NSString *GifPath))completionBlock{ | ||
| 23 | + | ||
| 24 | + NSLog(@"取出时间戳"); | ||
| 25 | + NSDictionary *fileProperties = [self filePropertiesWithLoopCount:loopCount]; | ||
| 26 | + NSDictionary *frameProperties = [self framePropertiesWithDelayTime:delayTime]; | ||
| 27 | + | ||
| 28 | + AVURLAsset *asset = [AVURLAsset assetWithURL:videoURL]; | ||
| 29 | + | ||
| 30 | + // Get the length of the video in seconds | ||
| 31 | + float videoLength = (float)asset.duration.value/asset.duration.timescale; | ||
| 32 | + | ||
| 33 | + // How far along the video track we want to move, in seconds. | ||
| 34 | + float increment = (float)videoLength/frameCount; | ||
| 35 | + | ||
| 36 | + // Add frames to the buffer | ||
| 37 | + NSMutableArray *timePoints = [NSMutableArray array]; | ||
| 38 | + for (int currentFrame = 0; currentFrame<frameCount; ++currentFrame) { | ||
| 39 | + float seconds = (float)increment * currentFrame; | ||
| 40 | + CMTime time = CMTimeMakeWithSeconds(seconds, [timeInterval intValue]); | ||
| 41 | + [timePoints addObject:[NSValue valueWithCMTime:time]]; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + // Prepare group for firing completion block | ||
| 45 | + dispatch_group_t gifQueue = dispatch_group_create(); | ||
| 46 | + dispatch_group_enter(gifQueue); | ||
| 47 | + | ||
| 48 | + __block NSString *gifPath; | ||
| 49 | + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | ||
| 50 | + NSLog(@"取出时间戳 动作完成 -> 取出CGImageRef"); | ||
| 51 | + gifPath = [self makingGIFforTimePoints:timePoints fromURL:videoURL fileProperties:fileProperties frameProperties:frameProperties frameCount:frameCount gifSize:GIFSizeMedium needCompression:isNeedCompression compressionWidth:compressionWidth compressionHeight:compressionHeight fileName:fileName]; | ||
| 52 | + | ||
| 53 | + dispatch_group_leave(gifQueue); | ||
| 54 | + }); | ||
| 55 | + | ||
| 56 | + dispatch_group_notify(gifQueue, dispatch_get_main_queue(), ^{ | ||
| 57 | + // Return GIF URL | ||
| 58 | + completionBlock(gifPath); | ||
| 59 | + }); | ||
| 60 | +} | ||
| 61 | ++ (void)makingGIFWithURL:(NSURL*)videoURL frameCount:(int)frameCount delayTime:(float)delayTime loopCount:(int)loopCount needCompression:(BOOL)isNeedCompression compressionWidth:(float)compressionWidth compressionHeight:(float)compressionHeight completion:(void(^)(NSString *GifPath))completionBlock{ | ||
| 62 | + | ||
| 63 | + NSDictionary *fileProperties = [self filePropertiesWithLoopCount:loopCount]; | ||
| 64 | + NSDictionary *frameProperties = [self framePropertiesWithDelayTime:delayTime]; | ||
| 65 | + | ||
| 66 | + AVURLAsset *asset = [AVURLAsset assetWithURL:videoURL]; | ||
| 67 | + | ||
| 68 | + // Get the length of the video in seconds | ||
| 69 | + float videoLength = (float)asset.duration.value/asset.duration.timescale; | ||
| 70 | + | ||
| 71 | + // How far along the video track we want to move, in seconds. | ||
| 72 | + float increment = (float)videoLength/frameCount; | ||
| 73 | + | ||
| 74 | + // Add frames to the buffer | ||
| 75 | + NSMutableArray *timePoints = [NSMutableArray array]; | ||
| 76 | + for (int currentFrame = 0; currentFrame<frameCount; ++currentFrame) { | ||
| 77 | + float seconds = (float)increment * currentFrame; | ||
| 78 | + CMTime time = CMTimeMakeWithSeconds(seconds, [timeInterval intValue]); | ||
| 79 | + [timePoints addObject:[NSValue valueWithCMTime:time]]; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + // Prepare group for firing completion block | ||
| 83 | + dispatch_group_t gifQueue = dispatch_group_create(); | ||
| 84 | + dispatch_group_enter(gifQueue); | ||
| 85 | + | ||
| 86 | + __block NSString *gifPath; | ||
| 87 | + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | ||
| 88 | + NSLog(@"取出时间戳 动作完成 -> 取出CGImageRef"); | ||
| 89 | + gifPath = [self makingGIFforTimePoints:timePoints fromURL:videoURL fileProperties:fileProperties frameProperties:frameProperties frameCount:frameCount gifSize:GIFSizeMedium needCompression:isNeedCompression compressionWidth:compressionWidth compressionHeight:compressionHeight]; | ||
| 90 | + | ||
| 91 | + dispatch_group_leave(gifQueue); | ||
| 92 | + }); | ||
| 93 | + | ||
| 94 | + dispatch_group_notify(gifQueue, dispatch_get_main_queue(), ^{ | ||
| 95 | + // Return GIF URL | ||
| 96 | + completionBlock(gifPath); | ||
| 97 | + }); | ||
| 98 | +} | ||
| 99 | + | ||
| 100 | +#pragma mark - Base methods | ||
| 101 | ++ (NSString *)makingGIFforTimePoints:(NSArray *)timePoints fromURL:(NSURL *)url fileProperties:(NSDictionary *)fileProperties frameProperties:(NSDictionary *)frameProperties frameCount:(int)frameCount gifSize:(GIFSize)gifSize needCompression:(BOOL)isNeedCompression compressionWidth:(float)compressionWidth compressionHeight:(float)compressionHeight fileName:(NSString*)filleName{ | ||
| 102 | + | ||
| 103 | + //保存路径 | ||
| 104 | + NSString *temporaryFile = [NSTemporaryDirectory() stringByAppendingString:filleName]; | ||
| 105 | + | ||
| 106 | + NSURL *fileURL = [NSURL fileURLWithPath:temporaryFile]; | ||
| 107 | + if (fileURL == nil) | ||
| 108 | + return nil; | ||
| 109 | + | ||
| 110 | + CGImageDestinationRef destination = CGImageDestinationCreateWithURL((__bridge CFURLRef)fileURL, kUTTypeGIF , frameCount, NULL); | ||
| 111 | + | ||
| 112 | + AVURLAsset *asset = [AVURLAsset URLAssetWithURL:url options:nil]; | ||
| 113 | + AVAssetImageGenerator *generator = [AVAssetImageGenerator assetImageGeneratorWithAsset:asset]; | ||
| 114 | + generator.appliesPreferredTrackTransform = YES; | ||
| 115 | + | ||
| 116 | + CMTime tol = CMTimeMakeWithSeconds([tolerance floatValue], [timeInterval intValue]); | ||
| 117 | + generator.requestedTimeToleranceBefore = tol; | ||
| 118 | + generator.requestedTimeToleranceAfter = tol; | ||
| 119 | + | ||
| 120 | + NSError *error = nil; | ||
| 121 | + CGImageRef previousImageRefCopy = nil; | ||
| 122 | + for (NSValue *time in timePoints) { | ||
| 123 | + CGImageRef imageRef; | ||
| 124 | + | ||
| 125 | +#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR | ||
| 126 | + imageRef = (float)gifSize/10 != 1 ? makingImageWithScale([generator copyCGImageAtTime:[time CMTimeValue] actualTime:nil error:&error], (float)gifSize/10) : [generator copyCGImageAtTime:[time CMTimeValue] actualTime:nil error:&error]; | ||
| 127 | +#elif TARGET_OS_MAC | ||
| 128 | + imageRef = [generator copyCGImageAtTime:[time CMTimeValue] actualTime:nil error:&error]; | ||
| 129 | +#endif | ||
| 130 | + | ||
| 131 | + if (error) { | ||
| 132 | + NSLog(@"Error copying image: %@", error); | ||
| 133 | + } | ||
| 134 | + if (imageRef) { | ||
| 135 | + CGImageRelease(previousImageRefCopy); | ||
| 136 | + previousImageRefCopy = CGImageCreateCopy(imageRef); | ||
| 137 | + } else if (previousImageRefCopy) { | ||
| 138 | + imageRef = CGImageCreateCopy(previousImageRefCopy); | ||
| 139 | + } else { | ||
| 140 | + NSLog(@"Error copying image and no previous frames to duplicate"); | ||
| 141 | + return nil; | ||
| 142 | + } | ||
| 143 | + if (isNeedCompression) { | ||
| 144 | + UIImage* image = [UIImage imageWithCGImage:imageRef]; | ||
| 145 | + // NSData* data = UIImageJPEGRepresentation(image, 1); | ||
| 146 | + // UIImage* newImage = [UIImage imageWithData:data]; | ||
| 147 | + | ||
| 148 | + CGSize targetSize = CGSizeMake(compressionWidth, compressionHeight); | ||
| 149 | + UIImage *sourceImage = image; | ||
| 150 | + UIImage *newImage = nil; | ||
| 151 | + CGSize imageSize = sourceImage.size; | ||
| 152 | + CGFloat width = imageSize.width; | ||
| 153 | + CGFloat height = imageSize.height; | ||
| 154 | + CGFloat targetWidth = targetSize.width; | ||
| 155 | + CGFloat targetHeight = targetSize.height; | ||
| 156 | + CGFloat scaleFactor = 0.0; | ||
| 157 | + CGFloat scaledWidth = targetWidth; | ||
| 158 | + CGFloat scaledHeight = targetHeight; | ||
| 159 | + CGPoint thumbnailPoint = CGPointMake(0.0,0.0); | ||
| 160 | + | ||
| 161 | + if (CGSizeEqualToSize(imageSize, targetSize) == NO) | ||
| 162 | + { | ||
| 163 | + | ||
| 164 | + CGFloat widthFactor = targetWidth / width; | ||
| 165 | + CGFloat heightFactor = targetHeight / height; | ||
| 166 | + | ||
| 167 | + if (widthFactor > heightFactor) | ||
| 168 | + scaleFactor = widthFactor; // scale to fit height | ||
| 169 | + else | ||
| 170 | + scaleFactor = heightFactor; // scale to fit width | ||
| 171 | + scaledWidth= width * scaleFactor; | ||
| 172 | + scaledHeight = height * scaleFactor; | ||
| 173 | + | ||
| 174 | + // center the image | ||
| 175 | + if (widthFactor > heightFactor) | ||
| 176 | + { | ||
| 177 | + thumbnailPoint.y = (targetHeight - scaledHeight) * 0.5; | ||
| 178 | + } | ||
| 179 | + else if (widthFactor < heightFactor) | ||
| 180 | + { | ||
| 181 | + thumbnailPoint.x = (targetWidth - scaledWidth) * 0.5; | ||
| 182 | + } | ||
| 183 | + } | ||
| 184 | + | ||
| 185 | + UIGraphicsBeginImageContext(targetSize); // this will crop | ||
| 186 | + | ||
| 187 | + CGRect thumbnailRect = CGRectZero; | ||
| 188 | + thumbnailRect.origin = thumbnailPoint; | ||
| 189 | + thumbnailRect.size.width= scaledWidth; | ||
| 190 | + thumbnailRect.size.height = scaledHeight; | ||
| 191 | + | ||
| 192 | + [sourceImage drawInRect:thumbnailRect]; | ||
| 193 | + | ||
| 194 | + newImage = UIGraphicsGetImageFromCurrentImageContext(); | ||
| 195 | + if(newImage == nil) | ||
| 196 | + NSLog(@"could not scale image"); | ||
| 197 | + | ||
| 198 | + //pop the context to get back to the default | ||
| 199 | + UIGraphicsEndImageContext(); | ||
| 200 | + | ||
| 201 | + CGImageRef imageRef1 = newImage.CGImage; | ||
| 202 | + NSLog(@"开始add,%@",time); | ||
| 203 | + CGImageDestinationAddImage(destination, imageRef1, (CFDictionaryRef)frameProperties); | ||
| 204 | + NSLog(@"当此add完成,%@",time); | ||
| 205 | + } | ||
| 206 | + else { | ||
| 207 | + CGImageDestinationAddImage(destination, imageRef, (CFDictionaryRef)frameProperties); | ||
| 208 | + } | ||
| 209 | + | ||
| 210 | + CGImageRelease(imageRef); | ||
| 211 | + } | ||
| 212 | + CGImageRelease(previousImageRefCopy); | ||
| 213 | + NSLog(@"取出imageRef完成"); | ||
| 214 | + CGImageDestinationSetProperties(destination, (CFDictionaryRef)fileProperties); | ||
| 215 | + // Finalize the GIF | ||
| 216 | + if (!CGImageDestinationFinalize(destination)) { | ||
| 217 | + NSLog(@"Failed to finalize GIF destination: %@", error); | ||
| 218 | + if (destination != nil) { | ||
| 219 | + CFRelease(destination); | ||
| 220 | + } | ||
| 221 | + return nil; | ||
| 222 | + } | ||
| 223 | + CFRelease(destination); | ||
| 224 | + | ||
| 225 | + return temporaryFile; | ||
| 226 | +} | ||
| 227 | ++ (NSString *)makingGIFforTimePoints:(NSArray *)timePoints fromURL:(NSURL *)url fileProperties:(NSDictionary *)fileProperties frameProperties:(NSDictionary *)frameProperties frameCount:(int)frameCount gifSize:(GIFSize)gifSize needCompression:(BOOL)isNeedCompression compressionWidth:(float)compressionWidth compressionHeight:(float)compressionHeight{ | ||
| 228 | + | ||
| 229 | + NSString *docPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; | ||
| 230 | + NSString *filePath = [docPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@/GifFace/DownLoad/Personal",[UserInformationModel manager].uid]]; | ||
| 231 | + | ||
| 232 | + NSFileManager *fileManager = [NSFileManager defaultManager]; | ||
| 233 | + BOOL result = [fileManager fileExistsAtPath:filePath]; | ||
| 234 | + if(!result){ | ||
| 235 | + //不存在已存在的路径 | ||
| 236 | + [fileManager createDirectoryAtPath:filePath withIntermediateDirectories:YES attributes:nil error:nil]; | ||
| 237 | + | ||
| 238 | + } | ||
| 239 | + | ||
| 240 | + NSDate* date = [NSDate dateWithTimeIntervalSinceNow:0];//获取当前时间0秒后的时间 | ||
| 241 | + long time = [date timeIntervalSince1970]*1000;// *1000 是精确到毫秒,不乘就是精确到秒 | ||
| 242 | + NSString *timeString = [NSString stringWithFormat:@"%ld.gif",time]; | ||
| 243 | + | ||
| 244 | + //保存路径 | ||
| 245 | + NSString *temporaryFile = [filePath stringByAppendingPathComponent:timeString]; | ||
| 246 | + | ||
| 247 | + NSURL *fileURL = [NSURL fileURLWithPath:temporaryFile]; | ||
| 248 | + if (fileURL == nil) | ||
| 249 | + return nil; | ||
| 250 | + | ||
| 251 | + CGImageDestinationRef destination = CGImageDestinationCreateWithURL((__bridge CFURLRef)fileURL, kUTTypeGIF , frameCount, NULL); | ||
| 252 | + | ||
| 253 | + AVURLAsset *asset = [AVURLAsset URLAssetWithURL:url options:nil]; | ||
| 254 | + AVAssetImageGenerator *generator = [AVAssetImageGenerator assetImageGeneratorWithAsset:asset]; | ||
| 255 | + generator.appliesPreferredTrackTransform = YES; | ||
| 256 | + | ||
| 257 | + CMTime tol = CMTimeMakeWithSeconds([tolerance floatValue], [timeInterval intValue]); | ||
| 258 | + generator.requestedTimeToleranceBefore = tol; | ||
| 259 | + generator.requestedTimeToleranceAfter = tol; | ||
| 260 | + | ||
| 261 | + NSError *error = nil; | ||
| 262 | + CGImageRef previousImageRefCopy = nil; | ||
| 263 | + for (NSValue *time in timePoints) { | ||
| 264 | + CGImageRef imageRef; | ||
| 265 | + | ||
| 266 | +#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR | ||
| 267 | + imageRef = (float)gifSize/10 != 1 ? makingImageWithScale([generator copyCGImageAtTime:[time CMTimeValue] actualTime:nil error:&error], (float)gifSize/10) : [generator copyCGImageAtTime:[time CMTimeValue] actualTime:nil error:&error]; | ||
| 268 | +#elif TARGET_OS_MAC | ||
| 269 | + imageRef = [generator copyCGImageAtTime:[time CMTimeValue] actualTime:nil error:&error]; | ||
| 270 | +#endif | ||
| 271 | + | ||
| 272 | + if (error) { | ||
| 273 | + NSLog(@"Error copying image: %@", error); | ||
| 274 | + } | ||
| 275 | + if (imageRef) { | ||
| 276 | + CGImageRelease(previousImageRefCopy); | ||
| 277 | + previousImageRefCopy = CGImageCreateCopy(imageRef); | ||
| 278 | + } else if (previousImageRefCopy) { | ||
| 279 | + imageRef = CGImageCreateCopy(previousImageRefCopy); | ||
| 280 | + } else { | ||
| 281 | + NSLog(@"Error copying image and no previous frames to duplicate"); | ||
| 282 | + return nil; | ||
| 283 | + } | ||
| 284 | + if (isNeedCompression) { | ||
| 285 | + UIImage* image = [UIImage imageWithCGImage:imageRef]; | ||
| 286 | + // NSData* data = UIImageJPEGRepresentation(image, 1); | ||
| 287 | + // UIImage* newImage = [UIImage imageWithData:data]; | ||
| 288 | + | ||
| 289 | + CGSize targetSize = CGSizeMake(compressionWidth, compressionHeight); | ||
| 290 | + UIImage *sourceImage = image; | ||
| 291 | + UIImage *newImage = nil; | ||
| 292 | + CGSize imageSize = sourceImage.size; | ||
| 293 | + CGFloat width = imageSize.width; | ||
| 294 | + CGFloat height = imageSize.height; | ||
| 295 | + CGFloat targetWidth = targetSize.width; | ||
| 296 | + CGFloat targetHeight = targetSize.height; | ||
| 297 | + CGFloat scaleFactor = 0.0; | ||
| 298 | + CGFloat scaledWidth = targetWidth; | ||
| 299 | + CGFloat scaledHeight = targetHeight; | ||
| 300 | + CGPoint thumbnailPoint = CGPointMake(0.0,0.0); | ||
| 301 | + | ||
| 302 | + if (CGSizeEqualToSize(imageSize, targetSize) == NO) | ||
| 303 | + { | ||
| 304 | + | ||
| 305 | + CGFloat widthFactor = targetWidth / width; | ||
| 306 | + CGFloat heightFactor = targetHeight / height; | ||
| 307 | + | ||
| 308 | + if (widthFactor > heightFactor) | ||
| 309 | + scaleFactor = widthFactor; // scale to fit height | ||
| 310 | + else | ||
| 311 | + scaleFactor = heightFactor; // scale to fit width | ||
| 312 | + scaledWidth= width * scaleFactor; | ||
| 313 | + scaledHeight = height * scaleFactor; | ||
| 314 | + | ||
| 315 | + // center the image | ||
| 316 | + if (widthFactor > heightFactor) | ||
| 317 | + { | ||
| 318 | + thumbnailPoint.y = (targetHeight - scaledHeight) * 0.5; | ||
| 319 | + } | ||
| 320 | + else if (widthFactor < heightFactor) | ||
| 321 | + { | ||
| 322 | + thumbnailPoint.x = (targetWidth - scaledWidth) * 0.5; | ||
| 323 | + } | ||
| 324 | + } | ||
| 325 | + | ||
| 326 | + UIGraphicsBeginImageContext(targetSize); // this will crop | ||
| 327 | + | ||
| 328 | + CGRect thumbnailRect = CGRectZero; | ||
| 329 | + thumbnailRect.origin = thumbnailPoint; | ||
| 330 | + thumbnailRect.size.width= scaledWidth; | ||
| 331 | + thumbnailRect.size.height = scaledHeight; | ||
| 332 | + | ||
| 333 | + [sourceImage drawInRect:thumbnailRect]; | ||
| 334 | + | ||
| 335 | + newImage = UIGraphicsGetImageFromCurrentImageContext(); | ||
| 336 | + if(newImage == nil) | ||
| 337 | + NSLog(@"could not scale image"); | ||
| 338 | + | ||
| 339 | + //pop the context to get back to the default | ||
| 340 | + UIGraphicsEndImageContext(); | ||
| 341 | + | ||
| 342 | + CGImageRef imageRef1 = newImage.CGImage; | ||
| 343 | + NSLog(@"开始add,%@",time); | ||
| 344 | + CGImageDestinationAddImage(destination, imageRef1, (CFDictionaryRef)frameProperties); | ||
| 345 | + NSLog(@"当此add完成,%@",time); | ||
| 346 | + } | ||
| 347 | + else { | ||
| 348 | + CGImageDestinationAddImage(destination, imageRef, (CFDictionaryRef)frameProperties); | ||
| 349 | + } | ||
| 350 | + | ||
| 351 | + | ||
| 352 | + | ||
| 353 | + CGImageRelease(imageRef); | ||
| 354 | + } | ||
| 355 | + CGImageRelease(previousImageRefCopy); | ||
| 356 | + NSLog(@"取出imageRef完成"); | ||
| 357 | + CGImageDestinationSetProperties(destination, (CFDictionaryRef)fileProperties); | ||
| 358 | + // Finalize the GIF | ||
| 359 | + if (!CGImageDestinationFinalize(destination)) { | ||
| 360 | + NSLog(@"Failed to finalize GIF destination: %@", error); | ||
| 361 | + if (destination != nil) { | ||
| 362 | + CFRelease(destination); | ||
| 363 | + } | ||
| 364 | + return nil; | ||
| 365 | + } | ||
| 366 | + CFRelease(destination); | ||
| 367 | + | ||
| 368 | + return temporaryFile; | ||
| 369 | +} | ||
| 370 | +#pragma mark - Helpers | ||
| 371 | +CGImageRef makingImageWithScale(CGImageRef imageRef, float scale) { | ||
| 372 | +#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR | ||
| 373 | + CGSize newSize = CGSizeMake(CGImageGetWidth(imageRef)*scale, CGImageGetHeight(imageRef)*scale); | ||
| 374 | + CGRect newRect = CGRectIntegral(CGRectMake(0, 0, newSize.width, newSize.height)); | ||
| 375 | + | ||
| 376 | + UIGraphicsBeginImageContextWithOptions(newSize, NO, 0); | ||
| 377 | + CGContextRef context = UIGraphicsGetCurrentContext(); | ||
| 378 | + if (!context) { | ||
| 379 | + return nil; | ||
| 380 | + } | ||
| 381 | + | ||
| 382 | + // Set the quality level to use when rescaling | ||
| 383 | + CGContextSetInterpolationQuality(context, kCGInterpolationHigh); | ||
| 384 | + CGAffineTransform flipVertical = CGAffineTransformMake(1, 0, 0, -1, 0, newSize.height); | ||
| 385 | + | ||
| 386 | + CGContextConcatCTM(context, flipVertical); | ||
| 387 | + // Draw into the context; this scales the image | ||
| 388 | + CGContextDrawImage(context, newRect, imageRef); | ||
| 389 | + | ||
| 390 | + //Release old image | ||
| 391 | + CFRelease(imageRef); | ||
| 392 | + // Get the resized image from the context and a UIImage | ||
| 393 | + imageRef = CGBitmapContextCreateImage(context); | ||
| 394 | + | ||
| 395 | + UIGraphicsEndImageContext(); | ||
| 396 | +#endif | ||
| 397 | + | ||
| 398 | + return imageRef; | ||
| 399 | +} | ||
| 400 | + | ||
| 401 | +#pragma mark - Properties | ||
| 402 | ++ (NSDictionary *)filePropertiesWithLoopCount:(int)loopCount { | ||
| 403 | + return @{(NSString *)kCGImagePropertyGIFDictionary: | ||
| 404 | + @{(NSString *)kCGImagePropertyGIFLoopCount: @(loopCount)} | ||
| 405 | + }; | ||
| 406 | +} | ||
| 407 | + | ||
| 408 | ++ (NSDictionary *)framePropertiesWithDelayTime:(float)delayTime { | ||
| 409 | + return @{(NSString *)kCGImagePropertyGIFDictionary: | ||
| 410 | + @{(NSString *)kCGImagePropertyGIFDelayTime: @(delayTime)}, | ||
| 411 | + (NSString *)kCGImagePropertyColorModel:(NSString *)kCGImagePropertyColorModelRGB | ||
| 412 | + }; | ||
| 413 | +} | ||
| 414 | + | ||
| 415 | +@end |
CNLiveGifFace/Classes/Tools/CNLiveArchiveManager.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveArchiveManager.h | ||
| 3 | +// Net++ | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2018/9/1. | ||
| 6 | +// Copyright © 2018年 CNLive-zxw. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <Foundation/Foundation.h> | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + ManagerResultBlock | ||
| 13 | + | ||
| 14 | + @param hostPath 数组的文件夹路径 | ||
| 15 | + @param array 图片数组 | ||
| 16 | + */ | ||
| 17 | +typedef void (^ManagerResultBlock)(NSString *hostPath, NSArray *array); | ||
| 18 | + | ||
| 19 | +@interface CNLiveArchiveManager : NSObject | ||
| 20 | + | ||
| 21 | +@property (nonatomic, strong) NSString *cachesPath; | ||
| 22 | +@property (nonatomic, strong) NSString *cachesFolderNamePath; | ||
| 23 | + | ||
| 24 | +@property (nonatomic, strong) NSFileManager *fileManager; | ||
| 25 | + | ||
| 26 | +@property (nonatomic, copy) ManagerResultBlock resultBlock; | ||
| 27 | + | ||
| 28 | ++ (instancetype)sharedInstance; | ||
| 29 | + | ||
| 30 | +/** | ||
| 31 | + 解压缩 | ||
| 32 | + | ||
| 33 | + @param urlString 需要解压缩文件的本地路径 | ||
| 34 | + @param folderName 解压缩完毕,文件存放的文件夹名 | ||
| 35 | + */ | ||
| 36 | +- (void)releaseZipWithLocalPath:(NSString *)urlString folderName:(NSString *)folderName resultBlock:(ManagerResultBlock)resultBlock; | ||
| 37 | +//cachesPath+folderName 就是解压缩完毕文件夹路径(cachesFolderNamePath) | ||
| 38 | +- (void)releaseZipWithLocalPath:(NSString *)urlString folderName:(NSString *)folderName releaseZipFolderName:(NSString *)releaseZipFolderName resultBlock:(ManagerResultBlock)resultBlock; | ||
| 39 | + | ||
| 40 | +- (NSArray *)getPicsWithFolderName:(NSString *)folderName; | ||
| 41 | + | ||
| 42 | +@end |
CNLiveGifFace/Classes/Tools/CNLiveArchiveManager.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveArchiveManager.m | ||
| 3 | +// Net++ | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2018/9/1. | ||
| 6 | +// Copyright © 2018年 CNLive-zxw. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNLiveArchiveManager.h" | ||
| 10 | +#import "SSZipArchive.h" | ||
| 11 | + | ||
| 12 | +typedef void (^ManagerStringBlock)(NSString *string); | ||
| 13 | +@interface CNLiveArchiveManager()<SSZipArchiveDelegate> | ||
| 14 | + | ||
| 15 | +@end | ||
| 16 | +@implementation CNLiveArchiveManager | ||
| 17 | +static CNLiveArchiveManager *_instance = nil; | ||
| 18 | + | ||
| 19 | +/* 单例控制器 */ | ||
| 20 | ++ (instancetype)sharedInstance { | ||
| 21 | + return [[self alloc] init]; | ||
| 22 | +} | ||
| 23 | + | ||
| 24 | +- (instancetype)init { | ||
| 25 | + static dispatch_once_t onceToken; | ||
| 26 | + dispatch_once(&onceToken, ^{ | ||
| 27 | + _instance = [super init]; | ||
| 28 | + | ||
| 29 | +// self->_cachesPath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject]; | ||
| 30 | + self->_cachesPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]; | ||
| 31 | + | ||
| 32 | +// self->_cachesFolderNamePath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject]; | ||
| 33 | + self->_cachesFolderNamePath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]; | ||
| 34 | + | ||
| 35 | + self->_fileManager = [NSFileManager defaultManager]; | ||
| 36 | + | ||
| 37 | + }); | ||
| 38 | + return _instance; | ||
| 39 | +} | ||
| 40 | + | ||
| 41 | + | ||
| 42 | +#pragma mark - 公开方法 | ||
| 43 | +#pragma mark - 从本地路径获取对应文件 | ||
| 44 | + | ||
| 45 | +- (void)releaseZipWithLocalPath:(NSString *)urlString folderName:(NSString *)folderName resultBlock:(ManagerResultBlock)resultBlock | ||
| 46 | +{ | ||
| 47 | + self.resultBlock = resultBlock; | ||
| 48 | + __weak __typeof(self)weakSelf = self; | ||
| 49 | + | ||
| 50 | + _cachesFolderNamePath = [_cachesPath stringByAppendingPathComponent:folderName]; | ||
| 51 | + | ||
| 52 | + // 文件夹路径 | ||
| 53 | + NSString *folderPath = [_cachesPath stringByAppendingPathComponent:folderName]; | ||
| 54 | + | ||
| 55 | + if ([self directoryExists:folderPath]) { | ||
| 56 | + // 存在文件夹则之间返回 | ||
| 57 | + if (self.resultBlock) { | ||
| 58 | + self.resultBlock(folderPath, [self fileList:folderPath]); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + }else{ | ||
| 62 | + // 不存在文件夹则创建、解压 | ||
| 63 | + | ||
| 64 | + if ([weakSelf createFolderWithPath:folderPath]) { | ||
| 65 | + [weakSelf releaseZipFiles:urlString unzipPath:folderPath]; | ||
| 66 | + | ||
| 67 | + }else{ | ||
| 68 | + // 创建文件夹失败 | ||
| 69 | + NSLog(@"创建文件夹失败"); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | +} | ||
| 75 | + | ||
| 76 | +- (void)releaseZipWithLocalPath:(NSString *)urlString folderName:(NSString *)folderName releaseZipFolderName:(NSString *)releaseZipFolderName resultBlock:(ManagerResultBlock)resultBlock{ | ||
| 77 | + | ||
| 78 | + self.resultBlock = resultBlock; | ||
| 79 | + __weak __typeof(self)weakSelf = self; | ||
| 80 | + | ||
| 81 | + _cachesFolderNamePath = [_cachesPath stringByAppendingPathComponent:folderName]; | ||
| 82 | + | ||
| 83 | + // 文件夹路径 | ||
| 84 | + NSString *folderPath = [_cachesPath stringByAppendingPathComponent:folderName]; | ||
| 85 | + NSString *existsFolderPath = [folderPath stringByAppendingPathComponent:releaseZipFolderName]; | ||
| 86 | + | ||
| 87 | + if ([self directoryExists:existsFolderPath]) { | ||
| 88 | + // 存在文件夹则之间返回 | ||
| 89 | + if (self.resultBlock) { | ||
| 90 | + self.resultBlock(folderPath, [self fileList:folderPath]); | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + }else{ | ||
| 94 | + // 不存在文件夹则创建、解压 | ||
| 95 | + | ||
| 96 | + if ([weakSelf createFolderWithPath:folderPath]) { | ||
| 97 | + [weakSelf releaseZipFiles:urlString unzipPath:folderPath]; | ||
| 98 | + | ||
| 99 | + }else{ | ||
| 100 | + // 创建文件夹失败 | ||
| 101 | + NSLog(@"创建文件夹失败"); | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + } | ||
| 105 | +} | ||
| 106 | + | ||
| 107 | + | ||
| 108 | +#pragma mark - 获取指定文件夹名字的内容 | ||
| 109 | +- (NSArray *)getPicsWithFolderName:(NSString *)folderName{ | ||
| 110 | + | ||
| 111 | + _cachesFolderNamePath = [_cachesPath stringByAppendingPathComponent:folderName]; | ||
| 112 | + | ||
| 113 | + NSString *folderPath = [_cachesPath stringByAppendingPathComponent:folderName]; | ||
| 114 | + | ||
| 115 | + if ([self directoryExists:folderPath]) { | ||
| 116 | + // 存在文件夹则之间返回 | ||
| 117 | + return [self fileList:folderPath]; | ||
| 118 | + | ||
| 119 | + } | ||
| 120 | + NSLog(@"创建文件夹不存在"); | ||
| 121 | + | ||
| 122 | + return nil; | ||
| 123 | +} | ||
| 124 | + | ||
| 125 | +#pragma mark - 文件处理 | ||
| 126 | +#pragma mark - 检测目录文件夹是否存在 | ||
| 127 | +/** | ||
| 128 | + 检测目录文件夹是否存在 | ||
| 129 | + | ||
| 130 | + @param directoryPath 目录路径 | ||
| 131 | + @return 是否存在 | ||
| 132 | + */ | ||
| 133 | +- (BOOL)directoryExists:(NSString *)directoryPath | ||
| 134 | +{ | ||
| 135 | + BOOL isDir = NO; | ||
| 136 | + BOOL isDirExist = [_fileManager fileExistsAtPath:directoryPath isDirectory:&isDir]; | ||
| 137 | + if (isDir && isDirExist) { | ||
| 138 | + return YES; | ||
| 139 | + }else{ | ||
| 140 | + return NO; | ||
| 141 | + } | ||
| 142 | +} | ||
| 143 | + | ||
| 144 | +#pragma mark - 获取文件夹下所有文件列表。 | ||
| 145 | +- (NSArray *)fileList:(NSString *)directoryPath | ||
| 146 | +{ | ||
| 147 | + return [[_fileManager contentsOfDirectoryAtPath:directoryPath error:nil] mutableCopy]; | ||
| 148 | +} | ||
| 149 | + | ||
| 150 | +#pragma mark - 创建文件夹。下载完文件,文件需要解压到这个文件夹 | ||
| 151 | +- (BOOL)createFolderWithPath:(NSString *)folderPath | ||
| 152 | +{ | ||
| 153 | + // 在路径下创建文件夹 | ||
| 154 | + return [_fileManager createDirectoryAtPath:folderPath withIntermediateDirectories:YES attributes:nil error:nil]; | ||
| 155 | + | ||
| 156 | +} | ||
| 157 | + | ||
| 158 | +#pragma mark - SSZipArchive | ||
| 159 | +#pragma mark - 解压 | ||
| 160 | +- (void)releaseZipFiles:(NSString *)zipPath unzipPath:(NSString *)unzipPath{ | ||
| 161 | + if ([SSZipArchive unzipFileAtPath:zipPath toDestination:unzipPath delegate:self]) { | ||
| 162 | + | ||
| 163 | + }else { | ||
| 164 | + NSLog(@"解压失败"); | ||
| 165 | + } | ||
| 166 | +} | ||
| 167 | + | ||
| 168 | +#pragma mark - SSZipArchiveDelegate | ||
| 169 | +- (void)zipArchiveDidUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo unzippedPath:(NSString *)unzippedPath | ||
| 170 | +{ | ||
| 171 | + // 解压会出现多余的文件夹__MACOSX,删除掉吧 | ||
| 172 | + NSString *invalidFolder = [unzippedPath stringByAppendingPathComponent:@"__MACOSX"]; | ||
| 173 | + [_fileManager removeItemAtPath:invalidFolder error:nil]; | ||
| 174 | + /* | ||
| 175 | + // 或者过滤数组,只取所需要的png文件名 | ||
| 176 | + NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF ENDSWITH %@", @".png"]; | ||
| 177 | + NSArray *reslutFilteredArray = [fileList filteredArrayUsingPredicate:predicate]; | ||
| 178 | + */ | ||
| 179 | + NSArray *fileList = [self fileList:unzippedPath]; | ||
| 180 | + if (self.resultBlock) { | ||
| 181 | + self.resultBlock(unzippedPath, fileList); | ||
| 182 | + } | ||
| 183 | +} | ||
| 184 | + | ||
| 185 | +@end |
CNLiveGifFace/Classes/Tools/CNLiveDownLoadManager.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveDownLoadManager.h | ||
| 3 | +// DownLoadManager | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2018/9/11. | ||
| 6 | +// Copyright © 2018年 CNLive-zxw. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <Foundation/Foundation.h> | ||
| 10 | + | ||
| 11 | +typedef void (^successBlock) (NSString *url, NSString *fileStorePath); | ||
| 12 | +typedef void (^faileBlock) (NSString *url, NSError *error); | ||
| 13 | +typedef void (^progressBlock) (NSString *url, float progress); | ||
| 14 | + | ||
| 15 | +@interface CNLiveDownLoadManager : NSObject <NSURLSessionDataDelegate> | ||
| 16 | +//@property (nonatomic, assign) BOOL isDownload; | ||
| 17 | +@property (nonatomic, strong) NSMutableArray *downloads; | ||
| 18 | + | ||
| 19 | +@property (nonatomic, copy) successBlock successBlock; | ||
| 20 | +@property (nonatomic, copy) faileBlock failedBlock; | ||
| 21 | +@property (nonatomic, copy) progressBlock progressBlock; | ||
| 22 | + | ||
| 23 | +//@property (nonatomic, copy) NSString *cachesPath; | ||
| 24 | + | ||
| 25 | ++ (instancetype)sharedInstance; | ||
| 26 | + | ||
| 27 | +- (void)downLoadWithURL:(NSString *)URL progress:(progressBlock)progressBlock success:(successBlock)successBlock faile:(faileBlock)faileBlock; | ||
| 28 | + | ||
| 29 | +- (void)stopTask; | ||
| 30 | + | ||
| 31 | +@end |
CNLiveGifFace/Classes/Tools/CNLiveDownLoadManager.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveDownLoadManager.m | ||
| 3 | +// DownLoadManager | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2018/9/11. | ||
| 6 | +// Copyright © 2018年 CNLive-zxw. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNLiveDownLoadManager.h" | ||
| 10 | +#import "NSString+Hash.h" | ||
| 11 | + | ||
| 12 | +@interface CNLiveDownLoadManager () | ||
| 13 | +/** 下载任务 */ | ||
| 14 | +@property (nonatomic, strong) NSURLSessionDataTask *task; | ||
| 15 | +/** session */ | ||
| 16 | +@property (nonatomic, strong) NSURLSession *session; | ||
| 17 | +/** 写文件的流对象 */ | ||
| 18 | +@property (nonatomic, strong) NSOutputStream *stream; | ||
| 19 | +/** 文件的总大小 */ | ||
| 20 | +@property (nonatomic, assign) NSInteger totalLength; | ||
| 21 | +@property (nonatomic, strong) NSString *downloadUrl; | ||
| 22 | + | ||
| 23 | +@end | ||
| 24 | + | ||
| 25 | +// 文件名(沙盒中的文件名),使用md5哈希url生成的,这样就能保证文件名唯一 | ||
| 26 | +#define FileName self.downloadUrl.md5String | ||
| 27 | + | ||
| 28 | +// 文件的存放路径(caches) | ||
| 29 | +#define FileStorePath [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:FileName] | ||
| 30 | + | ||
| 31 | +// 使用plist文件存储文件的总字节数 | ||
| 32 | +#define TotalLengthPlist [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"totalLength.plist"] | ||
| 33 | + | ||
| 34 | +// 文件的已被下载的大小 | ||
| 35 | +#define DownloadLength [[[NSFileManager defaultManager] attributesOfItemAtPath:FileStorePath error:nil][NSFileSize] integerValue] | ||
| 36 | + | ||
| 37 | +@implementation CNLiveDownLoadManager | ||
| 38 | + | ||
| 39 | +#pragma mark - 创建单例 | ||
| 40 | +static CNLiveDownLoadManager *_instance; | ||
| 41 | + | ||
| 42 | ++ (instancetype)allocWithZone:(struct _NSZone *)zone | ||
| 43 | +{ | ||
| 44 | + static dispatch_once_t onceToken; | ||
| 45 | + dispatch_once(&onceToken, ^{ | ||
| 46 | + _instance = [super allocWithZone:zone]; | ||
| 47 | + }); | ||
| 48 | + return _instance; | ||
| 49 | +} | ||
| 50 | + | ||
| 51 | ++ (instancetype)sharedInstance | ||
| 52 | +{ | ||
| 53 | + static dispatch_once_t onceToken; | ||
| 54 | + dispatch_once(&onceToken, ^{ | ||
| 55 | + _instance = [[self alloc] init]; | ||
| 56 | + _instance.downloads = [NSMutableArray array]; | ||
| 57 | + | ||
| 58 | + }); | ||
| 59 | + return _instance; | ||
| 60 | +} | ||
| 61 | + | ||
| 62 | +- (id)copyWithZone:(NSZone *)zone | ||
| 63 | +{ | ||
| 64 | + return _instance; | ||
| 65 | +} | ||
| 66 | + | ||
| 67 | +- (id)mutableCopyWithZone:(NSZone *)zone { | ||
| 68 | + return _instance; | ||
| 69 | +} | ||
| 70 | + | ||
| 71 | +#pragma mark - 公开方法 | ||
| 72 | + | ||
| 73 | +- (void)downLoadWithURL:(NSString *)URL progress:(progressBlock)progressBlock success:(successBlock)successBlock faile:(faileBlock)faileBlock | ||
| 74 | +{ | ||
| 75 | + self.downloadUrl = URL; | ||
| 76 | + self.progressBlock = progressBlock; | ||
| 77 | + self.successBlock = successBlock; | ||
| 78 | + self.failedBlock = faileBlock; | ||
| 79 | + | ||
| 80 | + [self.task resume]; | ||
| 81 | + | ||
| 82 | +} | ||
| 83 | + | ||
| 84 | + | ||
| 85 | +- (void)stopTask{ | ||
| 86 | + [self.task suspend]; | ||
| 87 | + | ||
| 88 | +} | ||
| 89 | + | ||
| 90 | + | ||
| 91 | +#pragma mark - Getter方法 | ||
| 92 | +- (NSURLSession *)session | ||
| 93 | +{ | ||
| 94 | + if (!_session) { | ||
| 95 | + | ||
| 96 | + NSOperationQueue *queue = [[NSOperationQueue alloc] init]; | ||
| 97 | + queue.maxConcurrentOperationCount = 1; // 并发队列 | ||
| 98 | + _session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration] delegate:self delegateQueue:queue]; | ||
| 99 | + } | ||
| 100 | + return _session; | ||
| 101 | +} | ||
| 102 | + | ||
| 103 | +- (NSOutputStream *)stream | ||
| 104 | +{ | ||
| 105 | + if (!_stream) { | ||
| 106 | + _stream = [NSOutputStream outputStreamToFileAtPath:FileStorePath append:YES]; | ||
| 107 | + } | ||
| 108 | + return _stream; | ||
| 109 | +} | ||
| 110 | + | ||
| 111 | + | ||
| 112 | +- (NSURLSessionDataTask *)task | ||
| 113 | +{ | ||
| 114 | + if (!_task) { | ||
| 115 | + NSInteger totalLength = [[NSDictionary dictionaryWithContentsOfFile:TotalLengthPlist][FileName] integerValue]; | ||
| 116 | + | ||
| 117 | + if (totalLength && DownloadLength == totalLength) { | ||
| 118 | + NSLog(@"######文件已经下载过了######"); | ||
| 119 | + return nil; | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + // 创建请求 | ||
| 123 | + NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString: self.downloadUrl]]; | ||
| 124 | + | ||
| 125 | + // 设置请求头 | ||
| 126 | + // Range : bytes=xxx-xxx,从已经下载的长度开始到文件总长度的最后都要下载 | ||
| 127 | + NSString *range = [NSString stringWithFormat:@"bytes=%zd-", DownloadLength]; | ||
| 128 | + [request setValue:range forHTTPHeaderField:@"Range"]; | ||
| 129 | + | ||
| 130 | + // 创建一个Data任务 | ||
| 131 | + _task = [self.session dataTaskWithRequest:request]; | ||
| 132 | + } | ||
| 133 | + return _task; | ||
| 134 | +} | ||
| 135 | + | ||
| 136 | +#pragma mark - NSURLSessionDataDelegate | ||
| 137 | +/** | ||
| 138 | + * 1.接收到响应 | ||
| 139 | + */ | ||
| 140 | +- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveResponse:(NSHTTPURLResponse *)response completionHandler:(void (^)(NSURLSessionResponseDisposition))completionHandler | ||
| 141 | +{ | ||
| 142 | + // 打开流 | ||
| 143 | + [self.stream open]; | ||
| 144 | + | ||
| 145 | + /* | ||
| 146 | + (Content-Length字段返回的是服务器对每次客户端请求要下载文件的大小) | ||
| 147 | + 比如首次客户端请求下载文件A,大小为1000byte,那么第一次服务器返回的Content-Length = 1000, | ||
| 148 | + 客户端下载到500byte,突然中断,再次请求的range为 “bytes=500-”,那么此时服务器返回的Content-Length为500 | ||
| 149 | + 所以对于单个文件进行多次下载的情况(断点续传),计算文件的总大小,必须把服务器返回的content-length加上本地存储的已经下载的文件大小 | ||
| 150 | + */ | ||
| 151 | + self.totalLength = [response.allHeaderFields[@"Content-Length"] integerValue] + DownloadLength; | ||
| 152 | + | ||
| 153 | + // 把此次已经下载的文件大小存储在plist文件 | ||
| 154 | + NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithContentsOfFile: TotalLengthPlist]; | ||
| 155 | + if (dict == nil) dict = [NSMutableDictionary dictionary]; | ||
| 156 | + dict[FileName] = @(self.totalLength); | ||
| 157 | + [dict writeToFile: TotalLengthPlist atomically:YES]; | ||
| 158 | + | ||
| 159 | + // 接收这个请求,允许接收服务器的数据 | ||
| 160 | + completionHandler(NSURLSessionResponseAllow); | ||
| 161 | +} | ||
| 162 | + | ||
| 163 | +/** | ||
| 164 | + * 2.接收到服务器返回的数据(这个方法可能会被调用N次) | ||
| 165 | + */ | ||
| 166 | +- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data | ||
| 167 | +{ | ||
| 168 | + // 写入数据 | ||
| 169 | + [self.stream write:data.bytes maxLength:data.length]; | ||
| 170 | + | ||
| 171 | + float progress = 1.0 * DownloadLength / self.totalLength; | ||
| 172 | + if (self.progressBlock) { | ||
| 173 | + self.progressBlock(self.downloadUrl, progress); | ||
| 174 | + } | ||
| 175 | + // 下载进度 | ||
| 176 | +} | ||
| 177 | + | ||
| 178 | +/** | ||
| 179 | + * 3.请求完毕(成功\失败) | ||
| 180 | + */ | ||
| 181 | +- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error | ||
| 182 | +{ | ||
| 183 | + if (error) { | ||
| 184 | + self.stream = nil; | ||
| 185 | + self.task = nil; | ||
| 186 | + | ||
| 187 | + if (self.failedBlock) { | ||
| 188 | + self.failedBlock(self.downloadUrl, error); | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + }else{ | ||
| 192 | + // 关闭流 | ||
| 193 | + [self.stream close]; | ||
| 194 | + self.stream = nil; | ||
| 195 | + // 清除任务 | ||
| 196 | + self.task = nil; | ||
| 197 | + | ||
| 198 | + if (self.successBlock) { | ||
| 199 | + self.successBlock(self.downloadUrl, FileStorePath); | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + | ||
| 203 | + } | ||
| 204 | +} | ||
| 205 | + | ||
| 206 | +@end |
CNLiveGifFace/Classes/Tools/NSString+Hash.h
0 → 100644
| 1 | +// | ||
| 2 | +// NSString+Hash.h | ||
| 3 | +// Net++ | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2018/8/31. | ||
| 6 | +// Copyright © 2018年 CNLive-zxw. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <Foundation/Foundation.h> | ||
| 10 | + | ||
| 11 | +@interface NSString (Hash) | ||
| 12 | + | ||
| 13 | +@property (readonly) NSString *md5String; | ||
| 14 | +@property (readonly) NSString *sha1String; | ||
| 15 | +@property (readonly) NSString *sha256String; | ||
| 16 | +@property (readonly) NSString *sha512String; | ||
| 17 | + | ||
| 18 | +- (NSString *)hmacSHA1StringWithKey:(NSString *)key; | ||
| 19 | +- (NSString *)hmacSHA256StringWithKey:(NSString *)key; | ||
| 20 | +- (NSString *)hmacSHA512StringWithKey:(NSString *)key; | ||
| 21 | + | ||
| 22 | +@end |
CNLiveGifFace/Classes/Tools/NSString+Hash.m
0 → 100644
| 1 | +// | ||
| 2 | +// NSString+Hash.m | ||
| 3 | +// Net++ | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2018/8/31. | ||
| 6 | +// Copyright © 2018年 CNLive-zxw. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "NSString+Hash.h" | ||
| 10 | + | ||
| 11 | +#import <CommonCrypto/CommonDigest.h> | ||
| 12 | +#import <CommonCrypto/CommonHMAC.h> | ||
| 13 | + | ||
| 14 | +@implementation NSString (Hash) | ||
| 15 | + | ||
| 16 | +- (NSString *)md5String | ||
| 17 | +{ | ||
| 18 | + const char *string = self.UTF8String; | ||
| 19 | + int length = (int)strlen(string); | ||
| 20 | + unsigned char bytes[CC_MD5_DIGEST_LENGTH]; | ||
| 21 | + CC_MD5(string, length, bytes); | ||
| 22 | + return [self stringFromBytes:bytes length:CC_MD5_DIGEST_LENGTH]; | ||
| 23 | +} | ||
| 24 | + | ||
| 25 | +- (NSString *)sha1String | ||
| 26 | +{ | ||
| 27 | + const char *string = self.UTF8String; | ||
| 28 | + int length = (int)strlen(string); | ||
| 29 | + unsigned char bytes[CC_SHA1_DIGEST_LENGTH]; | ||
| 30 | + CC_SHA1(string, length, bytes); | ||
| 31 | + return [self stringFromBytes:bytes length:CC_SHA1_DIGEST_LENGTH]; | ||
| 32 | +} | ||
| 33 | + | ||
| 34 | +- (NSString *)sha256String | ||
| 35 | +{ | ||
| 36 | + const char *string = self.UTF8String; | ||
| 37 | + int length = (int)strlen(string); | ||
| 38 | + unsigned char bytes[CC_SHA256_DIGEST_LENGTH]; | ||
| 39 | + CC_SHA256(string, length, bytes); | ||
| 40 | + return [self stringFromBytes:bytes length:CC_SHA256_DIGEST_LENGTH]; | ||
| 41 | +} | ||
| 42 | + | ||
| 43 | +- (NSString *)sha512String | ||
| 44 | +{ | ||
| 45 | + const char *string = self.UTF8String; | ||
| 46 | + int length = (int)strlen(string); | ||
| 47 | + unsigned char bytes[CC_SHA512_DIGEST_LENGTH]; | ||
| 48 | + CC_SHA512(string, length, bytes); | ||
| 49 | + return [self stringFromBytes:bytes length:CC_SHA512_DIGEST_LENGTH]; | ||
| 50 | +} | ||
| 51 | + | ||
| 52 | +- (NSString *)hmacSHA1StringWithKey:(NSString *)key | ||
| 53 | +{ | ||
| 54 | + NSData *keyData = [key dataUsingEncoding:NSUTF8StringEncoding]; | ||
| 55 | + NSData *messageData = [self dataUsingEncoding:NSUTF8StringEncoding]; | ||
| 56 | + NSMutableData *mutableData = [NSMutableData dataWithLength:CC_SHA1_DIGEST_LENGTH]; | ||
| 57 | + CCHmac(kCCHmacAlgSHA1, keyData.bytes, keyData.length, messageData.bytes, messageData.length, mutableData.mutableBytes); | ||
| 58 | + return [self stringFromBytes:(unsigned char *)mutableData.bytes length:mutableData.length]; | ||
| 59 | +} | ||
| 60 | + | ||
| 61 | +- (NSString *)hmacSHA256StringWithKey:(NSString *)key | ||
| 62 | +{ | ||
| 63 | + NSData *keyData = [key dataUsingEncoding:NSUTF8StringEncoding]; | ||
| 64 | + NSData *messageData = [self dataUsingEncoding:NSUTF8StringEncoding]; | ||
| 65 | + NSMutableData *mutableData = [NSMutableData dataWithLength:CC_SHA256_DIGEST_LENGTH]; | ||
| 66 | + CCHmac(kCCHmacAlgSHA256, keyData.bytes, keyData.length, messageData.bytes, messageData.length, mutableData.mutableBytes); | ||
| 67 | + return [self stringFromBytes:(unsigned char *)mutableData.bytes length:mutableData.length]; | ||
| 68 | +} | ||
| 69 | + | ||
| 70 | +- (NSString *)hmacSHA512StringWithKey:(NSString *)key | ||
| 71 | +{ | ||
| 72 | + NSData *keyData = [key dataUsingEncoding:NSUTF8StringEncoding]; | ||
| 73 | + NSData *messageData = [self dataUsingEncoding:NSUTF8StringEncoding]; | ||
| 74 | + NSMutableData *mutableData = [NSMutableData dataWithLength:CC_SHA512_DIGEST_LENGTH]; | ||
| 75 | + CCHmac(kCCHmacAlgSHA512, keyData.bytes, keyData.length, messageData.bytes, messageData.length, mutableData.mutableBytes); | ||
| 76 | + return [self stringFromBytes:(unsigned char *)mutableData.bytes length:mutableData.length]; | ||
| 77 | +} | ||
| 78 | + | ||
| 79 | +#pragma mark - Helpers | ||
| 80 | + | ||
| 81 | +- (NSString *)stringFromBytes:(unsigned char *)bytes length:(NSUInteger)length | ||
| 82 | +{ | ||
| 83 | + NSMutableString *mutableString = @"".mutableCopy; | ||
| 84 | + for (int i = 0; i < length; i++) | ||
| 85 | + [mutableString appendFormat:@"%02x", bytes[i]]; | ||
| 86 | + return [NSString stringWithString:mutableString]; | ||
| 87 | +} | ||
| 88 | + | ||
| 89 | +@end |
CNLiveGifFace/Classes/View/CNGifFaceListHeaderView.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNGifFaceListHeaderView.h | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2019/2/20. | ||
| 6 | +// Copyright © 2019年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <UIKit/UIKit.h> | ||
| 10 | +#define kCNGifFaceListHeaderView @"CNGifFaceListHeaderView" | ||
| 11 | + | ||
| 12 | +NS_ASSUME_NONNULL_BEGIN | ||
| 13 | + | ||
| 14 | +@interface CNGifFaceListHeaderView : UITableViewHeaderFooterView | ||
| 15 | +@property (nonatomic, copy) NSString *text; | ||
| 16 | +@property (nonatomic, copy) NSString *textColor; | ||
| 17 | +@property (nonatomic, copy) NSString *backgroundColor; | ||
| 18 | +@property (nonatomic, assign) NSInteger textSize; | ||
| 19 | +@property (nonatomic, assign) BOOL isHidden; | ||
| 20 | + | ||
| 21 | +@end | ||
| 22 | + | ||
| 23 | +NS_ASSUME_NONNULL_END |
CNLiveGifFace/Classes/View/CNGifFaceListHeaderView.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNGifFaceListHeaderView.m | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2019/2/20. | ||
| 6 | +// Copyright © 2019年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNGifFaceListHeaderView.h" | ||
| 10 | +#import "UIColor+CNLiveExtension.h" | ||
| 11 | + | ||
| 12 | +@interface CNGifFaceListHeaderView() | ||
| 13 | +/** 内部的label */ | ||
| 14 | +@property (nonatomic, weak) UILabel *label; | ||
| 15 | +@property (nonatomic, weak) UIView *topLine; | ||
| 16 | +@property (nonatomic, weak) UIView *bottomLine; | ||
| 17 | + | ||
| 18 | +@end | ||
| 19 | + | ||
| 20 | +@implementation CNGifFaceListHeaderView | ||
| 21 | +static const NSInteger margin = 10; | ||
| 22 | + | ||
| 23 | +- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier{ | ||
| 24 | + if (self = [super initWithReuseIdentifier:reuseIdentifier]) { | ||
| 25 | + self.contentView.backgroundColor = [UIColor whiteColor]; | ||
| 26 | + | ||
| 27 | + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(margin, 0, 200, 45*RATIO)]; | ||
| 28 | + label.textColor = CNLiveColorWithHexString(@"000000"); | ||
| 29 | + label.font = UIFontCNMake(17); | ||
| 30 | + label.backgroundColor = [UIColor whiteColor]; | ||
| 31 | + [self.contentView addSubview:label]; | ||
| 32 | + self.label = label; | ||
| 33 | + | ||
| 34 | + UIView *topLine = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kMainScreenWidth, 0.5)]; | ||
| 35 | + topLine.backgroundColor = CNLiveColorWithHexString(@"EBEBEB"); | ||
| 36 | + [self.contentView addSubview:topLine]; | ||
| 37 | + self.topLine = topLine; | ||
| 38 | + | ||
| 39 | + UIView *bottomLine = [[UIView alloc] initWithFrame:CGRectMake(margin, 45*RATIO-0.5, kMainScreenWidth-margin, 0.5)]; | ||
| 40 | + bottomLine.backgroundColor = CNLiveColorWithHexString(@"EBEBEB"); | ||
| 41 | + [self.contentView addSubview:bottomLine]; | ||
| 42 | + self.bottomLine = bottomLine; | ||
| 43 | + | ||
| 44 | + } | ||
| 45 | + return self; | ||
| 46 | +} | ||
| 47 | +- (void)setIsHidden:(BOOL)isHidden{ | ||
| 48 | + _isHidden = isHidden; | ||
| 49 | + _topLine.hidden = isHidden; | ||
| 50 | + _bottomLine.hidden = isHidden; | ||
| 51 | +} | ||
| 52 | +- (void)setBackgroundColor:(NSString *)backgroundColor{ | ||
| 53 | + _backgroundColor = backgroundColor; | ||
| 54 | + self.contentView.backgroundColor = CNLiveColorWithHexString(backgroundColor); | ||
| 55 | + _label.backgroundColor = CNLiveColorWithHexString(backgroundColor); | ||
| 56 | + | ||
| 57 | +} | ||
| 58 | +- (void)setTextSize:(NSInteger)textSize{ | ||
| 59 | + _label.font = UIFontCNMake(textSize); | ||
| 60 | +} | ||
| 61 | +- (void)setTextColor:(NSString *)textColor{ | ||
| 62 | + _textColor = textColor; | ||
| 63 | + _label.textColor = CNLiveColorWithHexString(textColor); | ||
| 64 | + | ||
| 65 | +} | ||
| 66 | + | ||
| 67 | +- (void)setText:(NSString *)text{ | ||
| 68 | + self.label.text = text; | ||
| 69 | +} | ||
| 70 | + | ||
| 71 | +/* | ||
| 72 | +// Only override drawRect: if you perform custom drawing. | ||
| 73 | +// An empty implementation adversely affects performance during animation. | ||
| 74 | +- (void)drawRect:(CGRect)rect { | ||
| 75 | + // Drawing code | ||
| 76 | +} | ||
| 77 | +*/ | ||
| 78 | + | ||
| 79 | +@end |
CNLiveGifFace/Classes/View/CNGifFaceListTableViewCell.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNGifFaceListTableViewCell.h | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2019/1/26. | ||
| 6 | +// Copyright © 2019年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <UIKit/UIKit.h> | ||
| 10 | +#define kCNGifFaceListTableViewCell @"CNGifFaceListTableViewCell" | ||
| 11 | + | ||
| 12 | +NS_ASSUME_NONNULL_BEGIN | ||
| 13 | +@class CNGifFaceModel; | ||
| 14 | +@class CNGifFaceListTableViewCell; | ||
| 15 | + | ||
| 16 | +@protocol CNGifFaceListTableViewCellDelegate<NSObject> | ||
| 17 | +- (void)clickedAddBtn:(NSString *)url; | ||
| 18 | + | ||
| 19 | +@end | ||
| 20 | + | ||
| 21 | +@interface CNGifFaceListTableViewCell : UITableViewCell | ||
| 22 | +@property (nonatomic, strong) UIButton *addBtn; | ||
| 23 | +@property (nonatomic, strong) UIProgressView *processView; | ||
| 24 | +@property (nonatomic, strong) CNGifFaceModel *model; | ||
| 25 | +@property (nonatomic, weak) id<CNGifFaceListTableViewCellDelegate> delegate; | ||
| 26 | +- (void)refreshCell; | ||
| 27 | + | ||
| 28 | +@end | ||
| 29 | + | ||
| 30 | +NS_ASSUME_NONNULL_END |
CNLiveGifFace/Classes/View/CNGifFaceListTableViewCell.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNGifFaceListTableViewCell.m | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2019/1/26. | ||
| 6 | +// Copyright © 2019年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNGifFaceListTableViewCell.h" | ||
| 10 | +#import "CNGifFaceModel.h" | ||
| 11 | +#import "UIColor+CNLiveExtension.h" | ||
| 12 | +#import <AFNetworking/AFNetworking.h> | ||
| 13 | + | ||
| 14 | +@interface CNGifFaceListTableViewCell() | ||
| 15 | +@property (nonatomic, strong) UIImageView *leftImage; | ||
| 16 | +@property (nonatomic, strong) UILabel *titleLabel; | ||
| 17 | +@property (nonatomic, strong) UILabel *contentLabel; | ||
| 18 | +@property (nonatomic, strong) UIView *line; | ||
| 19 | + | ||
| 20 | +@end | ||
| 21 | +@implementation CNGifFaceListTableViewCell | ||
| 22 | +static const NSInteger margin = 10; | ||
| 23 | + | ||
| 24 | +#pragma mark - Init | ||
| 25 | +- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ | ||
| 26 | + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; | ||
| 27 | + if (self) { | ||
| 28 | + self.contentView.backgroundColor = [UIColor whiteColor]; | ||
| 29 | + [self setupUI]; | ||
| 30 | + | ||
| 31 | + } | ||
| 32 | + return self; | ||
| 33 | +} | ||
| 34 | +#pragma mark - Data | ||
| 35 | +- (void)setModel:(CNGifFaceModel *)model{ | ||
| 36 | + _model = model; | ||
| 37 | + [_leftImage sd_setImageWithURL:[NSURL URLWithString:model.coverPic] placeholderImage:nil]; | ||
| 38 | + _titleLabel.text = model.title; | ||
| 39 | + _contentLabel.text = model.desc; | ||
| 40 | + | ||
| 41 | + if([model.isDownload isEqualToString:@"1"]){ | ||
| 42 | + //已下载 | ||
| 43 | + _addBtn.selected = YES; | ||
| 44 | + _addBtn.layer.borderColor = CNLiveColorWithHexString(@"D9D9D9").CGColor; | ||
| 45 | + _addBtn.userInteractionEnabled = NO; | ||
| 46 | + | ||
| 47 | + }else{ | ||
| 48 | + //未下载 | ||
| 49 | + _addBtn.selected = NO; | ||
| 50 | + _addBtn.layer.borderColor = CNLiveColorWithHexString(@"23D41E").CGColor; | ||
| 51 | + _addBtn.userInteractionEnabled = YES; | ||
| 52 | + [_processView setProgress:0 animated:NO]; | ||
| 53 | + | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | +} | ||
| 57 | + | ||
| 58 | +#pragma mark - UI | ||
| 59 | +- (void)setupUI{ | ||
| 60 | + [self.contentView addSubview:self.leftImage]; | ||
| 61 | + [self.contentView addSubview:self.titleLabel]; | ||
| 62 | + [self.contentView addSubview:self.contentLabel]; | ||
| 63 | + | ||
| 64 | + [self.contentView addSubview:self.addBtn]; | ||
| 65 | + [self.contentView addSubview:self.line]; | ||
| 66 | + [self.contentView addSubview:self.processView]; | ||
| 67 | + | ||
| 68 | +} | ||
| 69 | +- (void)layoutSubviews{ | ||
| 70 | + [super layoutSubviews]; | ||
| 71 | + | ||
| 72 | + [_leftImage mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 73 | + make.top.equalTo(self.contentView.mas_top).with.offset(margin); | ||
| 74 | + make.left.equalTo(self.contentView.mas_left).with.offset(margin); | ||
| 75 | + make.width.offset(60*RATIO*3/4.0); | ||
| 76 | + make.height.offset(60*RATIO); | ||
| 77 | + | ||
| 78 | + }]; | ||
| 79 | + | ||
| 80 | + [_titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 81 | + make.top.equalTo(self.contentView.mas_top).with.offset(margin); | ||
| 82 | + make.left.equalTo(_leftImage.mas_right).with.offset(margin); | ||
| 83 | + make.right.equalTo(self.contentView.mas_right).with.offset(-(2*margin+60)); | ||
| 84 | + make.height.offset(30*RATIO); | ||
| 85 | + | ||
| 86 | + }]; | ||
| 87 | + | ||
| 88 | + [_contentLabel mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 89 | + make.top.equalTo(_titleLabel.mas_bottom).with.offset(0); | ||
| 90 | + make.left.equalTo(_leftImage.mas_right).with.offset(margin); | ||
| 91 | + make.right.equalTo(_titleLabel.mas_right); | ||
| 92 | + make.height.offset(30*RATIO); | ||
| 93 | + | ||
| 94 | + }]; | ||
| 95 | + | ||
| 96 | + [_addBtn mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 97 | + make.right.equalTo(self.contentView.mas_right).with.offset(-margin); | ||
| 98 | + make.centerY.equalTo(_leftImage.mas_centerY); | ||
| 99 | + make.height.offset(30*RATIO); | ||
| 100 | + make.width.offset(60); | ||
| 101 | + }]; | ||
| 102 | + | ||
| 103 | + [_processView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 104 | + make.right.equalTo(self.contentView.mas_right).with.offset(-margin); | ||
| 105 | + make.centerY.equalTo(_leftImage.mas_centerY); | ||
| 106 | + make.height.offset(6); | ||
| 107 | + make.width.offset(60); | ||
| 108 | + }]; | ||
| 109 | + | ||
| 110 | + [_line mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 111 | + make.bottom.equalTo(self.contentView.mas_bottom).with.offset(-0); | ||
| 112 | + make.left.equalTo(self.contentView.mas_right).with.offset(margin); | ||
| 113 | + make.right.equalTo(self.contentView); | ||
| 114 | + make.height.offset(0.5); | ||
| 115 | + | ||
| 116 | + }]; | ||
| 117 | +} | ||
| 118 | + | ||
| 119 | +- (void)awakeFromNib { | ||
| 120 | + [super awakeFromNib]; | ||
| 121 | + // Initialization code | ||
| 122 | +} | ||
| 123 | + | ||
| 124 | +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { | ||
| 125 | + [super setSelected:selected animated:animated]; | ||
| 126 | + | ||
| 127 | + // Configure the view for the selected state | ||
| 128 | +} | ||
| 129 | +#pragma mark - Private Methods | ||
| 130 | +- (void)refreshCell{ | ||
| 131 | + // UI更新代码 | ||
| 132 | + // [QMUITips hideAllTipsInView:AppKeyWindow]; | ||
| 133 | + _model.isDownload = @"1"; | ||
| 134 | + _processView.hidden = YES; | ||
| 135 | + _addBtn.hidden = NO; | ||
| 136 | + | ||
| 137 | + _addBtn.selected = YES; | ||
| 138 | + _addBtn.layer.borderColor = CNLiveColorWithHexString(@"D9D9D9").CGColor; | ||
| 139 | + _addBtn.userInteractionEnabled = NO; | ||
| 140 | + | ||
| 141 | +// QMUITips *tips = [QMUITips showSucceed:@"添加成功" inView:AppKeyWindow hideAfterDelay:1]; | ||
| 142 | +// tips.backgroundColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.6]; | ||
| 143 | + | ||
| 144 | +} | ||
| 145 | +#pragma mark - Action | ||
| 146 | +- (void)clickAddBtn:(UIButton *)btn{ | ||
| 147 | + _addBtn.hidden = YES; | ||
| 148 | + _processView.hidden = NO; | ||
| 149 | + | ||
| 150 | + AFNetworkReachabilityManager *manager = [AFNetworkReachabilityManager sharedManager]; | ||
| 151 | + if(manager.networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable || manager.networkReachabilityStatus == AFNetworkReachabilityStatusUnknown){ | ||
| 152 | + [QMUITips showWithText:@"无法连接网络" inView:AppKeyWindow hideAfterDelay:1]; | ||
| 153 | + return; | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + if (self.delegate && [self.delegate respondsToSelector:@selector(clickedAddBtn:)]) { | ||
| 157 | + [self.delegate clickedAddBtn:self.model.downloadUrl];//滑动响应实现 | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | +} | ||
| 161 | + | ||
| 162 | +#pragma mark - Lazy loading | ||
| 163 | +- (UIImageView *)leftImage{ | ||
| 164 | + if (!_leftImage) { | ||
| 165 | + _leftImage = [[UIImageView alloc] init]; | ||
| 166 | + _leftImage.userInteractionEnabled = YES; | ||
| 167 | + | ||
| 168 | + } | ||
| 169 | + return _leftImage; | ||
| 170 | +} | ||
| 171 | +- (UILabel *)titleLabel{ | ||
| 172 | + if(_titleLabel == nil){ | ||
| 173 | + _titleLabel = [[UILabel alloc] init]; | ||
| 174 | + _titleLabel.textColor = CNLiveColorWithHexString(@"000000"); | ||
| 175 | + _titleLabel.font = UIFontCNMake(17); | ||
| 176 | + _titleLabel.userInteractionEnabled = YES; | ||
| 177 | + | ||
| 178 | + } | ||
| 179 | + return _titleLabel; | ||
| 180 | + | ||
| 181 | +} | ||
| 182 | +- (UILabel *)contentLabel{ | ||
| 183 | + if(_contentLabel == nil){ | ||
| 184 | + _contentLabel = [[UILabel alloc] init]; | ||
| 185 | + _contentLabel.textColor = CNLiveColorWithHexString(@"888888"); | ||
| 186 | + _contentLabel.font = UIFontCNMake(13); | ||
| 187 | + | ||
| 188 | + } | ||
| 189 | + return _contentLabel; | ||
| 190 | + | ||
| 191 | +} | ||
| 192 | +- (UIButton *)addBtn{ | ||
| 193 | + if(_addBtn == nil){ | ||
| 194 | + _addBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 195 | + _addBtn.titleLabel.font = UIFontCNMake(14); | ||
| 196 | + _addBtn.layer.cornerRadius = 15*RATIO; | ||
| 197 | + _addBtn.layer.masksToBounds = YES; | ||
| 198 | + _addBtn.layer.borderWidth = 1; | ||
| 199 | + [_addBtn addTarget:self action:@selector(clickAddBtn:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 200 | + | ||
| 201 | + [_addBtn setTitle:@"添加" forState:UIControlStateNormal]; | ||
| 202 | + [_addBtn setTitleColor:CNLiveColorWithHexString(@"23D41E") forState:UIControlStateNormal]; | ||
| 203 | + _addBtn.layer.borderColor = CNLiveColorWithHexString(@"23D41E").CGColor; | ||
| 204 | + | ||
| 205 | + [_addBtn setTitle:@"已添加" forState:UIControlStateSelected]; | ||
| 206 | + [_addBtn setTitleColor:CNLiveColorWithHexString(@"D9D9D9") forState:UIControlStateSelected]; | ||
| 207 | + | ||
| 208 | + } | ||
| 209 | + return _addBtn; | ||
| 210 | + | ||
| 211 | +} | ||
| 212 | +- (UIProgressView *)processView{ | ||
| 213 | + if(_processView == nil){ | ||
| 214 | + _processView = [[UIProgressView alloc]initWithProgressViewStyle:UIProgressViewStyleDefault]; | ||
| 215 | + _processView.trackTintColor = CNLiveColorWithHexString(@"D9D9D9"); | ||
| 216 | + _processView.progressTintColor = CNLiveColorWithHexString(@"23D41E"); | ||
| 217 | + _processView.hidden = YES; | ||
| 218 | + } | ||
| 219 | + return _processView; | ||
| 220 | +} | ||
| 221 | +- (UIView *)line{ | ||
| 222 | + if(_line == nil){ | ||
| 223 | + _line = [[UIView alloc] init]; | ||
| 224 | + _line.backgroundColor = [UIColor colorWithRed:235/255.0 green:235/255.0 blue:235/255.0 alpha:1.0]; | ||
| 225 | + } | ||
| 226 | + return _line; | ||
| 227 | +} | ||
| 228 | + | ||
| 229 | +@end |
CNLiveGifFace/Classes/View/CNMyGifFaceTableViewCell.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNMyGifFaceTableViewCell.h | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2019/2/18. | ||
| 6 | +// Copyright © 2019年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <UIKit/UIKit.h> | ||
| 10 | +#define kCNMyGifFaceTableViewCell @"CNMyGifFaceTableViewCell" | ||
| 11 | + | ||
| 12 | +NS_ASSUME_NONNULL_BEGIN | ||
| 13 | +@class CNMyGifFaceTableViewCell; | ||
| 14 | + | ||
| 15 | +@protocol CNMyGifFaceTableViewCellDelegate<NSObject> | ||
| 16 | +- (void)refreshGifFaceTableView:(CNMyGifFaceTableViewCell *)cell; | ||
| 17 | + | ||
| 18 | +@end | ||
| 19 | + | ||
| 20 | +@interface CNMyGifFaceTableViewCell : UITableViewCell | ||
| 21 | +@property (nonatomic, weak) id<CNMyGifFaceTableViewCellDelegate> delegate; | ||
| 22 | +@property (nonatomic, copy) NSString *groupName; | ||
| 23 | + | ||
| 24 | +@end | ||
| 25 | + | ||
| 26 | +NS_ASSUME_NONNULL_END |
CNLiveGifFace/Classes/View/CNMyGifFaceTableViewCell.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNMyGifFaceTableViewCell.m | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by CNLive-zxw on 2019/2/18. | ||
| 6 | +// Copyright © 2019年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNMyGifFaceTableViewCell.h" | ||
| 10 | + | ||
| 11 | +#import "CNGifFaceModel.h" | ||
| 12 | +#import "CNLiveDownLoadManager.h" | ||
| 13 | +#import "CNLiveArchiveManager.h" | ||
| 14 | +//#import "UIColor+CNLiveExtension.h" | ||
| 15 | +#import "CNFaceThemeModel.h" | ||
| 16 | + | ||
| 17 | +@interface CNMyGifFaceTableViewCell() | ||
| 18 | +@property (nonatomic, strong) UIImageView *leftImage; | ||
| 19 | +@property (nonatomic, strong) UILabel *titleLabel; | ||
| 20 | +@property (nonatomic, strong) UIButton *removeBtn; | ||
| 21 | +@property (nonatomic, strong) UIView *line; | ||
| 22 | + | ||
| 23 | +@end | ||
| 24 | +@implementation CNMyGifFaceTableViewCell | ||
| 25 | +static const NSInteger margin = 10; | ||
| 26 | + | ||
| 27 | +#pragma mark - Init | ||
| 28 | +- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ | ||
| 29 | + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; | ||
| 30 | + if (self) { | ||
| 31 | + self.contentView.backgroundColor = [UIColor whiteColor]; | ||
| 32 | + [self setupUI]; | ||
| 33 | + | ||
| 34 | + } | ||
| 35 | + return self; | ||
| 36 | +} | ||
| 37 | +#pragma mark - Data | ||
| 38 | +- (void)setGroupName:(NSString *)groupName{ | ||
| 39 | + _groupName = groupName; | ||
| 40 | + NSString *path = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]stringByAppendingPathComponent:[NSString stringWithFormat:@"%@/GifFace/Download/%@",[UserInformationModel manager].uid,groupName]]; | ||
| 41 | + | ||
| 42 | + //设置图片 | ||
| 43 | + NSString *image = [path stringByAppendingPathComponent:[NSString stringWithFormat:@"%@_left0",groupName]]; | ||
| 44 | + _leftImage.image = [UIImage imageNamed:image]; | ||
| 45 | + | ||
| 46 | + //设置标题 | ||
| 47 | + // 将文件数据化 | ||
| 48 | + NSData *data = [[NSData alloc] initWithContentsOfFile:[path stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.json",groupName]]]; | ||
| 49 | + if(data){ | ||
| 50 | + // 对数据进行JSON格式化并返回字典形式 | ||
| 51 | + NSDictionary *faceDic = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil]; | ||
| 52 | + CNFaceThemeModel *themeModel = [CNFaceThemeModel mj_objectWithKeyValues:faceDic]; | ||
| 53 | + _titleLabel.text = themeModel.themeName; | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | +} | ||
| 57 | +#pragma mark - UI | ||
| 58 | +- (void)setupUI{ | ||
| 59 | + [self.contentView addSubview:self.leftImage]; | ||
| 60 | + [self.contentView addSubview:self.titleLabel]; | ||
| 61 | + [self.contentView addSubview:self.removeBtn]; | ||
| 62 | + | ||
| 63 | + [self.contentView addSubview:self.line]; | ||
| 64 | + | ||
| 65 | +} | ||
| 66 | +- (void)layoutSubviews{ | ||
| 67 | + [super layoutSubviews]; | ||
| 68 | + [_leftImage mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 69 | + make.top.equalTo(self.contentView.mas_top).with.offset(margin); | ||
| 70 | + make.left.equalTo(self.contentView.mas_left).with.offset(margin); | ||
| 71 | + make.width.offset(30*RATIO); | ||
| 72 | + make.height.offset(40*RATIO); | ||
| 73 | + | ||
| 74 | + }]; | ||
| 75 | + | ||
| 76 | + [_titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 77 | + make.centerY.equalTo(_leftImage.mas_centerY); | ||
| 78 | + make.left.equalTo(_leftImage.mas_right).with.offset(margin); | ||
| 79 | + make.height.offset(30*RATIO); | ||
| 80 | + | ||
| 81 | + }]; | ||
| 82 | + | ||
| 83 | + [_removeBtn mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 84 | + make.right.equalTo(self.contentView.mas_right).with.offset(-margin); | ||
| 85 | + make.centerY.equalTo(_leftImage.mas_centerY); | ||
| 86 | + make.height.offset(30*RATIO); | ||
| 87 | + make.width.offset(60*RATIO); | ||
| 88 | + | ||
| 89 | + }]; | ||
| 90 | + | ||
| 91 | + [_line mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 92 | + make.bottom.equalTo(self.contentView.mas_bottom).with.offset(-0); | ||
| 93 | + make.right.equalTo(self.contentView); | ||
| 94 | + make.left.equalTo(self.contentView.mas_right).with.offset(margin); | ||
| 95 | + make.height.offset(0.5); | ||
| 96 | + | ||
| 97 | + }]; | ||
| 98 | + | ||
| 99 | +} | ||
| 100 | + | ||
| 101 | +- (void)awakeFromNib { | ||
| 102 | + [super awakeFromNib]; | ||
| 103 | + // Initialization code | ||
| 104 | +} | ||
| 105 | + | ||
| 106 | +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { | ||
| 107 | + [super setSelected:selected animated:animated]; | ||
| 108 | + | ||
| 109 | + // Configure the view for the selected state | ||
| 110 | +} | ||
| 111 | +#pragma mark - Private Methods | ||
| 112 | + | ||
| 113 | +#pragma mark - Action | ||
| 114 | +- (void)clickRemoveBtn:(UIButton *)btn{ | ||
| 115 | + [QMUITips showLoading:@"移除中..." inView:AppKeyWindow]; | ||
| 116 | + | ||
| 117 | + //1先删除plist文件 | ||
| 118 | + NSString *docPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; | ||
| 119 | + NSString *filePath1 = [docPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@/GifFace/%@",[UserInformationModel manager].uid,@"GifFaceList.plist"]]; | ||
| 120 | + ///var/mobile/Containers/Data/Application/94E0C70B-9F4D-4716-8EAF-7BF0C53AEAEE/Documents/10514405/GifFace/GifFaceList.plist | ||
| 121 | + NSFileManager *fileManager = [NSFileManager defaultManager]; | ||
| 122 | + BOOL result1 = [fileManager fileExistsAtPath:filePath1]; | ||
| 123 | + | ||
| 124 | + if(result1){ | ||
| 125 | + //读取已存在的表情包列表 | ||
| 126 | + NSMutableArray *data = [NSMutableArray arrayWithContentsOfFile:filePath1]; | ||
| 127 | + [data removeObject:_groupName]; | ||
| 128 | + if([data writeToFile:filePath1 atomically:YES]){ | ||
| 129 | + NSLog(@"删除plist文件的数据并写入成功"); | ||
| 130 | + [[NSNotificationCenter defaultCenter] postNotificationName:@"GifFaceDownLoadSuccess" object:nil]; | ||
| 131 | + | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + } | ||
| 135 | + //2然后删除文件夹中的表情包 | ||
| 136 | + NSString *filePath2 = [docPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@/GifFace/Download/%@",[UserInformationModel manager].uid,_groupName]]; | ||
| 137 | + BOOL result2 = [fileManager fileExistsAtPath:filePath2]; | ||
| 138 | + if(result2){ | ||
| 139 | + //读取已存在的表情包列表 | ||
| 140 | + if([fileManager removeItemAtPath:filePath2 error:nil]){ | ||
| 141 | + NSLog(@"删除表情包的数据成功"); | ||
| 142 | + | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + } | ||
| 146 | + if (self.delegate && [self.delegate respondsToSelector:@selector(refreshGifFaceTableView:)]) { | ||
| 147 | + [self.delegate refreshGifFaceTableView:self]; | ||
| 148 | + [[NSNotificationCenter defaultCenter] postNotificationName:@"RemoveGifFacePackageSuccess" object:nil userInfo:@{@"sectionId":_groupName}]; | ||
| 149 | + } | ||
| 150 | + [QMUITips hideAllTipsInView:AppKeyWindow]; | ||
| 151 | +// QMUITips *tips = [QMUITips showSucceed:@"移除成功" inView:AppKeyWindow hideAfterDelay:1]; | ||
| 152 | +// tips.backgroundColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.6]; | ||
| 153 | + | ||
| 154 | +} | ||
| 155 | +#pragma mark - Lazy loading | ||
| 156 | +- (UIImageView *)leftImage{ | ||
| 157 | + if (!_leftImage) { | ||
| 158 | + _leftImage = [[UIImageView alloc] init]; | ||
| 159 | + _leftImage.userInteractionEnabled = YES; | ||
| 160 | +// _leftImage.contentMode = UIViewContentModeScaleAspectFill; | ||
| 161 | +// _leftImage.layer.masksToBounds = YES; | ||
| 162 | + } | ||
| 163 | + return _leftImage; | ||
| 164 | +} | ||
| 165 | +- (UILabel *)titleLabel{ | ||
| 166 | + if(_titleLabel == nil){ | ||
| 167 | + _titleLabel = [[UILabel alloc] init]; | ||
| 168 | + _titleLabel.textColor = [UIColor blackColor]; | ||
| 169 | + _titleLabel.font = UIFontCNMake(17); | ||
| 170 | + _titleLabel.userInteractionEnabled = YES; | ||
| 171 | + | ||
| 172 | + } | ||
| 173 | + return _titleLabel; | ||
| 174 | + | ||
| 175 | +} | ||
| 176 | + | ||
| 177 | +- (UIButton *)removeBtn{ | ||
| 178 | + if(_removeBtn == nil){ | ||
| 179 | + _removeBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 180 | + _removeBtn.titleLabel.font = UIFontCNMake(14); | ||
| 181 | + _removeBtn.backgroundColor = CNLiveColorWithHexString(@"FAFAFA"); | ||
| 182 | + _removeBtn.layer.cornerRadius = 15*RATIO; | ||
| 183 | + _removeBtn.layer.masksToBounds = YES; | ||
| 184 | + _removeBtn.layer.borderColor = CNLiveColorWithHexString(@"C6C6C6").CGColor; | ||
| 185 | + _removeBtn.layer.borderWidth = 1; | ||
| 186 | + [_removeBtn addTarget:self action:@selector(clickRemoveBtn:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 187 | + | ||
| 188 | + [_removeBtn setTitle:@"移除" forState:UIControlStateNormal]; | ||
| 189 | + [_removeBtn setTitleColor:CNLiveColorWithHexString(@"999999") forState:UIControlStateNormal]; | ||
| 190 | + | ||
| 191 | + } | ||
| 192 | + return _removeBtn; | ||
| 193 | + | ||
| 194 | +} | ||
| 195 | + | ||
| 196 | +- (UIView *)line{ | ||
| 197 | + if(_line == nil){ | ||
| 198 | + _line = [[UIView alloc] init]; | ||
| 199 | + _line.backgroundColor = [UIColor colorWithRed:235/255.0 green:235/255.0 blue:235/255.0 alpha:1.0]; | ||
| 200 | + } | ||
| 201 | + return _line; | ||
| 202 | +} | ||
| 203 | + | ||
| 204 | +@end |
Example/CNLiveGifFace.xcodeproj/project.pbxproj
0 → 100644
| 1 | +// !$*UTF8*$! | ||
| 2 | +{ | ||
| 3 | + archiveVersion = 1; | ||
| 4 | + classes = { | ||
| 5 | + }; | ||
| 6 | + objectVersion = 46; | ||
| 7 | + objects = { | ||
| 8 | + | ||
| 9 | +/* Begin PBXBuildFile section */ | ||
| 10 | + 3C45BBD3E956B231644AA223 /* Pods_CNLiveGifFace_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA80D1CB8962D25374B43E5A /* Pods_CNLiveGifFace_Tests.framework */; }; | ||
| 11 | + 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; | ||
| 12 | + 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; }; | ||
| 13 | + 6003F592195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; | ||
| 14 | + 6003F598195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F596195388D20070C39A /* InfoPlist.strings */; }; | ||
| 15 | + 6003F59A195388D20070C39A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F599195388D20070C39A /* main.m */; }; | ||
| 16 | + 6003F59E195388D20070C39A /* CNLiveAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F59D195388D20070C39A /* CNLiveAppDelegate.m */; }; | ||
| 17 | + 6003F5A7195388D20070C39A /* CNLiveViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5A6195388D20070C39A /* CNLiveViewController.m */; }; | ||
| 18 | + 6003F5A9195388D20070C39A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5A8195388D20070C39A /* Images.xcassets */; }; | ||
| 19 | + 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F5AF195388D20070C39A /* XCTest.framework */; }; | ||
| 20 | + 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; | ||
| 21 | + 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; | ||
| 22 | + 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5B8195388D20070C39A /* InfoPlist.strings */; }; | ||
| 23 | + 6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; }; | ||
| 24 | + 71719F9F1E33DC2100824A3D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */; }; | ||
| 25 | + 873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */; }; | ||
| 26 | + C4EABCADD995EFFBB1E7868D /* Pods_CNLiveGifFace_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B0E52A2A408C4B868B431007 /* Pods_CNLiveGifFace_Example.framework */; }; | ||
| 27 | +/* End PBXBuildFile section */ | ||
| 28 | + | ||
| 29 | +/* Begin PBXContainerItemProxy section */ | ||
| 30 | + 6003F5B3195388D20070C39A /* PBXContainerItemProxy */ = { | ||
| 31 | + isa = PBXContainerItemProxy; | ||
| 32 | + containerPortal = 6003F582195388D10070C39A /* Project object */; | ||
| 33 | + proxyType = 1; | ||
| 34 | + remoteGlobalIDString = 6003F589195388D20070C39A; | ||
| 35 | + remoteInfo = CNLiveGifFace; | ||
| 36 | + }; | ||
| 37 | +/* End PBXContainerItemProxy section */ | ||
| 38 | + | ||
| 39 | +/* Begin PBXFileReference section */ | ||
| 40 | + 2051FF30CDCC583E98B8C708 /* Pods-CNLiveGifFace_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveGifFace_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CNLiveGifFace_Example/Pods-CNLiveGifFace_Example.debug.xcconfig"; sourceTree = "<group>"; }; | ||
| 41 | + 5AEFDCD33862C2FAAAF22CD1 /* Pods-CNLiveGifFace_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveGifFace_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CNLiveGifFace_Tests/Pods-CNLiveGifFace_Tests.debug.xcconfig"; sourceTree = "<group>"; }; | ||
| 42 | + 6003F58A195388D20070C39A /* CNLiveGifFace_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CNLiveGifFace_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; | ||
| 43 | + 6003F58D195388D20070C39A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; | ||
| 44 | + 6003F58F195388D20070C39A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; | ||
| 45 | + 6003F591195388D20070C39A /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; | ||
| 46 | + 6003F595195388D20070C39A /* CNLiveGifFace-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CNLiveGifFace-Info.plist"; sourceTree = "<group>"; }; | ||
| 47 | + 6003F597195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; }; | ||
| 48 | + 6003F599195388D20070C39A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; | ||
| 49 | + 6003F59B195388D20070C39A /* CNLiveGifFace-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CNLiveGifFace-Prefix.pch"; sourceTree = "<group>"; }; | ||
| 50 | + 6003F59C195388D20070C39A /* CNLiveAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNLiveAppDelegate.h; sourceTree = "<group>"; }; | ||
| 51 | + 6003F59D195388D20070C39A /* CNLiveAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CNLiveAppDelegate.m; sourceTree = "<group>"; }; | ||
| 52 | + 6003F5A5195388D20070C39A /* CNLiveViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNLiveViewController.h; sourceTree = "<group>"; }; | ||
| 53 | + 6003F5A6195388D20070C39A /* CNLiveViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CNLiveViewController.m; sourceTree = "<group>"; }; | ||
| 54 | + 6003F5A8195388D20070C39A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; }; | ||
| 55 | + 6003F5AE195388D20070C39A /* CNLiveGifFace_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CNLiveGifFace_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; | ||
| 56 | + 6003F5AF195388D20070C39A /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; | ||
| 57 | + 6003F5B7195388D20070C39A /* Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Tests-Info.plist"; sourceTree = "<group>"; }; | ||
| 58 | + 6003F5B9195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; }; | ||
| 59 | + 6003F5BB195388D20070C39A /* Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tests.m; sourceTree = "<group>"; }; | ||
| 60 | + 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = "<group>"; }; | ||
| 61 | + 71719F9E1E33DC2100824A3D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; | ||
| 62 | + 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; | ||
| 63 | + B0E52A2A408C4B868B431007 /* Pods_CNLiveGifFace_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CNLiveGifFace_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; | ||
| 64 | + B6C7652C0773126A8AA5746B /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; }; | ||
| 65 | + CE0DA94002E697DFB1F14D69 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; }; | ||
| 66 | + D36FA93D809CEECAF1C63F33 /* CNLiveGifFace.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = CNLiveGifFace.podspec; path = ../CNLiveGifFace.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; | ||
| 67 | + DA80D1CB8962D25374B43E5A /* Pods_CNLiveGifFace_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CNLiveGifFace_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; | ||
| 68 | + E069E0E0388F846BD9FDC4C8 /* Pods-CNLiveGifFace_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveGifFace_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-CNLiveGifFace_Example/Pods-CNLiveGifFace_Example.release.xcconfig"; sourceTree = "<group>"; }; | ||
| 69 | + FE1D2324EB826AE79E024754 /* Pods-CNLiveGifFace_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveGifFace_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-CNLiveGifFace_Tests/Pods-CNLiveGifFace_Tests.release.xcconfig"; sourceTree = "<group>"; }; | ||
| 70 | +/* End PBXFileReference section */ | ||
| 71 | + | ||
| 72 | +/* Begin PBXFrameworksBuildPhase section */ | ||
| 73 | + 6003F587195388D20070C39A /* Frameworks */ = { | ||
| 74 | + isa = PBXFrameworksBuildPhase; | ||
| 75 | + buildActionMask = 2147483647; | ||
| 76 | + files = ( | ||
| 77 | + 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */, | ||
| 78 | + 6003F592195388D20070C39A /* UIKit.framework in Frameworks */, | ||
| 79 | + 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */, | ||
| 80 | + C4EABCADD995EFFBB1E7868D /* Pods_CNLiveGifFace_Example.framework in Frameworks */, | ||
| 81 | + ); | ||
| 82 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 83 | + }; | ||
| 84 | + 6003F5AB195388D20070C39A /* Frameworks */ = { | ||
| 85 | + isa = PBXFrameworksBuildPhase; | ||
| 86 | + buildActionMask = 2147483647; | ||
| 87 | + files = ( | ||
| 88 | + 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */, | ||
| 89 | + 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */, | ||
| 90 | + 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */, | ||
| 91 | + 3C45BBD3E956B231644AA223 /* Pods_CNLiveGifFace_Tests.framework in Frameworks */, | ||
| 92 | + ); | ||
| 93 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 94 | + }; | ||
| 95 | +/* End PBXFrameworksBuildPhase section */ | ||
| 96 | + | ||
| 97 | +/* Begin PBXGroup section */ | ||
| 98 | + 6003F581195388D10070C39A = { | ||
| 99 | + isa = PBXGroup; | ||
| 100 | + children = ( | ||
| 101 | + 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */, | ||
| 102 | + 6003F593195388D20070C39A /* Example for CNLiveGifFace */, | ||
| 103 | + 6003F5B5195388D20070C39A /* Tests */, | ||
| 104 | + 6003F58C195388D20070C39A /* Frameworks */, | ||
| 105 | + 6003F58B195388D20070C39A /* Products */, | ||
| 106 | + 7B70832029CA3305DF08E931 /* Pods */, | ||
| 107 | + ); | ||
| 108 | + sourceTree = "<group>"; | ||
| 109 | + }; | ||
| 110 | + 6003F58B195388D20070C39A /* Products */ = { | ||
| 111 | + isa = PBXGroup; | ||
| 112 | + children = ( | ||
| 113 | + 6003F58A195388D20070C39A /* CNLiveGifFace_Example.app */, | ||
| 114 | + 6003F5AE195388D20070C39A /* CNLiveGifFace_Tests.xctest */, | ||
| 115 | + ); | ||
| 116 | + name = Products; | ||
| 117 | + sourceTree = "<group>"; | ||
| 118 | + }; | ||
| 119 | + 6003F58C195388D20070C39A /* Frameworks */ = { | ||
| 120 | + isa = PBXGroup; | ||
| 121 | + children = ( | ||
| 122 | + 6003F58D195388D20070C39A /* Foundation.framework */, | ||
| 123 | + 6003F58F195388D20070C39A /* CoreGraphics.framework */, | ||
| 124 | + 6003F591195388D20070C39A /* UIKit.framework */, | ||
| 125 | + 6003F5AF195388D20070C39A /* XCTest.framework */, | ||
| 126 | + B0E52A2A408C4B868B431007 /* Pods_CNLiveGifFace_Example.framework */, | ||
| 127 | + DA80D1CB8962D25374B43E5A /* Pods_CNLiveGifFace_Tests.framework */, | ||
| 128 | + ); | ||
| 129 | + name = Frameworks; | ||
| 130 | + sourceTree = "<group>"; | ||
| 131 | + }; | ||
| 132 | + 6003F593195388D20070C39A /* Example for CNLiveGifFace */ = { | ||
| 133 | + isa = PBXGroup; | ||
| 134 | + children = ( | ||
| 135 | + 6003F59C195388D20070C39A /* CNLiveAppDelegate.h */, | ||
| 136 | + 6003F59D195388D20070C39A /* CNLiveAppDelegate.m */, | ||
| 137 | + 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */, | ||
| 138 | + 6003F5A5195388D20070C39A /* CNLiveViewController.h */, | ||
| 139 | + 6003F5A6195388D20070C39A /* CNLiveViewController.m */, | ||
| 140 | + 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */, | ||
| 141 | + 6003F5A8195388D20070C39A /* Images.xcassets */, | ||
| 142 | + 6003F594195388D20070C39A /* Supporting Files */, | ||
| 143 | + ); | ||
| 144 | + name = "Example for CNLiveGifFace"; | ||
| 145 | + path = CNLiveGifFace; | ||
| 146 | + sourceTree = "<group>"; | ||
| 147 | + }; | ||
| 148 | + 6003F594195388D20070C39A /* Supporting Files */ = { | ||
| 149 | + isa = PBXGroup; | ||
| 150 | + children = ( | ||
| 151 | + 6003F595195388D20070C39A /* CNLiveGifFace-Info.plist */, | ||
| 152 | + 6003F596195388D20070C39A /* InfoPlist.strings */, | ||
| 153 | + 6003F599195388D20070C39A /* main.m */, | ||
| 154 | + 6003F59B195388D20070C39A /* CNLiveGifFace-Prefix.pch */, | ||
| 155 | + ); | ||
| 156 | + name = "Supporting Files"; | ||
| 157 | + sourceTree = "<group>"; | ||
| 158 | + }; | ||
| 159 | + 6003F5B5195388D20070C39A /* Tests */ = { | ||
| 160 | + isa = PBXGroup; | ||
| 161 | + children = ( | ||
| 162 | + 6003F5BB195388D20070C39A /* Tests.m */, | ||
| 163 | + 6003F5B6195388D20070C39A /* Supporting Files */, | ||
| 164 | + ); | ||
| 165 | + path = Tests; | ||
| 166 | + sourceTree = "<group>"; | ||
| 167 | + }; | ||
| 168 | + 6003F5B6195388D20070C39A /* Supporting Files */ = { | ||
| 169 | + isa = PBXGroup; | ||
| 170 | + children = ( | ||
| 171 | + 6003F5B7195388D20070C39A /* Tests-Info.plist */, | ||
| 172 | + 6003F5B8195388D20070C39A /* InfoPlist.strings */, | ||
| 173 | + 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */, | ||
| 174 | + ); | ||
| 175 | + name = "Supporting Files"; | ||
| 176 | + sourceTree = "<group>"; | ||
| 177 | + }; | ||
| 178 | + 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */ = { | ||
| 179 | + isa = PBXGroup; | ||
| 180 | + children = ( | ||
| 181 | + D36FA93D809CEECAF1C63F33 /* CNLiveGifFace.podspec */, | ||
| 182 | + CE0DA94002E697DFB1F14D69 /* README.md */, | ||
| 183 | + B6C7652C0773126A8AA5746B /* LICENSE */, | ||
| 184 | + ); | ||
| 185 | + name = "Podspec Metadata"; | ||
| 186 | + sourceTree = "<group>"; | ||
| 187 | + }; | ||
| 188 | + 7B70832029CA3305DF08E931 /* Pods */ = { | ||
| 189 | + isa = PBXGroup; | ||
| 190 | + children = ( | ||
| 191 | + 2051FF30CDCC583E98B8C708 /* Pods-CNLiveGifFace_Example.debug.xcconfig */, | ||
| 192 | + E069E0E0388F846BD9FDC4C8 /* Pods-CNLiveGifFace_Example.release.xcconfig */, | ||
| 193 | + 5AEFDCD33862C2FAAAF22CD1 /* Pods-CNLiveGifFace_Tests.debug.xcconfig */, | ||
| 194 | + FE1D2324EB826AE79E024754 /* Pods-CNLiveGifFace_Tests.release.xcconfig */, | ||
| 195 | + ); | ||
| 196 | + name = Pods; | ||
| 197 | + sourceTree = "<group>"; | ||
| 198 | + }; | ||
| 199 | +/* End PBXGroup section */ | ||
| 200 | + | ||
| 201 | +/* Begin PBXNativeTarget section */ | ||
| 202 | + 6003F589195388D20070C39A /* CNLiveGifFace_Example */ = { | ||
| 203 | + isa = PBXNativeTarget; | ||
| 204 | + buildConfigurationList = 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "CNLiveGifFace_Example" */; | ||
| 205 | + buildPhases = ( | ||
| 206 | + 60A0D1167830517942B262B9 /* [CP] Check Pods Manifest.lock */, | ||
| 207 | + 6003F586195388D20070C39A /* Sources */, | ||
| 208 | + 6003F587195388D20070C39A /* Frameworks */, | ||
| 209 | + 6003F588195388D20070C39A /* Resources */, | ||
| 210 | + ECAC1BD9552FAE4C176008DA /* [CP] Embed Pods Frameworks */, | ||
| 211 | + ); | ||
| 212 | + buildRules = ( | ||
| 213 | + ); | ||
| 214 | + dependencies = ( | ||
| 215 | + ); | ||
| 216 | + name = CNLiveGifFace_Example; | ||
| 217 | + productName = CNLiveGifFace; | ||
| 218 | + productReference = 6003F58A195388D20070C39A /* CNLiveGifFace_Example.app */; | ||
| 219 | + productType = "com.apple.product-type.application"; | ||
| 220 | + }; | ||
| 221 | + 6003F5AD195388D20070C39A /* CNLiveGifFace_Tests */ = { | ||
| 222 | + isa = PBXNativeTarget; | ||
| 223 | + buildConfigurationList = 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "CNLiveGifFace_Tests" */; | ||
| 224 | + buildPhases = ( | ||
| 225 | + 13E3CAF3B091ED34803E1AB4 /* [CP] Check Pods Manifest.lock */, | ||
| 226 | + 6003F5AA195388D20070C39A /* Sources */, | ||
| 227 | + 6003F5AB195388D20070C39A /* Frameworks */, | ||
| 228 | + 6003F5AC195388D20070C39A /* Resources */, | ||
| 229 | + ); | ||
| 230 | + buildRules = ( | ||
| 231 | + ); | ||
| 232 | + dependencies = ( | ||
| 233 | + 6003F5B4195388D20070C39A /* PBXTargetDependency */, | ||
| 234 | + ); | ||
| 235 | + name = CNLiveGifFace_Tests; | ||
| 236 | + productName = CNLiveGifFaceTests; | ||
| 237 | + productReference = 6003F5AE195388D20070C39A /* CNLiveGifFace_Tests.xctest */; | ||
| 238 | + productType = "com.apple.product-type.bundle.unit-test"; | ||
| 239 | + }; | ||
| 240 | +/* End PBXNativeTarget section */ | ||
| 241 | + | ||
| 242 | +/* Begin PBXProject section */ | ||
| 243 | + 6003F582195388D10070C39A /* Project object */ = { | ||
| 244 | + isa = PBXProject; | ||
| 245 | + attributes = { | ||
| 246 | + CLASSPREFIX = CNLive; | ||
| 247 | + LastUpgradeCheck = 0720; | ||
| 248 | + ORGANIZATIONNAME = "153993236@qq.com"; | ||
| 249 | + TargetAttributes = { | ||
| 250 | + 6003F589195388D20070C39A = { | ||
| 251 | + DevelopmentTeam = 94X49GG3ZW; | ||
| 252 | + }; | ||
| 253 | + 6003F5AD195388D20070C39A = { | ||
| 254 | + TestTargetID = 6003F589195388D20070C39A; | ||
| 255 | + }; | ||
| 256 | + }; | ||
| 257 | + }; | ||
| 258 | + buildConfigurationList = 6003F585195388D10070C39A /* Build configuration list for PBXProject "CNLiveGifFace" */; | ||
| 259 | + compatibilityVersion = "Xcode 3.2"; | ||
| 260 | + developmentRegion = English; | ||
| 261 | + hasScannedForEncodings = 0; | ||
| 262 | + knownRegions = ( | ||
| 263 | + en, | ||
| 264 | + Base, | ||
| 265 | + ); | ||
| 266 | + mainGroup = 6003F581195388D10070C39A; | ||
| 267 | + productRefGroup = 6003F58B195388D20070C39A /* Products */; | ||
| 268 | + projectDirPath = ""; | ||
| 269 | + projectRoot = ""; | ||
| 270 | + targets = ( | ||
| 271 | + 6003F589195388D20070C39A /* CNLiveGifFace_Example */, | ||
| 272 | + 6003F5AD195388D20070C39A /* CNLiveGifFace_Tests */, | ||
| 273 | + ); | ||
| 274 | + }; | ||
| 275 | +/* End PBXProject section */ | ||
| 276 | + | ||
| 277 | +/* Begin PBXResourcesBuildPhase section */ | ||
| 278 | + 6003F588195388D20070C39A /* Resources */ = { | ||
| 279 | + isa = PBXResourcesBuildPhase; | ||
| 280 | + buildActionMask = 2147483647; | ||
| 281 | + files = ( | ||
| 282 | + 873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */, | ||
| 283 | + 71719F9F1E33DC2100824A3D /* LaunchScreen.storyboard in Resources */, | ||
| 284 | + 6003F5A9195388D20070C39A /* Images.xcassets in Resources */, | ||
| 285 | + 6003F598195388D20070C39A /* InfoPlist.strings in Resources */, | ||
| 286 | + ); | ||
| 287 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 288 | + }; | ||
| 289 | + 6003F5AC195388D20070C39A /* Resources */ = { | ||
| 290 | + isa = PBXResourcesBuildPhase; | ||
| 291 | + buildActionMask = 2147483647; | ||
| 292 | + files = ( | ||
| 293 | + 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */, | ||
| 294 | + ); | ||
| 295 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 296 | + }; | ||
| 297 | +/* End PBXResourcesBuildPhase section */ | ||
| 298 | + | ||
| 299 | +/* Begin PBXShellScriptBuildPhase section */ | ||
| 300 | + 13E3CAF3B091ED34803E1AB4 /* [CP] Check Pods Manifest.lock */ = { | ||
| 301 | + isa = PBXShellScriptBuildPhase; | ||
| 302 | + buildActionMask = 2147483647; | ||
| 303 | + files = ( | ||
| 304 | + ); | ||
| 305 | + inputFileListPaths = ( | ||
| 306 | + ); | ||
| 307 | + inputPaths = ( | ||
| 308 | + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", | ||
| 309 | + "${PODS_ROOT}/Manifest.lock", | ||
| 310 | + ); | ||
| 311 | + name = "[CP] Check Pods Manifest.lock"; | ||
| 312 | + outputFileListPaths = ( | ||
| 313 | + ); | ||
| 314 | + outputPaths = ( | ||
| 315 | + "$(DERIVED_FILE_DIR)/Pods-CNLiveGifFace_Tests-checkManifestLockResult.txt", | ||
| 316 | + ); | ||
| 317 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 318 | + shellPath = /bin/sh; | ||
| 319 | + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; | ||
| 320 | + showEnvVarsInLog = 0; | ||
| 321 | + }; | ||
| 322 | + 60A0D1167830517942B262B9 /* [CP] Check Pods Manifest.lock */ = { | ||
| 323 | + isa = PBXShellScriptBuildPhase; | ||
| 324 | + buildActionMask = 2147483647; | ||
| 325 | + files = ( | ||
| 326 | + ); | ||
| 327 | + inputFileListPaths = ( | ||
| 328 | + ); | ||
| 329 | + inputPaths = ( | ||
| 330 | + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", | ||
| 331 | + "${PODS_ROOT}/Manifest.lock", | ||
| 332 | + ); | ||
| 333 | + name = "[CP] Check Pods Manifest.lock"; | ||
| 334 | + outputFileListPaths = ( | ||
| 335 | + ); | ||
| 336 | + outputPaths = ( | ||
| 337 | + "$(DERIVED_FILE_DIR)/Pods-CNLiveGifFace_Example-checkManifestLockResult.txt", | ||
| 338 | + ); | ||
| 339 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 340 | + shellPath = /bin/sh; | ||
| 341 | + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; | ||
| 342 | + showEnvVarsInLog = 0; | ||
| 343 | + }; | ||
| 344 | + ECAC1BD9552FAE4C176008DA /* [CP] Embed Pods Frameworks */ = { | ||
| 345 | + isa = PBXShellScriptBuildPhase; | ||
| 346 | + buildActionMask = 2147483647; | ||
| 347 | + files = ( | ||
| 348 | + ); | ||
| 349 | + inputFileListPaths = ( | ||
| 350 | + ); | ||
| 351 | + inputPaths = ( | ||
| 352 | + "${SRCROOT}/Pods/Target Support Files/Pods-CNLiveGifFace_Example/Pods-CNLiveGifFace_Example-frameworks.sh", | ||
| 353 | + "${BUILT_PRODUCTS_DIR}/AFNetworking/AFNetworking.framework", | ||
| 354 | + "${BUILT_PRODUCTS_DIR}/CNLiveBaseKit/CNLiveBaseKit.framework", | ||
| 355 | + "${BUILT_PRODUCTS_DIR}/CNLiveCommonClass/CNLiveCommonClass.framework", | ||
| 356 | + "${BUILT_PRODUCTS_DIR}/CNLiveCustomUI/CNLiveCustomUI.framework", | ||
| 357 | + "${BUILT_PRODUCTS_DIR}/CNLiveGifFace/CNLiveGifFace.framework", | ||
| 358 | + "${BUILT_PRODUCTS_DIR}/CNLiveRequestBastKit/CNLiveRequestBastKit.framework", | ||
| 359 | + "${BUILT_PRODUCTS_DIR}/CNLiveUserManagement/CNLiveUserManagement.framework", | ||
| 360 | + "${BUILT_PRODUCTS_DIR}/MJExtension/MJExtension.framework", | ||
| 361 | + "${BUILT_PRODUCTS_DIR}/MJRefresh/MJRefresh.framework", | ||
| 362 | + "${BUILT_PRODUCTS_DIR}/Masonry/Masonry.framework", | ||
| 363 | + "${BUILT_PRODUCTS_DIR}/QMUIKit/QMUIKit.framework", | ||
| 364 | + "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", | ||
| 365 | + "${BUILT_PRODUCTS_DIR}/SSZipArchive/SSZipArchive.framework", | ||
| 366 | + "${BUILT_PRODUCTS_DIR}/WebViewJavascriptBridge/WebViewJavascriptBridge.framework", | ||
| 367 | + "${BUILT_PRODUCTS_DIR}/YYKit/YYKit.framework", | ||
| 368 | + ); | ||
| 369 | + name = "[CP] Embed Pods Frameworks"; | ||
| 370 | + outputFileListPaths = ( | ||
| 371 | + ); | ||
| 372 | + outputPaths = ( | ||
| 373 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AFNetworking.framework", | ||
| 374 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseKit.framework", | ||
| 375 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonClass.framework", | ||
| 376 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCustomUI.framework", | ||
| 377 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveGifFace.framework", | ||
| 378 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveRequestBastKit.framework", | ||
| 379 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveUserManagement.framework", | ||
| 380 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJExtension.framework", | ||
| 381 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJRefresh.framework", | ||
| 382 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Masonry.framework", | ||
| 383 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/QMUIKit.framework", | ||
| 384 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", | ||
| 385 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SSZipArchive.framework", | ||
| 386 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/WebViewJavascriptBridge.framework", | ||
| 387 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYKit.framework", | ||
| 388 | + ); | ||
| 389 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 390 | + shellPath = /bin/sh; | ||
| 391 | + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CNLiveGifFace_Example/Pods-CNLiveGifFace_Example-frameworks.sh\"\n"; | ||
| 392 | + showEnvVarsInLog = 0; | ||
| 393 | + }; | ||
| 394 | +/* End PBXShellScriptBuildPhase section */ | ||
| 395 | + | ||
| 396 | +/* Begin PBXSourcesBuildPhase section */ | ||
| 397 | + 6003F586195388D20070C39A /* Sources */ = { | ||
| 398 | + isa = PBXSourcesBuildPhase; | ||
| 399 | + buildActionMask = 2147483647; | ||
| 400 | + files = ( | ||
| 401 | + 6003F59E195388D20070C39A /* CNLiveAppDelegate.m in Sources */, | ||
| 402 | + 6003F5A7195388D20070C39A /* CNLiveViewController.m in Sources */, | ||
| 403 | + 6003F59A195388D20070C39A /* main.m in Sources */, | ||
| 404 | + ); | ||
| 405 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 406 | + }; | ||
| 407 | + 6003F5AA195388D20070C39A /* Sources */ = { | ||
| 408 | + isa = PBXSourcesBuildPhase; | ||
| 409 | + buildActionMask = 2147483647; | ||
| 410 | + files = ( | ||
| 411 | + 6003F5BC195388D20070C39A /* Tests.m in Sources */, | ||
| 412 | + ); | ||
| 413 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 414 | + }; | ||
| 415 | +/* End PBXSourcesBuildPhase section */ | ||
| 416 | + | ||
| 417 | +/* Begin PBXTargetDependency section */ | ||
| 418 | + 6003F5B4195388D20070C39A /* PBXTargetDependency */ = { | ||
| 419 | + isa = PBXTargetDependency; | ||
| 420 | + target = 6003F589195388D20070C39A /* CNLiveGifFace_Example */; | ||
| 421 | + targetProxy = 6003F5B3195388D20070C39A /* PBXContainerItemProxy */; | ||
| 422 | + }; | ||
| 423 | +/* End PBXTargetDependency section */ | ||
| 424 | + | ||
| 425 | +/* Begin PBXVariantGroup section */ | ||
| 426 | + 6003F596195388D20070C39A /* InfoPlist.strings */ = { | ||
| 427 | + isa = PBXVariantGroup; | ||
| 428 | + children = ( | ||
| 429 | + 6003F597195388D20070C39A /* en */, | ||
| 430 | + ); | ||
| 431 | + name = InfoPlist.strings; | ||
| 432 | + sourceTree = "<group>"; | ||
| 433 | + }; | ||
| 434 | + 6003F5B8195388D20070C39A /* InfoPlist.strings */ = { | ||
| 435 | + isa = PBXVariantGroup; | ||
| 436 | + children = ( | ||
| 437 | + 6003F5B9195388D20070C39A /* en */, | ||
| 438 | + ); | ||
| 439 | + name = InfoPlist.strings; | ||
| 440 | + sourceTree = "<group>"; | ||
| 441 | + }; | ||
| 442 | + 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */ = { | ||
| 443 | + isa = PBXVariantGroup; | ||
| 444 | + children = ( | ||
| 445 | + 71719F9E1E33DC2100824A3D /* Base */, | ||
| 446 | + ); | ||
| 447 | + name = LaunchScreen.storyboard; | ||
| 448 | + sourceTree = "<group>"; | ||
| 449 | + }; | ||
| 450 | +/* End PBXVariantGroup section */ | ||
| 451 | + | ||
| 452 | +/* Begin XCBuildConfiguration section */ | ||
| 453 | + 6003F5BD195388D20070C39A /* Debug */ = { | ||
| 454 | + isa = XCBuildConfiguration; | ||
| 455 | + buildSettings = { | ||
| 456 | + ALWAYS_SEARCH_USER_PATHS = NO; | ||
| 457 | + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; | ||
| 458 | + CLANG_CXX_LIBRARY = "libc++"; | ||
| 459 | + CLANG_ENABLE_MODULES = YES; | ||
| 460 | + CLANG_ENABLE_OBJC_ARC = YES; | ||
| 461 | + CLANG_WARN_BOOL_CONVERSION = YES; | ||
| 462 | + CLANG_WARN_CONSTANT_CONVERSION = YES; | ||
| 463 | + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | ||
| 464 | + CLANG_WARN_EMPTY_BODY = YES; | ||
| 465 | + CLANG_WARN_ENUM_CONVERSION = YES; | ||
| 466 | + CLANG_WARN_INT_CONVERSION = YES; | ||
| 467 | + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | ||
| 468 | + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | ||
| 469 | + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; | ||
| 470 | + COPY_PHASE_STRIP = NO; | ||
| 471 | + ENABLE_TESTABILITY = YES; | ||
| 472 | + GCC_C_LANGUAGE_STANDARD = gnu99; | ||
| 473 | + GCC_DYNAMIC_NO_PIC = NO; | ||
| 474 | + GCC_OPTIMIZATION_LEVEL = 0; | ||
| 475 | + GCC_PREPROCESSOR_DEFINITIONS = ( | ||
| 476 | + "DEBUG=1", | ||
| 477 | + "$(inherited)", | ||
| 478 | + ); | ||
| 479 | + GCC_SYMBOLS_PRIVATE_EXTERN = NO; | ||
| 480 | + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | ||
| 481 | + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | ||
| 482 | + GCC_WARN_UNDECLARED_SELECTOR = YES; | ||
| 483 | + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | ||
| 484 | + GCC_WARN_UNUSED_FUNCTION = YES; | ||
| 485 | + GCC_WARN_UNUSED_VARIABLE = YES; | ||
| 486 | + IPHONEOS_DEPLOYMENT_TARGET = 9.3; | ||
| 487 | + ONLY_ACTIVE_ARCH = YES; | ||
| 488 | + SDKROOT = iphoneos; | ||
| 489 | + TARGETED_DEVICE_FAMILY = "1,2"; | ||
| 490 | + }; | ||
| 491 | + name = Debug; | ||
| 492 | + }; | ||
| 493 | + 6003F5BE195388D20070C39A /* Release */ = { | ||
| 494 | + isa = XCBuildConfiguration; | ||
| 495 | + buildSettings = { | ||
| 496 | + ALWAYS_SEARCH_USER_PATHS = NO; | ||
| 497 | + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; | ||
| 498 | + CLANG_CXX_LIBRARY = "libc++"; | ||
| 499 | + CLANG_ENABLE_MODULES = YES; | ||
| 500 | + CLANG_ENABLE_OBJC_ARC = YES; | ||
| 501 | + CLANG_WARN_BOOL_CONVERSION = YES; | ||
| 502 | + CLANG_WARN_CONSTANT_CONVERSION = YES; | ||
| 503 | + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | ||
| 504 | + CLANG_WARN_EMPTY_BODY = YES; | ||
| 505 | + CLANG_WARN_ENUM_CONVERSION = YES; | ||
| 506 | + CLANG_WARN_INT_CONVERSION = YES; | ||
| 507 | + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | ||
| 508 | + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | ||
| 509 | + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; | ||
| 510 | + COPY_PHASE_STRIP = YES; | ||
| 511 | + ENABLE_NS_ASSERTIONS = NO; | ||
| 512 | + GCC_C_LANGUAGE_STANDARD = gnu99; | ||
| 513 | + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | ||
| 514 | + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | ||
| 515 | + GCC_WARN_UNDECLARED_SELECTOR = YES; | ||
| 516 | + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | ||
| 517 | + GCC_WARN_UNUSED_FUNCTION = YES; | ||
| 518 | + GCC_WARN_UNUSED_VARIABLE = YES; | ||
| 519 | + IPHONEOS_DEPLOYMENT_TARGET = 9.3; | ||
| 520 | + SDKROOT = iphoneos; | ||
| 521 | + TARGETED_DEVICE_FAMILY = "1,2"; | ||
| 522 | + VALIDATE_PRODUCT = YES; | ||
| 523 | + }; | ||
| 524 | + name = Release; | ||
| 525 | + }; | ||
| 526 | + 6003F5C0195388D20070C39A /* Debug */ = { | ||
| 527 | + isa = XCBuildConfiguration; | ||
| 528 | + baseConfigurationReference = 2051FF30CDCC583E98B8C708 /* Pods-CNLiveGifFace_Example.debug.xcconfig */; | ||
| 529 | + buildSettings = { | ||
| 530 | + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||
| 531 | + DEVELOPMENT_TEAM = 94X49GG3ZW; | ||
| 532 | + GCC_PRECOMPILE_PREFIX_HEADER = YES; | ||
| 533 | + GCC_PREFIX_HEADER = "CNLiveGifFace/CNLiveGifFace-Prefix.pch"; | ||
| 534 | + INFOPLIST_FILE = "CNLiveGifFace/CNLiveGifFace-Info.plist"; | ||
| 535 | + MODULE_NAME = ExampleApp; | ||
| 536 | + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; | ||
| 537 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| 538 | + WRAPPER_EXTENSION = app; | ||
| 539 | + }; | ||
| 540 | + name = Debug; | ||
| 541 | + }; | ||
| 542 | + 6003F5C1195388D20070C39A /* Release */ = { | ||
| 543 | + isa = XCBuildConfiguration; | ||
| 544 | + baseConfigurationReference = E069E0E0388F846BD9FDC4C8 /* Pods-CNLiveGifFace_Example.release.xcconfig */; | ||
| 545 | + buildSettings = { | ||
| 546 | + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||
| 547 | + DEVELOPMENT_TEAM = 94X49GG3ZW; | ||
| 548 | + GCC_PRECOMPILE_PREFIX_HEADER = YES; | ||
| 549 | + GCC_PREFIX_HEADER = "CNLiveGifFace/CNLiveGifFace-Prefix.pch"; | ||
| 550 | + INFOPLIST_FILE = "CNLiveGifFace/CNLiveGifFace-Info.plist"; | ||
| 551 | + MODULE_NAME = ExampleApp; | ||
| 552 | + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; | ||
| 553 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| 554 | + WRAPPER_EXTENSION = app; | ||
| 555 | + }; | ||
| 556 | + name = Release; | ||
| 557 | + }; | ||
| 558 | + 6003F5C3195388D20070C39A /* Debug */ = { | ||
| 559 | + isa = XCBuildConfiguration; | ||
| 560 | + baseConfigurationReference = 5AEFDCD33862C2FAAAF22CD1 /* Pods-CNLiveGifFace_Tests.debug.xcconfig */; | ||
| 561 | + buildSettings = { | ||
| 562 | + BUNDLE_LOADER = "$(TEST_HOST)"; | ||
| 563 | + FRAMEWORK_SEARCH_PATHS = ( | ||
| 564 | + "$(SDKROOT)/Developer/Library/Frameworks", | ||
| 565 | + "$(inherited)", | ||
| 566 | + "$(DEVELOPER_FRAMEWORKS_DIR)", | ||
| 567 | + ); | ||
| 568 | + GCC_PRECOMPILE_PREFIX_HEADER = YES; | ||
| 569 | + GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch"; | ||
| 570 | + GCC_PREPROCESSOR_DEFINITIONS = ( | ||
| 571 | + "DEBUG=1", | ||
| 572 | + "$(inherited)", | ||
| 573 | + ); | ||
| 574 | + INFOPLIST_FILE = "Tests/Tests-Info.plist"; | ||
| 575 | + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; | ||
| 576 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| 577 | + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CNLiveGifFace_Example.app/CNLiveGifFace_Example"; | ||
| 578 | + WRAPPER_EXTENSION = xctest; | ||
| 579 | + }; | ||
| 580 | + name = Debug; | ||
| 581 | + }; | ||
| 582 | + 6003F5C4195388D20070C39A /* Release */ = { | ||
| 583 | + isa = XCBuildConfiguration; | ||
| 584 | + baseConfigurationReference = FE1D2324EB826AE79E024754 /* Pods-CNLiveGifFace_Tests.release.xcconfig */; | ||
| 585 | + buildSettings = { | ||
| 586 | + BUNDLE_LOADER = "$(TEST_HOST)"; | ||
| 587 | + FRAMEWORK_SEARCH_PATHS = ( | ||
| 588 | + "$(SDKROOT)/Developer/Library/Frameworks", | ||
| 589 | + "$(inherited)", | ||
| 590 | + "$(DEVELOPER_FRAMEWORKS_DIR)", | ||
| 591 | + ); | ||
| 592 | + GCC_PRECOMPILE_PREFIX_HEADER = YES; | ||
| 593 | + GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch"; | ||
| 594 | + INFOPLIST_FILE = "Tests/Tests-Info.plist"; | ||
| 595 | + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; | ||
| 596 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| 597 | + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CNLiveGifFace_Example.app/CNLiveGifFace_Example"; | ||
| 598 | + WRAPPER_EXTENSION = xctest; | ||
| 599 | + }; | ||
| 600 | + name = Release; | ||
| 601 | + }; | ||
| 602 | +/* End XCBuildConfiguration section */ | ||
| 603 | + | ||
| 604 | +/* Begin XCConfigurationList section */ | ||
| 605 | + 6003F585195388D10070C39A /* Build configuration list for PBXProject "CNLiveGifFace" */ = { | ||
| 606 | + isa = XCConfigurationList; | ||
| 607 | + buildConfigurations = ( | ||
| 608 | + 6003F5BD195388D20070C39A /* Debug */, | ||
| 609 | + 6003F5BE195388D20070C39A /* Release */, | ||
| 610 | + ); | ||
| 611 | + defaultConfigurationIsVisible = 0; | ||
| 612 | + defaultConfigurationName = Release; | ||
| 613 | + }; | ||
| 614 | + 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "CNLiveGifFace_Example" */ = { | ||
| 615 | + isa = XCConfigurationList; | ||
| 616 | + buildConfigurations = ( | ||
| 617 | + 6003F5C0195388D20070C39A /* Debug */, | ||
| 618 | + 6003F5C1195388D20070C39A /* Release */, | ||
| 619 | + ); | ||
| 620 | + defaultConfigurationIsVisible = 0; | ||
| 621 | + defaultConfigurationName = Release; | ||
| 622 | + }; | ||
| 623 | + 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "CNLiveGifFace_Tests" */ = { | ||
| 624 | + isa = XCConfigurationList; | ||
| 625 | + buildConfigurations = ( | ||
| 626 | + 6003F5C3195388D20070C39A /* Debug */, | ||
| 627 | + 6003F5C4195388D20070C39A /* Release */, | ||
| 628 | + ); | ||
| 629 | + defaultConfigurationIsVisible = 0; | ||
| 630 | + defaultConfigurationName = Release; | ||
| 631 | + }; | ||
| 632 | +/* End XCConfigurationList section */ | ||
| 633 | + }; | ||
| 634 | + rootObject = 6003F582195388D10070C39A /* Project object */; | ||
| 635 | +} |
Example/CNLiveGifFace.xcodeproj/xcshareddata/xcschemes/CNLiveGifFace-Example.xcscheme
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<Scheme | ||
| 3 | + LastUpgradeVersion = "0720" | ||
| 4 | + version = "1.3"> | ||
| 5 | + <BuildAction | ||
| 6 | + parallelizeBuildables = "YES" | ||
| 7 | + buildImplicitDependencies = "YES"> | ||
| 8 | + <BuildActionEntries> | ||
| 9 | + <BuildActionEntry | ||
| 10 | + buildForTesting = "YES" | ||
| 11 | + buildForRunning = "YES" | ||
| 12 | + buildForProfiling = "YES" | ||
| 13 | + buildForArchiving = "YES" | ||
| 14 | + buildForAnalyzing = "YES"> | ||
| 15 | + <BuildableReference | ||
| 16 | + BuildableIdentifier = "primary" | ||
| 17 | + BlueprintIdentifier = "6003F589195388D20070C39A" | ||
| 18 | + BuildableName = "CNLiveGifFace_Example.app" | ||
| 19 | + BlueprintName = "CNLiveGifFace_Example" | ||
| 20 | + ReferencedContainer = "container:CNLiveGifFace.xcodeproj"> | ||
| 21 | + </BuildableReference> | ||
| 22 | + </BuildActionEntry> | ||
| 23 | + </BuildActionEntries> | ||
| 24 | + </BuildAction> | ||
| 25 | + <TestAction | ||
| 26 | + buildConfiguration = "Debug" | ||
| 27 | + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
| 28 | + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
| 29 | + shouldUseLaunchSchemeArgsEnv = "YES"> | ||
| 30 | + <Testables> | ||
| 31 | + <TestableReference | ||
| 32 | + skipped = "NO"> | ||
| 33 | + <BuildableReference | ||
| 34 | + BuildableIdentifier = "primary" | ||
| 35 | + BlueprintIdentifier = "6003F5AD195388D20070C39A" | ||
| 36 | + BuildableName = "CNLiveGifFace_Tests.xctest" | ||
| 37 | + BlueprintName = "CNLiveGifFace_Tests" | ||
| 38 | + ReferencedContainer = "container:CNLiveGifFace.xcodeproj"> | ||
| 39 | + </BuildableReference> | ||
| 40 | + </TestableReference> | ||
| 41 | + </Testables> | ||
| 42 | + <MacroExpansion> | ||
| 43 | + <BuildableReference | ||
| 44 | + BuildableIdentifier = "primary" | ||
| 45 | + BlueprintIdentifier = "6003F589195388D20070C39A" | ||
| 46 | + BuildableName = "CNLiveGifFace_Example.app" | ||
| 47 | + BlueprintName = "CNLiveGifFace_Example" | ||
| 48 | + ReferencedContainer = "container:CNLiveGifFace.xcodeproj"> | ||
| 49 | + </BuildableReference> | ||
| 50 | + </MacroExpansion> | ||
| 51 | + <AdditionalOptions> | ||
| 52 | + </AdditionalOptions> | ||
| 53 | + </TestAction> | ||
| 54 | + <LaunchAction | ||
| 55 | + buildConfiguration = "Debug" | ||
| 56 | + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
| 57 | + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
| 58 | + launchStyle = "0" | ||
| 59 | + useCustomWorkingDirectory = "NO" | ||
| 60 | + ignoresPersistentStateOnLaunch = "NO" | ||
| 61 | + debugDocumentVersioning = "YES" | ||
| 62 | + debugServiceExtension = "internal" | ||
| 63 | + allowLocationSimulation = "YES"> | ||
| 64 | + <BuildableProductRunnable | ||
| 65 | + runnableDebuggingMode = "0"> | ||
| 66 | + <BuildableReference | ||
| 67 | + BuildableIdentifier = "primary" | ||
| 68 | + BlueprintIdentifier = "6003F589195388D20070C39A" | ||
| 69 | + BuildableName = "CNLiveGifFace_Example.app" | ||
| 70 | + BlueprintName = "CNLiveGifFace_Example" | ||
| 71 | + ReferencedContainer = "container:CNLiveGifFace.xcodeproj"> | ||
| 72 | + </BuildableReference> | ||
| 73 | + </BuildableProductRunnable> | ||
| 74 | + <AdditionalOptions> | ||
| 75 | + </AdditionalOptions> | ||
| 76 | + </LaunchAction> | ||
| 77 | + <ProfileAction | ||
| 78 | + buildConfiguration = "Release" | ||
| 79 | + shouldUseLaunchSchemeArgsEnv = "YES" | ||
| 80 | + savedToolIdentifier = "" | ||
| 81 | + useCustomWorkingDirectory = "NO" | ||
| 82 | + debugDocumentVersioning = "YES"> | ||
| 83 | + <BuildableProductRunnable | ||
| 84 | + runnableDebuggingMode = "0"> | ||
| 85 | + <BuildableReference | ||
| 86 | + BuildableIdentifier = "primary" | ||
| 87 | + BlueprintIdentifier = "6003F589195388D20070C39A" | ||
| 88 | + BuildableName = "CNLiveGifFace_Example.app" | ||
| 89 | + BlueprintName = "CNLiveGifFace_Example" | ||
| 90 | + ReferencedContainer = "container:CNLiveGifFace.xcodeproj"> | ||
| 91 | + </BuildableReference> | ||
| 92 | + </BuildableProductRunnable> | ||
| 93 | + </ProfileAction> | ||
| 94 | + <AnalyzeAction | ||
| 95 | + buildConfiguration = "Debug"> | ||
| 96 | + </AnalyzeAction> | ||
| 97 | + <ArchiveAction | ||
| 98 | + buildConfiguration = "Release" | ||
| 99 | + revealArchiveInOrganizer = "YES"> | ||
| 100 | + </ArchiveAction> | ||
| 101 | +</Scheme> |
Example/CNLiveGifFace/Base.lproj/LaunchScreen.storyboard
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> | ||
| 3 | + <device id="retina4_7" orientation="portrait"> | ||
| 4 | + <adaptation id="fullscreen"/> | ||
| 5 | + </device> | ||
| 6 | + <dependencies> | ||
| 7 | + <deployment identifier="iOS"/> | ||
| 8 | + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/> | ||
| 9 | + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | ||
| 10 | + </dependencies> | ||
| 11 | + <scenes> | ||
| 12 | + <!--View Controller--> | ||
| 13 | + <scene sceneID="EHf-IW-A2E"> | ||
| 14 | + <objects> | ||
| 15 | + <viewController id="01J-lp-oVM" sceneMemberID="viewController"> | ||
| 16 | + <layoutGuides> | ||
| 17 | + <viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/> | ||
| 18 | + <viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/> | ||
| 19 | + </layoutGuides> | ||
| 20 | + <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> | ||
| 21 | + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | ||
| 22 | + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | ||
| 23 | + <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | ||
| 24 | + </view> | ||
| 25 | + </viewController> | ||
| 26 | + <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> | ||
| 27 | + </objects> | ||
| 28 | + <point key="canvasLocation" x="53" y="375"/> | ||
| 29 | + </scene> | ||
| 30 | + </scenes> | ||
| 31 | +</document> |
Example/CNLiveGifFace/Base.lproj/Main.storyboard
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="whP-gf-Uak"> | ||
| 3 | + <device id="retina4_7" orientation="portrait"> | ||
| 4 | + <adaptation id="fullscreen"/> | ||
| 5 | + </device> | ||
| 6 | + <dependencies> | ||
| 7 | + <deployment identifier="iOS"/> | ||
| 8 | + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/> | ||
| 9 | + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | ||
| 10 | + </dependencies> | ||
| 11 | + <scenes> | ||
| 12 | + <!--View Controller--> | ||
| 13 | + <scene sceneID="wQg-tq-qST"> | ||
| 14 | + <objects> | ||
| 15 | + <viewController id="whP-gf-Uak" customClass="CNLiveViewController" sceneMemberID="viewController"> | ||
| 16 | + <layoutGuides> | ||
| 17 | + <viewControllerLayoutGuide type="top" id="uEw-UM-LJ8"/> | ||
| 18 | + <viewControllerLayoutGuide type="bottom" id="Mvr-aV-6Um"/> | ||
| 19 | + </layoutGuides> | ||
| 20 | + <view key="view" contentMode="scaleToFill" id="TpU-gO-2f1"> | ||
| 21 | + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | ||
| 22 | + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | ||
| 23 | + <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | ||
| 24 | + </view> | ||
| 25 | + </viewController> | ||
| 26 | + <placeholder placeholderIdentifier="IBFirstResponder" id="tc2-Qw-aMS" userLabel="First Responder" sceneMemberID="firstResponder"/> | ||
| 27 | + </objects> | ||
| 28 | + <point key="canvasLocation" x="305" y="433"/> | ||
| 29 | + </scene> | ||
| 30 | + </scenes> | ||
| 31 | +</document> |
Example/CNLiveGifFace/CNLiveAppDelegate.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveAppDelegate.h | ||
| 3 | +// CNLiveGifFace | ||
| 4 | +// | ||
| 5 | +// Created by 153993236@qq.com on 05/08/2019. | ||
| 6 | +// Copyright (c) 2019 153993236@qq.com. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +@import UIKit; | ||
| 10 | + | ||
| 11 | +@interface CNLiveAppDelegate : UIResponder <UIApplicationDelegate> | ||
| 12 | + | ||
| 13 | +@property (strong, nonatomic) UIWindow *window; | ||
| 14 | + | ||
| 15 | +@end |
Example/CNLiveGifFace/CNLiveAppDelegate.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveAppDelegate.m | ||
| 3 | +// CNLiveGifFace | ||
| 4 | +// | ||
| 5 | +// Created by 153993236@qq.com on 05/08/2019. | ||
| 6 | +// Copyright (c) 2019 153993236@qq.com. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNLiveAppDelegate.h" | ||
| 10 | + | ||
| 11 | +@implementation CNLiveAppDelegate | ||
| 12 | + | ||
| 13 | +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | ||
| 14 | +{ | ||
| 15 | + // Override point for customization after application launch. | ||
| 16 | + return YES; | ||
| 17 | +} | ||
| 18 | + | ||
| 19 | +- (void)applicationWillResignActive:(UIApplication *)application | ||
| 20 | +{ | ||
| 21 | + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. | ||
| 22 | + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. | ||
| 23 | +} | ||
| 24 | + | ||
| 25 | +- (void)applicationDidEnterBackground:(UIApplication *)application | ||
| 26 | +{ | ||
| 27 | + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. | ||
| 28 | + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. | ||
| 29 | +} | ||
| 30 | + | ||
| 31 | +- (void)applicationWillEnterForeground:(UIApplication *)application | ||
| 32 | +{ | ||
| 33 | + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. | ||
| 34 | +} | ||
| 35 | + | ||
| 36 | +- (void)applicationDidBecomeActive:(UIApplication *)application | ||
| 37 | +{ | ||
| 38 | + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. | ||
| 39 | +} | ||
| 40 | + | ||
| 41 | +- (void)applicationWillTerminate:(UIApplication *)application | ||
| 42 | +{ | ||
| 43 | + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. | ||
| 44 | +} | ||
| 45 | + | ||
| 46 | +@end |
Example/CNLiveGifFace/CNLiveGifFace-Info.plist
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| 3 | +<plist version="1.0"> | ||
| 4 | +<dict> | ||
| 5 | + <key>CFBundleDevelopmentRegion</key> | ||
| 6 | + <string>en</string> | ||
| 7 | + <key>CFBundleDisplayName</key> | ||
| 8 | + <string>${PRODUCT_NAME}</string> | ||
| 9 | + <key>CFBundleExecutable</key> | ||
| 10 | + <string>${EXECUTABLE_NAME}</string> | ||
| 11 | + <key>CFBundleIdentifier</key> | ||
| 12 | + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
| 13 | + <key>CFBundleInfoDictionaryVersion</key> | ||
| 14 | + <string>6.0</string> | ||
| 15 | + <key>CFBundleName</key> | ||
| 16 | + <string>${PRODUCT_NAME}</string> | ||
| 17 | + <key>CFBundlePackageType</key> | ||
| 18 | + <string>APPL</string> | ||
| 19 | + <key>CFBundleShortVersionString</key> | ||
| 20 | + <string>1.0</string> | ||
| 21 | + <key>CFBundleSignature</key> | ||
| 22 | + <string>????</string> | ||
| 23 | + <key>CFBundleVersion</key> | ||
| 24 | + <string>1.0</string> | ||
| 25 | + <key>LSRequiresIPhoneOS</key> | ||
| 26 | + <true/> | ||
| 27 | + <key>UILaunchStoryboardName</key> | ||
| 28 | + <string>LaunchScreen</string> | ||
| 29 | + <key>UIMainStoryboardFile</key> | ||
| 30 | + <string>Main</string> | ||
| 31 | + <key>UIRequiredDeviceCapabilities</key> | ||
| 32 | + <array> | ||
| 33 | + <string>armv7</string> | ||
| 34 | + </array> | ||
| 35 | + <key>UISupportedInterfaceOrientations</key> | ||
| 36 | + <array> | ||
| 37 | + <string>UIInterfaceOrientationPortrait</string> | ||
| 38 | + <string>UIInterfaceOrientationLandscapeLeft</string> | ||
| 39 | + <string>UIInterfaceOrientationLandscapeRight</string> | ||
| 40 | + </array> | ||
| 41 | + <key>UISupportedInterfaceOrientations~ipad</key> | ||
| 42 | + <array> | ||
| 43 | + <string>UIInterfaceOrientationPortrait</string> | ||
| 44 | + <string>UIInterfaceOrientationPortraitUpsideDown</string> | ||
| 45 | + <string>UIInterfaceOrientationLandscapeLeft</string> | ||
| 46 | + <string>UIInterfaceOrientationLandscapeRight</string> | ||
| 47 | + </array> | ||
| 48 | +</dict> | ||
| 49 | +</plist> |
Example/CNLiveGifFace/CNLiveGifFace-Prefix.pch
0 → 100644
| 1 | +// | ||
| 2 | +// Prefix header | ||
| 3 | +// | ||
| 4 | +// The contents of this file are implicitly included at the beginning of every source file. | ||
| 5 | +// | ||
| 6 | + | ||
| 7 | +#import <Availability.h> | ||
| 8 | + | ||
| 9 | +#ifndef __IPHONE_5_0 | ||
| 10 | +#warning "This project uses features only available in iOS SDK 5.0 and later." | ||
| 11 | +#endif | ||
| 12 | + | ||
| 13 | +#ifdef __OBJC__ | ||
| 14 | + @import UIKit; | ||
| 15 | + @import Foundation; | ||
| 16 | +#endif |
Example/CNLiveGifFace/CNLiveViewController.h
0 → 100644
Example/CNLiveGifFace/CNLiveViewController.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveViewController.m | ||
| 3 | +// CNLiveGifFace | ||
| 4 | +// | ||
| 5 | +// Created by 153993236@qq.com on 05/08/2019. | ||
| 6 | +// Copyright (c) 2019 153993236@qq.com. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNLiveViewController.h" | ||
| 10 | + | ||
| 11 | +@interface CNLiveViewController () | ||
| 12 | + | ||
| 13 | +@end | ||
| 14 | + | ||
| 15 | +@implementation CNLiveViewController | ||
| 16 | + | ||
| 17 | +- (void)viewDidLoad | ||
| 18 | +{ | ||
| 19 | + [super viewDidLoad]; | ||
| 20 | + // Do any additional setup after loading the view, typically from a nib. | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | +- (void)didReceiveMemoryWarning | ||
| 24 | +{ | ||
| 25 | + [super didReceiveMemoryWarning]; | ||
| 26 | + // Dispose of any resources that can be recreated. | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +@end |
Example/CNLiveGifFace/Images.xcassets/AppIcon.appiconset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "iphone", | ||
| 5 | + "size" : "20x20", | ||
| 6 | + "scale" : "2x" | ||
| 7 | + }, | ||
| 8 | + { | ||
| 9 | + "idiom" : "iphone", | ||
| 10 | + "size" : "20x20", | ||
| 11 | + "scale" : "3x" | ||
| 12 | + }, | ||
| 13 | + { | ||
| 14 | + "idiom" : "iphone", | ||
| 15 | + "size" : "29x29", | ||
| 16 | + "scale" : "2x" | ||
| 17 | + }, | ||
| 18 | + { | ||
| 19 | + "idiom" : "iphone", | ||
| 20 | + "size" : "29x29", | ||
| 21 | + "scale" : "3x" | ||
| 22 | + }, | ||
| 23 | + { | ||
| 24 | + "idiom" : "iphone", | ||
| 25 | + "size" : "40x40", | ||
| 26 | + "scale" : "2x" | ||
| 27 | + }, | ||
| 28 | + { | ||
| 29 | + "idiom" : "iphone", | ||
| 30 | + "size" : "40x40", | ||
| 31 | + "scale" : "3x" | ||
| 32 | + }, | ||
| 33 | + { | ||
| 34 | + "idiom" : "iphone", | ||
| 35 | + "size" : "60x60", | ||
| 36 | + "scale" : "2x" | ||
| 37 | + }, | ||
| 38 | + { | ||
| 39 | + "idiom" : "iphone", | ||
| 40 | + "size" : "60x60", | ||
| 41 | + "scale" : "3x" | ||
| 42 | + }, | ||
| 43 | + { | ||
| 44 | + "idiom" : "ipad", | ||
| 45 | + "size" : "20x20", | ||
| 46 | + "scale" : "1x" | ||
| 47 | + }, | ||
| 48 | + { | ||
| 49 | + "idiom" : "ipad", | ||
| 50 | + "size" : "20x20", | ||
| 51 | + "scale" : "2x" | ||
| 52 | + }, | ||
| 53 | + { | ||
| 54 | + "idiom" : "ipad", | ||
| 55 | + "size" : "29x29", | ||
| 56 | + "scale" : "1x" | ||
| 57 | + }, | ||
| 58 | + { | ||
| 59 | + "idiom" : "ipad", | ||
| 60 | + "size" : "29x29", | ||
| 61 | + "scale" : "2x" | ||
| 62 | + }, | ||
| 63 | + { | ||
| 64 | + "idiom" : "ipad", | ||
| 65 | + "size" : "40x40", | ||
| 66 | + "scale" : "1x" | ||
| 67 | + }, | ||
| 68 | + { | ||
| 69 | + "idiom" : "ipad", | ||
| 70 | + "size" : "40x40", | ||
| 71 | + "scale" : "2x" | ||
| 72 | + }, | ||
| 73 | + { | ||
| 74 | + "idiom" : "ipad", | ||
| 75 | + "size" : "76x76", | ||
| 76 | + "scale" : "1x" | ||
| 77 | + }, | ||
| 78 | + { | ||
| 79 | + "idiom" : "ipad", | ||
| 80 | + "size" : "76x76", | ||
| 81 | + "scale" : "2x" | ||
| 82 | + }, | ||
| 83 | + { | ||
| 84 | + "idiom" : "ipad", | ||
| 85 | + "size" : "83.5x83.5", | ||
| 86 | + "scale" : "2x" | ||
| 87 | + }, | ||
| 88 | + { | ||
| 89 | + "idiom" : "ios-marketing", | ||
| 90 | + "size" : "1024x1024", | ||
| 91 | + "scale" : "1x" | ||
| 92 | + } | ||
| 93 | + ], | ||
| 94 | + "info" : { | ||
| 95 | + "version" : 1, | ||
| 96 | + "author" : "xcode" | ||
| 97 | + } | ||
| 98 | +} |
Example/CNLiveGifFace/en.lproj/InfoPlist.strings
0 → 100644
Example/CNLiveGifFace/main.m
0 → 100644
| 1 | +// | ||
| 2 | +// main.m | ||
| 3 | +// CNLiveGifFace | ||
| 4 | +// | ||
| 5 | +// Created by 153993236@qq.com on 05/08/2019. | ||
| 6 | +// Copyright (c) 2019 153993236@qq.com. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +@import UIKit; | ||
| 10 | +#import "CNLiveAppDelegate.h" | ||
| 11 | + | ||
| 12 | +int main(int argc, char * argv[]) | ||
| 13 | +{ | ||
| 14 | + @autoreleasepool { | ||
| 15 | + return UIApplicationMain(argc, argv, nil, NSStringFromClass([CNLiveAppDelegate class])); | ||
| 16 | + } | ||
| 17 | +} |
Example/Podfile
0 → 100644
| 1 | +source 'https://github.com/CocoaPods/Specs.git' | ||
| 2 | +source 'http://bj.gitlab.cnlive.com/ios-team/CNLiveRepos.git' | ||
| 3 | +use_frameworks! | ||
| 4 | + | ||
| 5 | +platform :ios, '9.0' | ||
| 6 | + | ||
| 7 | +target 'CNLiveGifFace_Example' do | ||
| 8 | + pod 'CNLiveGifFace', :path => '../' | ||
| 9 | + | ||
| 10 | + target 'CNLiveGifFace_Tests' do | ||
| 11 | + inherit! :search_paths | ||
| 12 | + | ||
| 13 | + | ||
| 14 | + end | ||
| 15 | +end |
Example/Tests/Tests-Info.plist
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| 3 | +<plist version="1.0"> | ||
| 4 | +<dict> | ||
| 5 | + <key>CFBundleDevelopmentRegion</key> | ||
| 6 | + <string>en</string> | ||
| 7 | + <key>CFBundleExecutable</key> | ||
| 8 | + <string>${EXECUTABLE_NAME}</string> | ||
| 9 | + <key>CFBundleIdentifier</key> | ||
| 10 | + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
| 11 | + <key>CFBundleInfoDictionaryVersion</key> | ||
| 12 | + <string>6.0</string> | ||
| 13 | + <key>CFBundlePackageType</key> | ||
| 14 | + <string>BNDL</string> | ||
| 15 | + <key>CFBundleShortVersionString</key> | ||
| 16 | + <string>1.0</string> | ||
| 17 | + <key>CFBundleSignature</key> | ||
| 18 | + <string>????</string> | ||
| 19 | + <key>CFBundleVersion</key> | ||
| 20 | + <string>1</string> | ||
| 21 | +</dict> | ||
| 22 | +</plist> |
Example/Tests/Tests-Prefix.pch
0 → 100644
Example/Tests/Tests.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveGifFaceTests.m | ||
| 3 | +// CNLiveGifFaceTests | ||
| 4 | +// | ||
| 5 | +// Created by 153993236@qq.com on 05/08/2019. | ||
| 6 | +// Copyright (c) 2019 153993236@qq.com. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +@import XCTest; | ||
| 10 | + | ||
| 11 | +@interface Tests : XCTestCase | ||
| 12 | + | ||
| 13 | +@end | ||
| 14 | + | ||
| 15 | +@implementation Tests | ||
| 16 | + | ||
| 17 | +- (void)setUp | ||
| 18 | +{ | ||
| 19 | + [super setUp]; | ||
| 20 | + // Put setup code here. This method is called before the invocation of each test method in the class. | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | +- (void)tearDown | ||
| 24 | +{ | ||
| 25 | + // Put teardown code here. This method is called after the invocation of each test method in the class. | ||
| 26 | + [super tearDown]; | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +- (void)testExample | ||
| 30 | +{ | ||
| 31 | + XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); | ||
| 32 | +} | ||
| 33 | + | ||
| 34 | +@end | ||
| 35 | + |
Example/Tests/en.lproj/InfoPlist.strings
0 → 100644
LICENSE
| 1 | +Copyright (c) 2019 153993236@qq.com <zhangxiaowen@cnlive.com> | ||
| 2 | + | ||
| 3 | +Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 4 | +of this software and associated documentation files (the "Software"), to deal | ||
| 5 | +in the Software without restriction, including without limitation the rights | ||
| 6 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 7 | +copies of the Software, and to permit persons to whom the Software is | ||
| 8 | +furnished to do so, subject to the following conditions: | ||
| 9 | + | ||
| 10 | +The above copyright notice and this permission notice shall be included in | ||
| 11 | +all copies or substantial portions of the Software. | ||
| 12 | + | ||
| 13 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 14 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 15 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 16 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 17 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 18 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| 19 | +THE SOFTWARE. |
README.md
| 1 | -CNLiveGifFace | ||
| 2 | \ No newline at end of file | 1 | \ No newline at end of file |
| 2 | +# CNLiveGifFace | ||
| 3 | + | ||
| 4 | +[](https://travis-ci.org/153993236@qq.com/CNLiveGifFace) | ||
| 5 | +[](https://cocoapods.org/pods/CNLiveGifFace) | ||
| 6 | +[](https://cocoapods.org/pods/CNLiveGifFace) | ||
| 7 | +[](https://cocoapods.org/pods/CNLiveGifFace) | ||
| 8 | + | ||
| 9 | +## Example | ||
| 10 | + | ||
| 11 | +To run the example project, clone the repo, and run `pod install` from the Example directory first. | ||
| 12 | + | ||
| 13 | +## Requirements | ||
| 14 | + | ||
| 15 | +## Installation | ||
| 16 | + | ||
| 17 | +CNLiveGifFace is available through [CocoaPods](https://cocoapods.org). To install | ||
| 18 | +it, simply add the following line to your Podfile: | ||
| 19 | + | ||
| 20 | +```ruby | ||
| 21 | +pod 'CNLiveGifFace' | ||
| 22 | +``` | ||
| 23 | + | ||
| 24 | +## Author | ||
| 25 | + | ||
| 26 | +153993236@qq.com, zhangxiaowen@cnlive.com | ||
| 27 | + | ||
| 28 | +## License | ||
| 29 | + | ||
| 30 | +CNLiveGifFace is available under the MIT license. See the LICENSE file for more info. |
_Pods.xcodeproj
0 → 120000