123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579 |
- #import "CCLocalStorage.h"
- #import "AppDelegate.h"
- #ifdef CUSTOM_BUILD
- #import "CustomSwift.h"
- #else
- #import "Nextcloud-Swift.h"
- #endif
- @interface CCLocalStorage ()
- {
- NSArray *dataSource;
- }
- @end
- @implementation CCLocalStorage
- - (void)viewDidLoad
- {
- [super viewDidLoad];
-
-
- [self.tableView registerNib:[UINib nibWithNibName:@"CCLocalStorageCell" bundle:nil] forCellReuseIdentifier:@"Cell"];
-
- dataSource = [NSMutableArray new];
-
-
- _metadata = [CCMetadata new];
-
- self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 1)];
- self.tableView.separatorColor = [NCColorBrand sharedInstance].seperator;
- self.tableView.emptyDataSetDelegate = self;
- self.tableView.emptyDataSetSource = self;
- self.tableView.allowsMultipleSelectionDuringEditing = NO;
-
-
- if (!_serverUrl)
- _serverUrl = [CCUtility getDirectoryLocal];
-
-
- if (_titleViewControl)
- self.title = _titleViewControl;
- else
- self.title = NSLocalizedString(@"_local_storage_", nil);
- }
- - (void)viewWillAppear:(BOOL)animated
- {
- [super viewWillAppear:animated];
-
-
- [CCAspect aspectNavigationControllerBar:self.navigationController.navigationBar encrypted:NO online:[app.reachability isReachable] hidden:NO];
- [CCAspect aspectTabBar:self.tabBarController.tabBar hidden:NO];
-
-
- [app plusButtonVisibile:true];
-
- [self reloadDatasource];
- }
- - (void)viewDidAppear:(BOOL)animated
- {
- [super viewDidAppear:animated];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- }
- #pragma --------------------------------------------------------------------------------------------
- #pragma mark ==== DZNEmptyDataSetSource ====
- #pragma --------------------------------------------------------------------------------------------
- - (BOOL)emptyDataSetShouldDisplay:(UIScrollView *)scrollView
- {
-
- if ([_serverUrl isEqualToString:[CCUtility getDirectoryLocal]])
- return YES;
- else
- return NO;
- }
- - (CGFloat)spaceHeightForEmptyDataSet:(UIScrollView *)scrollView
- {
- return 0.0f;
- }
- - (UIColor *)backgroundColorForEmptyDataSet:(UIScrollView *)scrollView
- {
- return [UIColor whiteColor];
- }
- - (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView
- {
- return [UIImage imageNamed:image_localStorageNoRecord];
- }
- - (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView
- {
- NSString *text = [NSString stringWithFormat:@"%@", NSLocalizedString(@"_local_storage_no_record_", nil)];
-
- NSDictionary *attributes = @{NSFontAttributeName:[UIFont boldSystemFontOfSize:20.0f], NSForegroundColorAttributeName:[UIColor lightGrayColor]};
-
- return [[NSAttributedString alloc] initWithString:text attributes:attributes];
- }
- - (NSAttributedString *)descriptionForEmptyDataSet:(UIScrollView *)scrollView
- {
- NSString *text = [NSString stringWithFormat:@"\n%@", NSLocalizedString(@"_tutorial_local_view_", nil)];
-
- NSMutableParagraphStyle *paragraph = [NSMutableParagraphStyle new];
- paragraph.lineBreakMode = NSLineBreakByWordWrapping;
- paragraph.alignment = NSTextAlignmentCenter;
-
- NSDictionary *attributes = @{NSFontAttributeName: [UIFont systemFontOfSize:14.0], NSForegroundColorAttributeName: [UIColor lightGrayColor], NSParagraphStyleAttributeName: paragraph};
-
- return [[NSAttributedString alloc] initWithString:text attributes:attributes];
- }
- #pragma --------------------------------------------------------------------------------------------
- #pragma mark ===== UIDocumentInteractionController <delegate> =====
- #pragma --------------------------------------------------------------------------------------------
- - (void)documentInteractionControllerDidDismissOptionsMenu:(UIDocumentInteractionController *)controller
- {
-
- if ([CCCoreData getCameraUploadActiveAccount:app.activeAccount]) {
-
- [CCCoreData setCameraUploadDatePhoto:[NSDate date]];
- [CCCoreData setCameraUploadDateVideo:[NSDate date]];
- }
- }
- #pragma --------------------------------------------------------------------------------------------
- #pragma mark ===== menu =====
- #pragma--------------------------------------------------------------------------------------------
- - (void)openModel:(CCMetadata *)metadata
- {
- UIViewController *viewController;
- BOOL isLocal = YES;
- NSString *serverUrl = [CCCoreData getServerUrlFromDirectoryID:_metadata.directoryID activeAccount:app.activeAccount];
-
- if ([metadata.model isEqualToString:@"cartadicredito"])
- viewController = [[CCCartaDiCredito alloc] initWithDelegate:self fileName:metadata.fileName uuid:metadata.uuid fileID:metadata.fileID isLocal:isLocal serverUrl:serverUrl];
-
- if ([metadata.model isEqualToString:@"bancomat"])
- viewController = [[CCBancomat alloc] initWithDelegate:self fileName:metadata.fileName uuid:metadata.uuid fileID:metadata.fileID isLocal:isLocal serverUrl:serverUrl];
-
- if ([metadata.model isEqualToString:@"contocorrente"])
- viewController = [[CCContoCorrente alloc] initWithDelegate:self fileName:metadata.fileName uuid:metadata.uuid fileID:metadata.fileID isLocal:isLocal serverUrl:serverUrl];
-
- if ([metadata.model isEqualToString:@"accountweb"])
- viewController = [[CCAccountWeb alloc] initWithDelegate:self fileName:metadata.fileName uuid:metadata.uuid fileID:metadata.fileID isLocal:isLocal serverUrl:serverUrl];
-
- if ([metadata.model isEqualToString:@"patenteguida"])
- viewController = [[CCPatenteGuida alloc] initWithDelegate:self fileName:metadata.fileName uuid:metadata.uuid fileID:metadata.fileID isLocal:isLocal serverUrl:serverUrl];
-
- if ([metadata.model isEqualToString:@"cartaidentita"])
- viewController = [[CCCartaIdentita alloc] initWithDelegate:self fileName:metadata.fileName uuid:metadata.uuid fileID:metadata.fileID isLocal:isLocal serverUrl:serverUrl];
-
- if ([metadata.model isEqualToString:@"passaporto"])
- viewController = [[CCPassaporto alloc] initWithDelegate:self fileName:metadata.fileName uuid:metadata.uuid fileID:metadata.fileID isLocal:isLocal serverUrl:serverUrl];
-
- if ([metadata.model isEqualToString:@"note"]) {
-
- viewController = [[CCNote alloc] initWithDelegate:self fileName:metadata.fileName uuid:metadata.uuid fileID:metadata.fileID isLocal:isLocal serverUrl:serverUrl];
-
- UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
-
- [self presentViewController:navigationController animated:YES completion:nil];
-
- } else {
-
- UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
-
- [navigationController setModalPresentationStyle:UIModalPresentationFormSheet];
-
- [self presentViewController:navigationController animated:YES completion:nil];
- }
- }
- - (void)openWith:(CCMetadata *)metadata
- {
- NSString *fileNamePath = [NSString stringWithFormat:@"%@/%@", _serverUrl, metadata.fileNameData];
-
- if ([[NSFileManager defaultManager] fileExistsAtPath:fileNamePath]) {
-
- [[NSFileManager defaultManager] removeItemAtPath:[NSTemporaryDirectory() stringByAppendingString:metadata.fileNamePrint] error:nil];
- [[NSFileManager defaultManager] linkItemAtPath:fileNamePath toPath:[NSTemporaryDirectory() stringByAppendingString:metadata.fileNamePrint] error:nil];
-
- NSURL *url = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingString:metadata.fileNamePrint]];
-
- _docController = [UIDocumentInteractionController interactionControllerWithURL:url];
- _docController.delegate = self;
-
- [_docController presentOptionsMenuFromRect:self.view.frame inView:self.view animated:YES];
- }
- }
- - (void)requestDeleteMetadata:(CCMetadata *)metadata indexPath:(NSIndexPath *)indexPath
- {
- UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
-
- [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_delete_", nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
-
- NSString *fileNamePath = [NSString stringWithFormat:@"%@/%@", _serverUrl, metadata.fileNameData];
- NSString *iconPath = [NSString stringWithFormat:@"%@/.%@.ico", _serverUrl, metadata.fileNameData];
-
- [[NSFileManager defaultManager] removeItemAtPath:fileNamePath error:nil];
- [[NSFileManager defaultManager] removeItemAtPath:iconPath error:nil];
-
-
- [self reloadDatasource];
- }]];
-
-
- [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_cancel_", nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
- }]];
-
- alertController.popoverPresentationController.sourceView = self.view;
- alertController.popoverPresentationController.sourceRect = [self.tableView rectForRowAtIndexPath:indexPath];
-
- if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
- [alertController.view layoutIfNeeded];
-
- [self presentViewController:alertController animated:YES completion:nil];
- }
- -(void)cellButtonDownWasTapped:(id)sender
- {
- CGPoint touchPoint = [sender convertPoint:CGPointZero toView:self.tableView];
- NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:touchPoint];
- CCMetadata *metadata = [CCMetadata new];
- UIImage *iconHeader;
-
- NSString *cameraFolderName = [CCCoreData getCameraUploadFolderNameActiveAccount:app.activeAccount];
- NSString *cameraFolderPath = [CCCoreData getCameraUploadFolderPathActiveAccount:app.activeAccount activeUrl:app.activeUrl];
-
- metadata = [CCUtility insertFileSystemInMetadata:[dataSource objectAtIndex:indexPath.row] directory:_serverUrl activeAccount:app.activeAccount cameraFolderName:cameraFolderName cameraFolderPath:cameraFolderPath];
-
-
- AHKActionSheet *actionSheet = [[AHKActionSheet alloc] initWithView:self.view title:nil];
-
- actionSheet.animationDuration = 0.2;
-
- actionSheet.blurRadius = 0.0f;
- actionSheet.blurTintColor = [UIColor colorWithWhite:0.0f alpha:0.50f];
-
- actionSheet.buttonHeight = 50.0;
- actionSheet.cancelButtonHeight = 50.0f;
- actionSheet.separatorHeight = 5.0f;
-
- actionSheet.automaticallyTintButtonImages = @(NO);
-
- actionSheet.encryptedButtonTextAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:16], NSForegroundColorAttributeName:[NCColorBrand sharedInstance].cryptocloud };
- actionSheet.buttonTextAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:16], NSForegroundColorAttributeName:[UIColor blackColor] };
- actionSheet.cancelButtonTextAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:16], NSForegroundColorAttributeName:[NCColorBrand sharedInstance].brand };
- actionSheet.disableButtonTextAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:16], NSForegroundColorAttributeName:[UIColor blackColor] };
-
- actionSheet.separatorColor = [NCColorBrand sharedInstance].seperator;
- actionSheet.cancelButtonTitle = NSLocalizedString(@"_cancel_",nil);
-
-
- if ([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@.ico", app.directoryUser, metadata.fileID]])
- iconHeader = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.ico", app.directoryUser, metadata.fileID]];
- else
- iconHeader = [UIImage imageNamed:metadata.iconName];
-
- [actionSheet addButtonWithTitle: metadata.fileNamePrint
- image: iconHeader
- backgroundColor: [NCColorBrand sharedInstance].tabBar
- height: 50.0
- type: AHKActionSheetButtonTypeDisabled
- handler: nil
- ];
-
- if (_serverUrl == nil) {
-
- [actionSheet addButtonWithTitle:NSLocalizedString(@"_remove_offline_", nil) image:[UIImage imageNamed:image_actionSheetOffline] backgroundColor:[UIColor whiteColor] height: 50.0 type:AHKActionSheetButtonTypeDefault handler:^(AHKActionSheet *as) {
-
- if (metadata.directory) {
-
-
- NSString *relativeRoot = [CCCoreData getServerUrlFromDirectoryID:metadata.directoryID activeAccount:app.activeAccount];
- NSString *dirServerUrl = [CCUtility stringAppendServerUrl:relativeRoot addFileName:metadata.fileNameData];
- NSArray *directories = [CCCoreData getOfflineDirectoryActiveAccount:app.activeAccount];
-
- for (TableDirectory *directory in directories)
- if ([directory.serverUrl containsString:dirServerUrl]) {
- [CCCoreData setOfflineDirectoryServerUrl:directory.serverUrl offline:NO activeAccount:app.activeAccount];
- [CCCoreData removeOfflineAllFileFromServerUrl:directory.serverUrl activeAccount:app.activeAccount];
- }
-
- } else {
-
- [CCCoreData setOfflineLocalFileID:metadata.fileID offline:NO activeAccount:app.activeAccount];
- }
-
- [self.tableView setEditing:NO animated:YES];
-
- [self reloadDatasource];
- }];
- }
-
-
- if (metadata.directory == NO && [metadata.type isEqualToString:k_metadataType_template] == NO) {
-
- [actionSheet addButtonWithTitle:NSLocalizedString(@"_open_in_", nil) image:[UIImage imageNamed:image_actionSheetOpenIn] backgroundColor:[UIColor whiteColor] height: 50.0 type:AHKActionSheetButtonTypeDefault handler:^(AHKActionSheet *as) {
-
- [self.tableView setEditing:NO animated:YES];
- [self openWith:metadata];
- }];
- }
-
- [actionSheet addButtonWithTitle:NSLocalizedString(@"_delete_", nil) image:[UIImage imageNamed:image_delete] backgroundColor:[UIColor whiteColor] height: 50.0 type:AHKActionSheetButtonTypeDestructive handler:^(AHKActionSheet *as) {
-
- [self requestDeleteMetadata:metadata indexPath:indexPath];
- }];
-
- [actionSheet show];
- }
- #pragma --------------------------------------------------------------------------------------------
- #pragma mark ==== Table ====
- #pragma --------------------------------------------------------------------------------------------
- - (CCMetadata *)setSelfMetadataFromIndexPath:(NSIndexPath *)indexPath
- {
- NSString *cameraFolderName = [CCCoreData getCameraUploadFolderNameActiveAccount:app.activeAccount];
- NSString *cameraFolderPath = [CCCoreData getCameraUploadFolderPathActiveAccount:app.activeAccount activeUrl:app.activeUrl];
-
- return [CCUtility insertFileSystemInMetadata:[dataSource objectAtIndex:indexPath.row] directory:_serverUrl activeAccount:app.activeAccount cameraFolderName:cameraFolderName cameraFolderPath:cameraFolderPath];
- }
- - (void)readFolderWithForced:(BOOL)forced serverUrl:(NSString *)serverUrl
- {
- [self reloadDatasource];
- }
- - (void)reloadDatasource
- {
- NSArray *subpaths = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:_serverUrl error:nil];
- NSMutableArray *metadatas = [NSMutableArray new];
-
- for (NSString *subpath in subpaths)
- if (![[subpath lastPathComponent] hasPrefix:@"."])
- [metadatas addObject:subpath];
-
- dataSource = [NSArray arrayWithArray:metadatas];
-
- [self.tableView reloadData];
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- return 60;
- }
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- {
- return 1;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- return [dataSource count];
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- CCLocalStorageCell *cell = (CCLocalStorageCell *)[tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
- CCMetadata *metadata;
-
-
- cell.separatorInset = UIEdgeInsetsMake(0.f, 60.f, 0.f, 0.f);
-
-
- cell.statusImageView.image = nil;
- cell.offlineImageView.image = nil;
-
-
- UIView *selectionColor = [[UIView alloc] init];
- selectionColor.backgroundColor = [NCColorBrand sharedInstance].selectBackgrond;
- cell.selectedBackgroundView = selectionColor;
- NSString *cameraFolderName = [CCCoreData getCameraUploadFolderNameActiveAccount:app.activeAccount];
- NSString *cameraFolderPath = [CCCoreData getCameraUploadFolderPathActiveAccount:app.activeAccount activeUrl:app.activeUrl];
-
- metadata = [CCUtility insertFileSystemInMetadata:[dataSource objectAtIndex:indexPath.row] directory:_serverUrl activeAccount:app.activeAccount cameraFolderName:cameraFolderName cameraFolderPath:cameraFolderPath];
-
- cell.fileImageView.image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/.%@.ico", _serverUrl, metadata.fileNamePrint]];
-
- if (!cell.fileImageView.image) {
-
- UIImage *icon = [CCGraphics createNewImageFrom:metadata.fileID directoryUser:_serverUrl fileNameTo:metadata.fileID fileNamePrint:metadata.fileNamePrint size:@"m" imageForUpload:NO typeFile:metadata.typeFile writePreview:NO optimizedFileName:[CCUtility getOptimizedPhoto]];
-
- if (icon) {
- [CCGraphics saveIcoWithFileID:metadata.fileNamePrint image:icon writeToFile:[NSString stringWithFormat:@"%@/.%@.ico", _serverUrl, metadata.fileNamePrint] copy:NO move:NO fromPath:nil toPath:nil];
- cell.fileImageView.image = icon;
- }
- }
-
-
- [cell.buttonDown addTarget:self action:@selector(cellButtonDownWasTapped:) forControlEvents:UIControlEventTouchUpInside];
-
-
- if (metadata.cryptated) {
- cell.labelTitle.textColor = [NCColorBrand sharedInstance].cryptocloud;
- } else {
- cell.labelTitle.textColor = [UIColor blackColor];
- }
-
-
- cell.labelTitle.text = metadata.fileNamePrint;
- cell.labelInfoFile.text = @"";
-
-
- if (cell.fileImageView.image == nil)
- cell.fileImageView.image = [UIImage imageNamed:metadata.iconName];
-
-
- if (metadata.cryptated && [metadata.type isEqualToString: k_metadataType_template] == NO)
- cell.statusImageView.image = [UIImage imageNamed:image_lock];
-
-
- if (metadata.directory) {
-
- cell.labelInfoFile.text = [CCUtility dateDiff:metadata.date];
- cell.accessoryType = UITableViewCellAccessoryNone;
-
-
- } else {
-
- NSString *date = [CCUtility dateDiff:metadata.date];
- NSString *length = [CCUtility transformedSize:metadata.size];
-
- if ([metadata.type isEqualToString: k_metadataType_template])
- cell.labelInfoFile.text = [NSString stringWithFormat:@"%@", date];
-
- if ([metadata.type isEqualToString: k_metadataType_file] || [metadata.type isEqualToString: k_metadataType_local])
- cell.labelInfoFile.text = [NSString stringWithFormat:@"%@ • %@", date, length];
-
- cell.accessoryType = UITableViewCellAccessoryNone;
- }
-
- return cell;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- {
-
- [tableView deselectRowAtIndexPath:indexPath animated:YES];
-
- _metadata = [self setSelfMetadataFromIndexPath:indexPath];
-
-
- if ([_metadata.session length] > 0 && [_metadata.session containsString:@"download"])
- return;
-
-
- if (([_metadata.type isEqualToString: k_metadataType_file] || [_metadata.type isEqualToString: k_metadataType_local]) && _metadata.directory == NO) {
-
- if ([_metadata.typeFile isEqualToString: k_metadataTypeFile_unknown] || [_metadata.typeFile isEqualToString: k_metadataTypeFile_compress]) {
-
- [self openWith:_metadata];
-
- } else {
-
- if ([self shouldPerformSegue])
- [self performSegueWithIdentifier:@"segueDetail" sender:self];
- }
- }
-
-
- if ([self.metadata.type isEqualToString: k_metadataType_template])
- [self openModel:_metadata];
-
-
- if (_metadata.directory)
- [self performSegueDirectoryWithControlPasscode];
- }
- -(void)performSegueDirectoryWithControlPasscode
- {
- CCLocalStorage *vc = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"CCLocalStorage"];
-
- vc.serverUrl = [CCUtility stringAppendServerUrl:_serverUrl addFileName:_metadata.fileNameData];
- vc.titleViewControl = _metadata.fileNamePrint;
-
- [self.navigationController pushViewController:vc animated:YES];
- }
- #pragma --------------------------------------------------------------------------------------------
- #pragma mark ===== Navigation ====
- #pragma --------------------------------------------------------------------------------------------
- - (BOOL)shouldPerformSegue
- {
-
- if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground) return NO;
-
-
- if (self.view.window == NO)
- return NO;
-
-
- if (self.splitViewController.isCollapsed)
- if (self.detailViewController.isViewLoaded && self.detailViewController.view.window) return NO;
-
-
- if (self.detailViewController.photoBrowser.currentVideoPlayerViewController.isViewLoaded && self.detailViewController.photoBrowser.currentVideoPlayerViewController.view.window) return NO;
-
- return YES;
- }
- -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
- {
- id viewController = segue.destinationViewController;
-
- if ([viewController isKindOfClass:[UINavigationController class]]) {
- UINavigationController *nav = viewController;
- _detailViewController = (CCDetail *)nav.topViewController;
- } else {
- _detailViewController = segue.destinationViewController;
- }
-
- NSMutableArray *allRecordsDataSourceImagesVideos = [NSMutableArray new];
-
- NSString *cameraFolderName = [CCCoreData getCameraUploadFolderNameActiveAccount:app.activeAccount];
- NSString *cameraFolderPath = [CCCoreData getCameraUploadFolderPathActiveAccount:app.activeAccount activeUrl:app.activeUrl];
-
- for (NSString *fileName in dataSource) {
-
- CCMetadata *metadata = [CCMetadata new];
- metadata = [CCUtility insertFileSystemInMetadata:fileName directory:_serverUrl activeAccount:app.activeAccount cameraFolderName:cameraFolderName cameraFolderPath:cameraFolderPath];
-
- if ([metadata.typeFile isEqualToString: k_metadataTypeFile_image] || [metadata.typeFile isEqualToString: k_metadataTypeFile_video])
- [allRecordsDataSourceImagesVideos addObject:metadata];
- }
-
- _detailViewController.sourceDirectoryLocal = YES;
- _detailViewController.metadataDetail = _metadata;
- _detailViewController.dateFilterQuery = nil;
- _detailViewController.isCameraUpload = NO;
- _detailViewController.dataSourceImagesVideos = allRecordsDataSourceImagesVideos;
- [_detailViewController setTitle:_metadata.fileNamePrint];
- }
- @end
|