Example usage for com.facebook.react.bridge ReadableMap toHashMap

List of usage examples for com.facebook.react.bridge ReadableMap toHashMap

Introduction

In this page you can find the example usage for com.facebook.react.bridge ReadableMap toHashMap.

Prototype

@NonNull
    HashMap<String, Object> toHashMap();

Source Link

Usage

From source file:it.near.sdk.reactnative.rnnearitsdk.RNNearItModule.java

License:Mozilla Public License

@ReactMethod
public void setUserData(final ReadableMap userData, final Promise promise) {
    try {/* www.jav a 2 s.c  o m*/
        for (HashMap.Entry<String, Object> ud : userData.toHashMap().entrySet()) {
            NearItManager.getInstance().setUserData(ud.getKey(), String.valueOf(ud.getValue()));
        }
        promise.resolve(null);
    } catch (Exception e) {
        promise.reject(E_USER_PROFILE_DATA_ERROR, "Error while setting UserData");
    }
}

From source file:org.jitsi.meet.sdk.AmplitudeModule.java

License:Apache License

/**
 * Sets the user properties for an Amplitude instance.
 *
 * @param instanceName The name of the Amplitude instance.
 * @param userProps JSON string with user properties to be set.
 *//* w ww.  jav  a2s .  co  m*/
@ReactMethod
public void setUserProperties(String instanceName, ReadableMap userProps) {
    if (userProps != null) {
        Amplitude.getInstance(instanceName).setUserProperties(new JSONObject(userProps.toHashMap()));
    }
}

From source file:org.jitsi.meet.sdk.invite.AddPeopleController.java

License:Apache License

/**
 * Caches results received by the search into a local map for use
 * later when the items are submitted.  Submission requires the full
 * map of information, but only the IDs are returned back to the delegate.
 * Using this map means we don't have to send the whole map back to the delegate.
 *
 * @param results//  w  w w .j  a  v  a2  s  . c  om
 * @param query
 */
void receivedResultsForQuery(ReadableArray results, String query) {
    AddPeopleControllerListener listener = getListener();

    if (listener != null) {
        List<Map<String, Object>> jvmResults = new ArrayList<>();

        // cache results for use in submission later
        // convert to jvm array
        for (int i = 0; i < results.size(); i++) {
            ReadableMap map = results.getMap(i);

            if (map.hasKey("id")) {
                items.put(map.getString("id"), map);
            } else if (map.hasKey("type") && map.getString("type").equals("phone") && map.hasKey("number")) {
                items.put(map.getString("number"), map);
            } else {
                Log.w("AddPeopleController",
                        "Received result without id and that was not a phone number, so not adding it to suggestions: "
                                + map);
            }

            jvmResults.add(map.toHashMap());
        }

        listener.onReceivedResults(this, jvmResults, query);
    }
}