Add label to the “load embed” button

This commit is contained in:
Jed Fox 2022-12-03 11:29:03 -05:00
parent c67e6ce45e
commit e46c25892d
No known key found for this signature in database
GPG Key ID: 0B61D18EA54B47E1
5 changed files with 9 additions and 3 deletions

View File

@ -132,6 +132,7 @@
"sensitive_content": "Sensitive Content", "sensitive_content": "Sensitive Content",
"media_content_warning": "Tap anywhere to reveal", "media_content_warning": "Tap anywhere to reveal",
"tap_to_reveal": "Tap to reveal", "tap_to_reveal": "Tap to reveal",
"load_embed": "Load Embed",
"poll": { "poll": {
"vote": "Vote", "vote": "Vote",
"closed": "Closed" "closed": "Closed"

View File

@ -132,6 +132,7 @@
"sensitive_content": "Sensitive Content", "sensitive_content": "Sensitive Content",
"media_content_warning": "Tap anywhere to reveal", "media_content_warning": "Tap anywhere to reveal",
"tap_to_reveal": "Tap to reveal", "tap_to_reveal": "Tap to reveal",
"load_embed": "Load Embed",
"poll": { "poll": {
"vote": "Vote", "vote": "Vote",
"closed": "Closed" "closed": "Closed"

View File

@ -272,6 +272,8 @@ public enum L10n {
public enum Status { public enum Status {
/// Content Warning /// Content Warning
public static let contentWarning = L10n.tr("Localizable", "Common.Controls.Status.ContentWarning", fallback: "Content Warning") public static let contentWarning = L10n.tr("Localizable", "Common.Controls.Status.ContentWarning", fallback: "Content Warning")
/// Load Embed
public static let loadEmbed = L10n.tr("Localizable", "Common.Controls.Status.LoadEmbed", fallback: "Load Embed")
/// Tap anywhere to reveal /// Tap anywhere to reveal
public static let mediaContentWarning = L10n.tr("Localizable", "Common.Controls.Status.MediaContentWarning", fallback: "Tap anywhere to reveal") public static let mediaContentWarning = L10n.tr("Localizable", "Common.Controls.Status.MediaContentWarning", fallback: "Tap anywhere to reveal")
/// Sensitive Content /// Sensitive Content

View File

@ -107,6 +107,7 @@ Please check your internet connection.";
"Common.Controls.Status.Actions.Unfavorite" = "Unfavorite"; "Common.Controls.Status.Actions.Unfavorite" = "Unfavorite";
"Common.Controls.Status.Actions.Unreblog" = "Undo reblog"; "Common.Controls.Status.Actions.Unreblog" = "Undo reblog";
"Common.Controls.Status.ContentWarning" = "Content Warning"; "Common.Controls.Status.ContentWarning" = "Content Warning";
"Common.Controls.Status.LoadEmbed" = "Load Embed";
"Common.Controls.Status.MediaContentWarning" = "Tap anywhere to reveal"; "Common.Controls.Status.MediaContentWarning" = "Tap anywhere to reveal";
"Common.Controls.Status.MetaEntity.Email" = "Email address: %@"; "Common.Controls.Status.MetaEntity.Email" = "Email address: %@";
"Common.Controls.Status.MetaEntity.Hashtag" = "Hashtag: %@"; "Common.Controls.Status.MetaEntity.Hashtag" = "Hashtag: %@";

View File

@ -9,6 +9,7 @@ import AlamofireImage
import Combine import Combine
import MastodonAsset import MastodonAsset
import MastodonCore import MastodonCore
import MastodonLocalization
import CoreDataStack import CoreDataStack
import UIKit import UIKit
import WebKit import WebKit
@ -33,6 +34,9 @@ public final class StatusCardControl: UIControl {
configuration.baseBackgroundColor = .clear configuration.baseBackgroundColor = .clear
configuration.cornerStyle = .capsule configuration.cornerStyle = .capsule
configuration.buttonSize = .large configuration.buttonSize = .large
configuration.title = L10n.Common.Controls.Status.loadEmbed
configuration.image = UIImage(systemName: "play.fill")
configuration.imagePadding = 12
return UIButton(configuration: configuration, primaryAction: UIAction { [weak self] _ in return UIButton(configuration: configuration, primaryAction: UIAction { [weak self] _ in
self?.showWebView() self?.showWebView()
}) })
@ -112,8 +116,6 @@ public final class StatusCardControl: UIControl {
containerStackView.isUserInteractionEnabled = false containerStackView.isUserInteractionEnabled = false
containerStackView.distribution = .fill containerStackView.distribution = .fill
showEmbedButton.setImage(UIImage(systemName: "play.fill"), for: .normal)
addSubview(containerStackView) addSubview(containerStackView)
addSubview(highlightView) addSubview(highlightView)
addSubview(showEmbedButton) addSubview(showEmbedButton)
@ -125,7 +127,6 @@ public final class StatusCardControl: UIControl {
containerStackView.pinToParent() containerStackView.pinToParent()
highlightView.pinToParent() highlightView.pinToParent()
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([
showEmbedButton.widthAnchor.constraint(equalTo: showEmbedButton.heightAnchor),
showEmbedButton.centerXAnchor.constraint(equalTo: imageView.centerXAnchor), showEmbedButton.centerXAnchor.constraint(equalTo: imageView.centerXAnchor),
showEmbedButton.centerYAnchor.constraint(equalTo: imageView.centerYAnchor), showEmbedButton.centerYAnchor.constraint(equalTo: imageView.centerYAnchor),
]) ])