Эх сурвалжийг харах

remove old code

Signed-off-by: marinofaggiana <ios@nextcloud.com>
marinofaggiana 2 жил өмнө
parent
commit
0475c2bac0

+ 0 - 3
iOSClient/Brand/NCBrand.swift

@@ -90,9 +90,6 @@ import UIKit
     @objc public var disable_request_account:           Bool = false
     @objc public var disable_log:                       Bool = false
 
-    @objc public var disable_background_color:          Bool = true
-    @objc public var disable_background_image:          Bool = true
-
     override init() {
 
         if folderBrandAutoUpload != "" {

+ 6 - 12
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -329,8 +329,9 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         collectionView.backgroundColor = NCBrandColor.shared.systemBackground
         refreshControl.tintColor = .gray
 
+        /*
         // IMAGE BACKGROUND
-        if let layoutForView = layoutForView, layoutForView.imageBackgroud != "" {
+        if let layoutForView = layoutForView, layoutForView.directoryColor != "" {
             let imagePath = CCUtility.getDirectoryGroup().appendingPathComponent(NCGlobal.shared.appBackground).path + "/" + layoutForView.imageBackgroud
             do {
                 let data = try Data(contentsOf: URL(fileURLWithPath: imagePath))
@@ -344,7 +345,8 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
             backgroundImageView.image = nil
             collectionView.backgroundView = nil
         }
-
+        */
+        
         // COLOR BACKGROUND
         let activeAccount = NCManageDatabase.shared.getActiveAccount()
         if traitCollection.userInterfaceStyle == .dark {
@@ -1002,11 +1004,6 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         if serverUrl != "" {
             listMenuItems.append(UIMenuItem(title: NSLocalizedString("_paste_file_", comment: ""), action: #selector(pasteFilesMenu)))
         }
-        if #available(iOS 13.0, *) {
-            if !NCBrandOptions.shared.disable_background_color {
-                listMenuItems.append(UIMenuItem(title: NSLocalizedString("_background_", comment: ""), action: #selector(backgroundFilesMenu)))
-            }
-        }
 
         if listMenuItems.count > 0 {
             UIMenuController.shared.menuItems = listMenuItems
@@ -1024,11 +1021,6 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
                 return true
             }
         }
-
-        if #selector(backgroundFilesMenu) == action {
-            return true
-        }
-
         return false
     }
 
@@ -1036,6 +1028,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         NCFunctionCenter.shared.pastePasteboard(serverUrl: serverUrl)
     }
 
+    /*
     @objc func backgroundFilesMenu() {
 
         if let vcBackgroundImageColor = UIStoryboard(name: "NCBackgroundImageColor", bundle: nil).instantiateInitialViewController() as? NCBackgroundImageColor {
@@ -1053,6 +1046,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
             self.present(popup, animated: true)
         }
     }
+    */
 
     // MARK: - DataSource + NC Endpoint
 

+ 1 - 39
iOSClient/Main/NCFunctionCenter.swift

@@ -109,10 +109,7 @@ import Photos
             
         case NCGlobal.shared.selectorSaveAlbum:
             saveAlbum(metadata: metadata)
-            
-        case NCGlobal.shared.selectorSaveBackground:
-            saveBackground(metadata: metadata)
-            
+
         case NCGlobal.shared.selectorSaveAlbumLivePhotoIMG, NCGlobal.shared.selectorSaveAlbumLivePhotoMOV:
 
             var metadata = metadata
@@ -383,25 +380,6 @@ import Photos
         })
     }
 
-    func saveBackground(metadata: tableMetadata) {
-
-        let fileNamePath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)!
-        let destination = CCUtility.getDirectoryGroup().appendingPathComponent(NCGlobal.shared.appBackground).path + "/" + metadata.fileNameView
-
-        if NCUtilityFileSystem.shared.copyFile(atPath: fileNamePath, toPath: destination) {
-
-            if appDelegate.activeViewController is NCCollectionViewCommon {
-                let viewController: NCCollectionViewCommon = appDelegate.activeViewController as! NCCollectionViewCommon
-                let layoutKey = viewController.layoutKey
-                let serverUrl = viewController.serverUrl
-                if serverUrl == metadata.serverUrl {
-                    NCUtility.shared.setBackgroundImageForView(key: layoutKey, serverUrl: serverUrl, imageBackgroud: metadata.fileNameView, imageBackgroudContentMode: "")
-                    viewController.changeTheming()
-                }
-            }
-        }
-    }
-
     // MARK: - Copy & Paste
 
     func copyPasteboard(pasteboardOcIds: [String], hudView: UIView) {
@@ -654,14 +632,6 @@ import Photos
             }
         }
 
-        let saveBackground = UIAction(title: NSLocalizedString("_use_as_background_", comment: ""), image: UIImage(systemName: "text.below.photo")) { _ in
-            if CCUtility.fileProviderStorageExists(metadata) {
-                self.saveBackground(metadata: metadata)
-            } else {
-                NCOperationQueue.shared.download(metadata: metadata, selector: NCGlobal.shared.selectorSaveBackground)
-            }
-        }
-
         let viewInFolder = UIAction(title: NSLocalizedString("_view_in_folder_", comment: ""), image: UIImage(systemName: "arrow.forward.square")) { _ in
             self.openFileViewInFolder(serverUrl: metadata.serverUrl, fileName: metadata.fileName)
         }
@@ -781,14 +751,6 @@ import Photos
             children.insert(modify, at: children.count - 1)
         }
 
-        if metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue && viewController is NCCollectionViewCommon && !NCBrandOptions.shared.disable_background_image {
-            let viewController: NCCollectionViewCommon = viewController as! NCCollectionViewCommon
-            let layoutKey = viewController.layoutKey
-            if layoutKey == NCGlobal.shared.layoutViewFiles {
-                children.insert(saveBackground, at: children.count - 1)
-            }
-        }
-
         let submenu = UIMenu(title: "", options: .displayInline, children: children)
         guard appDelegate.disableSharesView == false else { return submenu }
         return UIMenu(title: "", children: [detail, submenu])

+ 0 - 23
iOSClient/Menu/NCCollectionViewCommon+Menu.swift

@@ -271,29 +271,6 @@ extension NCCollectionViewCommon {
             actions.append(.copyAction(selectOcId: [metadata.ocId], hudView: self.view))
         }
         
-        /*
-        //
-        // USE AS BACKGROUND
-        //
-        if #available(iOS 13.0, *) {
-            if metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue && self.layoutKey == NCGlobal.shared.layoutViewFiles && !NCBrandOptions.shared.disable_background_image {
-                actions.append(
-                    NCMenuAction(
-                        title: NSLocalizedString("_use_as_background_", comment: ""),
-                        icon: NCUtility.shared.loadImage(named: "text.below.photo"),
-                        action: { menuAction in
-                            if CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: metadata.fileNameView) {
-                                NCFunctionCenter.shared.saveBackground(metadata: metadata)
-                            } else {
-                                NCOperationQueue.shared.download(metadata: metadata, selector: NCGlobal.shared.selectorSaveBackground)
-                            }
-                        }
-                    )
-                )
-            }
-        }
-        */
-
         //
         // MODIFY
         //

+ 0 - 3
iOSClient/NCGlobal.swift

@@ -79,8 +79,6 @@ class NCGlobal: NSObject {
         var directoryOnTop: Bool
         var titleButtonHeader: String
         var itemForLine: Int
-        var imageBackgroud: String
-        var imageBackgroudContentMode: String
     }
 
     // Directory on Group
@@ -292,7 +290,6 @@ class NCGlobal: NSObject {
     let selectorUploadFile                          = "uploadFile"
     let selectorUploadFileShareExtension            = "uploadFileShareExtension"
     let selectorSaveAlbum                           = "saveAlbum"
-    let selectorSaveBackground                      = "saveBackground"
     let selectorSaveAlbumLivePhotoIMG               = "saveAlbumLivePhotoIMG"
     let selectorSaveAlbumLivePhotoMOV               = "saveAlbumLivePhotoMOV"
     let selectorSaveAsScan                          = "saveAsScan"

+ 2 - 19
iOSClient/Utility/NCUtility.swift

@@ -43,7 +43,7 @@ class NCUtility: NSObject {
 
     func setLayoutForView(key: String, serverUrl: String, layoutForView: NCGlobal.layoutForViewType) {
 
-        let string =  layoutForView.layout + "|" + layoutForView.sort + "|" + "\(layoutForView.ascending)" + "|" + layoutForView.groupBy + "|" + "\(layoutForView.directoryOnTop)" + "|" + layoutForView.titleButtonHeader + "|" + "\(layoutForView.itemForLine)" + "|" + layoutForView.imageBackgroud + "|" + layoutForView.imageBackgroudContentMode
+        let string =  layoutForView.layout + "|" + layoutForView.sort + "|" + "\(layoutForView.ascending)" + "|" + layoutForView.groupBy + "|" + "\(layoutForView.directoryOnTop)" + "|" + layoutForView.titleButtonHeader + "|" + "\(layoutForView.itemForLine)"
         var keyStore = key
 
         if serverUrl != "" {
@@ -63,20 +63,10 @@ class NCUtility: NSObject {
         }
     }
 
-    func setBackgroundImageForView(key: String, serverUrl: String, imageBackgroud: String, imageBackgroudContentMode: String) {
-
-        var layoutForView: NCGlobal.layoutForViewType = NCUtility.shared.getLayoutForView(key: key, serverUrl: serverUrl)
-
-        layoutForView.imageBackgroud = imageBackgroud
-        layoutForView.imageBackgroudContentMode = imageBackgroudContentMode
-
-        setLayoutForView(key: key, serverUrl: serverUrl, layoutForView: layoutForView)
-    }
-
     func getLayoutForView(key: String, serverUrl: String, sort: String = "fileName", ascending: Bool = true, titleButtonHeader: String = "_sorted_by_name_a_z_") -> (NCGlobal.layoutForViewType) {
 
         var keyStore = key
-        var layoutForView: NCGlobal.layoutForViewType = NCGlobal.layoutForViewType(layout: NCGlobal.shared.layoutList, sort: sort, ascending: ascending, groupBy: "none", directoryOnTop: true, titleButtonHeader: titleButtonHeader, itemForLine: 3, imageBackgroud: "", imageBackgroudContentMode: "")
+        var layoutForView: NCGlobal.layoutForViewType = NCGlobal.layoutForViewType(layout: NCGlobal.shared.layoutList, sort: sort, ascending: ascending, groupBy: "none", directoryOnTop: true, titleButtonHeader: titleButtonHeader, itemForLine: 3)
 
         if serverUrl != "" {
             keyStore = serverUrl
@@ -97,13 +87,6 @@ class NCUtility: NSObject {
             layoutForView.directoryOnTop = NSString(string: array[4]).boolValue
             layoutForView.titleButtonHeader = array[5]
             layoutForView.itemForLine = Int(NSString(string: array[6]).intValue)
-            // version 2
-            if array.count > 8 {
-                layoutForView.imageBackgroud = array[7]
-                layoutForView.imageBackgroudContentMode = array[8]
-                // layoutForView.lightColorBackground = array[9] WAS STRING
-                // layoutForView.darkColorBackground = array[10] WAS STRING
-            }
         }
 
         return layoutForView