|
@@ -451,38 +451,26 @@
|
|
|
|
|
|
- (void)photoBrowser:(MWPhotoBrowser *)photoBrowser didDisplayPhotoAtIndex:(NSUInteger)index
|
|
|
{
|
|
|
- if (index != _indexNowVisible) {
|
|
|
-
|
|
|
- tableMetadata *metadata = [self.dataSourceImagesVideos objectAtIndex:index];
|
|
|
+ tableMetadata *metadata = [self.dataSourceImagesVideos objectAtIndex:index];
|
|
|
+ NSString *directory;
|
|
|
|
|
|
- NSString *directory;
|
|
|
- NSString *fileID = metadata.fileID;
|
|
|
+ _indexNowVisible = index;
|
|
|
+ _fileIDNowVisible = metadata.fileID;
|
|
|
|
|
|
- _indexNowVisible = index;
|
|
|
- _fileIDNowVisible = metadata.fileID;
|
|
|
+ photoBrowser.toolbar.hidden = NO;
|
|
|
|
|
|
- photoBrowser.toolbar.hidden = NO;
|
|
|
+ if (_sourceDirectoryLocal)
|
|
|
+ directory = self.metadataDetail.directoryID;
|
|
|
+ else
|
|
|
+ directory = app.directoryUser;
|
|
|
|
|
|
-
|
|
|
+ // Download
|
|
|
+ if (metadata && [[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@", directory, metadata.fileID]] == NO && [metadata.session length] == 0)
|
|
|
+ [self performSelector:@selector(downloadPhotoBrowser:) withObject:metadata];
|
|
|
|
|
|
- if (_sourceDirectoryLocal)
|
|
|
- directory = self.metadataDetail.directoryID;
|
|
|
- else
|
|
|
- directory = app.directoryUser;
|
|
|
-
|
|
|
- // Download
|
|
|
- if (fileID) {
|
|
|
-
|
|
|
- metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"fileID = %@", fileID]];
|
|
|
-
|
|
|
- if (metadata && [[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@", directory, metadata.fileID]] == NO && [metadata.session length] == 0)
|
|
|
- [self performSelector:@selector(downloadPhotoBrowser:) withObject:metadata afterDelay:0.1];
|
|
|
-
|
|
|
- // Title
|
|
|
- if (metadata && !photoBrowser.isGridController)
|
|
|
- self.title = metadata.fileNamePrint;
|
|
|
- }
|
|
|
- }
|
|
|
+ // Title
|
|
|
+ if (metadata && !photoBrowser.isGridController)
|
|
|
+ self.title = metadata.fileNamePrint;
|
|
|
|
|
|
if (_reload) {
|
|
|
|
|
@@ -503,8 +491,6 @@
|
|
|
|
|
|
tableMetadata *metadata = [self.dataSourceImagesVideos objectAtIndex:index];
|
|
|
|
|
|
- //NSLog(@"[LOG] photoBrowser: photoAtIndex : %lu ---- di totali photo : %lu", (unsigned long)index, (unsigned long)_photos.count);
|
|
|
-
|
|
|
if (index < self.photos.count) {
|
|
|
|
|
|
if (metadata.fileID) {
|
|
@@ -533,15 +519,6 @@
|
|
|
[self.photos replaceObjectAtIndex:index withObject:[MWPhoto photoWithImage:[UIImage imageNamed:@"filePreviewError"]]];
|
|
|
|
|
|
} else {
|
|
|
- /*
|
|
|
- UIImage *imageIcon = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.ico", app.directoryUser, metadata.fileID]];
|
|
|
-
|
|
|
- if (imageIcon)
|
|
|
- image = [CCGraphics scaleImage:imageIcon toSize:self.view.bounds.size isAspectRation:YES];
|
|
|
-
|
|
|
- //image = [CCGraphics blurryImage:imageIcon withBlurLevel:2 toSize:self.view.bounds.size];
|
|
|
- else
|
|
|
- */
|
|
|
|
|
|
image = [CCGraphics drawText:[NSLocalizedString(@"_loading_", nil) stringByAppendingString:@"..."] inImage:[UIImage imageNamed:@"button1000x200"] colorText:[UIColor darkGrayColor] sizeOfFont:50];
|
|
|
|