|
@@ -300,21 +300,20 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|
if self.view?.window == nil { return }
|
|
if self.view?.window == nil { return }
|
|
|
|
|
|
if let userInfo = notification.userInfo as NSDictionary? {
|
|
if let userInfo = notification.userInfo as NSDictionary? {
|
|
- if let ocId = userInfo["ocId"] as? String, let onlyLocal = userInfo["onlyLocal"] as? Bool {
|
|
|
|
- if let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocId) {
|
|
|
|
- if onlyLocal {
|
|
|
|
- reloadDataSource()
|
|
|
|
- } else if metadata.fileNameView.lowercased() == k_fileNameRichWorkspace.lowercased() {
|
|
|
|
- reloadDataSourceNetwork(forced: true)
|
|
|
|
- } else {
|
|
|
|
- if let row = dataSource.deleteMetadata(ocId: metadata.ocId) {
|
|
|
|
- let indexPath = IndexPath(row: row, section: 0)
|
|
|
|
- collectionView?.performBatchUpdates({
|
|
|
|
- collectionView?.deleteItems(at: [indexPath])
|
|
|
|
- }, completion: { (_) in
|
|
|
|
- self.collectionView?.reloadData()
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
|
|
+ if let ocId = userInfo["ocId"] as? String, let onlyLocal = userInfo["onlyLocal"] as? Bool, let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocId) {
|
|
|
|
+
|
|
|
|
+ if onlyLocal {
|
|
|
|
+ reloadDataSource()
|
|
|
|
+ } else if metadata.fileNameView.lowercased() == k_fileNameRichWorkspace.lowercased() {
|
|
|
|
+ reloadDataSourceNetwork(forced: true)
|
|
|
|
+ } else {
|
|
|
|
+ if let row = dataSource.deleteMetadata(ocId: metadata.ocId) {
|
|
|
|
+ let indexPath = IndexPath(row: row, section: 0)
|
|
|
|
+ collectionView?.performBatchUpdates({
|
|
|
|
+ collectionView?.deleteItems(at: [indexPath])
|
|
|
|
+ }, completion: { (_) in
|
|
|
|
+ self.collectionView?.reloadData()
|
|
|
|
+ })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -325,26 +324,25 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|
if self.view?.window == nil { return }
|
|
if self.view?.window == nil { return }
|
|
|
|
|
|
if let userInfo = notification.userInfo as NSDictionary? {
|
|
if let userInfo = notification.userInfo as NSDictionary? {
|
|
- if let ocId = userInfo["ocId"] as? String, let ocIdNew = userInfo["ocIdNew"] as? String {
|
|
|
|
- if let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocId), let metadataNew = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocIdNew) {
|
|
|
|
- if metadata.serverUrl == serverUrl && metadata.account == appDelegate.account {
|
|
|
|
- if let row = dataSource.deleteMetadata(ocId: metadata.ocId) {
|
|
|
|
- let indexPath = IndexPath(row: row, section: 0)
|
|
|
|
- collectionView?.performBatchUpdates({
|
|
|
|
- collectionView?.deleteItems(at: [indexPath])
|
|
|
|
- }, completion: { (_) in
|
|
|
|
- self.collectionView?.reloadData()
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- } else if metadataNew.serverUrl == serverUrl && metadata.account == appDelegate.account {
|
|
|
|
- if let row = dataSource.addMetadata(metadataNew) {
|
|
|
|
- let indexPath = IndexPath(row: row, section: 0)
|
|
|
|
- collectionView?.performBatchUpdates({
|
|
|
|
- collectionView?.insertItems(at: [indexPath])
|
|
|
|
- }, completion: { (_) in
|
|
|
|
- self.collectionView?.reloadData()
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
|
|
+ if let ocId = userInfo["ocId"] as? String, let ocIdNew = userInfo["ocIdNew"] as? String, let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocId), let metadataNew = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocIdNew) {
|
|
|
|
+
|
|
|
|
+ if metadata.serverUrl == serverUrl && metadata.account == appDelegate.account {
|
|
|
|
+ if let row = dataSource.deleteMetadata(ocId: metadata.ocId) {
|
|
|
|
+ let indexPath = IndexPath(row: row, section: 0)
|
|
|
|
+ collectionView?.performBatchUpdates({
|
|
|
|
+ collectionView?.deleteItems(at: [indexPath])
|
|
|
|
+ }, completion: { (_) in
|
|
|
|
+ self.collectionView?.reloadData()
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ } else if metadataNew.serverUrl == serverUrl && metadata.account == appDelegate.account {
|
|
|
|
+ if let row = dataSource.addMetadata(metadataNew) {
|
|
|
|
+ let indexPath = IndexPath(row: row, section: 0)
|
|
|
|
+ collectionView?.performBatchUpdates({
|
|
|
|
+ collectionView?.insertItems(at: [indexPath])
|
|
|
|
+ }, completion: { (_) in
|
|
|
|
+ self.collectionView?.reloadData()
|
|
|
|
+ })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -356,6 +354,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|
|
|
|
|
if let userInfo = notification.userInfo as NSDictionary? {
|
|
if let userInfo = notification.userInfo as NSDictionary? {
|
|
if let serverUrlTo = userInfo["serverUrlTo"] as? String {
|
|
if let serverUrlTo = userInfo["serverUrlTo"] as? String {
|
|
|
|
+
|
|
if serverUrlTo == self.serverUrl {
|
|
if serverUrlTo == self.serverUrl {
|
|
reloadDataSource()
|
|
reloadDataSource()
|
|
}
|
|
}
|
|
@@ -373,17 +372,16 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|
if self.view?.window == nil { return }
|
|
if self.view?.window == nil { return }
|
|
|
|
|
|
if let userInfo = notification.userInfo as NSDictionary? {
|
|
if let userInfo = notification.userInfo as NSDictionary? {
|
|
- if let ocId = userInfo["ocId"] as? String {
|
|
|
|
- if let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocId) {
|
|
|
|
- if metadata.serverUrl == serverUrl && metadata.account == appDelegate.account {
|
|
|
|
- if let row = dataSource.addMetadata(metadata) {
|
|
|
|
- let indexPath = IndexPath(row: row, section: 0)
|
|
|
|
- collectionView?.performBatchUpdates({
|
|
|
|
- collectionView?.insertItems(at: [indexPath])
|
|
|
|
- }, completion: { (_) in
|
|
|
|
- self.collectionView?.reloadData()
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
|
|
+ if let ocId = userInfo["ocId"] as? String, let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocId) {
|
|
|
|
+
|
|
|
|
+ if metadata.serverUrl == serverUrl && metadata.account == appDelegate.account {
|
|
|
|
+ if let row = dataSource.addMetadata(metadata) {
|
|
|
|
+ let indexPath = IndexPath(row: row, section: 0)
|
|
|
|
+ collectionView?.performBatchUpdates({
|
|
|
|
+ collectionView?.insertItems(at: [indexPath])
|
|
|
|
+ }, completion: { (_) in
|
|
|
|
+ self.collectionView?.reloadData()
|
|
|
|
+ })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -397,6 +395,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|
|
|
|
|
if let userInfo = notification.userInfo as NSDictionary? {
|
|
if let userInfo = notification.userInfo as NSDictionary? {
|
|
if let ocId = userInfo["ocId"] as? String, let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocId) {
|
|
if let ocId = userInfo["ocId"] as? String, let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocId) {
|
|
|
|
+
|
|
if dataSource.getIndexMetadata(ocId: metadata.ocId) != nil {
|
|
if dataSource.getIndexMetadata(ocId: metadata.ocId) != nil {
|
|
reloadDataSource()
|
|
reloadDataSource()
|
|
}
|
|
}
|
|
@@ -408,12 +407,10 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|
if self.view?.window == nil { return }
|
|
if self.view?.window == nil { return }
|
|
|
|
|
|
if let userInfo = notification.userInfo as NSDictionary? {
|
|
if let userInfo = notification.userInfo as NSDictionary? {
|
|
- if let ocId = userInfo["ocId"] as? String {
|
|
|
|
- if let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocId) {
|
|
|
|
- if let row = dataSource.reloadMetadata(ocId: metadata.ocId) {
|
|
|
|
- let indexPath = IndexPath(row: row, section: 0)
|
|
|
|
- collectionView?.reloadItems(at: [indexPath])
|
|
|
|
- }
|
|
|
|
|
|
+ if let ocId = userInfo["ocId"] as? String , let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocId) {
|
|
|
|
+ if let row = dataSource.reloadMetadata(ocId: metadata.ocId) {
|
|
|
|
+ let indexPath = IndexPath(row: row, section: 0)
|
|
|
|
+ collectionView?.reloadItems(at: [indexPath])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -423,13 +420,11 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|
if self.view?.window == nil { return }
|
|
if self.view?.window == nil { return }
|
|
|
|
|
|
if let userInfo = notification.userInfo as NSDictionary? {
|
|
if let userInfo = notification.userInfo as NSDictionary? {
|
|
- if let ocId = userInfo["ocId"] as? String, let _ = userInfo["errorCode"] as? Int {
|
|
|
|
- if let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocId) {
|
|
|
|
- if let row = dataSource.reloadMetadata(ocId: metadata.ocId) {
|
|
|
|
- let indexPath = IndexPath(row: row, section: 0)
|
|
|
|
- collectionView?.reloadItems(at: [indexPath])
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ if let ocId = userInfo["ocId"] as? String, let _ = userInfo["errorCode"] as? Int, let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocId) {
|
|
|
|
+ if let row = dataSource.reloadMetadata(ocId: metadata.ocId) {
|
|
|
|
+ let indexPath = IndexPath(row: row, section: 0)
|
|
|
|
+ collectionView?.reloadItems(at: [indexPath])
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -438,12 +433,10 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|
if self.view?.window == nil { return }
|
|
if self.view?.window == nil { return }
|
|
|
|
|
|
if let userInfo = notification.userInfo as NSDictionary? {
|
|
if let userInfo = notification.userInfo as NSDictionary? {
|
|
- if let ocId = userInfo["ocId"] as? String {
|
|
|
|
- if let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocId) {
|
|
|
|
- if let row = dataSource.reloadMetadata(ocId: metadata.ocId) {
|
|
|
|
- let indexPath = IndexPath(row: row, section: 0)
|
|
|
|
- collectionView?.reloadItems(at: [indexPath])
|
|
|
|
- }
|
|
|
|
|
|
+ if let ocId = userInfo["ocId"] as? String, let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocId) {
|
|
|
|
+ if let row = dataSource.reloadMetadata(ocId: metadata.ocId) {
|
|
|
|
+ let indexPath = IndexPath(row: row, section: 0)
|
|
|
|
+ collectionView?.reloadItems(at: [indexPath])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -453,18 +446,15 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|
if self.view?.window == nil { return }
|
|
if self.view?.window == nil { return }
|
|
|
|
|
|
if let userInfo = notification.userInfo as NSDictionary? {
|
|
if let userInfo = notification.userInfo as NSDictionary? {
|
|
- if let ocId = userInfo["ocId"] as? String {
|
|
|
|
- if let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocId) {
|
|
|
|
- if metadata.serverUrl == serverUrl && metadata.account == appDelegate.account {
|
|
|
|
-
|
|
|
|
- if let row = dataSource.addMetadata(metadata) {
|
|
|
|
- let indexPath = IndexPath(row: row, section: 0)
|
|
|
|
- collectionView?.performBatchUpdates({
|
|
|
|
- collectionView?.insertItems(at: [indexPath])
|
|
|
|
- }, completion: { (_) in
|
|
|
|
- self.collectionView?.reloadData()
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
|
|
+ if let ocId = userInfo["ocId"] as? String, let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocId) {
|
|
|
|
+ if metadata.serverUrl == serverUrl && metadata.account == appDelegate.account {
|
|
|
|
+ if let row = dataSource.addMetadata(metadata) {
|
|
|
|
+ let indexPath = IndexPath(row: row, section: 0)
|
|
|
|
+ collectionView?.performBatchUpdates({
|
|
|
|
+ collectionView?.insertItems(at: [indexPath])
|
|
|
|
+ }, completion: { (_) in
|
|
|
|
+ self.collectionView?.reloadData()
|
|
|
|
+ })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -475,12 +465,10 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|
if self.view?.window == nil { return }
|
|
if self.view?.window == nil { return }
|
|
|
|
|
|
if let userInfo = notification.userInfo as NSDictionary? {
|
|
if let userInfo = notification.userInfo as NSDictionary? {
|
|
- if let ocId = userInfo["ocId"] as? String, let ocIdTemp = userInfo["ocIdTemp"] as? String, let _ = userInfo["errorCode"] as? Int {
|
|
|
|
- if let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocId) {
|
|
|
|
- if metadata.serverUrl == serverUrl && metadata.account == appDelegate.account {
|
|
|
|
- dataSource.reloadMetadata(ocId: metadata.ocId, ocIdTemp: ocIdTemp)
|
|
|
|
- collectionView?.reloadData()
|
|
|
|
- }
|
|
|
|
|
|
+ if let ocId = userInfo["ocId"] as? String, let ocIdTemp = userInfo["ocIdTemp"] as? String, let _ = userInfo["errorCode"] as? Int, let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocId) {
|
|
|
|
+ if metadata.serverUrl == serverUrl && metadata.account == appDelegate.account {
|
|
|
|
+ dataSource.reloadMetadata(ocId: metadata.ocId, ocIdTemp: ocIdTemp)
|
|
|
|
+ collectionView?.reloadData()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -490,20 +478,18 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|
if self.view?.window == nil { return }
|
|
if self.view?.window == nil { return }
|
|
|
|
|
|
if let userInfo = notification.userInfo as NSDictionary? {
|
|
if let userInfo = notification.userInfo as NSDictionary? {
|
|
- if let ocId = userInfo["ocId"] as? String {
|
|
|
|
- if let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocId) {
|
|
|
|
- if metadata.serverUrl == serverUrl && metadata.account == appDelegate.account {
|
|
|
|
-
|
|
|
|
- if let row = dataSource.deleteMetadata(ocId: metadata.ocId) {
|
|
|
|
- let indexPath = IndexPath(row: row, section: 0)
|
|
|
|
- collectionView?.performBatchUpdates({
|
|
|
|
- collectionView?.deleteItems(at: [indexPath])
|
|
|
|
- }, completion: { (_) in
|
|
|
|
- self.collectionView?.reloadData()
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- self.reloadDataSource()
|
|
|
|
- }
|
|
|
|
|
|
+ if let ocId = userInfo["ocId"] as? String, let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocId) {
|
|
|
|
+
|
|
|
|
+ if metadata.serverUrl == serverUrl && metadata.account == appDelegate.account {
|
|
|
|
+ if let row = dataSource.deleteMetadata(ocId: metadata.ocId) {
|
|
|
|
+ let indexPath = IndexPath(row: row, section: 0)
|
|
|
|
+ collectionView?.performBatchUpdates({
|
|
|
|
+ collectionView?.deleteItems(at: [indexPath])
|
|
|
|
+ }, completion: { (_) in
|
|
|
|
+ self.collectionView?.reloadData()
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ self.reloadDataSource()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|