[TIMOB-20156] iOS: typedText not returned for Remote Notifications with Text Actions
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Critical |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2017-05-24T13:42:13.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 6.2.0 |
| Components | iOS |
| Labels | qe-6.2.0 |
| Reporter | Mike Butler |
| Assignee | Hans Knöchel |
| Created | 2015-12-18T13:00:16.000+0000 |
| Updated | 2017-05-24T14:50:44.000+0000 |
Description
5.1 added support for TextActions. Works fine for local notifications, unfortunately for Remote notifications the typedText value is ignored and not passed back to Javascript side.
I've submitted a pull request taking the code that was added for returning 'typedText' in local notifications and added it to the remote notification callback.
PR: https://github.com/appcelerator/titanium_mobile/pull/7593
PR: https://github.com/appcelerator/titanium_mobile/pull/9033 Test-Case: See above, trigger a remote notification and check both the
localnotificationaction(for local notifications) andremotenotificationaction(for remote notifications) event.Test case for remote notification :
var win = Ti.UI.createWindow({ backgroundColor: "#fff" }); var btn = Ti.UI.createButton({ title: "Send notification" }); btn.addEventListener("click", sendNotification); win.add(btn); win.open(); Ti.App.iOS.addEventListener('remotenotificationaction', function(e) { // As soon as the app-badge increases to __THREE__, we now it works Ti.UI.iOS.appBadge = 3; Ti.API.info(e); }); Ti.App.iOS.addEventListener('notification', function(e) { alert("Event: notification"); Ti.API.warn(e); }); function sendNotification() { var answerAction = Ti.App.iOS.createUserNotificationAction({ identifier: "ANSWER_IDENTIFIER", title: "Answer", activationMode: Ti.App.iOS.USER_NOTIFICATION_ACTIVATION_MODE_BACKGROUND, behavior: Ti.App.iOS.USER_NOTIFICATION_BEHAVIOR_TEXTINPUT }); var invitationCategory = Ti.App.iOS.createUserNotificationCategory({ identifier: "INVITE_CATEGORY", actionsForDefaultContext: [answerAction], actionsForMinimalContext: [answerAction] }); Ti.App.iOS.registerUserNotificationSettings({ types: [ Ti.App.iOS.USER_NOTIFICATION_TYPE_ALERT, Ti.App.iOS.USER_NOTIFICATION_TYPE_BADGE, Ti.App.iOS.USER_NOTIFICATION_TYPE_SOUND ], categories: [invitationCategory] }); function registerForPush() { Ti.Network.registerForPushNotifications({ success: function(e) { Ti.API.info('success') Ti.API.info(e.deviceToken); }, error: function(e) { Ti.API.info('failed') }, callback: function(e) { Ti.API.info('data found'); Ti.API.info(e); }, }); // Remove event listener once registered for push notifications Ti.App.iOS.removeEventListener('usernotificationsettings', registerForPush); }; // Wait for user settings to be registered before registering for push notifications Ti.App.iOS.addEventListener('usernotificationsettings', registerForPush); }Verified as fixed, using the following test steps, typedText was properly returned with the use of remote notifications: 1. Run test code, click 'Send Notification'. 2. Background the app 3. Send a push notification from arrowDB application with the "ok" channel 4. Make sure the 'Category' field is "INVITE_CATEGORY" 5. Swipe down on the banner alert and it will let you enter text 6. put whatever you want and push send 7. Check console for typedText property, verify that app badge icon has been set to "3" Tested On: iPhone 7 10.3.2 Device Mac OS Sierra (10.12.2) Ti SDK: 6.2.0.v20170524065210 Appc NPM: 4.2.9-1 App CLI: 6.1.0 Xcode 8.2.1 Node v4.6.0 *Closing ticket.*