Search in sources :

Example 76 with ReactMethod

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);
}
Also used : WritableMap(com.facebook.react.bridge.WritableMap) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 77 with ReactMethod

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();
}
Also used : ImageConfig(com.imagepicker.media.ImageConfig) AlertDialog(android.support.v7.app.AlertDialog) UI(com.imagepicker.utils.UI) ReactActivity(com.facebook.react.ReactActivity) Activity(android.app.Activity) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 78 with ReactMethod

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) {
    // 
    }
}
Also used : Window(android.view.Window) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 79 with ReactMethod

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);
}
Also used : LoginBehavior(com.facebook.login.LoginBehavior) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 80 with ReactMethod

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));
    }
}
Also used : LoginManager(com.facebook.login.LoginManager) Activity(android.app.Activity) ReactMethod(com.facebook.react.bridge.ReactMethod)

Aggregations

ReactMethod (com.facebook.react.bridge.ReactMethod)87 Activity (android.app.Activity)21 WritableMap (com.facebook.react.bridge.WritableMap)17 Intent (android.content.Intent)10 Bundle (android.os.Bundle)10 ReactApplicationContext (com.facebook.react.bridge.ReactApplicationContext)6 WritableArray (com.facebook.react.bridge.WritableArray)5 ArrayList (java.util.ArrayList)5 Camera (android.hardware.Camera)4 InterstitialAd (com.facebook.ads.InterstitialAd)4 ShareContent (com.facebook.share.model.ShareContent)4 LayoutNode (com.reactnativenavigation.options.LayoutNode)4 LoginManager (com.facebook.login.LoginManager)3 ReactActivity (com.facebook.react.ReactActivity)3 LatLng (com.google.android.gms.maps.model.LatLng)3 NotificationManager (android.app.NotificationManager)2 ActivityNotFoundException (android.content.ActivityNotFoundException)2 RemoteException (android.os.RemoteException)2 NativeAdsManager (com.facebook.ads.NativeAdsManager)2 JSApplicationIllegalArgumentException (com.facebook.react.bridge.JSApplicationIllegalArgumentException)2