Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20156] iOS: typedText not returned for Remote Notifications with Text Actions

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2017-05-24T13:42:13.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.2.0
ComponentsiOS
Labelsqe-6.2.0
ReporterMike Butler
AssigneeHans Knöchel
Created2015-12-18T13:00:16.000+0000
Updated2017-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.

Comments

  1. Hans Knöchel 2015-12-19

    PR: https://github.com/appcelerator/titanium_mobile/pull/7593
  2. Hans Knöchel 2017-05-08

    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) and remotenotificationaction (for remote notifications) event.
  3. Vijay Singh 2017-05-22

    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);
       
       }
       
  4. Harry Bryant 2017-05-24

    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.*

JSON Source