marinofaggiana 4 年之前
父節點
當前提交
e049b047dd
共有 2 個文件被更改,包括 5 次插入21 次删除
  1. 3 19
      iOSClient/Main/Colleaction Common/NCCollectionViewCommon.swift
  2. 2 2
      iOSClient/Viewer/NCViewer.swift

+ 3 - 19
iOSClient/Main/Colleaction Common/NCCollectionViewCommon.swift

@@ -1211,24 +1211,6 @@ extension NCCollectionViewCommon: UICollectionViewDelegate {
             
             guard let metadataTouch = metadataTouch else { return }
             
-            if metadata.typeFile == NCBrandGlobal.shared.metadataTypeFileDocument && NCUtility.shared.isDirectEditing(account: metadata.account, contentType: metadata.contentType) != nil {
-                if NCCommunication.shared.isNetworkReachable() {
-                    NCViewer.shared.view(viewController: self, metadata: metadataTouch, metadatas: [metadataTouch])
-                } else {
-                    NCContentPresenter.shared.messageNotification("_info_", description: "_go_online_", delay: NCBrandGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: NCBrandGlobal.shared.ErrorOffline, forced: true)
-                }
-                return
-            }
-            
-            if metadata.typeFile == NCBrandGlobal.shared.metadataTypeFileDocument && NCUtility.shared.isRichDocument(metadata) {
-                if NCCommunication.shared.isNetworkReachable() {
-                    NCViewer.shared.view(viewController: self, metadata: metadataTouch, metadatas: [metadataTouch])
-                } else {
-                    NCContentPresenter.shared.messageNotification("_info_", description: "_go_online_", delay: NCBrandGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: NCBrandGlobal.shared.ErrorOffline, forced: true)
-                }
-                return
-            }
-            
             if metadata.typeFile == NCBrandGlobal.shared.metadataTypeFileImage || metadata.typeFile == NCBrandGlobal.shared.metadataTypeFileVideo || metadata.typeFile == NCBrandGlobal.shared.metadataTypeFileAudio {
                 var metadatas: [tableMetadata] = []
                 for metadata in dataSource.metadatas {
@@ -1242,8 +1224,10 @@ extension NCCollectionViewCommon: UICollectionViewDelegate {
             
             if CCUtility.fileProviderStorageExists(metadataTouch.ocId, fileNameView: metadataTouch.fileNameView) {
                 NCViewer.shared.view(viewController: self, metadata: metadataTouch, metadatas: [metadataTouch])
-            } else {
+            } else if NCCommunication.shared.isNetworkReachable() {
                 NCNetworking.shared.download(metadata: metadataTouch, selector: NCBrandGlobal.shared.selectorLoadFileView) { (_) in }
+            } else {
+                NCContentPresenter.shared.messageNotification("_info_", description: "_go_online_", delay: NCBrandGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: NCBrandGlobal.shared.ErrorOffline, forced: true)
             }
         }
     }

+ 2 - 2
iOSClient/Viewer/NCViewer.swift

@@ -79,7 +79,7 @@ class NCViewer: NSObject {
             }
             
             // DirectEditinf: Nextcloud Text - OnlyOffice
-            if NCUtility.shared.isDirectEditing(account: metadata.account, contentType: metadata.contentType) != nil &&  NCCommunication.shared.isNetworkReachable() {
+            if NCUtility.shared.isDirectEditing(account: metadata.account, contentType: metadata.contentType) != nil && NCCommunication.shared.isNetworkReachable() {
                 
                 guard let editor = NCUtility.shared.isDirectEditing(account: metadata.account, contentType: metadata.contentType) else { return }
                 if editor == NCBrandGlobal.shared.editorText || editor == NCBrandGlobal.shared.editorOnlyoffice {
@@ -140,7 +140,7 @@ class NCViewer: NSObject {
             }
             
             // RichDocument: Collabora
-            if NCUtility.shared.isRichDocument(metadata) &&  NCCommunication.shared.isNetworkReachable() {
+            if NCUtility.shared.isRichDocument(metadata) && NCCommunication.shared.isNetworkReachable() {
                                 
                 if metadata.url == "" {