{ "id": "173820", "key": "AC-6297", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2019-07-02T22:15:25.000+0000", "created": "2019-06-28T12:11:31.000+0000", "labels": [ "android" ], "versions": [], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2019-07-02T22:15:26.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "Please check the following bug i have found in SDK 8.1.0.v20190619134801\r\n\r\nPlease us the attached code\r\n\r\nIn the older SDK version i get the following:\r\n[INFO] : Ti.Platform.isIOS TEST 1 false\r\n[INFO] : Ti.Platform.isIOS TEST 2 false\r\n[INFO] : Ti.Platform.isIOS TEST 3 false\r\n\r\nat SDK SDK 8.1.0.v20190619134801 i get the following\r\n[INFO] : Ti.Platform.isIOS TEST 1 false\r\n[INFO] : Ti.Platform.isIOS TEST 2 undefined\r\n[INFO] : Ti.Platform.isIOS TEST 3 false", "attachment": [ { "id": "66729", "filename": "app.js", "author": { "name": "andreas.pingas", "key": "andreas.pingas", "displayName": "Andreas Pingas", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-06-28T12:10:31.000+0000", "size": 156, "mimeType": "text/javascript" }, { "id": "66728", "filename": "templates.js", "author": { "name": "andreas.pingas", "key": "andreas.pingas", "displayName": "Andreas Pingas", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-06-28T12:10:33.000+0000", "size": 196, "mimeType": "text/javascript" } ], "flagged": false, "summary": "Please check the following bug i have found in SDK 8.1.0.v20190619134801", "creator": { "name": "andreas.pingas", "key": "andreas.pingas", "displayName": "Andreas Pingas", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "andreas.pingas", "key": "andreas.pingas", "displayName": "Andreas Pingas", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "449483", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~andreas.pingas], I'm not going to accept this as a bug. This was unfortunately intentional. Here is why...\r\n\r\nOn Android, every JS file has its own \"copy\" of core Titanium modules such as {{Ti.Filesystem}}, {{Ti.Media}}, {{Ti.UI}}, etc. This is true even in older versions of Titanium. The negative consequence of this is that whatever methods/properties you add to that core Titanium module will not be available to any other JS file. This was an intentional design decision made on Android years ago to support file paths relative to a JS file that it was called in. I don't personally agree with it (doesn't match iOS' behavior), but that's how it works for now. The reason you're seeing this in Titanium 8.1.0 now is because we added relative path support to {{Ti.Platform.openURL()}} and {{Ti.Platform.canOpenURL()}}.\r\n\r\nFor example, run the below code on both Android and iOS. The below will log if the core library references match between the \"app.js\" and \"foo.js\" scripts. Notice that it'll return false on Android for {{Ti.UI}} and {{Ti.Media}} on older SDK versions, but they return true on iOS.\r\n\r\napp.js\r\n{code:javascript}\r\nvar foo = require(\"foo\");\r\nTi.API.info(\"Do 'Ti.UI' modules equals? \" + (Ti.UI == foo.TiUI));\r\nTi.API.info(\"Do 'Ti.Media' modules equals? \" + (Ti.Media == foo.TiMedia));\r\n{code}\r\n\r\nfoo.js\r\n{code:javascript}\r\nexports.TiUI = Ti.UI;\r\nexports.TiMedia = Ti.Media;\r\n{code}\r\n\r\n----\r\n\r\nWhat I recommend that you do instead is set up your own properties/methods in the \"global\" namespace. For example...\r\n{code:javascript}\r\nglobal.MyGlobals = {\r\n\tisIOS = true,\r\n};\r\n{code}\r\n\r\n----\r\n\r\nAlternatively, if your goal is to simply identify the platform, then a simpler solution that works for a Classic Titanium app is to do the following...\r\n{code:javascript}\r\nif (Ti.App.Android) {\r\n\t// Do Android stuff...\r\n} else if (Ti.App.iOS) {\r\n\t// Do iOS stuff...\r\n} else if (Ti.App.Windows) {\r\n\t// Do Windows stuff...\r\n}\r\n{code}\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-06-28T21:23:55.000+0000", "updated": "2019-06-28T21:23:55.000+0000" }, { "id": "449550", "author": { "name": "andreas.pingas", "key": "andreas.pingas", "displayName": "Andreas Pingas", "active": true, "timeZone": "America/Los_Angeles" }, "body": "ok, thanks!", "updateAuthor": { "name": "andreas.pingas", "key": "andreas.pingas", "displayName": "Andreas Pingas", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-07-02T15:28:51.000+0000", "updated": "2019-07-02T15:28:51.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }