|
@@ -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()
|
|
|
}
|
|
|
}
|
|
|
-
|