android icon indicating copy to clipboard operation
android copied to clipboard

svg image isn't shown in app

Open gahoo opened this issue 5 years ago • 4 comments

SVG is not shown within the android app using markdown. On the server side it works as expected. And #107 remains in v2.0.14.

curl "https://myserver.com/message?token=<secret>" --header 'Content-Type: application/json' \
--data-raw '{
 "title":"Test",
 "message":"![banana](https://www.svgrepo.com/show/42310/banana.svg)",
 "priority":0,
 "extras": {
   "client::display": {
     "contentType": "text/markdown"
   }
 }
}'

gotify/android v2.0.14; gotify/server v2.0.14

gahoo avatar Aug 20 '20 10:08 gahoo

Yeah, seems good. Probably this must be added: https://noties.io/Markwon/docs/v4/image/#svgmediadecoder

jmattheis avatar Aug 24 '20 19:08 jmattheis

I know this issue is a little older, but I spent a little time on it. The problem here is, that Picasso/Markwon Picasso Plugin, which currently handles the images in markdown messages, doesn't support svg. If the original images plugin, including the svg-decoder is used (as suggested), then all images in the markdown messages are handled by this plugin and not by the Picasso plugin anymore. That's because Markwon doesn't support multiple plugins that handle different type of images (or at least image loading). Potential solutions would be:

  • Let the suggested images plugin handle the images including svg and drop Picasso in markdown messages. This might result in performance issues.
  • Drop Picasso and try to use Coil instead (either only in markdown messages or in the whole app). Coil supports svg and there's a markwon plugin.

Sternagfonkel avatar Aug 08 '21 20:08 Sternagfonkel

Hey @Sternagfonkel I'd be okay with replacing Picasso with Coil.

jmattheis avatar Aug 10 '21 19:08 jmattheis

Okay, then I'll give it a try.

Sternagfonkel avatar Aug 12 '21 17:08 Sternagfonkel

Picasso was replaced with Coil in https://github.com/gotify/android/pull/337.
SVG isn't supported by default, but it could be easily implemented by importing io.coil-kt:coil-svg

and the following code:

.components {
    add(SvgDecoder.Factory())
}

Should we implement this?

cyb3rko avatar Apr 22 '24 16:04 cyb3rko

Yes.

jmattheis avatar Apr 22 '24 16:04 jmattheis