use of com.facebook.react.bridge.ReactMethod in project react-native-twilio-programmable-voice by hoxfon.
the class TwilioVoiceModule method reject.
@ReactMethod
public void reject() {
callAccepted = false;
SoundPoolManager.getInstance(getReactApplicationContext()).stopRinging();
WritableMap params = Arguments.createMap();
if (activeCallInvite != null) {
params.putString("call_sid", activeCallInvite.getCallSid());
params.putString("call_from", activeCallInvite.getFrom());
params.putString("call_to", activeCallInvite.getTo());
params.putString("call_state", activeCallInvite.getState().name());
activeCallInvite.reject(getReactApplicationContext());
clearIncomingNotification(activeCallInvite);
}
eventManager.sendEvent(EVENT_CONNECTION_DID_DISCONNECT, params);
}
use of com.facebook.react.bridge.ReactMethod in project react-native-image-picker by marcshilling.
the class ImagePickerModule method showImagePicker.
@ReactMethod
public void showImagePicker(final ReadableMap options, final Callback callback) {
Activity currentActivity = getCurrentActivity();
if (currentActivity == null) {
responseHelper.invokeError(callback, "can't find current Activity");
return;
}
this.callback = callback;
this.options = options;
imageConfig = new ImageConfig(null, null, 0, 0, 100, 0, false);
final AlertDialog dialog = UI.chooseDialog(this, options, new UI.OnAction() {
@Override
public void onTakePhoto(@NonNull final ImagePickerModule module) {
if (module == null) {
return;
}
module.launchCamera();
}
@Override
public void onUseLibrary(@NonNull final ImagePickerModule module) {
if (module == null) {
return;
}
module.launchImageLibrary();
}
@Override
public void onCancel(@NonNull final ImagePickerModule module) {
if (module == null) {
return;
}
module.doOnCancel();
}
@Override
public void onCustomButton(@NonNull final ImagePickerModule module, @NonNull final String action) {
if (module == null) {
return;
}
module.invokeCustomButton(action);
}
});
dialog.show();
}
use of com.facebook.react.bridge.ReactMethod in project LeMondeRssReader by MBach.
the class DynamicNavbarModule method setLightNavigationBar.
@ReactMethod
public void setLightNavigationBar(final boolean isLight) {
try {
UiThreadUtil.runOnUiThread(() -> {
if (getCurrentActivity() == null) {
return;
}
Window window = getCurrentActivity().getWindow();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
int flags = window.getDecorView().getSystemUiVisibility();
if (isLight) {
flags |= View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
} else {
flags &= ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
}
window.getDecorView().setSystemUiVisibility(flags);
}
window.setNavigationBarColor(Color.parseColor(isLight ? "#FFFFFF" : "#000000"));
});
} catch (Exception e) {
//
}
}
use of com.facebook.react.bridge.ReactMethod in project react-native-fbsdk by facebook.
the class FBLoginManagerModule method setLoginBehavior.
/**
* Set {@link LoginBehavior} for login attempts.
* @param loginBehaviorString must be one of the constants in Enum
* {@link LoginBehavior}.
* @throws {@link java.lang.IllegalArgumentException} if the argument is not a valid constant.
*/
@ReactMethod
public void setLoginBehavior(String loginBehaviorString) {
LoginBehavior loginBehavior = LoginBehavior.valueOf(loginBehaviorString.toUpperCase());
LoginManager.getInstance().setLoginBehavior(loginBehavior);
}
use of com.facebook.react.bridge.ReactMethod in project react-native-fbsdk by facebook.
the class FBLoginManagerModule method logInWithPermissions.
/**
* Attempts a Facebook login with the specified permissions.
* @param permissions must be one of the provided permissions. See
* <a href="https://developers.facebook.com/docs/facebook-login/permissions">
* Facebook login permissions</a>.
* @param promise Use promise to pass login result to JS after login finish.
*/
@ReactMethod
public void logInWithPermissions(ReadableArray permissions, final Promise promise) {
final LoginManager loginManager = LoginManager.getInstance();
loginManager.registerCallback(getCallbackManager(), new LoginManagerCallback(promise));
Activity activity = getCurrentActivity();
if (activity != null) {
loginManager.logIn(activity, Utility.reactArrayToStringList(permissions));
}
}
Aggregations