Skip to content

Commit 49d5185

Browse files
committed
Added a protection to support files that do not support oc_privatelink
1 parent 94720f6 commit 49d5185

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

Owncloud iOs Client/Tabs/FileTab/Share/ShareMainViewController.m

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -505,19 +505,24 @@ - (UITableViewCell *) getCellOfFileOrFolderInformationByTableView:(UITableView *
505505
shareFileCell.fileSize.hidden = self.sharedItem.isDirectory;
506506
shareFileCell.folderName.hidden = !self.sharedItem.isDirectory;
507507

508-
//Add long press event
509-
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(didLongPressPrivateLinkButton:)];
510-
// longPress.minimumPressDuration = 3; //seconds
511-
longPress.delegate = self;
512-
[shareFileCell.privateLinkButton addGestureRecognizer:longPress];
513-
514-
//Add tap event
515-
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapPrivateLinkButton)];
516-
tapGesture.numberOfTapsRequired = 1;
517-
tapGesture.numberOfTouchesRequired = 1;
518-
[shareFileCell.privateLinkButton addGestureRecognizer:tapGesture];
519-
520-
shareFileCell.privateLinkButton.tag = -1;
508+
if (self.sharedItem.ocPrivatelink && !([self.sharedItem.ocPrivatelink isEqual:@""])) {
509+
//Add long press event
510+
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(didLongPressPrivateLinkButton:)];
511+
// longPress.minimumPressDuration = 3; //seconds
512+
longPress.delegate = self;
513+
[shareFileCell.privateLinkButton addGestureRecognizer:longPress];
514+
515+
//Add tap event
516+
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapPrivateLinkButton)];
517+
tapGesture.numberOfTapsRequired = 1;
518+
tapGesture.numberOfTouchesRequired = 1;
519+
[shareFileCell.privateLinkButton addGestureRecognizer:tapGesture];
520+
521+
shareFileCell.privateLinkButton.tag = -1;
522+
} else {
523+
shareFileCell.privateLinkButton.hidden = true;
524+
shareFileCell.privateLinkButton.enabled = false;
525+
}
521526

522527

523528
if (self.sharedItem.isDirectory) {

0 commit comments

Comments
 (0)