forked from zelo72/mastodon-ios
fix: roll back new media preview loader which may cause image flash
This commit is contained in:
parent
1bff861a6d
commit
3582762ace
|
@ -2,17 +2,6 @@
|
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>mastodon</string>
|
||||
</array>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>org.joinmastodon.app</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
|
@ -27,6 +16,17 @@
|
|||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>$(MARKETING_VERSION)</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>org.joinmastodon.app</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>mastodon</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>ITSAppUsesNonExemptEncryption</key>
|
||||
|
|
|
@ -70,35 +70,35 @@ extension MediaPreviewImageViewController {
|
|||
let previewImageViewContextMenuInteraction = UIContextMenuInteraction(delegate: self)
|
||||
previewImageView.addInteraction(previewImageViewContextMenuInteraction)
|
||||
|
||||
switch viewModel.item {
|
||||
case .local(let meta):
|
||||
self.previewImageView.imageView.image = meta.image
|
||||
self.previewImageView.setup(image: meta.image, container: self.previewImageView, forceUpdate: true)
|
||||
self.previewImageView.imageView.accessibilityLabel = self.viewModel.altText
|
||||
case .status(let meta):
|
||||
Nuke.loadImage(
|
||||
with: meta.url,
|
||||
into: self.previewImageView.imageView
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
break
|
||||
case .success(let response):
|
||||
self.previewImageView.setup(image: response.image, container: self.previewImageView, forceUpdate: true)
|
||||
self.previewImageView.imageView.accessibilityLabel = self.viewModel.altText
|
||||
}
|
||||
}
|
||||
}
|
||||
// viewModel.image
|
||||
// .receive(on: RunLoop.main) // use RunLoop prevent set image during zooming (TODO: handle transitioning state)
|
||||
// .sink { [weak self] image in
|
||||
// guard let self = self else { return }
|
||||
// guard let image = image else { return }
|
||||
// self.previewImageView.imageView.image = image
|
||||
// self.previewImageView.setup(image: image, container: self.previewImageView, forceUpdate: true)
|
||||
// self.previewImageView.imageView.accessibilityLabel = self.viewModel.altText
|
||||
// switch viewModel.item {
|
||||
// case .local(let meta):
|
||||
// self.previewImageView.imageView.image = meta.image
|
||||
// self.previewImageView.setup(image: meta.image, container: self.previewImageView, forceUpdate: true)
|
||||
// self.previewImageView.imageView.accessibilityLabel = self.viewModel.altText
|
||||
// case .status(let meta):
|
||||
// Nuke.loadImage(
|
||||
// with: meta.url,
|
||||
// into: self.previewImageView.imageView
|
||||
// ) { result in
|
||||
// switch result {
|
||||
// case .failure(let error):
|
||||
// break
|
||||
// case .success(let response):
|
||||
// self.previewImageView.setup(image: response.image, container: self.previewImageView, forceUpdate: true)
|
||||
// self.previewImageView.imageView.accessibilityLabel = self.viewModel.altText
|
||||
// }
|
||||
// }
|
||||
// .store(in: &disposeBag)
|
||||
// }
|
||||
viewModel.image
|
||||
.receive(on: RunLoop.main) // use RunLoop prevent set image during zooming (TODO: handle transitioning state)
|
||||
.sink { [weak self] image in
|
||||
guard let self = self else { return }
|
||||
guard let image = image else { return }
|
||||
self.previewImageView.imageView.image = image
|
||||
self.previewImageView.setup(image: image, container: self.previewImageView, forceUpdate: true)
|
||||
self.previewImageView.imageView.accessibilityLabel = self.viewModel.altText
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue