163
Views
1
Comments
[OneSignal Plugin] Register and Set Tags (issues with the component)
Question
onesignal-plugin
Mobile icon
Forge asset by OutSystems

Hi team,

I've noticed that setting tags after device registration (RegisterWithUser) doesn't always work. After troubleshooting, I've found a few issues:

  1. Why is RegisterWithUser always re-applying existing tags? If I want to use SetTag after login/registration (for example, depending on the user role), this seems a waste.
    • Suggestion: make it an option (eg add a SetUserTags parameter).
  2. RegisterWithUser.AsyncRegistration doesn't really work, since RegisterUserAsync will always be invoked asynchronously from the JS node. This was causing concurrency issues when trying to set tags after registration.
    • Suggestion: just invoke RegisterUserAsync normally if AsyncRegistration=false, instead using the existing JS.
  3. While unregistering the device (and tags were set), I was getting an API error. Reason: malformed JSON. This happened when clearing tags (Key, ""), since the empty value was not being included in the JSON.
    • Suggestion: OneSignalAPI > Tag structure > Value: change property Send Default Value to Yes.
  4. OneSignalAPI > SetTag > If after LogMessage4: added the condition GetDevice.List.Current.Device.OneSignalPlayerId <> "" and deleted empty Assigns, since this was invoking the API with an empty PlayerId, which caused an error. This was likely a side-effect of issue 2 above, but still this logic seems to need some rework.


For now I'm using a custom version of the component. Let me know if you need more details / modules.

Also, a question: what do you advise as a best practice when the user logs out of the app? Unregister (which also clears tags) or just DisableSubscription? 


2024-03-25 06-19-08
Harlin Setiadarma

Have this been fixed?

For a supported component, this plugin has so many bugs, and slow to fix.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.