open remote url for unknown attachments (#4941)
closes https://github.com/tuskyapp/Tusky/issues/4729
This commit is contained in:
parent
89d5b9670a
commit
cd24ee8f26
4 changed files with 9 additions and 3 deletions
|
|
@ -206,7 +206,7 @@ class AccountMediaFragment :
|
|||
}
|
||||
}
|
||||
Attachment.Type.UNKNOWN -> {
|
||||
context?.openLink(selected.attachment.url)
|
||||
context?.openLink(selected.attachment.unknownUrl)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ class SearchStatusesFragment : SearchFragment<StatusViewData.Concrete>(), Status
|
|||
}
|
||||
|
||||
Attachment.Type.UNKNOWN -> {
|
||||
context?.openLink(status.attachments[attachmentIndex].url)
|
||||
context?.openLink(status.attachments[attachmentIndex].unknownUrl)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,12 +27,18 @@ data class Attachment(
|
|||
val url: String,
|
||||
// can be null for e.g. audio attachments
|
||||
@Json(name = "preview_url") val previewUrl: String? = null,
|
||||
// null when local attachment
|
||||
@Json(name = "remote_url") val remoteUrl: String? = null,
|
||||
val meta: MetaData? = null,
|
||||
val type: Type,
|
||||
val description: String? = null,
|
||||
val blurhash: String? = null
|
||||
) : Parcelable {
|
||||
|
||||
/** The url to open for attachments of unknown type */
|
||||
val unknownUrl: String
|
||||
get() = remoteUrl ?: url
|
||||
|
||||
@JsonClass(generateAdapter = false)
|
||||
enum class Type {
|
||||
@Json(name = "image")
|
||||
|
|
|
|||
|
|
@ -414,7 +414,7 @@ abstract class SFragment(@LayoutRes contentLayoutId: Int) : Fragment(contentLayo
|
|||
}
|
||||
|
||||
Attachment.Type.UNKNOWN -> {
|
||||
requireContext().openLink(attachment.url)
|
||||
requireContext().openLink(attachment.unknownUrl)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue