use of com.facebook.react.bridge.ReadableMapKeySetIterator in project react-native-fcm by evollu.
the class FIRMessagingModule method send.
@ReactMethod
public void send(String senderId, ReadableMap payload) throws Exception {
FirebaseMessaging fm = FirebaseMessaging.getInstance();
RemoteMessage.Builder message = new RemoteMessage.Builder(senderId + "@gcm.googleapis.com").setMessageId(UUID.randomUUID().toString());
ReadableMapKeySetIterator iterator = payload.keySetIterator();
while (iterator.hasNextKey()) {
String key = iterator.nextKey();
String value = getStringFromReadableMap(payload, key);
message.addData(key, value);
}
fm.send(message.build());
}
use of com.facebook.react.bridge.ReadableMapKeySetIterator 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;
}
use of com.facebook.react.bridge.ReadableMapKeySetIterator 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();
}
use of com.facebook.react.bridge.ReadableMapKeySetIterator 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();
}
Aggregations