|
@@ -70,6 +70,11 @@
|
|
|
|
|
|
// Title
|
|
|
self.title = NSLocalizedString(@"_list_shares_", nil);
|
|
|
+
|
|
|
+ // Register for 3D Touch Previewing if available
|
|
|
+ if ([self.traitCollection respondsToSelector:@selector(forceTouchCapability)] && (self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable)) {
|
|
|
+ [self registerForPreviewingWithDelegate:self sourceView:self.view];
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// Apparirà
|
|
@@ -132,6 +137,42 @@
|
|
|
return [[NSAttributedString alloc] initWithString:text attributes:attributes];
|
|
|
}
|
|
|
|
|
|
+#pragma mark -
|
|
|
+#pragma --------------------------------------------------------------------------------------------
|
|
|
+#pragma mark ===== Peek & Pop =====
|
|
|
+#pragma --------------------------------------------------------------------------------------------
|
|
|
+
|
|
|
+- (UIViewController *)previewingContext:(id<UIViewControllerPreviewing>)previewingContext viewControllerForLocation:(CGPoint)location
|
|
|
+{
|
|
|
+ CGPoint convertedLocation = [self.view convertPoint:location toView:self.tableView];
|
|
|
+ NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:convertedLocation];
|
|
|
+ tableShare *table = [_dataSource objectAtIndex:indexPath.row];
|
|
|
+ tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@ AND fileName == %@", appDelegate.activeAccount, table.serverUrl, table.fileName]];
|
|
|
+
|
|
|
+ NCSharesCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
|
|
|
+
|
|
|
+ if (cell) {
|
|
|
+ previewingContext.sourceRect = cell.frame;
|
|
|
+ CCPeekPop *viewController = [[UIStoryboard storyboardWithName:@"CCPeekPop" bundle:nil] instantiateViewControllerWithIdentifier:@"PeekPopImagePreview"];
|
|
|
+
|
|
|
+ viewController.metadata = metadata;
|
|
|
+ viewController.imageFile = cell.fileImageView.image;
|
|
|
+ viewController.showOpenIn = false;
|
|
|
+ viewController.showShare = false;
|
|
|
+
|
|
|
+ return viewController;
|
|
|
+ }
|
|
|
+
|
|
|
+ return nil;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)previewingContext:(id<UIViewControllerPreviewing>)previewingContext commitViewController:(UIViewController *)viewControllerToCommit
|
|
|
+{
|
|
|
+ NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:previewingContext.sourceRect.origin];
|
|
|
+
|
|
|
+ [self tableView:self.tableView didSelectRowAtIndexPath:indexPath];
|
|
|
+}
|
|
|
+
|
|
|
#pragma --------------------------------------------------------------------------------------------
|
|
|
#pragma mark ==== unShare <Delegate> ====
|
|
|
#pragma --------------------------------------------------------------------------------------------
|