{ "id": "163153", "key": "TIMOB-23891", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "16980", "description": "New V8", "name": "Release 6.0.0", "archived": false, "released": true, "releaseDate": "2016-11-15" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-10-06T08:25:50.000+0000", "created": "2016-09-09T23:48:28.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "ios", "ios10", "qe-6.0.0" ], "versions": [], "issuelinks": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2018-10-20T09:28:50.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "iOS 10 exposes new API's for the iPhone 7 for generating feedback when an action happens through a new Haptic Engine API and {{UIFeedbackGenerator}}. This would be great to be exposed for all Ti users. \r\n\r\nhttps://developer.apple.com/ios/human-interface-guidelines/interaction/feedback/\r\n\r\nhttps://www.hackingwithswift.com/example-code/uikit/how-to-generate-haptic-feedback-with-uifeedbackgenerator", "attachment": [], "flagged": false, "summary": "iOS 10: Support iPhone 7 Haptic Engine API ", "creator": { "name": "dlewis23", "key": "dlewis23", "displayName": "Donovan Lewis", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "dlewis23", "key": "dlewis23", "displayName": "Donovan Lewis", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "iPhone 7\r\niOS 10", "closedSprints": [ { "id": 722, "state": "closed", "name": "2016 Sprint 20 SDK", "startDate": "2016-09-28T16:50:17.299Z", "endDate": "2016-10-12T16:50:00.000Z", "completeDate": "2016-10-10T06:17:01.016Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "395805", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Thanks for the ticket! I searched for the correct API's yesterday but couldn't find them. It seems like it is all about the {{UIFeedbackGenerator}} subclasses, am I correct? There not seem to be any docs about that, yet. ", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-09-10T11:18:56.000+0000", "updated": "2016-09-10T11:18:56.000+0000" }, { "id": "395806", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/8342\r\nPR (6_0_X: https://github.com/appcelerator/titanium_mobile/pull/8389\r\n\r\nDemo:\r\n{code:javascript}\r\nvar dataStructure = [\r\n\t\"FEEDBACK_GENERATOR_TYPE_SELECTION\",\r\n\t\"FEEDBACK_GENERATOR_TYPE_IMPACT\",\r\n\t\"FEEDBACK_GENERATOR_TYPE_NOTIFICATION\",\r\n];\r\n\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: \"#fff\",\r\n\ttitle: \"iOS 10 Haptic Engine\",\r\n\ttranslucent: false\r\n});\r\n\r\nvar nav = Ti.UI.iOS.createNavigationWindow({\r\n\twindow: win\r\n});\r\n\r\nvar list = Ti.UI.createListView({\r\n\tsections: [\r\n\t\tTi.UI.createListSection({\r\n\t\t\titems: createItems()\r\n\t\t})\r\n\t]\r\n});\r\n\r\nlist.addEventListener(\"itemclick\", function(e) {\r\n\tvar type = e.itemId;\r\n\tvar args = {\r\n\t\ttype: Ti.UI.iOS[type] // Same as Ti.UI.iOS.FEEDBACK_GENERATOR_TYPE_SELECTION etc.\r\n\t};\r\n\r\n\t// If we select the impact-feedback, the style property specifies the style of it\r\n\tif (Ti.UI.iOS[type] == Ti.UI.iOS.FEEDBACK_GENERATOR_TYPE_IMPACT) {\r\n\t\targs[\"style\"] = Ti.UI.iOS.FEEDBACK_GENERATOR_IMPACT_STYLE_MEDIUM;\r\n\t}\r\n\r\n\t// Create the generator with the selected type\r\n\tvar generator = Ti.UI.iOS.createFeedbackGenerator(args);\r\n\tgenerator.prepare(); // Prepare the feedback before to avoid latence\r\n\r\n\t// Execute different feedbacks based on the type\r\n\tswitch (generator.type) {\r\n\t\tcase Ti.UI.iOS.FEEDBACK_GENERATOR_TYPE_SELECTION:\r\n\t\t\tgenerator.selectionChanged();\r\n\t\tbreak;\r\n\t\tcase Ti.UI.iOS.FEEDBACK_GENERATOR_TYPE_IMPACT:\r\n\t\t\tgenerator.impactOccurred();\r\n\t\tbreak;\r\n\t\tcase Ti.UI.iOS.FEEDBACK_GENERATOR_TYPE_NOTIFICATION:\r\n\t\t\tgenerator.notificationOccurred(Ti.UI.iOS.FEEDBACK_GENERATOR_NOTIFICATION_TYPE_SUCCESS);\r\n\t\tbreak;\r\n\t}\r\n\r\n\tthis.deselectItem(e.sectionIndex, e.itemIndex);\r\n});\r\n\r\nwin.add(list);\r\nnav.open();\r\n\r\nfunction createItems() {\r\n\tvar items = [];\r\n\r\n\tfor (var i = 0; i < dataStructure.length; i++) {\r\n\t\titems.push({\r\n\t\t\tproperties: {\r\n\t\t\t\titemId: dataStructure[i],\r\n\t\t\t\ttitle: dataStructure[i],\r\n\t\t\t\theight: 60,\r\n\t\t\t\taccessoryType: Ti.UI.LIST_ACCESSORY_TYPE_DISCLOSURE\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\treturn items;\r\n}\r\n{code}", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-09-10T12:56:27.000+0000", "updated": "2016-09-16T21:19:14.000+0000" }, { "id": "395810", "author": { "name": "dlewis23", "key": "dlewis23", "displayName": "Donovan Lewis", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The only other documentation I have been able to find on it is: https://developer.apple.com/ios/human-interface-guidelines/interaction/feedback/\r\n\r\nThe hackingwithswift article was the only thing I could find with some bit of how it works. Apple says it needs to be Prepared but there isn't much right now on how to work with this thing. I looks like UINotificationFeedbackGenerator is the most important. \r\n\r\nThanks for adding this to TI.", "updateAuthor": { "name": "dlewis23", "key": "dlewis23", "displayName": "Donovan Lewis", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-09-10T13:46:25.000+0000", "updated": "2016-09-10T13:46:25.000+0000" }, { "id": "395811", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~cng] to review this PR. Since we are *very* early with this PR and the iPhone 7 is not even out, yet, testing can be done through debugging debugging the methods-calls through Xcode as I did.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-09-10T14:14:18.000+0000", "updated": "2016-09-10T14:15:30.000+0000" }, { "id": "396030", "author": { "name": "sdavenport", "key": "sdavenport", "displayName": "Scott Davenport", "active": true, "timeZone": "America/Havana" }, "body": "Sorry for the delay here...I really like the idea of supporting this capability. I agree with the Hyperloop statement and that would be ideal but Han's point is key as to who can have access to this without us exposing it directly.", "updateAuthor": { "name": "sdavenport", "key": "sdavenport", "displayName": "Scott Davenport", "active": true, "timeZone": "America/Havana" }, "created": "2016-09-13T18:03:20.000+0000", "updated": "2016-09-13T18:03:20.000+0000" }, { "id": "396340", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Just tested the API on a real iPhone 7 device. Works without further adjustments!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-09-16T14:22:51.000+0000", "updated": "2016-09-16T14:22:51.000+0000" }, { "id": "396423", "author": { "name": "dlewis23", "key": "dlewis23", "displayName": "Donovan Lewis", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I tried to get this to work on my iPhone 7 but was unable to. I can get it to work in the simulator but on device it will throw errors. On device using the same code provided I get \"undefined is not a function (evaluating 'Ti.UI.iOS.createFeedbackGenerator(i)') at app.js (line 1)\"\r\n\r\nI'm sure it works, I tried adding it into a build of 6.0.x and 6.1.x I have have done something wrong there but can't see anything I did going over it so hopefully just a mistake I made somewhere. ", "updateAuthor": { "name": "dlewis23", "key": "dlewis23", "displayName": "Donovan Lewis", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-09-17T02:43:16.000+0000", "updated": "2016-09-17T02:43:16.000+0000" }, { "id": "396429", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~dlewis23] That's because it's status is {{In Review}} meaning that it is not merged, yet.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-09-17T11:01:44.000+0000", "updated": "2016-09-17T11:01:44.000+0000" }, { "id": "398208", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "CR AND FT PASSED. \r\nTested with sample code and the following constants:\r\nTi.UI.iOS.FEEDBACK_GENERATOR_NOTIFICATION_TYPE_ERROR\r\nTi.UI.iOS.FEEDBACK_GENERATOR_NOTIFICATION_TYPE_WARNING\r\nTi.UI.iOS.FEEDBACK_GENERATOR_NOTIFICATION_TYPE_SUCCESS\r\nTi.UI.iOS.FEEDBACK_GENERATOR_IMPACT_STYLE_LIGHT\r\nTi.UI.iOS.FEEDBACK_GENERATOR_IMPACT_STYLE_MEDIUM\r\nTi.UI.iOS.FEEDBACK_GENERATOR_IMPACT_STYLE_HEAVY\r\n", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-10-06T08:25:39.000+0000", "updated": "2016-10-06T08:25:39.000+0000" }, { "id": "400259", "author": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "body": "I can report that I am experiencing the same behaviour as [~dlewis23] has described. Using the provided sample code and running to an iPhone 7 Device, I see the following error when selecting any of the FEEDBACK_GENERATOR_TYPES:\r\n\r\n{code:java}\r\n[ERROR] : Script Error {\r\n[ERROR] : column = 804;\r\n[ERROR] : line = 1;\r\n[ERROR] : message = \"undefined is not a function (evaluating 'Ti.UI.iOS.createFeedbackGenerator(t)')\";\r\n[ERROR] : sourceURL = \"file:///var/containers/Bundle/Application/3B45FD55-0EF0-4AAE-86A0-1C59EC2A25DB/HapticTest.app/app.js\";\r\n[ERROR] : stack = \"file:///var/containers/Bundle/Application/3B45FD55-0EF0-4AAE-86A0-1C59EC2A25DB/HapticTest.app/app.js:1:804\";\r\n[ERROR] : }\r\n{code}\r\n\r\nThis does not occur on simulator.\r\nChecked that selected SDK {{6.0.0.v20161101155110}} had the merged files present.\r\n\r\nTested On:\r\niPhone 7 10.0.3 Device & Simulator\r\nMac OS Sierra (10.12)\r\nTi SDK: 6.0.0.v20161101155110\r\nAppc Studio: 4.8.0.201610060953\r\nAppc NPM: 4.2.8-9\r\nApp CLI: 6.0.0-68\r\nXcode 8.0 \r\nNode v4.4.7\r\n", "updateAuthor": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "created": "2016-11-02T14:59:43.000+0000", "updated": "2016-11-02T14:59:43.000+0000" }, { "id": "400275", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Fixed the device-issue in [#8576|https://github.com/appcelerator/titanium_mobile/pull/8576] and [#8577|https://github.com/appcelerator/titanium_mobile/pull/8577], thx!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-11-02T17:48:34.000+0000", "updated": "2016-11-02T17:48:49.000+0000" }, { "id": "400339", "author": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "body": "Verified as fixed, tested the various available constants and can confirm that they work without issue\r\n\r\nTested On:\r\niPhone 7 10.1.1 Device & Simulator\r\nMac OS Sierra (10.12.1)\r\nTi SDK: 6.0.0.v20161102104808\r\nAppc Studio: 4.8.0.201610060953\r\nAppc NPM: 4.2.8-9\r\nApp CLI: 6.0.0-68\r\nXcode 8.1\r\nNode v4.4.7\r\n\r\n*Closing ticket.*", "updateAuthor": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "created": "2016-11-03T14:34:44.000+0000", "updated": "2016-11-03T14:34:44.000+0000" }, { "id": "442811", "author": { "name": "Andrea.Vitale", "key": "andrea.vitale", "displayName": "Andrea Vitale", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hi guys, I'm trying to use this feature on an iPhone 7 with iOS 11.4.1 and the latest Ti SDK 7.4.1.GA with this code:\r\n\r\n{code:javascript}\r\n if (OS_IOS) {\r\n var hapticFeedbackGenerator = Ti.UI.iOS.createFeedbackGenerator({\r\n type: Ti.UI.iOS.FEEDBACK_GENERATOR_TYPE_SELECTION\r\n });\r\n\r\n hapticFeedbackGenerator.prepare();\r\n hapticFeedbackGenerator.selectionChanged();\r\n }\r\n{code}\r\n\r\nI got the same error as reported in this issue:\r\n\r\n{code}\r\n[ERROR] Script Error {\r\n[ERROR] column = 72;\r\n[ERROR] line = 197;\r\n[ERROR] message = \"Ti.UI.iOS.createFeedbackGenerator is not a function. (In 'Ti.UI.iOS.createFeedbackGenerator({\\n type: Ti.UI.iOS.FEEDBACK_GENERATOR_TYPE_SELECTION })', 'Ti.UI.iOS.createFeedbackGenerator' is undefined)\";\r\n[ERROR] stack = \" at onLoginWithEmail)\\n at trigger)\\n at onButtonClick)\";\r\n[ERROR] } \r\n{code}", "updateAuthor": { "name": "Andrea.Vitale", "key": "andrea.vitale", "displayName": "Andrea Vitale", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-10-20T09:28:50.000+0000", "updated": "2018-10-20T09:28:50.000+0000" } ], "maxResults": 16, "total": 16, "startAt": 0 } } }