{ "id": "173874", "key": "ALOY-1697", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [ { "id": "20859", "description": "Alloy items that will be included in CLI 7.1.1", "name": "CLI Release 7.1.1", "archived": false, "released": true, "releaseDate": "2019-09-06" }, { "id": "20860", "description": "", "name": "Alloy 1.14.1", "archived": false, "released": true, "releaseDate": "2019-08-19" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2019-08-16T18:32:17.000+0000", "created": "2019-07-11T23:54:48.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "WebView", "callback", "link" ], "versions": [], "issuelinks": [], "assignee": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "updated": "2019-08-20T21:41:20.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "12326", "name": "XML", "description": "View XML and parsing" } ], "description": "*Summary:*\r\nWe should add {{Ti.UI.WebView}} \"onlink\" callback support in view XML to make it more convenient to use. Currently, Alloy users are limited to assigning the callback in their JavaScript code instead.\r\nhttps://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.WebView-property-onlink\r\n\r\n*Example:*\r\nindex.xml\r\n{code:xml}\r\n\r\n\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\nindex.js\r\n{code:javascript}\r\nvar htmlText =\r\n\t\t'\\n' +\r\n\t\t'\\n' +\r\n\t\t'\t\\n' +\r\n\t\t'\t\t\\n' +\r\n\t\t'\t\\n' +\r\n\t\t'\t\\n' +\r\n\t\t'\t\t

WebView \"onlink\" Test

\\n' +\r\n\t\t'\t\t
\\n' +\r\n\t\t'\t\t
\\n' +\r\n\t\t'\t\tShow Alert\\n' +\r\n\t\t'\t\\n' +\r\n\t\t'\\n';\r\n\r\nfunction onLinkHandler(e) {\r\n\tif (e.url === \"mylink://show/alert\") {\r\n\t\talert(\"The 'onLinkHandler' callback was invoked.\");\r\n\t\treturn false;\r\n\t}\r\n\treturn true;\r\n};\r\n$.webView.html = htmlText;\r\n$.index.open();\r\n{code}\r\n\r\n*Note:*\r\nCurrently, doing the above causes the \"onlink\" property to be assigned a string literal of the callback function like the below, which is invalid.\r\n{code:javascript}\r\n$.webView.onlink = 'onLinkHandler';\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "Add WebView \"onlink\" callback support", "creator": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "450531", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "PR: https://github.com/appcelerator/alloy/pull/936", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2019-08-16T16:33:14.000+0000", "updated": "2019-08-16T16:33:14.000+0000" }, { "id": "450651", "author": { "name": "kmahalingam", "key": "kmahalingam", "displayName": "Keerthi Mahalingam", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix on CLI 7.1.1-master.5.web view onlink callback support added. Works as expected.\r\n\r\nTest Environment:\r\nName = Mac OS X\r\n Version = 10.14.5\r\n Architecture = 64bit\r\nNode.js\r\n Node.js Version = 10.16.2\r\n npm Version = 6.9.0\r\nTitanium CLI\r\n CLI Version = 5.2.1\r\nTitanium SDK\r\n SDK Version = 8.1.1.v20190813101121\r\nCLI = 7.1.1-MASTER.5\r\nStudio -5.1.3.201907112159\r\nappc npm -4.2.15-1\r\ndevice -iPhone X iOS 11,oneplus 5t Android 9\r\nSimulator/Emulator -iphone6 ios12,pixel android 8\r\n\r\n", "updateAuthor": { "name": "kmahalingam", "key": "kmahalingam", "displayName": "Keerthi Mahalingam", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2019-08-20T21:40:38.000+0000", "updated": "2019-08-20T21:41:06.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }