You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the additional data contains a value that is array of objects, the "value" variable on the above function becomes an instance of ArrayList class. However, the function is not checking this condition and executing the last else statement that puts null for that key.
Possible solution
Adding check for the value instanceof the ArrayList
else if (value instanceof ArrayList) {
writableMap.putArray(key, convertArrayListIntoReadableArray((ArrayList<Object>) value));
}
implementing an additional function that converts an ArrayList into ReadableArray
public static ReadableArray convertArrayListIntoReadableArray(ArrayList<Object> arrayList) throws JSONException {
WritableArray array = Arguments.createArray();
for (Object object : arrayList) {
if (object instanceof HashMap)
array.pushMap(convertHashMapToWritableMap((HashMap<String, Object>) object));
}
return array;
}
Steps to reproduce?
1. Install react-native-onesignal: 5.2.2
2. Setup notification click event listener as docs suggested
3. send notification via onesignal api which contains data like below:
{
"data": {
"route": "Search",
"basket": [
{
"sku": "12qw3er56y",
"itemName": "Hand-crafted Peppermint Candy Canes",
"qty": 3,
"cost": "9.99"
},
{
"sku": "90ujr5383",
"itemName": "Fat Squirrel",
"qty": 1,
"cost": "29.99"
}
]
},
}
4. check the additionalData on the notification click listener
5. you will see that the basket property going to be null
What did you expect to happen?
I expected to see the arrays on the additional data parsed correctly and not getting null value
React Native OneSignal SDK version
5.2.2
Which platform(s) are affected?
iOS
Android
Relevant log output
No response
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
What happened?
Description
Arrays on the additional data becomes null while retrieving them on the notification click event listener only on android.
Suspected Cause
I think the "convertHashMapToWritableMap" method below may be causing this issue
If the additional data contains a value that is array of objects, the "value" variable on the above function becomes an instance of ArrayList class. However, the function is not checking this condition and executing the last else statement that puts null for that key.
Possible solution
Steps to reproduce?
What did you expect to happen?
I expected to see the arrays on the additional data parsed correctly and not getting null value
React Native OneSignal SDK version
5.2.2
Which platform(s) are affected?
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: