private static DialogFeature getFeature( Class<? extends ShareContent> contentType) { if (ShareLinkContent.class.isAssignableFrom(contentType)) { return MessageDialogFeature.MESSAGE_DIALOG; } else if (SharePhotoContent.class.isAssignableFrom(contentType)) { return MessageDialogFeature.PHOTOS; } else if (ShareVideoContent.class.isAssignableFrom(contentType)) { return MessageDialogFeature.VIDEO; } else if (ShareOpenGraphContent.class.isAssignableFrom(contentType)) { return OpenGraphMessageDialogFeature.OG_MESSAGE_DIALOG; } return null; }
private static DialogFeature getFeature( Class<? extends ShareContent> contentType) { if (ShareLinkContent.class.isAssignableFrom(contentType)) { return ShareDialogFeature.SHARE_DIALOG; } else if (SharePhotoContent.class.isAssignableFrom(contentType)) { return ShareDialogFeature.PHOTOS; } else if (ShareVideoContent.class.isAssignableFrom(contentType)) { return ShareDialogFeature.VIDEO; } else if (ShareOpenGraphContent.class.isAssignableFrom(contentType)) { return OpenGraphActionDialogFeature.OG_ACTION_DIALOG; } return null; }
private static DialogFeature getFeature() { return LikeDialogFeature.LIKE_DIALOG; }
private static boolean canShowNative(Class<? extends ShareContent> contentType) { DialogFeature feature = getFeature(contentType); return feature != null && DialogPresenter.canPresentNativeDialogWithFeature(feature); }
private void logDialogShare(Context context, ShareContent content, Mode mode) { String displayType; if (isAutomaticMode) { mode = Mode.AUTOMATIC; } switch (mode) { case AUTOMATIC: displayType = AnalyticsEvents.PARAMETER_SHARE_DIALOG_SHOW_AUTOMATIC; break; case WEB: displayType = AnalyticsEvents.PARAMETER_SHARE_DIALOG_SHOW_WEB; break; case NATIVE: displayType = AnalyticsEvents.PARAMETER_SHARE_DIALOG_SHOW_NATIVE; break; default: displayType = AnalyticsEvents.PARAMETER_SHARE_DIALOG_SHOW_UNKNOWN; break; } String contentType; DialogFeature dialogFeature = getFeature(content.getClass()); if (dialogFeature == ShareDialogFeature.SHARE_DIALOG) { contentType = AnalyticsEvents.PARAMETER_SHARE_DIALOG_CONTENT_STATUS; } else if (dialogFeature == ShareDialogFeature.PHOTOS) { contentType = AnalyticsEvents.PARAMETER_SHARE_DIALOG_CONTENT_PHOTO; } else if (dialogFeature == ShareDialogFeature.VIDEO) { contentType = AnalyticsEvents.PARAMETER_SHARE_DIALOG_CONTENT_VIDEO; } else if (dialogFeature == OpenGraphActionDialogFeature.OG_ACTION_DIALOG) { contentType = AnalyticsEvents.PARAMETER_SHARE_DIALOG_CONTENT_OPENGRAPH; } else { contentType = AnalyticsEvents.PARAMETER_SHARE_DIALOG_CONTENT_UNKNOWN; } AppEventsLogger logger = AppEventsLogger.newLogger(context); Bundle parameters = new Bundle(); parameters.putString( AnalyticsEvents.PARAMETER_SHARE_DIALOG_SHOW, displayType ); parameters.putString( AnalyticsEvents.PARAMETER_SHARE_DIALOG_CONTENT_TYPE, contentType ); logger.logSdkEvent(AnalyticsEvents.EVENT_SHARE_DIALOG_SHOW, null, parameters); }
/** * Indicates whether it is possible to show the dialog for * {@link com.facebook.share.model.ShareContent} of the specified type. * * @param contentType Class of the intended {@link com.facebook.share.model.ShareContent} to * send. * @return True if the specified content type can be shown via the dialog */ public static boolean canShow(Class<? extends ShareContent> contentType) { DialogFeature feature = getFeature(contentType); return feature != null && DialogPresenter.canPresentNativeDialogWithFeature(feature); }