use of com.facebook.react.bridge.ReactMethod 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.ReactMethod in project react-native-fcm by evollu.
the class FIRMessagingModule method getScheduledLocalNotifications.
@ReactMethod
public void getScheduledLocalNotifications(Promise promise) {
ArrayList<Bundle> bundles = mFIRLocalMessagingHelper.getScheduledLocalNotifications();
WritableArray array = Arguments.createArray();
for (Bundle bundle : bundles) {
array.pushMap(Arguments.fromBundle(bundle));
}
promise.resolve(array);
}
use of com.facebook.react.bridge.ReactMethod in project react-native-navigation by wix.
the class NavigationModule method showOverlay.
@ReactMethod
public void showOverlay(String commandId, ReadableMap rawLayoutTree, Promise promise) {
final LayoutNode layoutTree = LayoutNodeParser.parse(jsonParser.parse(rawLayoutTree));
handle(() -> {
final ViewController<?> viewController = layoutFactory.create(layoutTree);
navigator().showOverlay(viewController, new NativeCommandListener("showOverlay", commandId, promise, eventEmitter, now));
});
}
use of com.facebook.react.bridge.ReactMethod in project react-native-camera by lwansbrough.
the class RCTCameraModule method hasFlash.
@ReactMethod
public void hasFlash(ReadableMap options, final Promise promise) {
Camera camera = RCTCamera.getInstance().acquireCameraInstance(options.getInt("type"));
if (null == camera) {
promise.reject("No camera found.");
return;
}
List<String> flashModes = camera.getParameters().getSupportedFlashModes();
promise.resolve(null != flashModes && !flashModes.isEmpty());
}
use of com.facebook.react.bridge.ReactMethod in project react-native-orientation-locker by wonday.
the class OrientationModule method getAutoRotateState.
@ReactMethod
public void getAutoRotateState(Callback callback) {
final ContentResolver resolver = ctx.getContentResolver();
boolean rotateLock = android.provider.Settings.System.getInt(resolver, android.provider.Settings.System.ACCELEROMETER_ROTATION, 0) == 1;
callback.invoke(rotateLock);
}
Aggregations