Эх сурвалжийг харах

add basic UI for swipe-to-reply

cyberta 4 жил өмнө
parent
commit
12aaa87029

+ 3 - 3
deltachat-ios/Assets.xcassets/Contents.json

@@ -1,6 +1,6 @@
 {
   "info" : {
-    "version" : 1,
-    "author" : "xcode"
+    "author" : "xcode",
+    "version" : 1
   }
-}
+}

+ 23 - 0
deltachat-ios/Assets.xcassets/ic_reply.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "filename" : "baseline_reply_white_36pt_1x.png",
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "baseline_reply_white_36pt_2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "baseline_reply_white_36pt_3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
deltachat-ios/Assets.xcassets/ic_reply.imageset/baseline_reply_white_36pt_1x.png


BIN
deltachat-ios/Assets.xcassets/ic_reply.imageset/baseline_reply_white_36pt_2x.png


BIN
deltachat-ios/Assets.xcassets/ic_reply.imageset/baseline_reply_white_36pt_3x.png


+ 23 - 0
deltachat-ios/Assets.xcassets/ic_reply_black.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "filename" : "baseline_reply_white_36pt_1x.png",
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "baseline_reply_white_36pt_2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "baseline_reply_white_36pt_3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
deltachat-ios/Assets.xcassets/ic_reply_black.imageset/baseline_reply_white_36pt_1x.png


BIN
deltachat-ios/Assets.xcassets/ic_reply_black.imageset/baseline_reply_white_36pt_2x.png


BIN
deltachat-ios/Assets.xcassets/ic_reply_black.imageset/baseline_reply_white_36pt_3x.png


+ 18 - 0
deltachat-ios/Chat/ChatViewController.swift

@@ -399,6 +399,24 @@ class ChatViewController: UITableViewController {
         markSeenMessagesInVisibleArea()
     }
 
+    override func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration?  {
+        let action = UIContextualAction(style: .normal, title: nil,
+                                        handler: { (action, view, completionHandler) in
+                                            // Update data source when user taps action
+                                            completionHandler(true)
+                                        })
+        if #available(iOS 12.0, *) {
+            action.image = UIImage(named: traitCollection.userInterfaceStyle == .light ? "ic_reply_black" : "ic_reply")
+        } else {
+            action.image = UIImage(named: "ic_reply_black")
+        }
+        action.backgroundColor = DcColors.chatBackgroundColor
+        action.accessibilityHint = String.localized("reply_noun")
+        let configuration = UISwipeActionsConfiguration(actions: [action])
+
+        return configuration
+    }
+
     func markSeenMessagesInVisibleArea() {
         if let indexPaths = tableView.indexPathsForVisibleRows {
             let visibleMessagesIds = indexPaths.map { UInt32(messageIds[$0.row]) }