This commit is contained in:
Matthieu 2021-09-23 00:22:08 +02:00
commit dc03e52568
5 changed files with 8 additions and 4 deletions

View File

@ -230,7 +230,7 @@ class LoginActivity : BaseActivity() {
"client_id" + "=" + client_id + "&" +
"redirect_uri" + "=" + "$oauthScheme://$PACKAGE_ID" + "&" +
"response_type=code" + "&" +
"scope=$SCOPE"
"scope=${SCOPE.replace(" ", "%20")}"
if (!openUrl(url)) return failedRegistration(getString(R.string.browser_launch_failed))
}

View File

@ -172,7 +172,7 @@ class NotificationsFragment : CachedFeedFragment<Notification>() {
Glide.with(itemView).load(notification?.account?.anyAvatar()).circleCrop()
.into(avatar)
val previewUrl = notification?.status?.media_attachments?.getOrNull(0)?.preview_url
val previewUrl = notification?.status?.getPostPreviewURL()
if (!previewUrl.isNullOrBlank()) {
Glide.with(itemView).load(previewUrl)
.placeholder(R.drawable.ic_picture_fallback).into(photoThumbnail)

View File

@ -121,7 +121,7 @@ class SearchDiscoverFragment : BaseFragment() {
} else {
holder.albumIcon.visibility = View.GONE
}
ImageConverter.setSquareImageFromURL(holder.postView, post?.media_attachments?.firstOrNull()?.preview_url, holder.postPreview, post?.media_attachments?.firstOrNull()?.blurhash)
ImageConverter.setSquareImageFromURL(holder.postView, post?.getPostPreviewURL(), holder.postPreview, post?.media_attachments?.firstOrNull()?.blurhash)
holder.postPreview.setOnClickListener {
val intent = Intent(holder.postView.context, PostActivity::class.java)
intent.putExtra(Status.POST_TAG, post)

View File

@ -38,4 +38,8 @@ data class Attachment(
val aspect: Double?
) : Serializable
}
val previewNoPlaceholder: String?
get() = if (preview_url?.contains(Regex("public/no-preview\\.(png|jpg|webp)")) == true) url else preview_url
}

View File

@ -65,7 +65,7 @@ open class Status(
fun getPostUrl() : String? = media_attachments?.firstOrNull()?.url
fun getProfilePicUrl() : String? = account?.anyAvatar()
fun getPostPreviewURL() : String? = media_attachments?.firstOrNull()?.preview_url
fun getPostPreviewURL() : String? = media_attachments?.firstOrNull()?.previewNoPlaceholder
fun getNLikes(context: Context) : CharSequence {