Преглед изворни кода

Restrict webxdc summary (#1486)

* restrict webxdc to one line

* check for empty summary fields and use 'Webxdc' as placeholder if needed
cyBerta пре 3 година
родитељ
комит
8358f9405b
1 измењених фајлова са 7 додато и 2 уклоњено
  1. 7 2
      deltachat-ios/Chat/Views/WebxdcPreview.swift

+ 7 - 2
deltachat-ios/Chat/Views/WebxdcPreview.swift

@@ -27,7 +27,8 @@ public class WebxdcPreview: UIView {
         let view = UILabel()
         view.font = UIFont.preferredFont(forTextStyle: .body)
         view.translatesAutoresizingMaskIntoConstraints = false
-        view.numberOfLines = 3
+        view.numberOfLines = 1
+        view.lineBreakMode = .byTruncatingTail
         isAccessibilityElement = false
         return view
     }()
@@ -69,7 +70,11 @@ public class WebxdcPreview: UIView {
             }
         }
         titleView.text = dict["name"] as? String
-        subtitleView.text = dict["summary"] as? String ?? "Webxdc"
+        guard let summary = dict["summary"] as? String, !summary.isEmpty else {
+            subtitleView.text = "Webxdc"
+            return
+        }
+        subtitleView.text = summary
     }
 
     public func configureAccessibilityLabel() -> String {