Browse Source

add : disable_openin_file

Marino Faggiana 6 years ago
parent
commit
76bed1617c

+ 1 - 1
File Provider Extension/FileProviderData.swift

@@ -62,7 +62,7 @@ class FileProviderData: NSObject {
     
     func setupActiveAccount() -> Bool {
         
-        if CCUtility.getDisableFilesApp() {
+        if CCUtility.getDisableFilesApp() || NCBrandOptions.sharedInstance.disable_openin_file {
             return false
         }
         

+ 1 - 1
iOSClient/Brand/NCBrand.swift

@@ -103,7 +103,7 @@ class NCBrandColor: NSObject {
     @objc public let disable_multiaccount:              Bool = false
     @objc public let disable_manage_account:            Bool = false
     @objc public let disable_more_external_site:        Bool = false
-    @objc public let disable_share_file:                Bool = false
+    @objc public let disable_openin_file:               Bool = false
 
     override init() {
         

+ 1 - 1
iOSClient/Favorites/CCFavorites.m

@@ -506,7 +506,7 @@
     }];
     
     // NO Directory
-    if (metadata.directory == NO) {
+    if (metadata.directory == NO && [NCBrandOptions sharedInstance].disable_openin_file == NO) {
         
         [actionSheet addButtonWithTitle:NSLocalizedString(@"_open_in_", nil) image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"openFile"] multiplier:2 color:[NCBrandColor sharedInstance].brandElement] backgroundColor:[NCBrandColor sharedInstance].backgroundView height: 50.0 type:AHKActionSheetButtonTypeDefault handler:^(AHKActionSheet *as) {
             [self.tableView setEditing:NO animated:YES];

+ 9 - 20
iOSClient/Library/MWPhotoBrowser/MWPhotoBrowser.m

@@ -248,29 +248,18 @@ static void * MWVideoPlayerObservation = &MWVideoPlayerObservation;
         [items addObject:flexSpace];
     }
 
-    // Right - Action
+    if (_deleteButton) {
+        [items addObject:_deleteButton];
+        [items addObject:fixedSpaceMini];
+    }
+    if (_shareButton) {
+        [items addObject:_shareButton];
+        [items addObject:fixedSpaceMini];
+    }
     if (_actionButton) {
-        
-        if (_deleteButton) {
-            
-            [items addObject:_deleteButton];
-            [items addObject:fixedSpaceMini];
-        }
-        if (_shareButton) {
-            
-            [items addObject:_shareButton];
-            [items addObject:fixedSpaceMini];
-        }
         [items addObject:_actionButton];
-        
-    } else {
-        
-        // We're not showing the toolbar so try and show in top right
-        if (_actionButton)
-            self.navigationItem.rightBarButtonItem = _actionButton;
-        [items addObject:fixedSpace];
     }
-
+    
     // Toolbar visibility
     [_toolbar setItems:items];
     BOOL hideToolbar = YES;

+ 8 - 2
iOSClient/Main/CCDetail.m

@@ -277,7 +277,9 @@
     fixedSpaceMini.width = 25;
     
     buttonModifyTxt = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"actionSheetModify"] style:UIBarButtonItemStylePlain target:self action:@selector(modifyTxtButtonPressed:)];
-    buttonAction = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"openFile"] style:UIBarButtonItemStylePlain target:self action:@selector(actionButtonPressed:)];
+    if (![NCBrandOptions sharedInstance].disable_openin_file) {
+        buttonAction = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"openFile"] style:UIBarButtonItemStylePlain target:self action:@selector(actionButtonPressed:)];
+    }
     buttonShare  = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"share"] style:UIBarButtonItemStylePlain target:self action:@selector(shareButtonPressed:)];
     buttonDelete = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemTrash target:self action:@selector(deleteButtonPressed:)];
     
@@ -527,7 +529,11 @@
     }
     
     // PhotoBrowser
-    self.photoBrowser.displayActionButton = YES;
+    if ([NCBrandOptions sharedInstance].disable_openin_file) {
+        self.photoBrowser.displayActionButton = NO;
+    } else {
+        self.photoBrowser.displayActionButton = YES;
+    }
     self.photoBrowser.displayDeleteButton = YES;
     if ([CCUtility isFolderEncrypted:serverUrl account:appDelegate.activeAccount]) // E2EE
         self.photoBrowser.displayShareButton = NO;

+ 27 - 13
iOSClient/Main/CCMain.m

@@ -2752,14 +2752,22 @@
     appDelegate.deleteItem = [[REMenuItem alloc] initWithTitle:NSLocalizedString(@"_delete_selected_files_", nil) subtitle:@"" image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"delete"] multiplier:2 color:[NCBrandColor sharedInstance].icon] highlightedImage:nil action:^(REMenuItem *item) {
         [self deleteFile];
     }];
-
+    
     // E2EE
     if (_metadataFolder.e2eEncrypted) {
-        appDelegate.reSelectMenu = [[REMenu alloc] initWithItems:@[appDelegate.selectAllItem, appDelegate.downloadItem, appDelegate.saveItem, appDelegate.deleteItem]];
+        if ([NCBrandOptions sharedInstance].disable_openin_file) {
+            appDelegate.reSelectMenu = [[REMenu alloc] initWithItems:@[appDelegate.selectAllItem, appDelegate.downloadItem, appDelegate.deleteItem]];
+        } else {
+            appDelegate.reSelectMenu = [[REMenu alloc] initWithItems:@[appDelegate.selectAllItem, appDelegate.downloadItem, appDelegate.saveItem, appDelegate.deleteItem]];
+        }
     } else {
-        appDelegate.reSelectMenu = [[REMenu alloc] initWithItems:@[appDelegate.selectAllItem, appDelegate.moveItem, appDelegate.downloadItem, appDelegate.saveItem, appDelegate.deleteItem]];
+        if ([NCBrandOptions sharedInstance].disable_openin_file) {
+            appDelegate.reSelectMenu = [[REMenu alloc] initWithItems:@[appDelegate.selectAllItem, appDelegate.moveItem, appDelegate.downloadItem, appDelegate.deleteItem]];
+        } else {
+            appDelegate.reSelectMenu = [[REMenu alloc] initWithItems:@[appDelegate.selectAllItem, appDelegate.moveItem, appDelegate.downloadItem, appDelegate.saveItem, appDelegate.deleteItem]];
+        }
     }
-    
+
     appDelegate.reSelectMenu.imageOffset = CGSizeMake(5, -1);
     
     appDelegate.reSelectMenu.separatorOffset = CGSizeMake(50.0, 0.0);
@@ -2858,7 +2866,11 @@
         
         UIMenuItem *pasteFilesItem = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"_paste_files_", nil) action:@selector(pasteFiles:)];
         
-        [menuController setMenuItems:[NSArray arrayWithObjects:copyFileItem, copyFilesItem, openinFileItem, pasteFileItem, pasteFilesItem, nil]];
+        if ([NCBrandOptions sharedInstance].disable_openin_file) {
+            [menuController setMenuItems:[NSArray arrayWithObjects:copyFileItem, copyFilesItem, pasteFileItem, pasteFilesItem, nil]];
+        } else {
+            [menuController setMenuItems:[NSArray arrayWithObjects:copyFileItem, copyFilesItem, openinFileItem, pasteFileItem, pasteFilesItem, nil]];
+        }
         
         [menuController setTargetRect:CGRectMake(touchPoint.x, touchPoint.y, 0.0f, 0.0f) inView:self.tableView];
         [menuController setMenuVisible:YES animated:YES];
@@ -3625,15 +3637,17 @@
                                         }];
         }
         
-        [actionSheet addButtonWithTitle:NSLocalizedString(@"_open_in_", nil)
-                                  image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"openFile"] multiplier:2 color:[NCBrandColor sharedInstance].icon]
-                        backgroundColor:[NCBrandColor sharedInstance].backgroundView
-                                 height: 50.0
-                                   type:AHKActionSheetButtonTypeDefault
-                                handler:^(AHKActionSheet *as) {
-                                    [self performSelector:@selector(DownloadOpenIn:) withObject:self.metadata];
-                                }];
+        if (![NCBrandOptions sharedInstance].disable_openin_file) {
         
+            [actionSheet addButtonWithTitle:NSLocalizedString(@"_open_in_", nil)
+                                      image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"openFile"] multiplier:2 color:[NCBrandColor sharedInstance].icon]
+                            backgroundColor:[NCBrandColor sharedInstance].backgroundView
+                                     height: 50.0
+                                       type:AHKActionSheetButtonTypeDefault
+                                    handler:^(AHKActionSheet *as) {
+                                        [self performSelector:@selector(DownloadOpenIn:) withObject:self.metadata];
+                                    }];
+        }
         
         [actionSheet addButtonWithTitle:NSLocalizedString(@"_rename_", nil)
                                   image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"rename"] multiplier:2 color:[NCBrandColor sharedInstance].icon]

+ 4 - 0
iOSClient/Richdocument/NCRichdocument.swift

@@ -95,6 +95,10 @@ class NCRichdocument: NSObject, WKNavigationDelegate, WKScriptMessageHandler, CC
                 movieNavigationController.modalPresentationStyle = UIModalPresentationStyle.formSheet
                 self.viewDetail.present(movieNavigationController, animated: true, completion: nil)
             }
+            
+            if message.body as! String == "share" {
+                appDelegate.activeMain.openWindowShare(viewDetail.metadataDetail)
+            }
         }
     }
     

+ 13 - 10
iOSClient/Settings/CCAdvanced.m

@@ -112,16 +112,19 @@
     
     // Section : Files App --------------------------------------------------------------
     
-    section = [XLFormSectionDescriptor formSection];
-    [form addFormSection:section];
-    section.footerTitle = NSLocalizedString(@"_disable_files_app_footer_", nil);
-
-    // Disable Files App
-    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"disablefilesapp" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_disable_files_app_", nil)];
-    if ([CCUtility getDisableFilesApp]) row.value = @"1";
-    else row.value = @"0";
-    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
-    [section addFormRow:row];
+    if (![NCBrandOptions sharedInstance].disable_openin_file) {
+    
+        section = [XLFormSectionDescriptor formSection];
+        [form addFormSection:section];
+        section.footerTitle = NSLocalizedString(@"_disable_files_app_footer_", nil);
+
+        // Disable Files App
+        row = [XLFormRowDescriptor formRowDescriptorWithTag:@"disablefilesapp" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_disable_files_app_", nil)];
+        if ([CCUtility getDisableFilesApp]) row.value = @"1";
+        else row.value = @"0";
+        [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
+        [section addFormRow:row];
+    }
     
     // Section CLEAR CACHE -------------------------------------------------