Search in sources :

Example 16 with ReadableMap

use of com.facebook.react.bridge.ReadableMap in project gl-react-native by ProjectSeptemberInc.

the class GLData method fromMap.

public static GLData fromMap(ReadableMap map) {
    Integer shader = map.getInt("shader");
    ReadableMap uniforms = map.getMap("uniforms");
    Double width = map.getDouble("width");
    Double height = map.getDouble("height");
    Double pixelRatio = map.getDouble("pixelRatio");
    Integer fboId = map.getInt("fboId");
    List<GLData> children = fromArray(map.getArray("children"));
    List<GLData> contextChildren = fromArray(map.getArray("contextChildren"));
    return new GLData(shader, uniforms, width, height, pixelRatio, fboId, contextChildren, children);
}
Also used : ReadableMap(com.facebook.react.bridge.ReadableMap)

Example 17 with ReadableMap

use of com.facebook.react.bridge.ReadableMap in project react-native-fbsdk by facebook.

the class FBGraphRequestModule method buildParameters.

private Bundle buildParameters(ReadableMap parameterMap) {
    Bundle parameters = new Bundle();
    ReadableMapKeySetIterator keyIterator = parameterMap.keySetIterator();
    while (keyIterator.hasNextKey()) {
        String key = keyIterator.nextKey();
        ReadableMap parameter = parameterMap.getMap(key);
        if (parameter.hasKey("string")) {
            parameters.putString(key, parameter.getString("string"));
        }
    }
    return parameters;
}
Also used : ReadableMapKeySetIterator(com.facebook.react.bridge.ReadableMapKeySetIterator) Bundle(android.os.Bundle) ReadableMap(com.facebook.react.bridge.ReadableMap)

Example 18 with ReadableMap

use of com.facebook.react.bridge.ReadableMap in project react-native-fbsdk by facebook.

the class Utility method buildShareOpenGraphAction.

public static ShareOpenGraphAction buildShareOpenGraphAction(ReadableMap shareOpenGraphActionMap) {
    ShareOpenGraphAction.Builder contentBuilder = new ShareOpenGraphAction.Builder();
    contentBuilder.setActionType(shareOpenGraphActionMap.getString("actionType"));
    ReadableMap properties = shareOpenGraphActionMap.getMap("_properties");
    ReadableMapKeySetIterator keySetIterator = properties.keySetIterator();
    while (keySetIterator.hasNextKey()) {
        String key = keySetIterator.nextKey();
        ReadableMap entry = properties.getMap(key);
        contentBuilder.putObject(key, buildShareOpenGraphObject(entry.getMap("value")));
    }
    return contentBuilder.build();
}
Also used : ReadableMapKeySetIterator(com.facebook.react.bridge.ReadableMapKeySetIterator) ShareOpenGraphAction(com.facebook.share.model.ShareOpenGraphAction) ReadableMap(com.facebook.react.bridge.ReadableMap)

Example 19 with ReadableMap

use of com.facebook.react.bridge.ReadableMap in project react-native-fbsdk by facebook.

the class Utility method buildShareOpenGraphObject.

public static ShareOpenGraphObject buildShareOpenGraphObject(ReadableMap entry) {
    ShareOpenGraphObject.Builder contentBuilder = new ShareOpenGraphObject.Builder();
    ReadableMap value = entry.getMap("_properties");
    ReadableMapKeySetIterator keySetIterator = value.keySetIterator();
    while (keySetIterator.hasNextKey()) {
        String key = keySetIterator.nextKey();
        ReadableMap subEntry = value.getMap(key);
        switch(subEntry.getString("type")) {
            case "number":
                contentBuilder.putDouble(key, subEntry.getDouble("value"));
                break;
            case "open-graph-object":
                contentBuilder.putObject(key, buildShareOpenGraphObject(subEntry.getMap("value")));
                break;
            case "photo":
                contentBuilder.putPhoto(key, buildSharePhoto(subEntry.getMap("value")));
                break;
            case "string":
                contentBuilder.putString(key, subEntry.getString("value"));
                break;
        }
    }
    return contentBuilder.build();
}
Also used : ReadableMapKeySetIterator(com.facebook.react.bridge.ReadableMapKeySetIterator) ShareOpenGraphObject(com.facebook.share.model.ShareOpenGraphObject) ReadableMap(com.facebook.react.bridge.ReadableMap)

Example 20 with ReadableMap

use of com.facebook.react.bridge.ReadableMap in project react-native-fbsdk by facebook.

the class Utility method appendGenericContent.

private static void appendGenericContent(ShareContent.Builder contentBuilder, ReadableMap shareContent) {
    if (shareContent.hasKey("commonParameters")) {
        ReadableMap commonParameters = shareContent.getMap("commonParameters");
        contentBuilder.setPeopleIds(commonParameters.hasKey("peopleIds") ? reactArrayToStringList(commonParameters.getArray("peopleIds")) : null);
        contentBuilder.setPlaceId(getValueOrNull(commonParameters, "placeId"));
        contentBuilder.setRef(getValueOrNull(commonParameters, "ref"));
        if (commonParameters.hasKey("hashtag")) {
            ShareHashtag tag = new ShareHashtag.Builder().setHashtag(commonParameters.getString("hashtag")).build();
            contentBuilder.setShareHashtag(tag);
        }
    }
}
Also used : ReadableMap(com.facebook.react.bridge.ReadableMap) ShareHashtag(com.facebook.share.model.ShareHashtag)

Aggregations

ReadableMap (com.facebook.react.bridge.ReadableMap)23 WritableMap (com.facebook.react.bridge.WritableMap)6 ReadableArray (com.facebook.react.bridge.ReadableArray)4 ReadableMapKeySetIterator (com.facebook.react.bridge.ReadableMapKeySetIterator)4 IOException (java.io.IOException)4 WritableArray (com.facebook.react.bridge.WritableArray)3 Resources (android.content.res.Resources)2 NonNull (android.support.annotation.NonNull)2 Nullable (android.support.annotation.Nullable)2 Promise (com.facebook.react.bridge.Promise)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Activity (android.app.Activity)1 Notification (android.app.Notification)1 PendingIntent (android.app.PendingIntent)1 DialogInterface (android.content.DialogInterface)1 Intent (android.content.Intent)1 SharedPreferences (android.content.SharedPreferences)1 ApplicationInfo (android.content.pm.ApplicationInfo)1 Bitmap (android.graphics.Bitmap)1