Compare commits
No commits in common. "bb3e1b44b112e33ffff1fdb0309e640968a42777" and "cccde29e6c591c62d663b8f16e2e847a0117d809" have entirely different histories.
bb3e1b44b1
...
cccde29e6c
|
@ -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 }
|
||||||
func setControlsVisible(_ controlsVisible: Bool)
|
|
||||||
func grayscaleStateChanged()
|
func grayscaleStateChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,9 +22,6 @@ class LargeImageImageContentView: UIImageView, LargeImageContentView {
|
||||||
#if !targetEnvironment(macCatalyst)
|
#if !targetEnvironment(macCatalyst)
|
||||||
@available(iOS 16.0, *)
|
@available(iOS 16.0, *)
|
||||||
private static let analyzer = ImageAnalyzer()
|
private static let analyzer = ImageAnalyzer()
|
||||||
private var _analysisInteraction: AnyObject?
|
|
||||||
@available(iOS 16.0, *)
|
|
||||||
private var analysisInteraction: ImageAnalysisInteraction? { _analysisInteraction as? ImageAnalysisInteraction }
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
var animationImage: UIImage? { image! }
|
var animationImage: UIImage? { image! }
|
||||||
|
@ -49,7 +45,6 @@ class LargeImageImageContentView: UIImageView, LargeImageContentView {
|
||||||
if #available(iOS 16.0, *),
|
if #available(iOS 16.0, *),
|
||||||
ImageAnalyzer.isSupported {
|
ImageAnalyzer.isSupported {
|
||||||
let interaction = ImageAnalysisInteraction()
|
let interaction = ImageAnalysisInteraction()
|
||||||
self._analysisInteraction = interaction
|
|
||||||
interaction.delegate = self
|
interaction.delegate = self
|
||||||
interaction.preferredInteractionTypes = .automatic
|
interaction.preferredInteractionTypes = .automatic
|
||||||
addInteraction(interaction)
|
addInteraction(interaction)
|
||||||
|
@ -69,17 +64,6 @@ class LargeImageImageContentView: UIImageView, LargeImageContentView {
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
func setControlsVisible(_ controlsVisible: Bool) {
|
|
||||||
#if !targetEnvironment(macCatalyst)
|
|
||||||
if #available(iOS 16.0, *),
|
|
||||||
let analysisInteraction {
|
|
||||||
// note: passing animated: true here doesn't seem to do anything by itself as of iOS 16.2 (20C5032e)
|
|
||||||
// so the LargeImageViewController handles animating, but we still need to pass true here otherwise it doesn't animate
|
|
||||||
analysisInteraction.setSupplementaryInterfaceHidden(!controlsVisible, animated: true)
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
func grayscaleStateChanged() {
|
func grayscaleStateChanged() {
|
||||||
guard let data = sourceData else {
|
guard let data = sourceData else {
|
||||||
return
|
return
|
||||||
|
@ -129,9 +113,6 @@ class LargeImageGifContentView: GIFImageView, LargeImageContentView {
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
func setControlsVisible(_ controlsVisible: Bool) {
|
|
||||||
}
|
|
||||||
|
|
||||||
func grayscaleStateChanged() {
|
func grayscaleStateChanged() {
|
||||||
// todo
|
// todo
|
||||||
}
|
}
|
||||||
|
@ -170,9 +151,6 @@ class LargeImageGifvContentView: GifvAttachmentView, LargeImageContentView {
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
func setControlsVisible(_ controlsVisible: Bool) {
|
|
||||||
}
|
|
||||||
|
|
||||||
func grayscaleStateChanged() {
|
func grayscaleStateChanged() {
|
||||||
// no-op, GifvAttachmentView observes the grayscale state itself
|
// no-op, GifvAttachmentView observes the grayscale state itself
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,6 @@ class LargeImageViewController: UIViewController, UIScrollViewDelegate, LargeIma
|
||||||
self.controlsVisible = controlsVisible
|
self.controlsVisible = controlsVisible
|
||||||
if animated {
|
if animated {
|
||||||
UIView.animate(withDuration: 0.2) {
|
UIView.animate(withDuration: 0.2) {
|
||||||
self.contentView.setControlsVisible(controlsVisible)
|
|
||||||
self.updateControlsView()
|
self.updateControlsView()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -160,7 +160,7 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
||||||
override func viewDidDisappear(_ animated: Bool) {
|
override func viewDidDisappear(_ animated: Bool) {
|
||||||
super.viewDidDisappear(animated)
|
super.viewDidDisappear(animated)
|
||||||
|
|
||||||
// pruneOffscreenRows()
|
pruneOffscreenRows()
|
||||||
}
|
}
|
||||||
|
|
||||||
private func removeTimelineDescriptionCell() {
|
private func removeTimelineDescriptionCell() {
|
||||||
|
@ -170,28 +170,27 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
||||||
isShowingTimelineDescription = false
|
isShowingTimelineDescription = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// private func pruneOffscreenRows() {
|
private func pruneOffscreenRows() {
|
||||||
// guard let lastVisibleIndexPath = collectionView.indexPathsForVisibleItems.last else {
|
guard let lastVisibleIndexPath = collectionView.indexPathsForVisibleItems.last else {
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// var snapshot = dataSource.snapshot()
|
var snapshot = dataSource.snapshot()
|
||||||
// guard snapshot.indexOfSection(.statuses) != nil else {
|
guard snapshot.indexOfSection(.statuses) != nil else {
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// let items = snapshot.itemIdentifiers(inSection: .statuses)
|
let items = snapshot.itemIdentifiers(inSection: .statuses)
|
||||||
// let pageSize = 20
|
let pageSize = 20
|
||||||
// let numberOfPagesToPrune = (items.count - lastVisibleIndexPath.row - 1) / pageSize
|
let numberOfPagesToPrune = (items.count - lastVisibleIndexPath.row - 1) / pageSize
|
||||||
// if numberOfPagesToPrune > 0 {
|
if numberOfPagesToPrune > 0 {
|
||||||
// let itemsToRemove = Array(items.suffix(numberOfPagesToPrune * pageSize))
|
let itemsToRemove = Array(items.suffix(numberOfPagesToPrune * pageSize))
|
||||||
// snapshot.deleteItems(itemsToRemove)
|
snapshot.deleteItems(itemsToRemove)
|
||||||
//
|
}
|
||||||
// dataSource.apply(snapshot, animatingDifferences: false)
|
dataSource.apply(snapshot, animatingDifferences: false)
|
||||||
//
|
|
||||||
// if case .status(id: let id, state: _) = snapshot.itemIdentifiers(inSection: .statuses).last {
|
if case .status(id: let id, state: _) = snapshot.itemIdentifiers(inSection: .statuses).last {
|
||||||
// older = .before(id: id, count: nil)
|
older = .before(id: id, count: nil)
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
@objc func refresh() {
|
@objc func refresh() {
|
||||||
Task {
|
Task {
|
||||||
|
|
|
@ -18,7 +18,6 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
|
||||||
$0.textColor = .secondaryLabel
|
$0.textColor = .secondaryLabel
|
||||||
// this needs to have a higher priorty than the content container's zero height constraint
|
// this needs to have a higher priorty than the content container's zero height constraint
|
||||||
$0.setContentHuggingPriority(.defaultHigh, for: .vertical)
|
$0.setContentHuggingPriority(.defaultHigh, for: .vertical)
|
||||||
$0.isUserInteractionEnabled = true
|
|
||||||
$0.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(reblogLabelPressed)))
|
$0.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(reblogLabelPressed)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue