Marino Faggiana 6 år sedan
förälder
incheckning
7a4c6adcb7

+ 10 - 0
iOSClient/Main/Create cloud/NCCreateFormUploadRichdocuments.storyboard

@@ -91,11 +91,20 @@
                                     <outlet property="delegate" destination="uQo-FX-ejX" id="gsE-cc-f9G"/>
                                 </connections>
                             </tableView>
+                            <activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="gray" translatesAutoresizingMaskIntoConstraints="NO" id="MR6-tv-tqK">
+                                <rect key="frame" x="172.5" y="174" width="30" height="30"/>
+                                <constraints>
+                                    <constraint firstAttribute="width" constant="30" id="0S5-5q-xmr"/>
+                                    <constraint firstAttribute="height" constant="30" id="pBW-Yp-CNJ"/>
+                                </constraints>
+                            </activityIndicatorView>
                         </subviews>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                         <constraints>
+                            <constraint firstItem="MR6-tv-tqK" firstAttribute="centerX" secondItem="ILQ-5j-b92" secondAttribute="centerX" id="71o-CE-nGW"/>
                             <constraint firstItem="eeP-9N-ZRP" firstAttribute="top" secondItem="kdt-bX-icm" secondAttribute="bottom" constant="10" id="Fhq-zQ-1Cx"/>
                             <constraint firstItem="kdt-bX-icm" firstAttribute="leading" secondItem="eeP-9N-ZRP" secondAttribute="leading" id="M0y-VC-ex7"/>
+                            <constraint firstItem="MR6-tv-tqK" firstAttribute="centerY" secondItem="kdt-bX-icm" secondAttribute="centerY" id="eM4-te-y7u"/>
                             <constraint firstItem="kdt-bX-icm" firstAttribute="trailing" secondItem="eeP-9N-ZRP" secondAttribute="trailing" id="iNB-l9-u3p"/>
                             <constraint firstItem="kdt-bX-icm" firstAttribute="top" secondItem="ILQ-5j-b92" secondAttribute="top" id="nnJ-OQ-Uly"/>
                             <constraint firstItem="eeP-9N-ZRP" firstAttribute="leading" secondItem="ILQ-5j-b92" secondAttribute="leading" id="pNx-zH-54E"/>
@@ -107,6 +116,7 @@
                     <connections>
                         <outlet property="collectionView" destination="kdt-bX-icm" id="KHF-Np-nhf"/>
                         <outlet property="collectionViewHeigth" destination="XAH-EC-bwE" id="I4u-n9-7pm"/>
+                        <outlet property="indicator" destination="MR6-tv-tqK" id="zvu-t9-npc"/>
                         <outlet property="tableView" destination="eeP-9N-ZRP" id="dzG-bV-m9u"/>
                     </connections>
                 </viewController>

+ 14 - 4
iOSClient/Main/Create cloud/NCCreateFormUploadRichdocuments.swift

@@ -36,8 +36,11 @@ class NCCreateFormUploadRichdocuments: XLFormViewController, NCSelectDelegate, U
     var listOfTemplate = [NCRichDocumentTemplate]()
     var selectTemplate: NCRichDocumentTemplate?
     
+    @IBOutlet weak var indicator: UIActivityIndicatorView!
+
     @IBOutlet weak var collectionView: UICollectionView!
     @IBOutlet weak var collectionViewHeigth: NSLayoutConstraint!
+    
 
     // Layout
     let numItems = 2
@@ -57,9 +60,6 @@ class NCCreateFormUploadRichdocuments: XLFormViewController, NCSelectDelegate, U
             fileNameFolder = (serverUrl as NSString).lastPathComponent
         }
         
-        self.title = titleForm
-        self.initializeForm()
-    
         self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none
         
         let cancelButton : UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_cancel_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(cancel))
@@ -72,7 +72,13 @@ class NCCreateFormUploadRichdocuments: XLFormViewController, NCSelectDelegate, U
         self.navigationController?.navigationBar.barTintColor = NCBrandColor.sharedInstance.brand
         self.navigationController?.navigationBar.tintColor = NCBrandColor.sharedInstance.brandText
         self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: NCBrandColor.sharedInstance.brandText]
-     
+
+        // title 
+        self.title = titleForm
+
+        // form
+        initializeForm()
+
         // load the templates available
         getTemplate()
     }
@@ -271,6 +277,8 @@ class NCCreateFormUploadRichdocuments: XLFormViewController, NCSelectDelegate, U
     
     func getTemplate() {
      
+        indicator.startAnimating()
+        
         let ocNetworking = OCnetworking.init(delegate: nil, metadataNet: nil, withUser: appDelegate.activeUser, withUserID: appDelegate.activeUserID, withPassword: appDelegate.activePassword, withUrl: appDelegate.activeUrl)
         
         ocNetworking?.geTemplatesRichdocuments(withTypeTemplate: typeTemplate, success: { (listOfTemplate) in
@@ -285,9 +293,11 @@ class NCCreateFormUploadRichdocuments: XLFormViewController, NCSelectDelegate, U
                 }
             }
             
+            self.indicator.stopAnimating()
             self.collectionView.reloadData()
             
         }, failure: { (message, errorCode) in
+            self.indicator.stopAnimating()
             self.appDelegate.messageNotification("_error_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)
         })
     }