Skip to content

Commit fa505db

Browse files
committed
Generate share link when sharing folder, and make share button available.
1 parent 13bfa72 commit fa505db

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

seafile/SeafFileViewController.m

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,7 @@ - (void)editDone:(id)sender
988988

989989
// Restore original title
990990
self.customTitleLabel.text = self.directory.name;
991+
_selectedindex = nil;
991992

992993
UIBarButtonItem *customBarButton = [[UIBarButtonItem alloc] initWithCustomView:[SeafNavLeftItem navLeftItemWithDirectory:self.directory target:self action:@selector(backButtonTapped)]];
993994
self.navigationItem.leftBarButtonItem = customBarButton;
@@ -1058,6 +1059,7 @@ - (void)noneSelected:(BOOL)none
10581059
{
10591060
if (none) {
10601061
// Get done button container view
1062+
_selectedindex = nil;
10611063
UIView *containerView = (UIView *)self.doneItem.customView;
10621064
UILabel *countLabel = [containerView.subviews.lastObject isKindOfClass:[UILabel class]] ?
10631065
(UILabel *)containerView.subviews.lastObject : nil;
@@ -1234,7 +1236,7 @@ - (void)popupRenameView:(NSString *)oldName
12341236
if ([_curEntry isKindOfClass:[SeafRepo class]]) {
12351237
repo = (SeafRepo *)_curEntry;
12361238
} else {
1237-
repo = (SeafRepo *)[self getDentrybyIndexPath:_selectedindex tableView:self.tableView];
1239+
return;
12381240
}
12391241
[[SeafFileOperationManager sharedManager]
12401242
renameEntry:oldName
@@ -2531,13 +2533,8 @@ - (void)setupCustomTabTool {
25312533
// Set button sizes and spacing
25322534
CGFloat screenWidth = customToolView.bounds.size.width;
25332535

2534-
// First row - evenly divide screen width
2535-
CGFloat firstRowButtonWidth = screenWidth / 5.0;
2536-
CGFloat firstRowTopPosition = kCustomTabToolWithTopPadding;
2537-
25382536
// Calculate second row position
25392537
CGFloat buttonHeight = kCustomTabToolButtonHeight;
2540-
CGFloat secondRowTopPosition = kCustomTabToolWithTopPadding + buttonHeight + 25;
25412538

25422539
// Set initial position below screen
25432540
CGRect initialFrame = customToolView.frame;
@@ -2709,6 +2706,21 @@ - (void)handleToolButtonTap:(UITapGestureRecognizer *)gesture {
27092706
// Execute action based on button type
27102707
switch (buttonView.tag) {
27112708
case ToolButtonShare: {
2709+
if (selectedItems.count == 1) {
2710+
SeafBase *selectedItem = selectedItems.firstObject;
2711+
if ([selectedItem isKindOfClass:[SeafDir class]]) {
2712+
self.state = STATE_SHARE_LINK;
2713+
[self editDone:nil]; // Exit edit mode here
2714+
if (!selectedItem.shareLink) {
2715+
[SVProgressHUD showWithStatus:NSLocalizedString(@"Generate share link ...", @"Seafile")];
2716+
[selectedItem generateShareLink:self];
2717+
} else {
2718+
[self generateSharelink:selectedItem WithResult:YES];
2719+
}
2720+
break;
2721+
}
2722+
}
2723+
27122724
self.state = STATE_EXPORT;
27132725
[self editDone:nil]; // Exit edit mode here
27142726
@weakify(self);
@@ -2834,9 +2846,8 @@ - (void)updateToolButtonsState {
28342846
if (selectedItems.count == 0) {
28352847
[self setAllToolButtonEnable:NO];
28362848
} else if (selectedItems.count == 1) {
2849+
_selectedindex = selectedIndexPaths.firstObject;
28372850
[self setAllToolButtonEnable:YES];
2838-
2839-
[self updateExportBarItem:selectedItems];//set share btn
28402851
} else {
28412852
//redownload
28422853
[self updateToolButton:ToolButtonDownload enabled:YES];

0 commit comments

Comments
 (0)