ubports / telegram-app

Unofficial Telegram App for Ubuntu Desktop & Mobile
GNU General Public License v3.0
55 stars 23 forks source link

Change media handling to use mime types only #114

Open Flohack74 opened 6 years ago

Flohack74 commented 6 years ago

It turns out that Telegram API sends typeMessageMediaPhoto = 0x3d8ce53d not for all image types, but instead also uses typeMessageMediaDocument = 0x2fda2204 - that means the whole handling code is tricked into believing it needs to handle a document instead of an image. That means: No automatic downloading, no in-app viewing, and a square thumbnail window.

Remove usage of FileHandler.TypeTarget... enum, and classify media by its mime type. This type can be also cached maybe in the messages db table to speed up handling. This will maybe also solve #113

mymike00 commented 6 years ago

that's because you can chose to send an image as an image (it will be compressed) or as a file (it won't be compressed). the file (also in the Android app) should be opened with an external app, even it's an image and the automatic download is the same as set for files (default disabled I think). so in a sort of way it's correct because also the official app do this, but if we want to make it different and let uncompressed image to be opened in-app, ok it's good!

Flohack74 commented 6 years ago

Hmm Ok I understand, forgot about this. Can we check the behaviour for both methods this evening? I was thinking it also does not honor a different format than jpg for Photos ;)