|
13 | 13 | import com.facebook.react.bridge.ReadableType; |
14 | 14 | import com.facebook.react.bridge.WritableMap; |
15 | 15 | import com.facebook.react.bridge.WritableNativeMap; |
| 16 | +import com.facebook.react.bridge.WritableArray; |
| 17 | +import com.facebook.react.bridge.WritableNativeArray; |
16 | 18 | import com.mparticle.AttributionResult; |
17 | 19 | import com.mparticle.MParticle; |
18 | 20 | import com.mparticle.MPEvent; |
@@ -121,7 +123,19 @@ public void getUserAttributes(final String userId, final Callback completion) { |
121 | 123 | selectedUser.getUserAttributes(new UserAttributeListener() { |
122 | 124 | @Override |
123 | 125 | public void onUserAttributesReceived(Map<String, String> userAttributes, Map<String, List<String>> userAttributeLists, Long mpid) { |
124 | | - completion.invoke(null, userAttributes); |
| 126 | + WritableMap resultMap = new WritableNativeMap(); |
| 127 | + for (Map.Entry<String, String> entry : userAttributes.entrySet()) { |
| 128 | + resultMap.putString(entry.getKey(), entry.getValue()); |
| 129 | + } |
| 130 | + for (Map.Entry<String, List<String>> entry : userAttributeLists.entrySet()) { |
| 131 | + WritableArray resultArray = new WritableNativeArray(); |
| 132 | + List<String> valueList = entry.getValue(); |
| 133 | + for (String arrayVal : valueList) { |
| 134 | + resultArray.pushString(arrayVal); |
| 135 | + } |
| 136 | + resultMap.putArray(entry.getKey(), resultArray); |
| 137 | + } |
| 138 | + completion.invoke(null, resultMap); |
125 | 139 | } |
126 | 140 | }); |
127 | 141 | } else { |
|
0 commit comments