Attribute values in string only
Hey guys,
First of all, thanks for your work. It's really helping us! 👍 Some little things that we could optimize of course, we'll have the occasion to discuss about this, but one of the most important issue, so far, is accepting only attributes values as strings.
Indeed, by not using the typage on attributes you'll not take advantage of queries with comparison operators on your Batch user base (we're not providing type coercion between numbers and strings in the interest of performance).
What I can suggest is to open a few more methods, with explicit names like :
@ReactMethod
public void setBooleanAttribute(String key, boolean value)
{
Batch.User.editor()
.setAttribute(key, value)
.save();
}
What do you think?
I think it's better to keep the same function name but support multiple value type.
Hello, the v4 has been released, you will now be able to add any type of value as an attribute with the JS UserDataEditor ;)
import { BatchUser } from '@bam.tech/react-native-batch';
BatchUser.editor()
.setAttribute('myBoolean', true)
.setDateAttribute('myDate', new Date().getTime())
.setAttribute('myNumber', 23)
.save()