Skip to content

Commit da1d2ee

Browse files
committed
文件上传[NYXImagesKit]
1 parent 63aec41 commit da1d2ee

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

Coding_iOS/Util/Manager/Coding_FileManager.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,14 @@ - (Coding_DownloadTask *)addDownloadTaskForFile:(ProjectFile *)file completionHa
143143
NSURL *downloadURL = [NSURL URLWithString:file.downloadPath];
144144
NSURLRequest *request = [NSURLRequest requestWithURL:downloadURL];
145145
NSURLSessionDownloadTask *downloadTask = [self.af_manager downloadTaskWithRequest:request progress:&progress destination:^NSURL *(NSURL *targetPath, NSURLResponse *response) {
146-
NSLog(@"destination------Path");
147146
NSURL *downloadUrl = [[Coding_FileManager sharedManager] urlForDownloadFolder];
148147
Coding_DownloadTask *cDownloadTask = [[Coding_FileManager sharedManager] cDownloadTaskForResponse:response];
149148
if (cDownloadTask) {
150149
downloadUrl = [downloadUrl URLByAppendingPathComponent:cDownloadTask.diskFileName];
151150
}else{
152151
downloadUrl = [downloadUrl URLByAppendingPathComponent:[response suggestedFilename]];
153152
}
153+
NSLog(@"download_destinationPath------\n%@", downloadUrl.absoluteString);
154154
return downloadUrl;
155155
} completionHandler:^(NSURLResponse *response, NSURL *filePath, NSError *error) {
156156
if (error) {
@@ -251,6 +251,7 @@ - (Coding_UploadTask *)addUploadTaskWithFileName:(NSString *)fileName completion
251251
[[NSFileManager defaultManager] moveItemAtPath:block_filePath toPath:diskFilePath error:nil];
252252
[manager directoryDidChange:manager.docUploadWatcher];
253253
[manager directoryDidChange:manager.docDownloadWatcher];
254+
NSLog(@"upload_fileName------\n%@", block_fileName);
254255

255256
//移除任务
256257
[[Coding_FileManager sharedManager] removeCUploadTaskForFile:block_fileName hasError:(error != nil)];
@@ -265,7 +266,6 @@ - (Coding_UploadTask *)addUploadTaskWithFileName:(NSString *)fileName completion
265266
[uploadTask resume];
266267
Coding_UploadTask *cUploadTask = [Coding_UploadTask cUploadTaskWithTask:uploadTask progress:progress fileName:fileName];
267268
[self.uploadDict setObject:cUploadTask forKey:fileName];
268-
NSLog(@"---\n%@-----\n%@", uploadUrl.absoluteString, self.uploadDict);
269269

270270
return cUploadTask;
271271
}

Coding_iOS/Views/Cell/FileListUploadCell.m

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#import "Coding_FileManager.h"
1111
#import "ASProgressPopUpView.h"
1212
#import <Masonry/Masonry.h>
13-
#import <SDWebImage/UIImageView+WebCache.h>
13+
#import <NYXImagesKit/NYXImagesKit.h>
1414

1515
@interface FileListUploadCell ()<ASProgressPopUpViewDelegate>
1616
@property (strong, nonatomic) UIImageView *iconView;
@@ -76,13 +76,13 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
7676
make.width.greaterThanOrEqualTo(@120);
7777
}];
7878
[_reDoButton mas_makeConstraints:^(MASConstraintMaker *make) {
79-
make.size.mas_equalTo(CGSizeMake(22, 22));
79+
make.size.mas_equalTo(CGSizeMake(42, 42));
8080
make.left.mas_greaterThanOrEqualTo(_nameLabel.mas_right);
8181
}];
8282
[_cancelButton mas_makeConstraints:^(MASConstraintMaker *make) {
83-
make.size.mas_equalTo(CGSizeMake(22, 22));
84-
make.left.equalTo(_reDoButton.mas_right).with.offset(20);
85-
make.right.equalTo(self.contentView.mas_right).with.offset(-20);
83+
make.size.mas_equalTo(CGSizeMake(42, 42));
84+
make.left.equalTo(_reDoButton.mas_right);
85+
make.right.equalTo(self.contentView.mas_right);
8686
}];
8787
}
8888
return self;
@@ -133,7 +133,9 @@ - (void)setFileName:(NSString *)fileName{
133133
Coding_FileManager *manager = [Coding_FileManager sharedManager];
134134

135135
NSURL *fileUrl = [manager diskUploadUrlForFile:_fileName];
136-
[_iconView sd_setImageWithURL:fileUrl placeholderImage:nil];
136+
UIImage *iconImage = [UIImage imageWithContentsOfFile:fileUrl.path];
137+
iconImage = [iconImage scaleToSize:(CGSize){64, 64} usingMode:NYXResizeModeAspectFill];
138+
_iconView.image = iconImage;
137139

138140
NSArray *fileInfos = [_fileName componentsSeparatedByString:@"|||"];
139141
_nameLabel.text = [fileInfos lastObject];

Podfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ pod 'JDStatusBarNotification', '1.4.9'
1212
pod 'BlocksKit', '2.2.5'
1313
pod 'ReactiveCocoa', '2.3.1'
1414
pod 'MMMarkdown', '0.3'
15-
pod 'Masonry', '0.5.3'
15+
pod 'Masonry', '0.5.3'
16+
pod 'NYXImagesKit', '2.3'

Podfile.lock

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ PODS:
1919
- Masonry (0.5.3)
2020
- MBProgressHUD (0.9)
2121
- MMMarkdown (0.3)
22+
- NYXImagesKit (2.3)
2223
- ODRefreshControl (1.1.0)
2324
- ReactiveCocoa (2.3.1):
2425
- ReactiveCocoa/UI (= 2.3.1)
@@ -41,6 +42,7 @@ DEPENDENCIES:
4142
- Masonry (= 0.5.3)
4243
- MBProgressHUD (= 0.9)
4344
- MMMarkdown (= 0.3)
45+
- NYXImagesKit (= 2.3)
4446
- ODRefreshControl (= 1.1.0)
4547
- ReactiveCocoa (= 2.3.1)
4648
- RegexKitLite (= 4.0)
@@ -55,6 +57,7 @@ SPEC CHECKSUMS:
5557
Masonry: 35368c2ca9577ca87722c12fc52c4bad9b1c1516
5658
MBProgressHUD: 2038dbcf3dce73215abed6001657043d53aa79a8
5759
MMMarkdown: 95af8920c647512d1efa2ac8ac1932baf3266e2c
60+
NYXImagesKit: 1c9f228ae78fab475d267b3b3a1308e0fba11731
5861
ODRefreshControl: 7bc75258d9dba1f93c4e34654d1e4b5aa39529f0
5962
ReactiveCocoa: dca75777b9d18990c8714a3a6f2149f29b4d1462
6063
RegexKitLite: c0e4c12e6e7de0769f3a3ed679f0f61604170661

0 commit comments

Comments
 (0)