-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add media URLs and entity IDs (#23887)
* Add URL to Media metadata * Add Media IDs * Add post IDs * Update release notes
- Loading branch information
Showing
8 changed files
with
100 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
WordPress/Classes/ViewRelated/Cells/TextViewTableCell.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import UIKit | ||
import WordPressUI | ||
|
||
final class TextViewTableCell: UITableViewCell { | ||
let titleLabel = UILabel() | ||
let detailsView = UITextView.makeLabel() | ||
|
||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
|
||
detailsView.textContainer.maximumNumberOfLines = 1 | ||
detailsView.textContainer.lineBreakMode = .byTruncatingMiddle | ||
detailsView.textColor = .secondaryLabel | ||
detailsView.font = .preferredFont(forTextStyle: .body) | ||
detailsView.dataDetectorTypes = .link | ||
|
||
titleLabel.setContentCompressionResistancePriority(.init(900), for: .horizontal) | ||
|
||
let stackView = UIStackView(alignment: .firstBaseline, spacing: 3, [titleLabel, UIView(), detailsView]) | ||
contentView.addSubview(stackView) | ||
stackView.pinEdges(to: contentView.layoutMarginsGuide) | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
WordPress/Classes/ViewRelated/Views/EntityMetadataTableFooterView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import UIKit | ||
|
||
final class EntityMetadataTableFooterView: UIView { | ||
let textLabel = UILabel() | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
|
||
textLabel.textColor = .tertiaryLabel | ||
textLabel.font = .preferredFont(forTextStyle: .footnote) | ||
textLabel.textAlignment = .center | ||
|
||
addSubview(textLabel) | ||
textLabel.pinEdges(insets: UIEdgeInsets(.all, 8)) | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
static func make(id: NSNumber) -> UIView { | ||
let footerView = EntityMetadataTableFooterView() | ||
footerView.textLabel.text = "\(Strings.id) \(id)" | ||
return footerView | ||
} | ||
} | ||
|
||
private enum Strings { | ||
static let id = NSLocalizedString("entityMetadataFooterView.id", value: "ID", comment: "A name of the ID field (it's a technical field, has to be short, displayed below everything else)") | ||
} |