Bläddra i källkod

fix templates

marinofaggiana 4 år sedan
förälder
incheckning
242719b6e9
1 ändrade filer med 25 tillägg och 6 borttagningar
  1. 25 6
      iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift

+ 25 - 6
iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift

@@ -411,7 +411,8 @@ import NCCommunication
                     }
                 }
                     
-                if templates.count == 0 {
+                if self.listOfTemplate.count == 0 {
+                    
                     let temp = NCCommunicationEditorTemplates()
                     
                     temp.identifier = ""
@@ -450,6 +451,7 @@ import NCCommunication
                     for template in templates! {
                         
                         let temp = NCCommunicationEditorTemplates()
+                        
                         temp.identifier = "\(template.templateId)"
                         temp.delete = template.delete
                         temp.ext = template.ext
@@ -466,14 +468,31 @@ import NCCommunication
                             self.navigationItem.rightBarButtonItem?.isEnabled = true
                         }
                     }
+                }
+                
+                if self.listOfTemplate.count == 0 {
                     
-                    self.collectionView.reloadData()
+                    let temp = NCCommunicationEditorTemplates()
                     
-                } else if errorCode != 0 {
-                    NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: TimeInterval(k_dismissAfterSecond), type: NCContentPresenter.messageType.error, errorCode: errorCode)
-                } else {
-                    print("[LOG] It has been changed user during networking process, error.")
+                    temp.identifier = ""
+                    if self.typeTemplate == k_template_document {
+                        temp.ext = "docx"
+                    } else if self.typeTemplate == k_template_spreadsheet {
+                        temp.ext = "xlsx"
+                    } else if self.typeTemplate == k_template_presentation {
+                        temp.ext = "pptx"
+                    }
+                    temp.name = "Empty"
+                    temp.preview = ""
+                                                                  
+                    self.listOfTemplate.append(temp)
+                    
+                    self.selectTemplate = temp
+                    self.fileNameExtension = temp.ext
+                    self.navigationItem.rightBarButtonItem?.isEnabled = true
                 }
+                
+                self.collectionView.reloadData()
             }
         }
     }