mastodon / mastodon-android

Official Android app for Mastodon
https://app.joinmastodon.org/android
GNU General Public License v3.0
1.65k stars 256 forks source link

No media shows at all when using Pleroma backend #69

Closed Devnol closed 1 year ago

Devnol commented 2 years ago

I'm not sure if this happens on Mastodon-based backends but I noticed it when using the Android app connected to my Pleroma instance (social.projectsegfau.lt). Posting media works but still does not show, open in browser shows that the media has ben uploaded.

To reproduce:

Setup: Samsung Galaxy A12 SM-A125F DS/N Android 11 - OneUI Core 3.1 Mastodon Android 1.0.1

Gargron commented 2 years ago

I am not against Pleroma users using the official Mastodon app, however, it is the Mastodon app and I do oppose developer resources being used to investigate Pleroma compatibility issues. If you independently determine what the issue is, we might fix it. I must remind that the Mastodon client API is not a standard and has never been intended for use with anything but Mastodon.

Devnol commented 2 years ago

Oh I see, I haven't really looked into how the fediverse works and since I was even able to login to my instance I assumed everything was designed as interoperable. I don't really develop for android or elixir so I don't think I'll be able to do it myself, but anyone else is welcome to try I suppose.

Also lol nice issue number

selfisekai commented 1 year ago

not sure if this is the same issue but for me this happens strictly when:

the medias show if either fetching from a Mastodon account, or the post comes from a Mastodon instance.

also, even though the image does not appear, the media hiding button shows correctly. 33677.png

selfisekai commented 1 year ago

comparing the Akkoma responses, posts from Mastodon additionally have these parameters set in media attachments, compared to others:

{
  "blurhash": "UMINv?_2-:-:~UELD*snI;ofxZRjxut7t7W;",
  "meta": {
      "original": {
        "aspect": 0.7498496692723993,
        "height": 1663,
        "width": 1247
      }
    }
}

my hypothesis: if server sends no height/width in the response, the app renders them with the size 0x0px, as getting the the resolution fallbacks to 0 in these functions: https://github.com/mastodon/mastodon-android/blob/6e718d6765405012134d74ca3f3fc8edfd4d2486/mastodon/src/main/java/org/joinmastodon/android/model/Attachment.java#L46-L68

grishka commented 1 year ago

Returning 0 is probably not the best idea, but then it didn't break anything for anyone using a Mastodon server, so... ¯\_(ツ)_/¯

Anyway, it should be an easy fix.