ソースを参照

show instructions what to do if a video is opened that did not get a preview (with high chance, Preview won't be able to play it)

B. Petersen 1 年間 前
コミット
87e778a238

+ 11 - 2
deltachat-ios/Chat/ChatViewController.swift

@@ -2147,7 +2147,7 @@ extension ChatViewController: BaseMessageCellDelegate {
         }
     }
 
-    @objc func imageTapped(indexPath: IndexPath) {
+    @objc func imageTapped(indexPath: IndexPath, previewError: Bool) {
         if handleUIMenu() || handleSelection(indexPath: indexPath) {
             return
         }
@@ -2155,7 +2155,16 @@ extension ChatViewController: BaseMessageCellDelegate {
         if message.type == DC_MSG_WEBXDC {
             showWebxdcViewFor(message: message)
         } else if message.type != DC_MSG_STICKER {
-            showMediaGalleryFor(message: message)
+            if previewError && message.type == DC_MSG_VIDEO {
+                let alert = UIAlertController(title: "To play this video, share to apps as VLC on the following page.", message: nil, preferredStyle: .safeActionSheet)
+                alert.addAction(UIAlertAction(title: String.localized("perm_continue"), style: .default, handler: { _ in
+                    self.showMediaGalleryFor(message: message)
+                }))
+                alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: nil))
+                present(alert, animated: true, completion: nil)
+            } else {
+                showMediaGalleryFor(message: message)
+            }
         }
     }
 

+ 1 - 1
deltachat-ios/Chat/Views/Cells/BaseMessageCell.swift

@@ -616,7 +616,7 @@ public protocol BaseMessageCellDelegate: class {
     func commandTapped(command: String, indexPath: IndexPath) // `/command`
     func phoneNumberTapped(number: String, indexPath: IndexPath)
     func urlTapped(url: URL, indexPath: IndexPath) // url is eg. `https://foo.bar`
-    func imageTapped(indexPath: IndexPath)
+    func imageTapped(indexPath: IndexPath, previewError: Bool)
     func avatarTapped(indexPath: IndexPath)
     func textTapped(indexPath: IndexPath)
     func quoteTapped(indexPath: IndexPath)

+ 1 - 1
deltachat-ios/Chat/Views/Cells/ImageTextCell.swift

@@ -103,7 +103,7 @@ class ImageTextCell: BaseMessageCell {
 
     @objc func onImageTapped() {
         if let tableView = self.superview as? UITableView, let indexPath = tableView.indexPath(for: self) {
-            baseDelegate?.imageTapped(indexPath: indexPath)
+            baseDelegate?.imageTapped(indexPath: indexPath, previewError: imageView?.image == nil)
         }
     }
 

+ 1 - 1
deltachat-ios/Chat/Views/Cells/WebxdcCell.swift

@@ -14,7 +14,7 @@ public class WebxdcCell: FileTextCell {
 
     @objc func onImageTapped() {
         if let tableView = self.superview as? UITableView, let indexPath = tableView.indexPath(for: self) {
-            baseDelegate?.imageTapped(indexPath: indexPath)
+            baseDelegate?.imageTapped(indexPath: indexPath, previewError: false)
         }
     }