marinofaggiana 3 năm trước cách đây
mục cha
commit
71b1d4f804
2 tập tin đã thay đổi với 50 bổ sung6 xóa
  1. 2 2
      Share/MainInterface.storyboard
  2. 48 4
      Share/NCShareExtension.swift

+ 2 - 2
Share/MainInterface.storyboard

@@ -43,7 +43,7 @@
                                         </constraints>
                                     </view>
                                     <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="eU0-LW-AnG">
-                                        <rect key="frame" x="0.0" y="11" width="414" height="239"/>
+                                        <rect key="frame" x="0.0" y="51" width="414" height="199"/>
                                         <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                                         <prototypes>
                                             <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="Cell" rowHeight="50" id="6Kt-n0-i8J">
@@ -85,7 +85,7 @@
                                 </subviews>
                                 <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                                 <constraints>
-                                    <constraint firstItem="eU0-LW-AnG" firstAttribute="top" secondItem="LAs-iQ-u1X" secondAttribute="bottom" constant="10" id="14j-96-VwG"/>
+                                    <constraint firstItem="eU0-LW-AnG" firstAttribute="top" secondItem="LAs-iQ-u1X" secondAttribute="bottom" constant="50" id="14j-96-VwG"/>
                                     <constraint firstAttribute="height" constant="300" id="50u-lA-AUo"/>
                                     <constraint firstItem="eU0-LW-AnG" firstAttribute="leading" secondItem="FaV-kz-PEs" secondAttribute="leading" id="E40-Ul-MEV"/>
                                     <constraint firstItem="LAs-iQ-u1X" firstAttribute="leading" secondItem="FaV-kz-PEs" secondAttribute="leading" id="dr0-zN-pwa"/>

+ 48 - 4
Share/NCShareExtension.swift

@@ -108,7 +108,6 @@ class NCShareExtension: UIViewController, NCListCellDelegate, NCGridCellDelegate
 
         separatorView.backgroundColor = NCBrandColor.shared.separator
         
-        cancelButton.title = NSLocalizedString("_cancel_", comment: "")
         //createFolderButton.title = NSLocalizedString("_create_folder_", comment: "")
         //uploadButton.title = NSLocalizedString("_upload_", comment: "")
     }
@@ -198,6 +197,51 @@ class NCShareExtension: UIViewController, NCListCellDelegate, NCGridCellDelegate
         }
     }
     
+    // MARK: -
+    
+    func navigationButtons() {
+        
+        cancelButton.title = NSLocalizedString("_cancel_", comment: "")
+        
+        navigationItem.leftBarButtonItem = nil
+        navigationItem.title = titleCurrentFolder
+        
+        // PROFILE BUTTON
+                
+        var image = NCUtility.shared.loadImage(named: "person.crop.circle")
+        let fileNamePath = String(CCUtility.getDirectoryUserData()) + "/" + String(CCUtility.getStringUser(activeAccount.user, urlBase: activeAccount.urlBase)) + "-" + activeAccount.user + ".png"
+        if let userImage = UIImage(contentsOfFile: fileNamePath) {
+            image = userImage
+        }
+            
+        image = NCUtility.shared.createAvatar(image: image, size: 30)
+            
+        let button = UIButton(type: .custom)
+        button.setImage(image, for: .normal)
+            
+        if serverUrl == NCUtilityFileSystem.shared.getHomeServer(urlBase: activeAccount.urlBase, account: activeAccount.account) {
+             
+            let account = NCManageDatabase.shared.getAccountActive()
+            var title = "  "
+            if account?.alias == "" {
+                title = title + (account?.user ?? "")
+            } else {
+                title = title + (account?.alias ?? "")
+            }
+                
+            button.setTitle(title, for: .normal)
+            button.setTitleColor(.systemBlue, for: .normal)
+        }
+            
+        button.semanticContentAttribute = .forceLeftToRight
+        button.sizeToFit()
+        //button.addTarget(self, action: #selector(profileButtonTapped(sender:)), for: .touchUpInside)
+                   
+        navigationItem.setLeftBarButton(UIBarButtonItem(customView: button), animated: true)
+        navigationItem.leftItemsSupplementBackButton = true
+    }
+    
+    
     // MARK: - Empty
     
     func emptyDataSetView(_ view: NCEmptyView) {
@@ -334,9 +378,7 @@ extension NCShareExtension: UICollectionViewDelegate {
 extension NCShareExtension: UICollectionViewDataSource {
 
     func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
-        
-        self.navigationItem.title = titleCurrentFolder
-        
+                
         if kind == UICollectionView.elementKindSectionHeader {
             
             let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionHeaderMenu", for: indexPath) as! NCSectionHeaderMenu
@@ -697,6 +739,8 @@ extension NCShareExtension {
     
     @objc func loadDatasource(withLoadFolder: Bool) {
                 
+        self.navigationItem.title = titleCurrentFolder
+
         (layout, sort, ascending, groupBy, directoryOnTop, titleButton, itemForLine) = NCUtility.shared.getLayoutForView(key: keyLayout, serverUrl: serverUrl)
                 
         let metadatasSource = NCManageDatabase.shared.getMetadatas(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND directory == true", activeAccount.account, serverUrl))