Browse Source

new view share (comments)

marinofaggiana 5 years ago
parent
commit
5af82eb2e2

+ 15 - 0
iOSClient/Images.xcassets/edit.imageset/Contents.json

@@ -0,0 +1,15 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "edit.pdf"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  },
+  "properties" : {
+    "preserves-vector-representation" : true
+  }
+}

BIN
iOSClient/Images.xcassets/edit.imageset/edit.pdf


+ 20 - 0
iOSClient/Share/NCShareComments.swift

@@ -22,6 +22,7 @@
 //
 
 import Foundation
+import Sheeeeeeeeet
 
 class NCShareComments: UIViewController, NCShareCommentsCellDelegate {
    
@@ -35,6 +36,7 @@ class NCShareComments: UIViewController, NCShareCommentsCellDelegate {
 
     var metadata: tableMetadata?
     public var height: CGFloat = 0
+    private var actionSheet: ActionSheet?
 
     override func viewDidLoad() {
         super.viewDidLoad()
@@ -115,7 +117,25 @@ class NCShareComments: UIViewController, NCShareCommentsCellDelegate {
     }
     
     func tapMenu(with tableComments: tableComments?, sender: Any) {
+     
+        var items = [ActionSheetItem]()
+        let appearanceDelete = ActionSheetItemAppearance.init()
+        appearanceDelete.textColor = UIColor.red
+        
+        items.append(ActionSheetItem(title: NSLocalizedString("_edit_comment_", comment: ""), value: 0, image: CCGraphics.changeThemingColorImage(UIImage.init(named: "edit"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon)))
+        let itemDelete = ActionSheetItem(title: NSLocalizedString("_delete_comment_", comment: ""), value: 1, image: CCGraphics.changeThemingColorImage(UIImage.init(named: "trash"), width: 50, height: 50, color: .red))
+        itemDelete.customAppearance = appearanceDelete
+        items.append(itemDelete)
+        items.append(ActionSheetCancelButton(title: NSLocalizedString("_cancel_", comment: "")))
+        
+        actionSheet = ActionSheet(items: items) { sheet, item in
+            
+            if item.value as? Int == 1 {  }
+            if item.value as? Int == 2 {  }
+            if item is ActionSheetCancelButton { print("Cancel buttons has the value `true`") }
+        }
         
+        actionSheet?.present(in: self, from: sender as! UIButton)
     }
 }
 

+ 4 - 1
iOSClient/Share/NCShareCommentsCell.xib

@@ -53,13 +53,16 @@
                         <color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                         <nil key="highlightedColor"/>
                     </label>
-                    <button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="J1z-RG-U4A" userLabel="ButtonMenu">
+                    <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="J1z-RG-U4A" userLabel="ButtonMenu">
                         <rect key="frame" x="93.5" y="25" width="20" height="20"/>
                         <constraints>
                             <constraint firstAttribute="height" constant="20" id="G48-LB-BsD"/>
                             <constraint firstAttribute="width" constant="20" id="vLI-cJ-Jqx"/>
                         </constraints>
                         <state key="normal" image="shareMenu"/>
+                        <connections>
+                            <action selector="touchUpInsideMenu:" destination="qJF-Yc-gKE" eventType="touchUpInside" id="dx2-2Z-VfO"/>
+                        </connections>
                     </button>
                     <label opaque="NO" userInteractionEnabled="NO" tag="101" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="message" lineBreakMode="middleTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mNK-Zq-pFW" userLabel="labelTitle">
                         <rect key="frame" x="55" y="63" width="540" height="43.5"/>

+ 2 - 0
iOSClient/Supporting Files/en.lproj/Localizable.strings

@@ -466,6 +466,8 @@
 "_shared_with_you_by_"          = "Shared with you by";
 "_shareLinksearch_placeholder_" = "Search for user or group...";
 "_new_comment_"                 = "New comment ...";
+"_edit_comment_"                = "Edit comment";
+"_delete_comment_"              = "Delete comment";
 
 // Share Permission