veskuh / Tweetian

A feature-rich Twitter app for smartphones developed using Qt/QML
GNU General Public License v3.0
50 stars 26 forks source link

Display images embedded into DMs #182

Closed mraleph closed 9 years ago

mraleph commented 9 years ago

Accessing images embedded into DMs requires proper OAuth token.

There is no way to tweak headers for an image request from QML - so we instead implement an image provider (subclass of QQuickImageProvider) that can pass custom headers alongside the request it sends.

Implemented image provider captures all http://dm/<auth-token> requests and then requests images passing the given auth-token as Authorization header. Image URL itself is extracted from the realm parameter of the auth token.

The rest of the changes are simple plumbing passing media url from API into the database and into the model.

veskuh commented 9 years ago

Works fine with the include added. Thanks, this is a nice feature.