Signed-off-by: Marcel Müller <marcel-mueller@gmx.de>
This commit is contained in:
Marcel Müller 2022-09-30 19:54:53 +02:00
Родитель 140aff2f05
Коммит d54dee1c00
2 изменённых файлов: 13 добавлений и 13 удалений

Просмотреть файл

@ -26,7 +26,7 @@ import Foundation
@IBOutlet var contentView: UIView! @IBOutlet var contentView: UIView!
@IBOutlet weak var referenceTypeIcon: UIImageView! @IBOutlet weak var referenceTypeIcon: UIImageView!
@IBOutlet weak var referenceTitle: UILabel! @IBOutlet weak var referenceTitle: UILabel!
@IBOutlet weak var referenceBody: UITextView! @IBOutlet weak var referenceDescription: UITextView!
@IBOutlet weak var referenceDueDate: UILabel! @IBOutlet weak var referenceDueDate: UILabel!
@IBOutlet weak var referenceDueDateIcon: UIImageView! @IBOutlet weak var referenceDueDateIcon: UIImageView!
@ -48,13 +48,14 @@ import Foundation
contentView.autoresizingMask = [.flexibleWidth, .flexibleHeight] contentView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
referenceTitle.text = "" referenceTitle.text = ""
referenceBody.text = "" referenceDescription.text = ""
referenceDueDate.text = ""
referenceTypeIcon.image = nil referenceTypeIcon.image = nil
// Remove padding from textView and adjust lineBreakMode // Remove padding from textView and adjust lineBreakMode
referenceBody.textContainerInset = .zero referenceDescription.textContainerInset = .zero
referenceBody.textContainer.lineFragmentPadding = .zero referenceDescription.textContainer.lineFragmentPadding = .zero
referenceBody.textContainer.lineBreakMode = .byTruncatingTail referenceDescription.textContainer.lineBreakMode = .byTruncatingTail
let tap = UITapGestureRecognizer(target: self, action: #selector(self.handleTap)) let tap = UITapGestureRecognizer(target: self, action: #selector(self.handleTap))
contentView.addGestureRecognizer(tap) contentView.addGestureRecognizer(tap)
@ -75,6 +76,7 @@ import Foundation
guard let card = reference["card"] as? [String: AnyObject] else { guard let card = reference["card"] as? [String: AnyObject] else {
referenceTitle.text = url referenceTitle.text = url
referenceDescription.isHidden = true
referenceDueDate.isHidden = true referenceDueDate.isHidden = true
referenceDueDateIcon.isHidden = true referenceDueDateIcon.isHidden = true
return return
@ -83,11 +85,9 @@ import Foundation
if let dueDateString = card["duedate"] as? String { if let dueDateString = card["duedate"] as? String {
let dateFormatter = DateFormatter() let dateFormatter = DateFormatter()
dateFormatter.locale = Locale(identifier: "en_US_POSIX") // set locale to reliable US_POSIX dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss" let date = dateFormatter.date(from: dueDateString)!
let date = dateFormatter.date(from:dueDateString)!
//let dueDate = NSDate(timeIntervalSince1970: TimeInterval(duedate))
referenceDueDate.text = NCUtils.readableDateTime(from: date) referenceDueDate.text = NCUtils.readableDateTime(from: date)
} else { } else {
referenceDueDate.isHidden = true referenceDueDate.isHidden = true
@ -99,9 +99,9 @@ import Foundation
} }
if let body = card["description"] as? String { if let body = card["description"] as? String {
referenceBody.text = body referenceDescription.text = body
} else { } else {
referenceBody.text = NSLocalizedString("No description provided", comment: "") referenceDescription.text = NSLocalizedString("No description provided", comment: "")
} }
} }
} }

Просмотреть файл

@ -11,7 +11,7 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ReferenceDeckView" customModule="NextcloudTalk" customModuleProvider="target"> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ReferenceDeckView" customModule="NextcloudTalk" customModuleProvider="target">
<connections> <connections>
<outlet property="contentView" destination="iN0-l3-epB" id="I1C-wk-7lp"/> <outlet property="contentView" destination="iN0-l3-epB" id="I1C-wk-7lp"/>
<outlet property="referenceBody" destination="PAt-pa-feD" id="TR8-w0-2bX"/> <outlet property="referenceDescription" destination="PAt-pa-feD" id="5Vf-EF-IsR"/>
<outlet property="referenceDueDate" destination="WRq-4l-Gy5" id="Qol-5i-5g2"/> <outlet property="referenceDueDate" destination="WRq-4l-Gy5" id="Qol-5i-5g2"/>
<outlet property="referenceDueDateIcon" destination="0Ho-aZ-xOH" id="g13-yA-huU"/> <outlet property="referenceDueDateIcon" destination="0Ho-aZ-xOH" id="g13-yA-huU"/>
<outlet property="referenceTitle" destination="Iby-r5-06p" id="aI4-Yi-Bp4"/> <outlet property="referenceTitle" destination="Iby-r5-06p" id="aI4-Yi-Bp4"/>
@ -36,7 +36,7 @@
<nil key="textColor"/> <nil key="textColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" userInteractionEnabled="NO" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" bounces="NO" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" bouncesZoom="NO" editable="NO" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PAt-pa-feD" userLabel="Body"> <textView clipsSubviews="YES" multipleTouchEnabled="YES" userInteractionEnabled="NO" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" bounces="NO" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" bouncesZoom="NO" editable="NO" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PAt-pa-feD" userLabel="Description">
<rect key="frame" x="40" y="30" width="565" height="40"/> <rect key="frame" x="40" y="30" width="565" height="40"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints> <constraints>