Sfoglia il codice sorgente

add DB

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 anni fa
parent
commit
f53e68fb3f

+ 1 - 1
Share/NCShareExtension+Files.swift

@@ -29,7 +29,7 @@ extension NCShareExtension {
 
         var groupByField = "name"
 
-        layoutForView = NCUtility.shared.getLayoutForView(key: keyLayout, serverUrl: serverUrl)
+        layoutForView = NCManageDatabase.shared.setLayoutForView(account: activeAccount.account, key: keyLayout, serverUrl: serverUrl)
 
         // set GroupField for Grid
         if layoutForView?.layout == NCGlobal.shared.layoutGrid {

+ 1 - 1
Share/NCShareExtension+NCDelegate.swift

@@ -97,7 +97,7 @@ extension NCShareExtension: NCEmptyDataSetDelegate, NCAccountRequestDelegate {
 
         serverUrl = NCUtilityFileSystem.shared.getHomeServer(urlBase: activeAccount.urlBase, userId: activeAccount.userId)
 
-        layoutForView = NCUtility.shared.getLayoutForView(key: keyLayout, serverUrl: serverUrl)
+        layoutForView = NCManageDatabase.shared.getLayoutForView(account: activeAccount.account, key: keyLayout, serverUrl: serverUrl)
 
         reloadDatasource(withLoadFolder: true)
         setNavigationBar(navigationTitle: NCBrandOptions.shared.brand)

+ 1 - 1
Share/NCShareExtension.swift

@@ -58,7 +58,7 @@ class NCShareExtension: UIViewController {
     var metadataFolder: tableMetadata?
     var networkInProgress = false
     var dataSource = NCDataSource()
-    var layoutForView: NCGlobal.layoutForViewType?
+    var layoutForView: NCDBLayoutForView?
     let heightRowTableView: CGFloat = 50
     let heightCommandView: CGFloat = 170
     var autoUploadFileName = ""

+ 30 - 5
iOSClient/Data/NCManageDatabase+LayoutForView.swift

@@ -42,18 +42,23 @@ class NCDBLayoutForView: Object {
 extension NCManageDatabase {
 
     @discardableResult
-    func setLayoutForView(account: String, keyStore: String, layout: String? = nil, sort: String? = nil, ascending: Bool? = nil, groupBy: String? = nil, directoryOnTop: Bool? = nil, titleButtonHeader: String? = nil, itemForLine: Int? = nil) -> NCDBLayoutForView? {
+    func setLayoutForView(account: String, key: String, serverUrl: String, layout: String? = nil, sort: String? = nil, ascending: Bool? = nil, groupBy: String? = nil, directoryOnTop: Bool? = nil, titleButtonHeader: String? = nil, itemForLine: Int? = nil) -> NCDBLayoutForView? {
 
         let realm = try! Realm()
-        var addObject = NCDBLayoutForView()
+
+        var keyStore = key
+        if !serverUrl.isEmpty { keyStore = serverUrl}
         let index = account + " " + keyStore
 
+        var addObject = NCDBLayoutForView()
+
         do {
             try realm.write {
                 if let result = realm.objects(NCDBLayoutForView.self).filter("index == %@", index).first {
                     addObject = result
+                } else {
+                    addObject.index = index
                 }
-                addObject.index = index
                 addObject.account = account
                 addObject.keyStore = keyStore
                 if let layout = layout {
@@ -89,15 +94,35 @@ extension NCManageDatabase {
         return NCDBLayoutForView.init(value: addObject)
     }
 
-    func getLayoutForView(account: String, keyStore: String) -> NCDBLayoutForView? {
+    @discardableResult
+    func setLayoutForView(layoutForView: NCDBLayoutForView) -> NCDBLayoutForView? {
 
         let realm = try! Realm()
+        let result = NCDBLayoutForView.init(value: layoutForView)
+
+        do {
+            try realm.write {
+                realm.add(result, update: .all)
+            }
+        } catch let error {
+            NKCommon.shared.writeLog("Could not write to database: \(error)")
+            return nil
+        }
+        return NCDBLayoutForView.init(value: result)
+    }
+
+    func getLayoutForView(account: String, key: String, serverUrl: String) -> NCDBLayoutForView? {
+
+        let realm = try! Realm()
+
+        var keyStore = key
+        if !serverUrl.isEmpty { keyStore = serverUrl}
         let index = account + " " + keyStore
 
         if let result = realm.objects(NCDBLayoutForView.self).filter("index == %@", index).first {
             return NCDBLayoutForView.init(value: result)
         } else {
-            return setLayoutForView(account: account, keyStore: keyStore)
+            return setLayoutForView(account: account, key: key, serverUrl: serverUrl)
         }
     }
 }

+ 3 - 3
iOSClient/Data/NCManageDatabase+Metadata.swift

@@ -317,17 +317,17 @@ extension NCManageDatabase {
     @objc func addMetadata(_ metadata: tableMetadata) -> tableMetadata? {
 
         let realm = try! Realm()
-        let returnMetadata = tableMetadata.init(value: metadata)
+        let result = tableMetadata.init(value: metadata)
 
         do {
             try realm.write {
-                realm.add(metadata, update: .all)
+                realm.add(result, update: .all)
             }
         } catch let error {
             NKCommon.shared.writeLog("Could not write to database: \(error)")
             return nil
         }
-        return returnMetadata
+        return tableMetadata.init(value: result)
     }
 
     @objc func addMetadatas(_ metadatas: [tableMetadata]) {

+ 8 - 16
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -46,7 +46,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
     internal var headerMenu: NCSectionHeaderMenu?
     internal var isSearchingMode: Bool = false
 
-    internal var layoutForView: NCGlobal.layoutForViewType?
+    internal var layoutForView: NCDBLayoutForView?
     internal var selectableDataSource: [RealmSwiftObject] { dataSource.getMetadataSourceForAllSections() }
 
     private var autoUploadFileName = ""
@@ -90,16 +90,9 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         self.navigationController?.presentationController?.delegate = self
 
         // CollectionView & layout
+        collectionView.alwaysBounceVertical = true
         listLayout = NCListLayout()
         gridLayout = NCGridLayout()
-        layoutForView = NCUtility.shared.getLayoutForView(key: layoutKey, serverUrl: serverUrl)
-        gridLayout.itemForLine = CGFloat(layoutForView?.itemForLine ?? 3)
-        if layoutForView?.layout == NCGlobal.shared.layoutList {
-            collectionView?.collectionViewLayout = listLayout
-        } else {
-            collectionView?.collectionViewLayout = gridLayout
-        }
-        collectionView.alwaysBounceVertical = true
 
         // Color
         view.backgroundColor = .systemBackground
@@ -172,7 +165,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
 
         appDelegate.activeViewController = self
 
-        layoutForView = NCUtility.shared.getLayoutForView(key: layoutKey, serverUrl: serverUrl)
+        layoutForView = NCManageDatabase.shared.getLayoutForView(account: appDelegate.account, key: layoutKey, serverUrl: serverUrl)
         gridLayout.itemForLine = CGFloat(layoutForView?.itemForLine ?? 3)
         if layoutForView?.layout == NCGlobal.shared.layoutList {
             collectionView?.collectionViewLayout = listLayout
@@ -319,7 +312,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
             self.navigationController?.popToRootViewController(animated: false)
         }
 
-        layoutForView = NCUtility.shared.getLayoutForView(key: layoutKey, serverUrl: serverUrl)
+        layoutForView = NCManageDatabase.shared.getLayoutForView(account: appDelegate.account, key: layoutKey, serverUrl: serverUrl)
         gridLayout.itemForLine = CGFloat(layoutForView?.itemForLine ?? 3)
         if layoutForView?.layout == NCGlobal.shared.layoutList {
             collectionView?.collectionViewLayout = listLayout
@@ -829,7 +822,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
             // list layout
             headerMenu?.buttonSwitch.accessibilityLabel = NSLocalizedString("_grid_view_", comment: "")
             layoutForView?.layout = NCGlobal.shared.layoutList
-            NCUtility.shared.setLayoutForView(key: layoutKey, serverUrl: serverUrl, layout: layoutForView?.layout)
+            NCManageDatabase.shared.setLayoutForView(account: appDelegate.account, key: layoutKey, serverUrl: serverUrl, layout: layoutForView?.layout)
             self.groupByField = "name"
             if self.dataSource.groupByField != self.groupByField {
                 self.dataSource.changeGroupByField(self.groupByField)
@@ -844,7 +837,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
             // grid layout
             headerMenu?.buttonSwitch.accessibilityLabel = NSLocalizedString("_list_view_", comment: "")
             layoutForView?.layout = NCGlobal.shared.layoutGrid
-            NCUtility.shared.setLayoutForView(key: layoutKey, serverUrl: serverUrl, layout: layoutForView?.layout)
+            NCManageDatabase.shared.setLayoutForView(account: appDelegate.account, key: layoutKey, serverUrl: serverUrl, layout: layoutForView?.layout)
             if isSearchingMode {
                 self.groupByField = "name"
             } else {
@@ -863,7 +856,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
     func tapButtonOrder(_ sender: Any) {
 
         let sortMenu = NCSortMenu()
-        sortMenu.toggleMenu(viewController: self, key: layoutKey, sortButton: sender as? UIButton, serverUrl: serverUrl)
+        sortMenu.toggleMenu(viewController: self, account: appDelegate.account, key: layoutKey, sortButton: sender as? UIButton, serverUrl: serverUrl)
     }
 
     func tapButton1(_ sender: Any) {
@@ -1012,7 +1005,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         autoUploadDirectory = NCManageDatabase.shared.getAccountAutoUploadDirectory(urlBase: appDelegate.urlBase, userId: appDelegate.userId, account: appDelegate.account)
 
         // get layout for view
-        layoutForView = NCUtility.shared.getLayoutForView(key: layoutKey, serverUrl: serverUrl)
+        layoutForView = NCManageDatabase.shared.getLayoutForView(account: appDelegate.account, key: layoutKey, serverUrl: serverUrl)
 
         // set GroupField for Grid
         if !isSearchingMode && layoutForView?.layout == NCGlobal.shared.layoutGrid {
@@ -1874,4 +1867,3 @@ extension NCCollectionViewCommon: EasyTipViewDelegate {
         self.tipView?.dismiss()
     }
 }
-

+ 4 - 8
iOSClient/Menu/NCSortMenu.swift

@@ -33,14 +33,14 @@ class NCSortMenu: NSObject {
 
     private var key = ""
 
-    func toggleMenu(viewController: UIViewController, key: String, sortButton: UIButton?, serverUrl: String, hideDirectoryOnTop: Bool = false) {
+    func toggleMenu(viewController: UIViewController, account: String, key: String, sortButton: UIButton?, serverUrl: String, hideDirectoryOnTop: Bool = false) {
 
         self.key = key
         self.sortButton = sortButton
         self.serverUrl = serverUrl
         self.hideDirectoryOnTop = hideDirectoryOnTop
 
-        var layoutForView = NCUtility.shared.getLayoutForView(key: key, serverUrl: serverUrl)
+        guard let layoutForView = NCManageDatabase.shared.getLayoutForView(account: account, key: key, serverUrl: serverUrl) else { return }
         var actions = [NCMenuAction]()
         var title = ""
         var icon = UIImage()
@@ -129,9 +129,7 @@ class NCSortMenu: NSObject {
         viewController.presentMenu(with: actions)
     }
 
-    func actionMenu(layoutForView: NCGlobal.layoutForViewType) {
-
-        var layoutForView = layoutForView
+    func actionMenu(layoutForView: NCDBLayoutForView) {
 
         switch layoutForView.sort {
         case "fileName":
@@ -145,9 +143,7 @@ class NCSortMenu: NSObject {
         }
 
         self.sortButton?.setTitle(NSLocalizedString(layoutForView.titleButtonHeader, comment: ""), for: .normal)
-
-        NCUtility.shared.setLayoutForView(key: key, serverUrl: serverUrl, layoutForView: layoutForView)
-
+        NCManageDatabase.shared.setLayoutForView(layoutForView: layoutForView)
         NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSource, userInfo: ["serverUrl": self.serverUrl])
     }
 }

+ 0 - 12
iOSClient/NCGlobal.swift

@@ -69,18 +69,6 @@ class NCGlobal: NSObject {
         var totalBytesExpected: Int64
     }
 
-    // Struct for LayoutForView
-    //
-    struct layoutForViewType {
-        var layout: String
-        var sort: String
-        var ascending: Bool
-        var groupBy: String
-        var directoryOnTop: Bool
-        var titleButtonHeader: String
-        var itemForLine: Int
-    }
-
     // Directory on Group
     //
     @objc let directoryProviderStorage              = "File Provider Storage"

+ 6 - 6
iOSClient/Select/NCSelect.swift

@@ -71,7 +71,7 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, UIAdaptivePresent
     private var dataSource = NCDataSource()
     internal var richWorkspaceText: String?
 
-    private var layoutForView: NCGlobal.layoutForViewType?
+    private var layoutForView: NCDBLayoutForView?
     internal var headerMenu: NCSectionHeaderMenu?
 
     private var autoUploadFileName = ""
@@ -174,7 +174,7 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, UIAdaptivePresent
         autoUploadFileName = NCManageDatabase.shared.getAccountAutoUploadFileName()
         autoUploadDirectory = NCManageDatabase.shared.getAccountAutoUploadDirectory(urlBase: activeAccount.urlBase, userId: activeAccount.userId, account: activeAccount.account)
 
-        layoutForView = NCUtility.shared.getLayoutForView(key: layoutKey, serverUrl: serverUrl)
+        layoutForView = NCManageDatabase.shared.getLayoutForView(account: activeAccount.account, key: layoutKey, serverUrl: serverUrl)
         gridLayout.itemForLine = CGFloat(layoutForView?.itemForLine ?? 3)
 
         if layoutForView?.layout == NCGlobal.shared.layoutList {
@@ -270,7 +270,7 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, UIAdaptivePresent
             // list layout
             headerMenu?.buttonSwitch.accessibilityLabel = NSLocalizedString("_grid_view_", comment: "")
             layoutForView?.layout = NCGlobal.shared.layoutList
-            NCUtility.shared.setLayoutForView(key: layoutKey, serverUrl: serverUrl, layout: layoutForView?.layout)
+            NCManageDatabase.shared.setLayoutForView(account: activeAccount.account, key: layoutKey, serverUrl: serverUrl, layout: layoutForView?.layout)
 
             self.collectionView.reloadData()
             self.collectionView.collectionViewLayout.invalidateLayout()
@@ -281,7 +281,7 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, UIAdaptivePresent
             // grid layout
             headerMenu?.buttonSwitch.accessibilityLabel = NSLocalizedString("_list_view_", comment: "")
             layoutForView?.layout = NCGlobal.shared.layoutGrid
-            NCUtility.shared.setLayoutForView(key: layoutKey, serverUrl: serverUrl, layout: layoutForView?.layout)
+            NCManageDatabase.shared.setLayoutForView(account: activeAccount.account, key: layoutKey, serverUrl: serverUrl, layout: layoutForView?.layout)
 
             self.collectionView.reloadData()
             self.collectionView.collectionViewLayout.invalidateLayout()
@@ -292,7 +292,7 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, UIAdaptivePresent
     func tapButtonOrder(_ sender: Any) {
 
         let sortMenu = NCSortMenu()
-        sortMenu.toggleMenu(viewController: self, key: layoutKey, sortButton: sender as? UIButton, serverUrl: serverUrl)
+        sortMenu.toggleMenu(viewController: self, account: activeAccount.account, key: layoutKey, sortButton: sender as? UIButton, serverUrl: serverUrl)
     }
 
     // MARK: - Push metadata
@@ -702,7 +702,7 @@ extension NCSelect {
         var predicate: NSPredicate?
         var groupByField = "name"
         
-        layoutForView = NCUtility.shared.getLayoutForView(key: layoutKey, serverUrl: serverUrl)
+        layoutForView = NCManageDatabase.shared.getLayoutForView(account: activeAccount.account, key: layoutKey, serverUrl: serverUrl)
 
         // set GroupField for Grid
         if layoutForView?.layout == NCGlobal.shared.layoutGrid {

+ 1 - 1
iOSClient/Transfers/NCTransfers.swift

@@ -49,7 +49,7 @@ class NCTransfers: NCCollectionViewCommon, NCTransferCellDelegate {
         super.viewDidLoad()
 
         listLayout.itemHeight = 105
-        NCUtility.shared.setLayoutForView(key: layoutKey, serverUrl: serverUrl, layout: NCGlobal.shared.layoutList)
+        NCManageDatabase.shared.setLayoutForView(account: appDelegate.account, key: layoutKey, serverUrl: serverUrl, layout: NCGlobal.shared.layoutList)
         self.navigationItem.title = titleCurrentFolder
     }
 

+ 6 - 6
iOSClient/Trash/NCTrash.swift

@@ -43,7 +43,7 @@ class NCTrash: UIViewController, NCSelectableNavigationView, NCTrashListCellDele
     internal var selectOcId: [String] = []
 
     var datasource: [tableTrash] = []
-    var layoutForView: NCGlobal.layoutForViewType?
+    var layoutForView: NCDBLayoutForView?
     var listLayout: NCListLayout!
     var gridLayout: NCGridLayout!
 
@@ -88,7 +88,7 @@ class NCTrash: UIViewController, NCSelectableNavigationView, NCTrashListCellDele
         navigationController?.setFileAppreance()
         navigationItem.title = titleCurrentFolder
 
-        layoutForView = NCUtility.shared.getLayoutForView(key: NCGlobal.shared.layoutViewTrash, serverUrl: "", sort: "date", ascending: false, titleButtonHeader: "_sorted_by_date_more_recent_")
+        layoutForView =  NCManageDatabase.shared.getLayoutForView(account: appDelegate.account, key: NCGlobal.shared.layoutViewTrash, serverUrl: "")
         gridLayout.itemForLine = CGFloat(layoutForView?.itemForLine ?? 3)
 
         if layoutForView?.layout == NCGlobal.shared.layoutList {
@@ -130,7 +130,7 @@ class NCTrash: UIViewController, NCSelectableNavigationView, NCTrashListCellDele
 
             // list layout
             layoutForView?.layout = NCGlobal.shared.layoutList
-            NCUtility.shared.setLayoutForView(key: NCGlobal.shared.layoutViewTrash, serverUrl: "", layout: layoutForView?.layout)
+            NCManageDatabase.shared.setLayoutForView(account: appDelegate.account, key: NCGlobal.shared.layoutViewTrash, serverUrl: "", layout: layoutForView?.layout)
 
             self.collectionView.reloadData()
             self.collectionView.collectionViewLayout.invalidateLayout()
@@ -140,7 +140,7 @@ class NCTrash: UIViewController, NCSelectableNavigationView, NCTrashListCellDele
 
             // grid layout
             layoutForView?.layout = NCGlobal.shared.layoutGrid
-            NCUtility.shared.setLayoutForView(key: NCGlobal.shared.layoutViewTrash, serverUrl: "", layout: layoutForView?.layout)
+            NCManageDatabase.shared.setLayoutForView(account: appDelegate.account, key: NCGlobal.shared.layoutViewTrash, serverUrl: "", layout: layoutForView?.layout)
 
             self.collectionView.reloadData()
             self.collectionView.collectionViewLayout.invalidateLayout()
@@ -150,7 +150,7 @@ class NCTrash: UIViewController, NCSelectableNavigationView, NCTrashListCellDele
 
     func tapButtonOrder(_ sender: Any) {
         let sortMenu = NCSortMenu()
-        sortMenu.toggleMenu(viewController: self, key: NCGlobal.shared.layoutViewTrash, sortButton: sender as? UIButton, serverUrl: "", hideDirectoryOnTop: true)
+        sortMenu.toggleMenu(viewController: self, account: appDelegate.account, key: NCGlobal.shared.layoutViewTrash, sortButton: sender as? UIButton, serverUrl: "", hideDirectoryOnTop: true)
     }
 
     func tapButtonMore(_ sender: Any) {
@@ -232,7 +232,7 @@ class NCTrash: UIViewController, NCSelectableNavigationView, NCTrashListCellDele
 
     @objc func reloadDataSource(forced: Bool = true) {
 
-        layoutForView = NCUtility.shared.getLayoutForView(key: NCGlobal.shared.layoutViewTrash, serverUrl: "")
+        layoutForView = NCManageDatabase.shared.getLayoutForView(account: appDelegate.account, key: NCGlobal.shared.layoutViewTrash, serverUrl: "")
         datasource.removeAll()
         guard let trashPath = self.getTrashPath(), let tashItems = NCManageDatabase.shared.getTrash(filePath: trashPath, sort: layoutForView?.sort, ascending: layoutForView?.ascending, account: appDelegate.account) else {
             return

+ 0 - 51
iOSClient/Utility/NCUtility.swift

@@ -38,57 +38,6 @@ class NCUtility: NSObject {
         return instance
     }()
 
-    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)"
-        var keyStore = key
-
-        if serverUrl != "" {
-            keyStore = serverUrl
-        }
-
-        UICKeyChainStore.setString(string, forKey: keyStore, service: NCGlobal.shared.serviceShareKeyChain)
-    }
-
-    func setLayoutForView(key: String, serverUrl: String, layout: String?) {
-
-        var layoutForView: NCGlobal.layoutForViewType = NCUtility.shared.getLayoutForView(key: key, serverUrl: serverUrl)
-
-        if let layout = layout {
-            layoutForView.layout = layout
-            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)
-
-        if serverUrl != "" {
-            keyStore = serverUrl
-        }
-
-        guard let string = UICKeyChainStore.string(forKey: keyStore, service: NCGlobal.shared.serviceShareKeyChain) else {
-            setLayoutForView(key: key, serverUrl: serverUrl, layoutForView: layoutForView)
-            return layoutForView
-        }
-
-        let array = string.components(separatedBy: "|")
-        if array.count >= 7 {
-            // version 1
-            layoutForView.layout = array[0]
-            layoutForView.sort = array[1]
-            layoutForView.ascending = NSString(string: array[2]).boolValue
-            layoutForView.groupBy = array[3]
-            layoutForView.directoryOnTop = NSString(string: array[4]).boolValue
-            layoutForView.titleButtonHeader = array[5]
-            layoutForView.itemForLine = Int(NSString(string: array[6]).intValue)
-        }
-
-        return layoutForView
-    }
-
     func convertSVGtoPNGWriteToUserData(svgUrlString: String, fileName: String?, width: CGFloat?, rewrite: Bool, account: String, closure: @escaping (String?) -> Void) {
 
         var fileNamePNG = ""