Example usage for com.facebook.react.bridge Callback Callback

List of usage examples for com.facebook.react.bridge Callback Callback

Introduction

In this page you can find the example usage for com.facebook.react.bridge Callback Callback.

Prototype

Callback

Source Link

Usage

From source file:co.rewen.statex.StateXModule.java

License:Open Source License

@Override
public void clearSensitiveData() {
    // Clear local storage. If fails, crash, since the app is potentially in a bad state and could
    // cause a privacy violation. We're still not recovering from this well, but at least the error
    // will be reported to the server.
    clear(new Callback() {
        @Override// w w w.j  a  v a  2s. c om
        public void invoke(Object... args) {
            if (args.length == 0) {
                FLog.d(ReactConstants.TAG, "Cleaned StateX.");
                return;
            }
            // Clearing the database has failed, delete it instead.
            if (mStateXDatabaseSupplier.deleteDatabase()) {
                FLog.d(ReactConstants.TAG, "Deleted Local Database StateX.");
                return;
            }
            // Everything failed, crash the app
            throw new RuntimeException("Clearing and deleting database failed: " + args[0]);
        }
    });
}

From source file:org.jitsi.meet.sdk.JitsiMeetActivityDelegate.java

License:Apache License

public static void onRequestPermissionsResult(final int requestCode, final String[] permissions,
        final int[] grantResults) {
    CalendarEventsPackage.onRequestPermissionsResult(requestCode, permissions, grantResults);
    permissionsCallback = new Callback() {
        @Override//from w  w  w.  ja  va  2  s  .co m
        public void invoke(Object... args) {
            if (permissionListener != null
                    && permissionListener.onRequestPermissionsResult(requestCode, permissions, grantResults)) {
                permissionListener = null;
            }
        }
    };
}