public static void invokeCallbackWithError( FacebookCallback<Sharer.Result> callback, String error) { invokeOnErrorCallback(callback, error); }
@Override public void onError(AppCall appCall, FacebookException error) { invokeOnErrorCallback(callback, error); } };
public static void invokeCallbackWithException( FacebookCallback<Sharer.Result> callback, final Exception exception) { if (exception instanceof FacebookException) { invokeOnErrorCallback(callback, (FacebookException) exception); return; } invokeCallbackWithError( callback, "Error preparing share content: " + exception.getLocalizedMessage()); }
@Override public void onSuccess(AppCall appCall, Bundle results) { if (results != null) { final String gesture = getNativeDialogCompletionGesture(results); if (gesture == null || "post".equalsIgnoreCase(gesture)) { String postId = getShareDialogPostId(results); invokeOnSuccessCallback(callback, postId); } else if ("cancel".equalsIgnoreCase(gesture)) { invokeOnCancelCallback(callback); } else { invokeOnErrorCallback( callback, new FacebookException(NativeProtocol.ERROR_UNKNOWN_ERROR)); } } }
public static void invokeCallbackWithResults( FacebookCallback<Sharer.Result> callback, final String postId, final GraphResponse graphResponse) { FacebookRequestError requestError = graphResponse.getError(); if (requestError != null) { String errorMessage = requestError.getErrorMessage(); if (Utility.isNullOrEmpty(errorMessage)) { errorMessage = "Unexpected error sharing."; } invokeOnErrorCallback(callback, graphResponse, errorMessage); } else { invokeOnSuccessCallback(callback, postId); } }
private static void issueResponse( final UploadContext uploadContext, final FacebookException error, final String videoId) { // Remove the UploadContext synchronously // Once the UploadContext is removed, this is the only reference to it. removePendingUpload(uploadContext); Utility.closeQuietly(uploadContext.videoStream); if (uploadContext.callback != null) { if (error != null) { ShareInternalUtility.invokeOnErrorCallback(uploadContext.callback, error); } else if (uploadContext.isCanceled) { ShareInternalUtility.invokeOnCancelCallback(uploadContext.callback); } else { ShareInternalUtility.invokeOnSuccessCallback(uploadContext.callback, videoId); } } }