|
@@ -279,21 +279,19 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|
|
if self.view?.window == nil { return }
|
|
|
|
|
|
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()
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -304,26 +302,24 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|
|
if self.view?.window == nil { return }
|
|
|
|
|
|
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()
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -352,17 +348,15 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|
|
if self.view?.window == nil { return }
|
|
|
|
|
|
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()
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -387,12 +381,10 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|
|
if self.view?.window == nil { return }
|
|
|
|
|
|
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])
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -402,13 +394,11 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|
|
if self.view?.window == nil { return }
|
|
|
|
|
|
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])
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -417,12 +407,10 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|
|
if self.view?.window == nil { return }
|
|
|
|
|
|
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])
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -432,18 +420,16 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|
|
if self.view?.window == nil { return }
|
|
|
|
|
|
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()
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -454,12 +440,10 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|
|
if self.view?.window == nil { return }
|
|
|
|
|
|
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()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -469,20 +453,18 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|
|
if self.view?.window == nil { return }
|
|
|
|
|
|
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()
|
|
|
}
|
|
|
}
|
|
|
}
|