Compare commits
No commits in common. "0a8d50cc27dc91c321f7962d7ab3a19babe607df" and "810ae718323e5266e9d9311026752a0f89dabeeb" have entirely different histories.
0a8d50cc27
...
810ae71832
|
@ -14,7 +14,6 @@ import VisionKit
|
||||||
protocol LargeImageContentView: UIView {
|
protocol LargeImageContentView: UIView {
|
||||||
var animationImage: UIImage? { get }
|
var animationImage: UIImage? { get }
|
||||||
var activityItemsForSharing: [Any] { get }
|
var activityItemsForSharing: [Any] { get }
|
||||||
var owner: LargeImageViewController? { get set }
|
|
||||||
func setControlsVisible(_ controlsVisible: Bool)
|
func setControlsVisible(_ controlsVisible: Bool)
|
||||||
func grayscaleStateChanged()
|
func grayscaleStateChanged()
|
||||||
}
|
}
|
||||||
|
@ -30,14 +29,17 @@ class LargeImageImageContentView: UIImageView, LargeImageContentView {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
var animationImage: UIImage? { image! }
|
var animationImage: UIImage? { image! }
|
||||||
|
|
||||||
var activityItemsForSharing: [Any] {
|
var activityItemsForSharing: [Any] {
|
||||||
[image!]
|
[image!]
|
||||||
}
|
}
|
||||||
weak var owner: LargeImageViewController?
|
|
||||||
|
|
||||||
private var sourceData: Data?
|
private var sourceData: Data?
|
||||||
|
private weak var owner: UIViewController?
|
||||||
|
|
||||||
|
init(image: UIImage, owner: UIViewController?) {
|
||||||
|
self.owner = owner
|
||||||
|
|
||||||
init(image: UIImage) {
|
|
||||||
super.init(image: image)
|
super.init(image: image)
|
||||||
|
|
||||||
contentMode = .scaleAspectFit
|
contentMode = .scaleAspectFit
|
||||||
|
@ -107,11 +109,11 @@ extension LargeImageImageContentView: ImageAnalysisInteractionDelegate {
|
||||||
|
|
||||||
class LargeImageGifContentView: GIFImageView, LargeImageContentView {
|
class LargeImageGifContentView: GIFImageView, LargeImageContentView {
|
||||||
var animationImage: UIImage? { image }
|
var animationImage: UIImage? { image }
|
||||||
|
|
||||||
var activityItemsForSharing: [Any] {
|
var activityItemsForSharing: [Any] {
|
||||||
// todo: should gifs share the data?
|
// todo: should gifs share the data?
|
||||||
[image].compactMap { $0 }
|
[image].compactMap { $0 }
|
||||||
}
|
}
|
||||||
weak var owner: LargeImageViewController?
|
|
||||||
|
|
||||||
init(gifController: GIFController) {
|
init(gifController: GIFController) {
|
||||||
super.init(image: gifController.lastFrame?.image)
|
super.init(image: gifController.lastFrame?.image)
|
||||||
|
@ -142,7 +144,6 @@ class LargeImageGifvContentView: GifvAttachmentView, LargeImageContentView {
|
||||||
// some SO posts indicate that just sharing a URL to the video should work, but that may need to be a local URL?
|
// some SO posts indicate that just sharing a URL to the video should work, but that may need to be a local URL?
|
||||||
[]
|
[]
|
||||||
}
|
}
|
||||||
weak var owner: LargeImageViewController?
|
|
||||||
|
|
||||||
private let asset: AVURLAsset
|
private let asset: AVURLAsset
|
||||||
|
|
||||||
|
|
|
@ -103,19 +103,15 @@ class LargeImageViewController: UIViewController, UIScrollViewDelegate, LargeIma
|
||||||
dismissInteractionController = LargeImageInteractionController(viewController: self)
|
dismissInteractionController = LargeImageInteractionController(viewController: self)
|
||||||
}
|
}
|
||||||
|
|
||||||
let singleTap = UITapGestureRecognizer(target: self, action: #selector(scrollViewPressed(_:)))
|
view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(scrollViewPressed(_:))))
|
||||||
let doubleTap = UITapGestureRecognizer(target: self, action: #selector(scrollViewDoubleTapped(_:)))
|
let doubleTap = UITapGestureRecognizer(target: self, action: #selector(scrollViewDoubleTapped(_:)))
|
||||||
doubleTap.numberOfTapsRequired = 2
|
doubleTap.numberOfTapsRequired = 2
|
||||||
// this requirement is needed to make sure the double tap is ever recognized
|
|
||||||
singleTap.require(toFail: doubleTap)
|
|
||||||
view.addGestureRecognizer(singleTap)
|
|
||||||
view.addGestureRecognizer(doubleTap)
|
view.addGestureRecognizer(doubleTap)
|
||||||
|
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(preferencesChanged), name: .preferencesChanged, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(preferencesChanged), name: .preferencesChanged, object: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func setupContentView() {
|
private func setupContentView() {
|
||||||
contentView.owner = self
|
|
||||||
contentView.translatesAutoresizingMaskIntoConstraints = false
|
contentView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
scrollView.addSubview(contentView)
|
scrollView.addSubview(contentView)
|
||||||
contentViewLeadingConstraint = contentView.leadingAnchor.constraint(equalTo: scrollView.leadingAnchor)
|
contentViewLeadingConstraint = contentView.leadingAnchor.constraint(equalTo: scrollView.leadingAnchor)
|
||||||
|
|
|
@ -138,9 +138,9 @@ class LoadingLargeImageViewController: UIViewController, LargeImageAnimatableVie
|
||||||
content = LargeImageGifContentView(gifController: gifController)
|
content = LargeImageGifContentView(gifController: gifController)
|
||||||
} else {
|
} else {
|
||||||
if let transformedImage = ImageGrayscalifier.convertIfNecessary(url: url, image: image) {
|
if let transformedImage = ImageGrayscalifier.convertIfNecessary(url: url, image: image) {
|
||||||
content = LargeImageImageContentView(image: transformedImage)
|
content = LargeImageImageContentView(image: transformedImage, owner: self)
|
||||||
} else {
|
} else {
|
||||||
content = LargeImageImageContentView(image: image)
|
content = LargeImageImageContentView(image: image, owner: self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ class LoadingLargeImageViewController: UIViewController, LargeImageAnimatableVie
|
||||||
let grayscale = ImageGrayscalifier.convert(url: nil, cgImage: source) {
|
let grayscale = ImageGrayscalifier.convert(url: nil, cgImage: source) {
|
||||||
image = grayscale
|
image = grayscale
|
||||||
}
|
}
|
||||||
setContent(LargeImageImageContentView(image: image))
|
setContent(LargeImageImageContentView(image: image, owner: self))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,6 @@ class TimelineGapCollectionViewCell: UICollectionViewCell {
|
||||||
let label = UILabel()
|
let label = UILabel()
|
||||||
label.text = "Load more"
|
label.text = "Load more"
|
||||||
label.font = .preferredFont(forTextStyle: .headline)
|
label.font = .preferredFont(forTextStyle: .headline)
|
||||||
label.adjustsFontForContentSizeCategory = true
|
|
||||||
label.textColor = .tintColor
|
label.textColor = .tintColor
|
||||||
|
|
||||||
chevronView.update(direction: .above)
|
chevronView.update(direction: .above)
|
||||||
|
|
|
@ -357,7 +357,6 @@ class CustomAlertActionButton: UIControl {
|
||||||
titleView = UIStackView()
|
titleView = UIStackView()
|
||||||
titleView.axis = .horizontal
|
titleView.axis = .horizontal
|
||||||
titleView.spacing = 4
|
titleView.spacing = 4
|
||||||
titleView.alignment = .center
|
|
||||||
|
|
||||||
if let title = action.title {
|
if let title = action.title {
|
||||||
let label = UILabel()
|
let label = UILabel()
|
||||||
|
|
|
@ -11,7 +11,7 @@ import Pachyderm
|
||||||
|
|
||||||
struct ToastConfiguration {
|
struct ToastConfiguration {
|
||||||
var systemImageName: String?
|
var systemImageName: String?
|
||||||
var titleFont: UIFont = UIFontMetrics(forTextStyle: .body).scaledFont(for: .boldSystemFont(ofSize: 14))
|
var titleFont: UIFont = .boldSystemFont(ofSize: 14)
|
||||||
var title: String
|
var title: String
|
||||||
var subtitle: String?
|
var subtitle: String?
|
||||||
var actionTitle: String?
|
var actionTitle: String?
|
||||||
|
|
|
@ -68,15 +68,13 @@ class ToastView: UIView {
|
||||||
titleLabel.textColor = .white
|
titleLabel.textColor = .white
|
||||||
titleLabel.font = configuration.titleFont
|
titleLabel.font = configuration.titleFont
|
||||||
titleLabel.adjustsFontSizeToFitWidth = true
|
titleLabel.adjustsFontSizeToFitWidth = true
|
||||||
titleLabel.adjustsFontForContentSizeCategory = true
|
|
||||||
|
|
||||||
if let subtitle = configuration.subtitle {
|
if let subtitle = configuration.subtitle {
|
||||||
let subtitleLabel = UILabel()
|
let subtitleLabel = UILabel()
|
||||||
subtitleLabel.text = subtitle
|
subtitleLabel.text = subtitle
|
||||||
subtitleLabel.textColor = .white
|
subtitleLabel.textColor = .white
|
||||||
subtitleLabel.numberOfLines = 0
|
subtitleLabel.numberOfLines = 0
|
||||||
subtitleLabel.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 14))
|
subtitleLabel.font = .systemFont(ofSize: 14)
|
||||||
subtitleLabel.adjustsFontForContentSizeCategory = true
|
|
||||||
let vStack = UIStackView(arrangedSubviews: [
|
let vStack = UIStackView(arrangedSubviews: [
|
||||||
titleLabel,
|
titleLabel,
|
||||||
subtitleLabel
|
subtitleLabel
|
||||||
|
@ -91,8 +89,7 @@ class ToastView: UIView {
|
||||||
if let actionTitle = configuration.actionTitle {
|
if let actionTitle = configuration.actionTitle {
|
||||||
let actionLabel = UILabel()
|
let actionLabel = UILabel()
|
||||||
actionLabel.text = actionTitle
|
actionLabel.text = actionTitle
|
||||||
actionLabel.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .boldSystemFont(ofSize: 16))
|
actionLabel.font = .boldSystemFont(ofSize: 16)
|
||||||
actionLabel.adjustsFontForContentSizeCategory = true
|
|
||||||
actionLabel.textColor = .white
|
actionLabel.textColor = .white
|
||||||
stack.addArrangedSubview(actionLabel)
|
stack.addArrangedSubview(actionLabel)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue