Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26550] Windows: Add support for file property to HTTPClient

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2019-03-04T11:34:08.000+0000
Affected Version/sRelease 7.5.0, Release 7.4.1
Fix Version/sRelease 8.1.0
ComponentsWindows
Labelsn/a
ReporterSamir Mohammed
AssigneeKota Iguchi
Created2018-11-13T13:02:30.000+0000
Updated2019-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.

Comments

  1. Kota Iguchi 2018-11-15

    https://github.com/appcelerator/titanium_mobile_windows/pull/1321
  2. Keerthi Mahalingam 2019-02-28

    FR passed.
  3. Keerthi Mahalingam 2019-02-28

    PR Merged
  4. Samir Mohammed 2019-03-04

    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

JSON Source