use of com.facebook.react.bridge.ReactMethod in project react-native-fbsdk by facebook.
the class FBShareDialogModule method show.
@ReactMethod
public void show(ReadableMap shareContent, final Promise promise) {
if (getCurrentActivity() != null) {
ShareDialog shareDialog = new ShareDialog(getCurrentActivity());
shareDialog.registerCallback(getCallbackManager(), new ShareDialogCallback(promise));
shareDialog.setShouldFailOnDataError(mShouldFailOnError);
if (mShareDialogMode != null) {
shareDialog.show(Utility.buildShareContent(shareContent), mShareDialogMode);
} else {
shareDialog.show(Utility.buildShareContent(shareContent));
}
} else {
promise.reject("No current activity.");
}
}
use of com.facebook.react.bridge.ReactMethod in project react-native-fbsdk by facebook.
the class FBAccessTokenModule method setCurrentAccessToken.
/**
* Set {@link AccessToken} for the current session.
* @param accessTokenMap must satisfy the requirements in
* <a href="https://developers.facebook.com/docs/reference/android/current/class/AccessToken/">
* Facebook AccessToken</a>
*/
@ReactMethod
public void setCurrentAccessToken(ReadableMap accessTokenMap) {
AccessToken accessToken = Utility.buildAccessToken(accessTokenMap);
AccessToken.setCurrentAccessToken(accessToken);
}
use of com.facebook.react.bridge.ReactMethod in project react-native-fbsdk by facebook.
the class FBGameRequestDialogModule method show.
/**
* Shows a GameRequestDialog to send a request.
* @param gameRequestContentMap must be a valid {@link GameRequestContent}.
* @param promise Use promise to pass the game request dialog result to JS.
*/
@ReactMethod
public void show(ReadableMap gameRequestContentMap, Promise promise) {
if (getCurrentActivity() != null) {
GameRequestDialog gameRequestDialog = new GameRequestDialog(getCurrentActivity());
GameRequestContent gameRequestContent = Utility.buildGameRequestContent(gameRequestContentMap);
gameRequestDialog.registerCallback(getCallbackManager(), new GameRequestDialogCallback(promise));
gameRequestDialog.show(gameRequestContent);
} else {
promise.reject("No current activity.");
}
}
use of com.facebook.react.bridge.ReactMethod in project react-native-fbsdk by facebook.
the class FBMessageDialogModule method show.
/**
* Show the provided ShareContent using the provided Activity.
* @param shareContentMap must be a valid {@link ShareContent}.
* @param promise Use promise to pass message dialog result to JS.
*/
@ReactMethod
public void show(ReadableMap shareContentMap, Promise promise) {
if (getCurrentActivity() != null) {
ShareContent shareContent = Utility.buildShareContent(shareContentMap);
MessageDialog messageDialog = new MessageDialog(getCurrentActivity());
messageDialog.setShouldFailOnDataError(mShouldFailOnDataError);
messageDialog.registerCallback(getCallbackManager(), new MessageDialogCallback(promise));
messageDialog.show(shareContent);
} else {
promise.reject("No current activity.");
}
}
use of com.facebook.react.bridge.ReactMethod in project react-native-push-notification by zo0r.
the class RNPushNotification method scheduleLocalNotification.
@ReactMethod
public void scheduleLocalNotification(ReadableMap details) {
Bundle bundle = Arguments.toBundle(details);
// If notification ID is not provided by the user, generate one at random
if (bundle.getString("id") == null) {
bundle.putString("id", String.valueOf(mRandomNumberGenerator.nextInt()));
}
mRNPushNotificationHelper.sendNotificationScheduled(bundle);
}
Aggregations