ShareViewController.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. //
  2. // ShareViewController.m
  3. // Crypto Cloud Technology Nextcloud
  4. //
  5. // Created by Marino Faggiana on 26/01/16.
  6. // Copyright (c) 2014 TWS. All rights reserved.
  7. //
  8. // Author Marino Faggiana <m.faggiana@twsweb.it>
  9. //
  10. // This program is free software: you can redistribute it and/or modify
  11. // it under the terms of the GNU General Public License as published by
  12. // the Free Software Foundation, either version 3 of the License, or
  13. // (at your option) any later version.
  14. //
  15. // This program is distributed in the hope that it will be useful,
  16. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. // GNU General Public License for more details.
  19. //
  20. // You should have received a copy of the GNU General Public License
  21. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. //
  23. #import "ShareViewController.h"
  24. #import "Share_Ext_Nextcloud-Swift.h"
  25. @import MobileCoreServices;
  26. @interface ShareViewController ()
  27. {
  28. NSURL *dirGroup;
  29. NSUInteger totalSize;
  30. NSExtensionItem *inputItem;
  31. CCMetadata *saveMetadataPlist;
  32. UIColor *barTintColor;
  33. UIColor *tintColor;
  34. NSMutableArray *_filesSendCryptated;
  35. }
  36. @end
  37. @implementation ShareViewController
  38. #pragma --------------------------------------------------------------------------------------------
  39. #pragma mark ===== View =====
  40. #pragma --------------------------------------------------------------------------------------------
  41. -(void)viewDidLoad
  42. {
  43. dirGroup = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:k_capabilitiesGroups];
  44. [MagicalRecord setupCoreDataStackWithAutoMigratingSqliteStoreNamed:(id)[dirGroup URLByAppendingPathComponent:[appDatabase stringByAppendingPathComponent:@"cryptocloud"]]];
  45. [MagicalRecord setLoggingLevel:MagicalRecordLoggingLevelOff];
  46. TableAccount *recordAccount = [CCCoreData getActiveAccount];
  47. if (recordAccount == nil) {
  48. // close now
  49. [self performSelector:@selector(closeShareViewController) withObject:nil afterDelay:0.1];
  50. return;
  51. } else {
  52. _activeAccount = recordAccount.account;
  53. _activePassword = recordAccount.password;
  54. _activeUrl = recordAccount.url;
  55. _activeUser = recordAccount.user;
  56. _directoryUser = [CCUtility getDirectoryActiveUser:self.activeUser activeUrl:self.activeUrl];
  57. _typeCloud = recordAccount.typeCloud;
  58. if ([_activeAccount isEqualToString:[CCUtility getActiveAccountShareExt]]) {
  59. // load
  60. _serverUrl = [CCUtility getServerUrlShareExt];
  61. _destinyFolderButton.title = [NSString stringWithFormat:NSLocalizedString(@"_destiny_folder_", nil), [CCUtility getTitleServerUrlShareExt]];
  62. _localCryptated = [CCUtility getCryptatedShareExt];
  63. } else {
  64. // Default settings
  65. [CCUtility setActiveAccountShareExt:self.activeAccount];
  66. _serverUrl = [CCUtility getHomeServerUrlActiveUrl:self.activeUrl typeCloud:self.typeCloud];
  67. [CCUtility setServerUrlShareExt:_serverUrl];
  68. _destinyFolderButton.title = [NSString stringWithFormat:NSLocalizedString(@"_destiny_folder_", nil), NSLocalizedString(@"_home_", nil)];
  69. [CCUtility setTitleServerUrlShareExt:NSLocalizedString(@"_home_", nil)];
  70. _localCryptated = YES;
  71. [CCUtility setCryptatedShareExt:YES];
  72. }
  73. }
  74. _filesName = [[NSMutableArray alloc] init];
  75. _filesSendCryptated = [[NSMutableArray alloc] init];
  76. _hud = [[CCHud alloc] initWithView:self.navigationController.view];
  77. _networkingOperationQueue = [NSOperationQueue new];
  78. _networkingOperationQueue.name = k_netQueueName;
  79. _networkingOperationQueue.maxConcurrentOperationCount = 1;
  80. [[CCNetworking sharedNetworking] settingDelegate:self];
  81. [self.shareTable registerNib:[UINib nibWithNibName:@"CCCellShareExt" bundle:nil] forCellReuseIdentifier:@"ShareExtCell"];
  82. [self navigationBarToolBar];
  83. [self loadDataSwift];
  84. }
  85. // Apparirà
  86. - (void)viewWillAppear:(BOOL)animated
  87. {
  88. [super viewWillAppear:animated];
  89. if ([[CCUtility getBlockCode] length] > 0 && [CCUtility getOnlyLockDir] == NO)
  90. [self openBKPasscode];
  91. }
  92. - (void)didReceiveMemoryWarning
  93. {
  94. [super didReceiveMemoryWarning];
  95. // Dispose of any resources that can be recreated.
  96. }
  97. - (void)closeShareViewController
  98. {
  99. [self.extensionContext completeRequestReturningItems:@[] completionHandler:nil];
  100. }
  101. //
  102. // L'applicazione terminerà
  103. //
  104. - (void)applicationWillTerminate:(UIApplication *)application
  105. {
  106. NSLog(@"[LOG] bye bye, Crypto Cloud Share Extension!");
  107. }
  108. #pragma --------------------------------------------------------------------------------------------
  109. #pragma mark == Action ==
  110. #pragma --------------------------------------------------------------------------------------------
  111. - (void)navigationBarToolBar
  112. {
  113. UIBarButtonItem *rightButtonUpload, *rightButtonEncrypt, *leftButtonCancel;
  114. barTintColor = self.navigationController.navigationBar.barTintColor;
  115. tintColor = self.navigationController.navigationBar.tintColor;
  116. if (barTintColor == nil) barTintColor = COLOR_NAVBAR_IOS7;
  117. if (tintColor == nil) tintColor = COLOR_GRAY;
  118. // Toolbar Color & navigationBar Color
  119. self.toolBar.barTintColor = barTintColor;
  120. self.toolBar.tintColor = tintColor;
  121. self.navigationController.navigationBar.barTintColor = barTintColor;
  122. self.navigationController.navigationBar.tintColor = tintColor;
  123. // Upload
  124. if (self.localCryptated) {
  125. rightButtonUpload = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"_save_encrypted_", nil) style:UIBarButtonItemStylePlain target:self action:@selector(selectPost)];
  126. [rightButtonUpload setTintColor:COLOR_ENCRYPTED];
  127. } else {
  128. rightButtonUpload = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"_save_", nil) style:UIBarButtonItemStylePlain target:self action:@selector(selectPost)];
  129. }
  130. // Encrypt
  131. UIImage *icon = [[UIImage imageNamed:image_shareExtEncrypt] imageWithRenderingMode:UIImageRenderingModeAutomatic];
  132. rightButtonEncrypt = [[UIBarButtonItem alloc] initWithImage:icon style:UIBarButtonItemStylePlain target:self action:@selector(changeEncrypt)];
  133. if (self.localCryptated) [rightButtonEncrypt setTintColor:COLOR_ENCRYPTED];
  134. // Cancel
  135. leftButtonCancel = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"_cancel_", nil) style:UIBarButtonItemStylePlain target:self action:@selector(cancelPost)];
  136. // Title
  137. [self.navigationController.navigationBar setTitleTextAttributes: @{NSForegroundColorAttributeName:self.navigationController.navigationBar.tintColor}];
  138. self.navigationItem.title = @"Nextcloud";
  139. self.navigationItem.leftBarButtonItem = leftButtonCancel;
  140. self.navigationItem.rightBarButtonItems = [[NSArray alloc] initWithObjects:rightButtonUpload, rightButtonEncrypt, nil];
  141. self.navigationItem.hidesBackButton = YES;
  142. }
  143. - (void)moveServerUrlTo:(NSString *)serverUrlTo title:(NSString *)title selectedMetadatas:(NSArray *)selectedMetadatas
  144. {
  145. if (serverUrlTo)
  146. _serverUrl = serverUrlTo;
  147. if (title) {
  148. self.destinyFolderButton.title = [NSString stringWithFormat:NSLocalizedString(@"_destiny_folder_", nil), title];
  149. [CCUtility setTitleServerUrlShareExt:title];
  150. } else {
  151. self.destinyFolderButton.title = [NSString stringWithFormat:NSLocalizedString(@"_destiny_folder_", nil), NSLocalizedString(@"_home_", nil)];
  152. [CCUtility setTitleServerUrlShareExt:NSLocalizedString(@"_home_", nil)];
  153. }
  154. [CCUtility setActiveAccountShareExt:self.activeAccount];
  155. [CCUtility setServerUrlShareExt:_serverUrl];
  156. }
  157. - (IBAction)destinyFolderButtonTapped:(UIBarButtonItem *)sender
  158. {
  159. UINavigationController* navigationController = [[UIStoryboard storyboardWithName:@"CCMove" bundle:nil] instantiateViewControllerWithIdentifier:@"CCMove"];
  160. CCMove *viewController = (CCMove *)navigationController.topViewController;
  161. viewController.delegate = self;
  162. viewController.move.title = NSLocalizedString(@"_select_", nil);
  163. viewController.tintColor = tintColor;
  164. viewController.barTintColor = barTintColor;
  165. viewController.tintColorTitle = tintColor;
  166. viewController.networkingOperationQueue = _networkingOperationQueue;
  167. [navigationController setModalPresentationStyle:UIModalPresentationFormSheet];
  168. [self presentViewController:navigationController animated:YES completion:nil];
  169. }
  170. - (void)selectPost
  171. {
  172. if ([self.filesName count] > 0) {
  173. NSString *fileName = [self.filesName objectAtIndex:0];
  174. CCMetadataNet *metadataNet = [[CCMetadataNet alloc] initWithAccount:_activeAccount];
  175. metadataNet.action = actionUploadFile;
  176. metadataNet.cryptated = _localCryptated;
  177. metadataNet.fileName = fileName;
  178. metadataNet.fileNamePrint = fileName;
  179. metadataNet.serverUrl = _serverUrl;
  180. metadataNet.session = k_upload_session_foreground;
  181. metadataNet.taskStatus = k_taskStatusResume;
  182. [self addNetworkingQueue:metadataNet];
  183. [self.hud visibleHudTitle:NSLocalizedString(@"_uploading_", nil) mode:MBProgressHUDModeDeterminateHorizontalBar color:self.view.tintColor];
  184. [self.hud AddButtonCancelWithTarget:self selector:@"cancelTransfer"];
  185. }
  186. else
  187. [self closeShareViewController];
  188. }
  189. - (void)cancelPost
  190. {
  191. // rimuoviamo i file+ico
  192. for (NSString *fileName in self.filesName) {
  193. [[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/%@", self.directoryUser, fileName] error:nil];
  194. [[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/%@.ico", self.directoryUser, fileName] error:nil];
  195. }
  196. [self closeShareViewController];
  197. }
  198. - (void)changeEncrypt
  199. {
  200. if (self.localCryptated) self.localCryptated = NO;
  201. else self.localCryptated = YES;
  202. [CCUtility setCryptatedShareExt:self.localCryptated];
  203. [self navigationBarToolBar];
  204. }
  205. - (void)cancelTransfer
  206. {
  207. [_networkingOperationQueue cancelAllOperations];
  208. }
  209. #pragma --------------------------------------------------------------------------------------------
  210. #pragma mark ======================= NetWorking ==================================
  211. #pragma --------------------------------------------------------------------------------------------
  212. - (void)progressTask:(NSString *)fileID serverUrl:(NSString *)serverUrl cryptated:(BOOL)cryptated progress:(float)progress
  213. {
  214. [self.hud progress:progress];
  215. }
  216. - (void)uploadFileFailure:(CCMetadataNet *)metadataNet fileID:(NSString *)fileID serverUrl:(NSString *)serverUrl selector:(NSString *)selector message:(NSString *)message errorCode:(NSInteger)errorCode
  217. {
  218. [self.hud hideHud];
  219. // remove file
  220. [CCCoreData deleteMetadataWithPredicate:[NSPredicate predicateWithFormat:@"(fileID == %@) AND (account == %@)", fileID, _activeAccount]];
  221. [[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/%@", _directoryUser, fileID] error:nil];
  222. [[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/%@.ico", _directoryUser, fileID] error:nil];
  223. // message error
  224. if (errorCode != kCFURLErrorCancelled) {
  225. UIAlertController * alert= [UIAlertController alertControllerWithTitle:NSLocalizedString(@"_error_", nil) message:message preferredStyle:UIAlertControllerStyleAlert];
  226. UIAlertAction* ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault
  227. handler:^(UIAlertAction * action) {
  228. [alert dismissViewControllerAnimated:YES completion:nil];
  229. [self closeShareViewController];
  230. }];
  231. [alert addAction:ok];
  232. [self presentViewController:alert animated:YES completion:nil];
  233. }
  234. else
  235. [self closeShareViewController];
  236. }
  237. - (void)uploadFileSuccess:(CCMetadataNet *)metadataNet fileID:(NSString *)fileID serverUrl:(NSString *)serverUrl selector:(NSString *)selector selectorPost:(NSString *)selectorPost
  238. {
  239. [self.hud hideHud];
  240. CCMetadata *metadata = [CCCoreData getMetadataWithPreficate:[NSPredicate predicateWithFormat:@"(fileID == %@) AND (account == %@)", fileID, _activeAccount] context:nil];
  241. [self.filesName removeObject:metadata.fileNamePrint];
  242. [self.shareTable performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];
  243. [self performSelector:@selector(selectPost) withObject:nil afterDelay:0.1];
  244. }
  245. - (void)addNetworkingQueue:(CCMetadataNet *)metadataNet
  246. {
  247. id operation;
  248. if ([_typeCloud isEqualToString:typeCloudOwnCloud] || [_typeCloud isEqualToString:typeCloudNextcloud])
  249. operation = [[OCnetworking alloc] initWithDelegate:self metadataNet:metadataNet withUser:_activeUser withPassword:_activePassword withUrl:_activeUrl withTypeCloud:_typeCloud activityIndicator:NO];
  250. [operation setQueuePriority:metadataNet.priority];
  251. [_networkingOperationQueue addOperation:operation];
  252. }
  253. #pragma --------------------------------------------------------------------------------------------
  254. #pragma mark ===== Lock Password =====
  255. #pragma --------------------------------------------------------------------------------------------
  256. - (void)openBKPasscode
  257. {
  258. CCBKPasscode *viewController = [[CCBKPasscode alloc] initWithNibName:nil bundle:nil];
  259. viewController.delegate = self;
  260. viewController.type = BKPasscodeViewControllerCheckPasscodeType;
  261. viewController.inputViewTitlePassword = YES;
  262. if ([CCUtility getSimplyBlockCode]) {
  263. viewController.passcodeStyle = BKPasscodeInputViewNumericPasscodeStyle;
  264. viewController.passcodeInputView.maximumLength = 6;
  265. } else {
  266. viewController.passcodeStyle = BKPasscodeInputViewNormalPasscodeStyle;
  267. viewController.passcodeInputView.maximumLength = 64;
  268. }
  269. BKTouchIDManager *touchIDManager = [[BKTouchIDManager alloc] initWithKeychainServiceName:BKPasscodeKeychainServiceName];
  270. touchIDManager.promptText = NSLocalizedString(@"_scan_fingerprint_", nil);
  271. viewController.touchIDManager = touchIDManager;
  272. viewController.title = @"Nextcloud";
  273. viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(passcodeViewCloseButtonPressed:)];
  274. viewController.navigationItem.leftBarButtonItem.tintColor = COLOR_ENCRYPTED;
  275. UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
  276. [self presentViewController:navController animated:YES completion:nil];
  277. }
  278. - (NSUInteger)passcodeViewControllerNumberOfFailedAttempts:(CCBKPasscode *)aViewController
  279. {
  280. return self.failedAttempts;
  281. }
  282. - (NSDate *)passcodeViewControllerLockUntilDate:(CCBKPasscode *)aViewController
  283. {
  284. return self.lockUntilDate;
  285. }
  286. - (void)passcodeViewCloseButtonPressed:(id)sender
  287. {
  288. [self dismissViewControllerAnimated:YES completion:^{
  289. [self performSelector:@selector(closeShareViewController) withObject:nil];
  290. }];
  291. }
  292. - (void)passcodeViewController:(CCBKPasscode *)aViewController authenticatePasscode:(NSString *)aPasscode resultHandler:(void (^)(BOOL))aResultHandler
  293. {
  294. if ([aPasscode isEqualToString:[CCUtility getBlockCode]]) {
  295. self.lockUntilDate = nil;
  296. self.failedAttempts = 0;
  297. aResultHandler(YES);
  298. } else aResultHandler(NO);
  299. }
  300. - (void)passcodeViewController:(CCBKPasscode *)aViewController didFinishWithPasscode:(NSString *)aPasscode
  301. {
  302. [aViewController dismissViewControllerAnimated:YES completion:nil];
  303. }
  304. #pragma --------------------------------------------------------------------------------------------
  305. #pragma mark ===== Swipe Table DELETE -> menu =====
  306. #pragma--------------------------------------------------------------------------------------------
  307. - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
  308. {
  309. [self setEditing:NO animated:YES];
  310. NSString *fileName = [self.filesName objectAtIndex:indexPath.row];
  311. [[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/%@", self.directoryUser, fileName] error:nil];
  312. [[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/%@.ico", self.directoryUser, fileName] error:nil];
  313. [self.filesName removeObjectAtIndex:indexPath.row];
  314. if ([self.filesName count] == 0) [self closeShareViewController];
  315. else [self.shareTable performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];
  316. }
  317. #pragma --------------------------------------------------------------------------------------------
  318. #pragma mark == Table ==
  319. #pragma --------------------------------------------------------------------------------------------
  320. - (void)loadDataSwift
  321. {
  322. CCloadItemData *loadItem = [[CCloadItemData alloc] init];
  323. [loadItem loadFiles:self.directoryUser extensionContext:self.extensionContext vc:self];
  324. }
  325. - (void)reloadData:(NSArray *)files
  326. {
  327. totalSize = 0;
  328. for (NSString *file in files) {
  329. NSUInteger fileSize = (NSInteger)[[[NSFileManager defaultManager] attributesOfItemAtPath:[NSString stringWithFormat:@"%@/%@", self.directoryUser, file] error:nil] fileSize];
  330. totalSize += fileSize;
  331. // creiamo l'ICO
  332. CFStringRef fileExtension = (__bridge CFStringRef)[file pathExtension];
  333. CFStringRef fileUTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, fileExtension, NULL);
  334. if (fileSize > 0 && ((UTTypeConformsTo(fileUTI, kUTTypeImage)) || (UTTypeConformsTo(fileUTI, kUTTypeMovie)))) {
  335. NSString *typeFile;
  336. if (UTTypeConformsTo(fileUTI, kUTTypeImage)) typeFile = k_metadataTypeFile_image;
  337. if (UTTypeConformsTo(fileUTI, kUTTypeMovie)) typeFile = k_metadataTypeFile_video;
  338. [CCGraphics createNewImageFrom:file directoryUser:self.directoryUser fileNameTo:file fileNamePrint:nil size:@"m" imageForUpload:NO typeFile:typeFile writePreview:YES optimizedFileName:NO];
  339. }
  340. }
  341. if (totalSize > 0) {
  342. self.filesName = [[NSMutableArray alloc] initWithArray:files];
  343. [self.shareTable reloadData];
  344. } else {
  345. [self closeShareViewController];
  346. }
  347. }
  348. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  349. {
  350. return 80;
  351. }
  352. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  353. {
  354. return 1;
  355. }
  356. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  357. {
  358. return [self.filesName count];
  359. }
  360. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  361. {
  362. NSString *fileName = [self.filesName objectAtIndex:indexPath.row];
  363. UIImage *image = nil;
  364. CFStringRef fileExtension = (__bridge CFStringRef)[fileName pathExtension];
  365. CFStringRef fileUTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, fileExtension, NULL);
  366. if (UTTypeConformsTo(fileUTI, kUTTypeZipArchive) && [(__bridge NSString *)fileUTI containsString:@"org.openxmlformats"] == NO) image = [UIImage imageNamed:image_typeFileCompress];
  367. else if (UTTypeConformsTo(fileUTI, kUTTypeAudio)) image = [UIImage imageNamed:image_audio];
  368. else if ((UTTypeConformsTo(fileUTI, kUTTypeImage)) || (UTTypeConformsTo(fileUTI, kUTTypeMovie))) {
  369. image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.ico", self.directoryUser, fileName]];
  370. }
  371. else if (UTTypeConformsTo(fileUTI, kUTTypeContent)) {
  372. image = [UIImage imageNamed:image_document];
  373. NSString *typeFile = (__bridge NSString *)fileUTI;
  374. if ([typeFile isEqualToString:@"com.adobe.pdf"]) image = [UIImage imageNamed:image_pdf];
  375. if ([typeFile isEqualToString:@"org.openxmlformats.spreadsheetml.sheet"]) image = [UIImage imageNamed:image_xls];
  376. if ([typeFile isEqualToString:@"public.plain-text"]) image = [UIImage imageNamed:image_txt];
  377. }
  378. else image = [UIImage imageNamed:image_file];
  379. CCCellShareExt *cell = (CCCellShareExt *)[tableView dequeueReusableCellWithIdentifier:@"ShareExtCell" forIndexPath:indexPath];
  380. NSUInteger fileSize = (NSInteger)[[[NSFileManager defaultManager] attributesOfItemAtPath:[NSString stringWithFormat:@"%@/%@", self.directoryUser, fileName] error:nil] fileSize];
  381. cell.labelInformazioni.text = [NSString stringWithFormat:@"%@\r\r%@", fileName, [CCUtility transformedSize:fileSize]];
  382. cell.labelInformazioni.textColor = [UIColor blackColor];
  383. cell.fileImageView.image = image;
  384. return cell;
  385. }
  386. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  387. {
  388. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  389. }
  390. @end