marinofaggiana 3 years ago
parent
commit
85dc2f4a96

+ 16 - 12
Nextcloud.xcodeproj/project.pbxproj

@@ -221,6 +221,7 @@
 		F77B0F611D118A16002130FE /* Acknowledgements.rtf in Resources */ = {isa = PBXBuildFile; fileRef = F7ACE42B1BAC0268006C0017 /* Acknowledgements.rtf */; };
 		F77B0F631D118A16002130FE /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = F7E70DE91A24DE4100E1B66A /* Localizable.strings */; };
 		F77B0F7D1D118A16002130FE /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F7F67BB81A24D27800EE80DA /* Images.xcassets */; };
+		F77EFC0C26D6751F00806ED6 /* NCShareQuickStatusMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = F77EFC0B26D6751F00806ED6 /* NCShareQuickStatusMenu.swift */; };
 		F78071091EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m in Sources */ = {isa = PBXBuildFile; fileRef = F78071081EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m */; };
 		F780710A1EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m in Sources */ = {isa = PBXBuildFile; fileRef = F78071081EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m */; };
 		F78295311F962EFA00A572F5 /* NCEndToEndEncryption.m in Sources */ = {isa = PBXBuildFile; fileRef = F70CAE391F8CF31A008125FD /* NCEndToEndEncryption.m */; };
@@ -643,6 +644,7 @@
 		F77910A425DD517B00CEDB9E /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; };
 		F77910AA25DD53C700CEDB9E /* NCSettingsBundleHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCSettingsBundleHelper.swift; sourceTree = "<group>"; };
 		F77A697C250A0FBC00FF1708 /* NCCollectionViewCommon+Menu.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NCCollectionViewCommon+Menu.swift"; sourceTree = "<group>"; };
+		F77EFC0B26D6751F00806ED6 /* NCShareQuickStatusMenu.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCShareQuickStatusMenu.swift; sourceTree = "<group>"; };
 		F78071071EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSNotificationCenter+MainThread.h"; sourceTree = "<group>"; };
 		F78071081EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSNotificationCenter+MainThread.m"; sourceTree = "<group>"; };
 		F785EE9C246196DF00B3F945 /* NCNetworkingE2EE.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCNetworkingE2EE.swift; sourceTree = "<group>"; };
@@ -993,23 +995,24 @@
 		F728CE741BF6322C00E69702 /* Share */ = {
 			isa = PBXGroup;
 			children = (
-				F73CB3B122E072A000AD728E /* NCShareHeaderView.xib */,
 				F700510022DF63AC003A3356 /* NCShare.storyboard */,
-				F787704E22E7019900F287A9 /* NCShareLinkCell.xib */,
-				F769453B22E9CFFF000A798A /* NCShareUserCell.xib */,
-				F7DFAA8922E22EF100FC4527 /* NCShareLinkMenuView.xib */,
-				F79728D322F96F2D003CACA7 /* NCShareLinkFolderMenuView.xib */,
-				F769453D22E9E97D000A798A /* NCShareUserMenuView.xib */,
-				F79728D522F9A0B0003CACA7 /* NCShareUserFolderMenuView.xib */,
-				F774264822EB4D0000B23912 /* NCShareUserDropDownCell.xib */,
-				F723B3DC22FC6D1C00301EFE /* NCShareCommentsCell.xib */,
 				F700510422DF6A89003A3356 /* NCShare.swift */,
-				F769453F22E9F077000A798A /* NCSharePaging.swift */,
 				F7E4D9C322ED929B003675FD /* NCShareComments.swift */,
+				F723B3DC22FC6D1C00301EFE /* NCShareCommentsCell.xib */,
+				F769454522E9F1B0000A798A /* NCShareCommon.swift */,
+				F73CB3B122E072A000AD728E /* NCShareHeaderView.xib */,
+				F787704E22E7019900F287A9 /* NCShareLinkCell.xib */,
+				F79728D322F96F2D003CACA7 /* NCShareLinkFolderMenuView.xib */,
 				F769454122E9F0EE000A798A /* NCShareLinkMenuView.swift */,
-				F769454322E9F142000A798A /* NCShareUserMenuView.swift */,
+				F7DFAA8922E22EF100FC4527 /* NCShareLinkMenuView.xib */,
 				F769454722E9F20D000A798A /* NCShareNetworking.swift */,
-				F769454522E9F1B0000A798A /* NCShareCommon.swift */,
+				F769453F22E9F077000A798A /* NCSharePaging.swift */,
+				F77EFC0B26D6751F00806ED6 /* NCShareQuickStatusMenu.swift */,
+				F769453B22E9CFFF000A798A /* NCShareUserCell.xib */,
+				F774264822EB4D0000B23912 /* NCShareUserDropDownCell.xib */,
+				F79728D522F9A0B0003CACA7 /* NCShareUserFolderMenuView.xib */,
+				F769454322E9F142000A798A /* NCShareUserMenuView.swift */,
+				F769453D22E9E97D000A798A /* NCShareUserMenuView.xib */,
 			);
 			path = Share;
 			sourceTree = "<group>";
@@ -2192,6 +2195,7 @@
 				F769454422E9F142000A798A /* NCShareUserMenuView.swift in Sources */,
 				F7581D2425EFDDDF004DC699 /* NCMedia+Menu.swift in Sources */,
 				F77B0E981D118A16002130FE /* CCManageAccount.m in Sources */,
+				F77EFC0C26D6751F00806ED6 /* NCShareQuickStatusMenu.swift in Sources */,
 				F702F30125EE5D2C008F8E80 /* NYMnemonic.m in Sources */,
 				F7EFA47825ADBA500083159A /* NCViewerProviderContextMenu.swift in Sources */,
 				F755BD9B20594AC7008C5FBB /* NCService.swift in Sources */,

+ 21 - 0
iOSClient/Images.xcassets/downArrow.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "downArrow@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
iOSClient/Images.xcassets/downArrow.imageset/downArrow@2x.png


+ 4 - 0
iOSClient/NCGlobal.swift

@@ -320,6 +320,10 @@ class NCGlobal: NSObject {
     
     let notificationCenterChangedLocation                       = "changedLocation"
     let notificationStatusAuthorizationChangedLocation          = "statusAuthorizationChangedLocation"
+    
+    let notificationCenterSharePermissionReadOnly               = "sharePermissionReadOnly"
+    let notificationCenterSharePermissionEditing                = "sharePermissionEditing"
+    let notificationCenterSharePermissionFileDrop               = "sharePermissionFileDrop"
 }
 
 //let rootView = UIApplication.shared.keyWindow?.rootViewController?.view

+ 73 - 0
iOSClient/Share/NCShareQuickStatusMenu.swift

@@ -0,0 +1,73 @@
+//
+//  NCShareQuickStatusMenu.swift
+//  Nextcloud
+//
+//  Created by TSI-mc on 30/06/21.
+//  Copyright © 2021 Marino Faggiana. All rights reserved.
+//
+
+import UIKit
+
+class NCShareQuickStatusMenu: NSObject {
+        
+    func toggleMenu(viewController: UIViewController, directory: Bool, status: Int) {
+        
+        print(status)
+        let menuViewController = UIStoryboard.init(name: "NCMenu", bundle: nil).instantiateInitialViewController() as! NCMenu
+        var actions = [NCMenuAction]()
+
+//        "_share_read_only_"             = "Read only";
+//        "_share_editing_"               = "Editing";
+//        "_share_allow_upload_"          = "Allow upload and editing";
+//        "_share_file_drop_"             = "File drop (upload only)";
+        
+        actions.append(
+            NCMenuAction(
+                title: NSLocalizedString("_share_read_only_", comment: ""),
+                icon: UIImage(),
+                selected: status == NCGlobal.shared.permissionReadShare + NCGlobal.shared.permissionShareShare,
+                on: false,
+                action: { menuAction in
+                    NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterSharePermissionReadOnly)
+                }
+            )
+        )
+
+        actions.append(
+            NCMenuAction(
+                title: directory ? NSLocalizedString("_share_allow_upload_", comment: "") : NSLocalizedString("_share_editing_", comment: ""),
+                icon: UIImage(),
+                selected: status == NCGlobal.shared.permissionMaxFileShare || status == NCGlobal.shared.permissionMaxFolderShare ||  status == NCGlobal.shared.permissionDefaultFileRemoteShareNoSupportShareOption,
+                on: false,
+                action: { menuAction in
+                    NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterSharePermissionEditing)
+                }
+            )
+        )
+        
+        if directory {
+            actions.append(
+                NCMenuAction(
+                    title: NSLocalizedString("_share_file_drop_", comment: ""),
+                    icon: UIImage(),
+                    selected: status == NCGlobal.shared.permissionCreateShare,
+                    on: false,
+                    action: { menuAction in
+                        NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterSharePermissionFileDrop)
+                    }
+                )
+            )
+        }
+
+        menuViewController.actions = actions
+
+        let menuPanelController = NCMenuPanelController()
+        menuPanelController.parentPresenter = viewController
+        menuPanelController.delegate = menuViewController
+        menuPanelController.set(contentViewController: menuViewController)
+        menuPanelController.track(scrollView: menuViewController.tableView)
+
+        viewController.present(menuPanelController, animated: true, completion: nil)
+    }
+}
+

+ 5 - 26
iOSClient/Supporting Files/en.lproj/Localizable.strings

@@ -584,6 +584,7 @@
 "_delete_comment_"              = "Delete comment";
 "_share_allow_editing_"         = "Allow editing";
 "_share_read_only_"             = "View only";
+"_share_editing_"               = "Editing";
 "_share_allow_upload_"          = "Allow upload and editing";
 "_share_file_drop_"             = "File drop (upload only)";
 "_share_hide_download_"         = "Hide download";
@@ -592,35 +593,13 @@
 "_share_note_recipient_"        = "Note to recipient";
 "_share_delete_sharelink_"      = "Delete link";
 "_share_add_sharelink_"         = "Add another link";
-"_share_can_reshare_"           = "Can reshare";
-"_share_can_create_"            = "Can create";
-"_share_can_change_"            = "Can change";
-"_share_can_delete_"            = "Can delete";
+"_share_can_reshare_"           = "Allow resharing";
+"_share_can_create_"            = "Allow creating";
+"_share_can_change_"            = "Allow editing";
+"_share_can_delete_"            = "Allow deleting";
 "_share_unshare_"               = "Unshare";
 "_share_internal_link_"         = "Internal link";
 "_share_internal_link_des_"     = "Only works for users with access to this folder";
-"_share_permission_title_"          = "Privileges";
-"_share_permission_edit_"           = "Can edit";
-"_share_permission_file_can_write_" = "Can write file";
-"_share_permission_create_"         = "Can create";
-"_share_permission_create_file_"    = "Can create files";
-"_share_permission_create_folder_"  = "Can create folders";
-"_share_permission_change_"         = "Can change";
-"_share_permission_delete_"         = "Can delete";
-"_share_permission_share_"          = "Can share";
-"_share_permission_rename_"         = "Can rename";
-"_share_permission_move_"           = "Can move";
-"_share_permission_read_"           = "Can read";
-"_share_permission_info_"           = "Sharing information";
-"_share_permission_path_"           = "File/Folder";
-"_share_permission_type_"           = "Type";
-"_share_permission_typeuser_"       = "User";
-"_share_permission_typegroup_"      = "Group";
-"_share_permission_typepubliclink_" = "Link";
-"_share_permission_typefederated_"  = "Federated";
-"_share_permission_owner_"          = "Owner";
-"_share_permission_date_"           = "Date";
-"_share_permission_email_"          = "Notification via email";
 "_no_transfer_"                     = "No transfers yet";
 "_no_transfer_sub_"                 = "Uploads and downloads from this device will show up here";
 "_no_activity_"                     = "No activity yet";