forked from zelo72/mastodon-ios
fix: content warning user interaction not cancel after disappear issue
This commit is contained in:
parent
692ca257fd
commit
4325ca3127
|
@ -7,7 +7,7 @@
|
|||
<key>AppShared.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>14</integer>
|
||||
<integer>26</integer>
|
||||
</dict>
|
||||
<key>CoreDataStack.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
|
@ -17,7 +17,7 @@
|
|||
<key>Mastodon - ASDK.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>4</integer>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<key>Mastodon - RTL.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
|
@ -32,12 +32,12 @@
|
|||
<key>Mastodon.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>2</integer>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>NotificationService.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>22</integer>
|
||||
<integer>2</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
|
|
|
@ -600,37 +600,37 @@ extension StatusSection {
|
|||
let isSingleMosaicLayout = mosaics.count == 1
|
||||
|
||||
// set link preview
|
||||
cell.statusView.linkPreview.isHidden = true
|
||||
|
||||
var _firstURL: URL? = {
|
||||
for entity in cell.statusView.activeTextLabel.activeEntities {
|
||||
guard case let .url(_, _, url, _) = entity.type else { continue }
|
||||
return URL(string: url)
|
||||
}
|
||||
return nil
|
||||
}()
|
||||
|
||||
if let url = _firstURL {
|
||||
Future<LPLinkMetadata?, Error> { promise in
|
||||
LPMetadataProvider().startFetchingMetadata(for: url) { meta, error in
|
||||
if let error = error {
|
||||
promise(.failure(error))
|
||||
} else {
|
||||
promise(.success(meta))
|
||||
}
|
||||
}
|
||||
}
|
||||
.receive(on: RunLoop.main)
|
||||
.sink { _ in
|
||||
// do nothing
|
||||
} receiveValue: { [weak cell] meta in
|
||||
guard let meta = meta else { return }
|
||||
guard let cell = cell else { return }
|
||||
cell.statusView.linkPreview.metadata = meta
|
||||
cell.statusView.linkPreview.isHidden = false
|
||||
}
|
||||
.store(in: &cell.disposeBag)
|
||||
}
|
||||
// cell.statusView.linkPreview.isHidden = true
|
||||
//
|
||||
// var _firstURL: URL? = {
|
||||
// for entity in cell.statusView.activeTextLabel.activeEntities {
|
||||
// guard case let .url(_, _, url, _) = entity.type else { continue }
|
||||
// return URL(string: url)
|
||||
// }
|
||||
// return nil
|
||||
// }()
|
||||
//
|
||||
// if let url = _firstURL {
|
||||
// Future<LPLinkMetadata?, Error> { promise in
|
||||
// LPMetadataProvider().startFetchingMetadata(for: url) { meta, error in
|
||||
// if let error = error {
|
||||
// promise(.failure(error))
|
||||
// } else {
|
||||
// promise(.success(meta))
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// .receive(on: RunLoop.main)
|
||||
// .sink { _ in
|
||||
// // do nothing
|
||||
// } receiveValue: { [weak cell] meta in
|
||||
// guard let meta = meta else { return }
|
||||
// guard let cell = cell else { return }
|
||||
// cell.statusView.linkPreview.metadata = meta
|
||||
// cell.statusView.linkPreview.isHidden = false
|
||||
// }
|
||||
// .store(in: &cell.disposeBag)
|
||||
// }
|
||||
|
||||
// set image
|
||||
let imageSize = CGSize(
|
||||
|
|
|
@ -103,10 +103,12 @@ extension MosaicImageViewContainer {
|
|||
imageViews.forEach { imageView in
|
||||
imageView.constraints.forEach { imageView.removeConstraint($0) }
|
||||
imageView.removeFromSuperview()
|
||||
imageView.image = nil
|
||||
}
|
||||
blurhashOverlayImageViews.forEach { imageView in
|
||||
imageView.constraints.forEach { imageView.removeConstraint($0) }
|
||||
imageView.removeFromSuperview()
|
||||
imageView.image = nil
|
||||
}
|
||||
|
||||
contentWarningOverlayView.removeFromSuperview()
|
||||
|
|
|
@ -12,7 +12,9 @@ import AVKit
|
|||
import ActiveLabel
|
||||
import AlamofireImage
|
||||
import FLAnimatedImage
|
||||
import LinkPresentation
|
||||
|
||||
// TODO:
|
||||
// import LinkPresentation
|
||||
|
||||
protocol StatusViewDelegate: AnyObject {
|
||||
func statusView(_ statusView: StatusView, headerInfoLabelDidPressed label: UILabel)
|
||||
|
@ -205,7 +207,8 @@ final class StatusView: UIView {
|
|||
|
||||
var isRevealing = true
|
||||
|
||||
let linkPreview = LPLinkView()
|
||||
// TODO:
|
||||
// let linkPreview = LPLinkView()
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
|
@ -360,9 +363,10 @@ extension StatusView {
|
|||
statusContainerStackView.addArrangedSubview(activeTextLabel)
|
||||
activeTextLabel.setContentCompressionResistancePriority(.required - 1, for: .vertical)
|
||||
|
||||
// TODO:
|
||||
// link preview
|
||||
statusContainerStackView.addArrangedSubview(linkPreview)
|
||||
linkPreview.setContentHuggingPriority(.defaultHigh, for: .vertical)
|
||||
// statusContainerStackView.addArrangedSubview(linkPreview)
|
||||
// linkPreview.setContentHuggingPriority(.defaultHigh, for: .vertical)
|
||||
|
||||
// image
|
||||
statusContainerStackView.addArrangedSubview(statusMosaicImageViewContainer)
|
||||
|
@ -444,6 +448,7 @@ extension StatusView {
|
|||
func updateContentWarningDisplay(isHidden: Bool, animated: Bool) {
|
||||
func updateOverlayView() {
|
||||
contentWarningOverlayView.contentOverlayView.alpha = isHidden ? 0 : 1
|
||||
contentWarningOverlayView.isUserInteractionEnabled = !isHidden
|
||||
}
|
||||
|
||||
if animated {
|
||||
|
@ -456,7 +461,6 @@ extension StatusView {
|
|||
}
|
||||
|
||||
contentWarningOverlayView.blurContentWarningTitleLabel.isHidden = isHidden
|
||||
contentWarningOverlayView.blurContentWarningLabel.isHidden = isHidden
|
||||
}
|
||||
|
||||
func updateRevealContentWarningButton(isRevealing: Bool) {
|
||||
|
|
Loading…
Reference in New Issue