123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- //
- // KMServicesFiles.m
- // PDF Reader
- //
- // Created by 丁林圭 on 2020/7/8.
- // Copyright © 2020 Kdan Mobile. All rights reserved.
- //
- #import "KMServicesCloudFile.h"
- #pragma mark - KMGoogleDriveUserMetadata
- @implementation KMGoogleDriveUserMetadata
- - (void)dealloc {}
- @end
- #pragma mark - KMDropboxUserMetadata
- @implementation KMDropboxUserMetadata
- - (void)dealloc {}
- @end
- #pragma mark - KMDropboxErrorMetadata
- @implementation KMDropboxErrorMetadata
- - (void)dealloc {}
- @end
- #pragma mark - KMServicesFile
- @implementation KMServicesCloudFile
- - (void)dealloc {}
- - (NSString *)fileSizeString
- {
- float fileSize = self.fileSize / 1024;
- float size = fileSize >= 1024 ?(fileSize < 1048576 ? fileSize/1024.0 : fileSize/1048576.0) : fileSize;
- char unit = fileSize >= 1024 ? (fileSize < 1048576 ? 'M':'G'):'K';
- return [NSString stringWithFormat:@"%0.1f%c", size, unit]?:@"";
- }
- - (NSString *)fileModiDateString
- {
- NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
- [dateFormatter setDateFormat:@"yyyy/MM/dd hh:mm:ss"];
- NSString * dateString = [dateFormatter stringFromDate:self.fileModiDate];
- return dateString;
- }
- - (NSString *)file_type {
- if (self.mimeType) {
- return self.mimeType;
- }
- return @"";
- }
- - (NSComparisonResult)nameCompare:(KMServicesCloudFile *)item {
- return [self.fileName caseInsensitiveCompare:item.fileName];
- }
- - (NSComparisonResult)dateCompare:(KMServicesCloudFile *)item {
- return [self.fileModiDate compare:item.fileModiDate];
- }
- //#define IntCompare(a, b) (a!=b ? a>b ? NSOrderedDescending : NSOrderedAscending : NSOrderedSame)
- //- (NSComparisonResult)sizeCompare:(KMServicesCloudFile *)item {
- // return self.isDirectory ? IntCompare(self.filesCount, item.filesCount) : IntCompare(self.fileSize, item.fileSize);
- //}
- @end
|