[TIMOB-26550] Windows: Add support for file property to HTTPClient
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-03-04T11:34:08.000+0000 |
Affected Version/s | Release 7.5.0, Release 7.4.1 |
Fix Version/s | Release 8.1.0 |
Components | Windows |
Labels | n/a |
Reporter | Samir Mohammed |
Assignee | Kota Iguchi |
Created | 2018-11-13T13:02:30.000+0000 |
Updated | 2019-03-04T11:34:08.000+0000 |
Description
*Test case:*
function createButton(title, filename, url) {
var b = Ti.UI.createButton({
title : title
});
b.addEventListener("click", function() {
var xhr = Titanium.Network.createHTTPClient();
if (filename != null) {
xhr.file = filename;
}
xhr.onload = function() {
var responseFilePath = this.responseData.nativePath;
alert("responseData.nativePath = " + responseFilePath);
if (responseFilePath != null) {
imageView.image = responseFilePath;
} else {
imageView.image = this.responseData;
}
};
xhr.open('GET', url);
xhr.send();
});
return b;
}
var win = Titanium.UI.createWindow({
title: "The 'file' property for HTTPClient",
layout: "vertical"
});
var imageView = Titanium.UI.createImageView({
top : 5,
height : 200,
width : 300
});
win.add(createButton("Not setting 'file' (download a small image)", null, "http://developer.appcelerator.com/blog/wp-content/themes/newapp/images/appcelerator_avatar.png?s=48"));
win.add(createButton("Not setting 'file' (download a large image)", null, "http://2.bp.blogspot.com/-z-cZ7JirojQ/Tc8OMAAqbLI/AAAAAAAAAfc/slhGE764cyY/s1600/Cars+2.jpg"));
win.add(createButton("'file' is in tempDirectory", Ti.Filesystem.tempDirectory + "/sky.jpg", "http://www.forestwander.com/wp-content/original/2009_01/Sky-View.JPG"));
win.add(createButton("'file' is in applicationDataDirectory", Ti.Filesystem.applicationDataDirectory + "/flower.jpg", "http://flowerdeliverygo.com/wp-content/uploads/2014/05/flower-delivery.jpg"));
win.add(createButton("'file' is in externalStorageDirectory", Ti.Filesystem.externalStorageDirectory + "/fruit.jpg", "http://southernbite.com/wp-content/uploads/2012/05/SouthernBiteFruitSalad-2.jpg"));
win.add(imageView);
win.open();
Null should only be shown for the first two buttons but it shown for all buttons unlike on Android.
https://github.com/appcelerator/titanium_mobile_windows/pull/1321
FR passed.
PR Merged
Closing ticket, fix verified in SDK version
8.1.0.v20190301155716
Test and other information can be found at: https://github.com/appcelerator/titanium_mobile_windows/pull/1321