use of com.facebook.share.model.ShareContent in project react-native-fbsdk by facebook.
the class FBMessageDialogModule method canShow.
/**
* Indicates whether it is possible to show the dialog for ShareContent of the specified type.
* @param shareContentMap must be a valid {@link ShareContent}.
* @param promise Use promise to pass message dialog result to JS.
*/
@ReactMethod
public void canShow(ReadableMap shareContentMap, Promise promise) {
if (getCurrentActivity() != null) {
ShareContent shareContent = Utility.buildShareContent(shareContentMap);
MessageDialog messageDialog = new MessageDialog(getCurrentActivity());
promise.resolve(messageDialog.canShow(shareContent));
} else {
promise.reject("No current activity.");
}
}
use of com.facebook.share.model.ShareContent in project facebook-android-sdk by facebook.
the class SelectionFragment method updateShareContent.
private void updateShareContent() {
ShareContent content = createOpenGraphContent();
if (content != null) {
enableButtons();
} else {
disableButtons();
}
shareButton.setShareContent(content);
messageButton.setShareContent(content);
}
use of com.facebook.share.model.ShareContent 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.share.model.ShareContent in project react-native-fbsdk by facebook.
the class FBShareAPIModule method canShare.
/**
* Check if the content can be shared.
* @param shareContentMap must be a valid {@link ShareContent}
* @param promise Use promise to pass the result to JS.
*/
@ReactMethod
public void canShare(ReadableMap shareContentMap, Promise promise) {
ShareContent shareContent = Utility.buildShareContent(shareContentMap);
if (shareContent != null) {
ShareApi shareApi = new ShareApi(shareContent);
promise.resolve(shareApi.canShare());
} else {
promise.reject("ShareContent cannot be null");
}
}
use of com.facebook.share.model.ShareContent in project react-native-fbsdk by facebook.
the class FBShareAPIModule method share.
/**
* Share the content.
* @param shareContentMap must be a valid {@link ShareContent}.
* @param graphNode The graph node to share to (this can be a user id, event id, page id, group id, album
* id, etc).
* @param message The custom message that will accompany the share content.
* @param promise Use promise to pass share api result to JS.
*/
@ReactMethod
public void share(ReadableMap shareContentMap, String graphNode, String message, Promise promise) {
ShareContent shareContent = Utility.buildShareContent(shareContentMap);
if (shareContent != null) {
ShareApi shareApi = new ShareApi(shareContent);
shareApi.setGraphNode(graphNode);
shareApi.setMessage(message);
shareApi.share(new ShareAPICallback(promise));
} else {
promise.reject("ShareContent cannot be null");
}
}
Aggregations