[TIMOB-27165] iOS: The localnotificationaction event always contains the notification identifier instead of the action identifier
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-10-04T13:58:35.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 8.2.1 |
Components | n/a |
Labels | n/a |
Reporter | Teun Klijn |
Assignee | Jan Vennemann |
Created | 2019-06-19T11:02:30.000+0000 |
Updated | 2020-11-04T03:51:49.000+0000 |
Description
*Describe the bug*
When adding category with an action to an iOS local notification the localnotificationaction always contains the notification identifier instead of the action identifier.
*To Reproduce*
Create a notification action with an identifier
Create a category with the action
Schedule notification with the category
Print the localnotificationaction object
Check the identifier
var ACTION = "action";
var CATEGORY = "category";
function onSchedule() {
Ti.App.iOS.scheduleLocalNotification({
date: new Date(new Date().getTime() + 5000),
alertBody: "Hello",
identifier: "notification 1",
category: CATEGORY
});
}
function onLocalNotificationAction(e) {
console.log('Action: ' + e.identifier);
}
function onOpen() {
Ti.App.iOS.addEventListener('localnotificationaction', onLocalNotificationAction);
var action = Ti.App.iOS.createUserNotificationAction({
identifier: ACTION,
title: "My Action",
activationMode: Ti.App.iOS.USER_NOTIFICATION_ACTIVATION_MODE_FOREGROUND
});
var category = Ti.App.iOS.createUserNotificationCategory({
identifier: CATEGORY,
actionsForDefaultContext: [action],
actionsForMinimalContext: [action]
});
Ti.App.iOS.registerUserNotificationSettings({
types: [
Ti.App.iOS.USER_NOTIFICATION_TYPE_ALERT,
Ti.App.iOS.USER_NOTIFICATION_TYPE_SOUND,
Ti.App.iOS.USER_NOTIFICATION_TYPE_BADGE
],
categories: [category]
});
}
var win = Ti.UI.createWindow();
win.addEventListener('open', onOpen);
var button = Ti.UI.createButton({
title: "Schedule"
});
button.addEventListener('click', onSchedule);
win.add(button);
win.open();
*Expected behavior*
The identifier has the value of the action
*Actual behavior*
The identifier has the value of the notification
*Environment*
Titanium SDK version: 7.5.2.GA; 8.0.1.GA
I did create a pull request for this, but I want to be sure that it will be picked up: https://github.com/appcelerator/titanium_mobile/pull/10940
PR: https://github.com/appcelerator/titanium_mobile/pull/10940
FR Passed on Master.
Merged PR to master, created an 8_2_X PR intended for 8.2.1 here: https://github.com/appcelerator/titanium_mobile/pull/11226
FR Passed on 8_2_X as well.
merged to 8_2_X
Closing ticket, fix verified SDK version 8.3.0.v20191003144543 and 8.2.1.v20191003075717. Test and other information cab be found at: master: https://github.com/appcelerator/titanium_mobile/pull/10940 8_2_X: https://github.com/appcelerator/titanium_mobile/pull/11226