Handle uncached attachments

This commit is contained in:
Justin Mazzocchi 2021-02-06 17:03:15 -08:00
parent b2e56a1b9b
commit 45820517e9
No known key found for this signature in database
GPG key ID: E223E6937AAFB01C
2 changed files with 9 additions and 3 deletions

View file

@ -329,7 +329,11 @@ public extension StatusViewModel {
} }
func attachmentSelected(viewModel: AttachmentViewModel) { func attachmentSelected(viewModel: AttachmentViewModel) {
eventsSubject.send(Just(.attachment(viewModel, self)).setFailureType(to: Error.self).eraseToAnyPublisher()) if viewModel.attachment.type == .unknown, let remoteUrl = viewModel.attachment.remoteUrl {
urlSelected(remoteUrl)
} else {
eventsSubject.send(Just(.attachment(viewModel, self)).setFailureType(to: Error.self).eraseToAnyPublisher())
}
} }
func shareStatus() { func shareStatus() {

View file

@ -177,8 +177,10 @@ private extension AttachmentView {
playImageView.image = UIImage(systemName: "waveform.circle", playImageView.image = UIImage(systemName: "waveform.circle",
withConfiguration: UIImage.SymbolConfiguration(textStyle: .largeTitle)) withConfiguration: UIImage.SymbolConfiguration(textStyle: .largeTitle))
backgroundColor = .secondarySystemBackground backgroundColor = .secondarySystemBackground
default: case .unknown:
break playImageView.image = UIImage(systemName: "link",
withConfiguration: UIImage.SymbolConfiguration(textStyle: .largeTitle))
backgroundColor = .secondarySystemBackground
} }
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([