[MOD-2473] TiAPI: Add support for RequestHeaders for ImageViews
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | Critical |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2018-11-28T18:58:09.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 7.5.0 |
| Components | Module Development Guide |
| Labels | demo_app, imageview |
| Reporter | Rene Pot |
| Assignee | Rene Pot |
| Created | 2017-02-16T14:38:05.000+0000 |
| Updated | 2018-11-28T18:58:18.000+0000 |
Description
A lot of times an image requires requestheaders, like oAuth/basic auth or others before it can be loaded. Right now a workaround is needed to get these images (doing a XHR call to fetch images, then insert it into imageview).
However, by adding support for requestheaders to ImageViews a workaround would not be needed anymore.
A possible example of implementation:
Ti.UI.createImageView({
url: 'http://example.com/my_image.png',
requestHeaders: {
'Authorization' : 'Bearer myToken'
}
});
Hello, Thanks for submitting the ticket. Our engineers will consider it.
PR (iOS, master): https://github.com/appcelerator/titanium_mobile/pull/8888 PR (iOS, 7_1_X): https://github.com/appcelerator/titanium_mobile/pull/9853 Test-Case:
Awaiting Android and Windows before reviewing this. Probably rather going into 6.2.0, since Android could take time.var win = Ti.UI.createWindow({ backgroundColor: '#fff' }); var image = Ti.UI.createImageView({ image: 'http://hans-knoechel.de/test/test.png', requestHeaders: { 'Authorization' : 'Basic ' + Titanium.Utils.base64encode('hans:test') } }); win.add(image); win.open();[~gmathews] Is this feature going into 6.2.0 for Android? [~kiguchi] Same question to you for Windows. cc: [~emerriman]
Moved out of 6.2.0 as we are close to RC at this point.
Will this get into the 6.3 release?
No, it's scheduled for 7.0.0 (see above).
[~hknoechel] Can you add an image at given url (http://hans-knoechel.de/test/test.png) in test case. Thanks.
[~vijaysingh] URL restored. [~lchoudhary] I don't think Android / Windows has been implemented for this feature, yet. I recommend to push it out of 7.0.0 as there were also no community efforts here, which was the initial plan here.
PR (Android): https://github.com/appcelerator/titanium_mobile/pull/9660
I just split out Windows component target to TIMOB-25764; because I'm not yet sure if we can make Windows Ti SDK ready for 7.1.0.
Found issues commented in the PR's for android.
For all watchers: We decided to go with a CommonJS module here that will make sure of the existing Ti.Network.HTTPClient. It will be released via Github and won't require an SDK update.
repository published: https://github.com/appcelerator-modules/ti.imageview http://npmjs.com/package/ti.imageview
Resolving issue after moving it to the MOD project since this was implemented using a commonjs module https://github.com/appcelerator-modules/ti.imageview