|
@@ -68,25 +68,52 @@ class NCShares: NCCollectionViewCommon {
|
|
|
isReloadDataSourceNetworkInProgress = true
|
|
|
collectionView?.reloadData()
|
|
|
|
|
|
- NCCommunication.shared.readShares { (account, shares, errorCode, ErrorDescription) in
|
|
|
+ if serverUrl == "" {
|
|
|
|
|
|
- self.refreshControl.endRefreshing()
|
|
|
- self.isReloadDataSourceNetworkInProgress = false
|
|
|
-
|
|
|
- if errorCode == 0 {
|
|
|
+ NCCommunication.shared.readShares { (account, shares, errorCode, ErrorDescription) in
|
|
|
|
|
|
- NCManageDatabase.sharedInstance.deleteTableShare(account: account)
|
|
|
- if shares != nil {
|
|
|
- NCManageDatabase.sharedInstance.addShare(urlBase: self.appDelegate.urlBase, account: account, shares: shares!)
|
|
|
- }
|
|
|
- self.appDelegate.shares = NCManageDatabase.sharedInstance.getTableShares(account: account)
|
|
|
+ self.refreshControl.endRefreshing()
|
|
|
+ self.isReloadDataSourceNetworkInProgress = false
|
|
|
|
|
|
- self.reloadDataSource()
|
|
|
+ if errorCode == 0 {
|
|
|
+
|
|
|
+ NCManageDatabase.sharedInstance.deleteTableShare(account: account)
|
|
|
+ if shares != nil {
|
|
|
+ NCManageDatabase.sharedInstance.addShare(urlBase: self.appDelegate.urlBase, account: account, shares: shares!)
|
|
|
+ }
|
|
|
+ self.appDelegate.shares = NCManageDatabase.sharedInstance.getTableShares(account: account)
|
|
|
+
|
|
|
+ self.reloadDataSource()
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ self.collectionView?.reloadData()
|
|
|
+ NCContentPresenter.shared.messageNotification("_share_", description: ErrorDescription, delay: TimeInterval(k_dismissAfterSecond), type: NCContentPresenter.messageType.error, errorCode: errorCode)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ networkReadFolder(forced: forced) { (metadatas, metadatasUpdate, errorCode, errorDescription) in
|
|
|
+ if errorCode == 0 {
|
|
|
+ for metadata in metadatas ?? [] {
|
|
|
+ if !metadata.directory {
|
|
|
+ let localFile = NCManageDatabase.sharedInstance.getTableLocalFile(predicate: NSPredicate(format: "ocId == %@", metadata.ocId))
|
|
|
+ if localFile == nil || localFile?.etag != metadata.etag {
|
|
|
+ NCOperationQueue.shared.download(metadata: metadata, selector: selectorDownloadFile, setFavorite: false)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- } else {
|
|
|
+ self.refreshControl.endRefreshing()
|
|
|
+ self.isReloadDataSourceNetworkInProgress = false
|
|
|
|
|
|
- self.collectionView?.reloadData()
|
|
|
- NCContentPresenter.shared.messageNotification("_share_", description: ErrorDescription, delay: TimeInterval(k_dismissAfterSecond), type: NCContentPresenter.messageType.error, errorCode: errorCode)
|
|
|
+ if metadatasUpdate?.count ?? 0 > 0 || forced {
|
|
|
+ self.reloadDataSource()
|
|
|
+ } else {
|
|
|
+ self.collectionView?.reloadData()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|