Browse Source

clear code

Marino Faggiana 2 years ago
parent
commit
836498e601

+ 1 - 0
.swiftlint.yml

@@ -49,6 +49,7 @@ excluded:
   - Widget/Lockscreen/LockscreenData.swift
   - Widget/Lockscreen/LockscreenWidgetView.swift
   - Widget/Lockscreen/LockscreenWidgetProvider.swift
+  - iOSClient/ExternalResources
   - iOSClient/Activity/NCActivity.swift
   - iOSClient/Activity/NCActivityTableViewCell.swift
   - iOSClient/AppDelegate.swift

+ 9 - 1
Nextcloud.xcodeproj/project.pbxproj

@@ -1715,6 +1715,14 @@
 			path = NCViewerMedia;
 			sourceTree = "<group>";
 		};
+		F7903A4A2948CAC300203DA5 /* ExternalResources */ = {
+			isa = PBXGroup;
+			children = (
+				F71CD6C92930D7B1006C95C1 /* NCApplicationHandle.swift */,
+			);
+			path = ExternalResources;
+			sourceTree = "<group>";
+		};
 		F79630EC215526B60015EEA5 /* Viewer */ = {
 			isa = PBXGroup;
 			children = (
@@ -1914,7 +1922,6 @@
 				F7362A1E220C853A005101B5 /* LaunchScreen.storyboard */,
 				F70F96AF2874394B006C8379 /* Nextcloud-Bridging-Header.h */,
 				F73CB5771ED46807005F2A5A /* NCBridgeSwift.h */,
-				F71CD6C92930D7B1006C95C1 /* NCApplicationHandle.swift */,
 				F76B3CCD1EAE01BD00921AC9 /* NCBrand.swift */,
 			);
 			path = Brand;
@@ -2118,6 +2125,7 @@
 				F73FAEE224D2CA830090692E /* Diagnostics */,
 				F723986F253D867900257F49 /* EmptyView */,
 				F7A0D14E259229FA008F8A13 /* Extensions */,
+				F7903A4A2948CAC300203DA5 /* ExternalResources */,
 				F7A3214D1E9E2A070069AD1B /* Favorites */,
 				F7725A5D251F33BB00D125E0 /* Files */,
 				F7BFFA621A24D7300044ED85 /* Login */,

+ 2 - 3
iOSClient/AppDelegate.swift

@@ -803,7 +803,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
     // MARK: - Open URL
 
     func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
-        guard !account.isEmpty else { return false }
 
         let scheme = url.scheme
         let action = url.host
@@ -815,7 +814,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
          nextcloud://open-action?action=create-voice-memo&&user=marinofaggiana&url=https://cloud.nextcloud.com
          */
 
-        if scheme == "nextcloud" && action == "open-action" {
+        if !account.isEmpty && scheme == "nextcloud" && action == "open-action" {
 
             if let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false) {
 
@@ -891,7 +890,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
          nextcloud://open-file?path=Talk/IMG_0000123.jpg&user=marinofaggiana&link=https://cloud.nextcloud.com/f/123
          */
 
-        else if scheme == "nextcloud" && action == "open-file" {
+        else if !account.isEmpty && scheme == "nextcloud" && action == "open-file" {
 
             if let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false) {
 

+ 3 - 3
iOSClient/Brand/NCApplicationHandle.swift → iOSClient/ExternalResources/NCApplicationHandle.swift

@@ -26,7 +26,7 @@ import NextcloudKit
 
 class NCApplicationHandle: NSObject {
 
-    let appDelegate = UIApplication.shared.delegate as? AppDelegate
+    let appDelegate = UIApplication.shared.delegate as! AppDelegate
 
     // class: AppDelegate
     // func: application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:])
@@ -41,12 +41,12 @@ class NCApplicationHandle: NSObject {
 
     // class: NCCollectionViewCommon (+Menu)
     // func: toggleMenu(metadata: tableMetadata, imageIcon: UIImage?)
-    func addCollectionViewCommonMenu(metadata: tableMetadata, imageIcon: UIImage?, actions: [NCMenuAction]) {
+    func addCollectionViewCommonMenu(metadata: tableMetadata, imageIcon: UIImage?, actions: inout [NCMenuAction]) {
     }
 
     // class: NCMore
     // func: loadItems()
-    func loadItems(functionMenu: [NKExternalSite]) {
+    func loadItems(functionMenu: inout [NKExternalSite]) {
     }
 
     // class: NCMore

+ 1 - 1
iOSClient/Menu/NCCollectionViewCommon+Menu.swift

@@ -373,7 +373,7 @@ extension NCCollectionViewCommon {
             actions.append(.deleteAction(selectedMetadatas: [metadata], metadataFolder: metadataFolder, viewController: self, order: 170))
         }
 
-        applicationHandle.addCollectionViewCommonMenu(metadata: metadata, imageIcon: imageIcon, actions: actions)
+        applicationHandle.addCollectionViewCommonMenu(metadata: metadata, imageIcon: imageIcon, actions: &actions)
 
         presentMenu(with: actions)
     }

+ 1 - 1
iOSClient/More/NCMore.swift

@@ -169,7 +169,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
         }
 
         // ITEM : HANDLE
-        applicationHandle.loadItems(functionMenu: functionMenu)
+        applicationHandle.loadItems(functionMenu: &functionMenu)
 
         // ORDER ITEM
         functionMenu = functionMenu.sorted(by: { $0.order < $1.order })