OneSignal / OneSignal-DotNet-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your .NET app with OneSignal. https://onesignal.com
MIT License
14 stars 4 forks source link

[Bug]: Incorrect key / value tag is create when using User.AddTags api #74

Closed dottam closed 4 months ago

dottam commented 8 months ago

What happened?

When you pass-in a dictionary of tags via OneSignal.User.AddTags api, the user tags that are created, the value of the tag is the same as the key. I expect that the key/value should match the dictionary

When I try to use OneSignal.User.AddTag api, not all tags are created. I've verified in the subscription's user tags section in the portal that there are tags missing in the list

Tested on iOS, OneSignalSDK.DotNet v5.0.2

Steps to reproduce?

1. create a maui project
dotnet new maui
2. add OneSignalSDK.DotNet v5.0.2 nuget
3. add the following code in App.xaml.cs
OneSignal.Debug.LogLevel = LogLevel.VERBOSE;
OneSignal.Initialize("YOUR_APP_ID");
OneSignal.Notifications.RequestPermissionAsync(true);
var tags = new Dictionary<string, string>()
{
   { "deviceId", "00000000-0000-0000-0000-000000000000" },
   { "accountId", "1234" },
   { "deviceType", "phone" }
};
OneSignal.User.AddTags(tags);

4. build and launch app and observe the logs

What did you expect to happen?

Relevant log output

default 12:46:02.242897+1100    Simba.Platform.IOS  VERBOSE: OneSignal.User addTags called with: ["deviceId": "deviceId", "accountId": "accountId", "deviceType": "deviceType"]
default 12:46:02.245126+1100    Simba.Platform.IOS  VERBOSE: OSOperationRepo enqueueDelta: OSDelta OS_UPDATE_PROPERTIES_DELTA with property: tags value: ["deviceId": "deviceId", "accountId": "accountId", "deviceType": "deviceType"]
default 12:46:07.367523+1100    Simba.Platform.IOS  VERBOSE: OSPropertyOperationExecutor processDeltaQueue with queue: [OSDelta OS_UPDATE_PROPERTIES_DELTA with property: tags value: ["deviceId": "deviceId", "accountId": "accountId", "deviceType": "deviceType"]]
default 12:46:07.858860+1100    Simba.Platform.IOS  VERBOSE: network response (OneSignalUser.OSRequestUpdateProperties): {
    httpStatusCode = 202;
    properties =     {
        tags =         {
            deviceId = deviceId;
            accountId = accountId;
            deviceType = deviceType;
        };
    };
}

Code of Conduct

shepherd-l commented 8 months ago

Thanks for the detailed info, we are looking into this

We have a limit on how many tags each user can have depending on your plan. What plan are you on? For free users, we have a limit of 2 tags for each user. Does this match up with what you are seeing?

You can find the limits for Data Tags here under Message Personalization

dottam commented 8 months ago

we are on Growth, there's no issue on v4.3.3

shepherd-l commented 8 months ago

I found the source of the issue and we are currently working on verifying the fix.

emawby commented 5 months ago

The fix for this will be available in the next release of the SDK. Thank you for your patience

shepherd-l commented 4 months ago

This has been fixed in the latest 5.1.0 release. Please open a new issue if you have any questions or are still having issues