Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Json conversion in ExternalUserId class for Android differs from IOS' #798

Open
hyungonkim-StroeerNZ opened this issue Sep 4, 2024 · 0 comments

Comments

@hyungonkim-StroeerNZ
Copy link

hyungonkim-StroeerNZ commented Sep 4, 2024

Version 2.2.3

Converting to JSON string in the ExternalUserId class differs between iOS and Android.

I guess no one uses this method, but I found this.

The "atype" in both platforms is stored into the different name
Android is stored as "adtype" and IOS is stored as "atype"

In Android.

public JSONObject getJson() {
JSONObject result = new JSONObject();

    if (getSource() == null || getSource().isEmpty() || getIdentifier() == null || getIdentifier().isEmpty()) {
        return null;
    }

    try {
        JSONObject uidObject = new JSONObject();
        uidObject.putOpt("id", getIdentifier());
        uidObject.putOpt("adtype", getAtype());  <<<<< HERE
        if (getExt() != null) {
            uidObject.putOpt("ext", new JSONObject(getExt()));
        }

        result.put("source", getSource());
        result.put("uids", new JSONArray().put(uidObject));
    } catch (JSONException e) {
        LogUtil.warning("ExternalUserId", "Can't create json object.");
        return null;
    }

    return result;
}

In IOS.

public func toJSONDictionary() -> [AnyHashable: Any] {
guard source.count != 0 && identifier.count != 0 else {
return [:]
}
var transformedEUIdDic = AnyHashable: Any
transformedEUIdDic["source"] = source

    var externalUserIdDict = [AnyHashable: Any] ()
    externalUserIdDict["id"] = identifier
    externalUserIdDict["atype"] = atype    <<<<< HERE
    externalUserIdDict["ext"] = ext
    
    transformedEUIdDic["uids"] = [externalUserIdDict]
    return transformedEUIdDic
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Triage
Development

No branches or pull requests

1 participant