public static Bundle createBaseParameters(ShareContent shareContent) { Bundle params = new Bundle(); ShareHashtag shareHashtag = shareContent.getShareHashtag(); if (shareHashtag != null) { Utility.putNonEmptyString( params, ShareConstants.WEB_DIALOG_PARAM_HASHTAG, shareHashtag.getHashtag()); } return params; }
@Override public boolean canShow(final ShareContent content, boolean isBestEffort) { if (content == null || (content instanceof ShareCameraEffectContent) || (content instanceof ShareStoryContent)) { return false; } boolean canShowResult = true; if (!isBestEffort) { // The following features are considered best-effort and will not prevent the // native share dialog from being presented, even if the installed version does // not support the feature. // However, to let apps pivot to a different approach or dialog (for example, Web), // we need to be able to signal back when native support is lacking. if (content.getShareHashtag() != null) { canShowResult = DialogPresenter.canPresentNativeDialogWithFeature( ShareDialogFeature.HASHTAG); } if ((content instanceof ShareLinkContent) && (!Utility.isNullOrEmpty(((ShareLinkContent)content).getQuote()))) { canShowResult &= DialogPresenter.canPresentNativeDialogWithFeature( ShareDialogFeature.LINK_SHARE_QUOTES); } } return canShowResult && ShareDialog.canShowNative(content.getClass()); }
private static Bundle createBaseParameters(ShareContent content, boolean dataErrorsFatal) { Bundle params = new Bundle(); Utility.putUri(params, ShareConstants.CONTENT_URL, content.getContentUrl()); Utility.putNonEmptyString(params, ShareConstants.PLACE_ID, content.getPlaceId()); Utility.putNonEmptyString(params, ShareConstants.PAGE_ID, content.getPageId()); Utility.putNonEmptyString(params, ShareConstants.REF, content.getRef()); params.putBoolean(ShareConstants.DATA_FAILURES_FATAL, dataErrorsFatal); List<String> peopleIds = content.getPeopleIds(); if (!Utility.isNullOrEmpty(peopleIds)) { params.putStringArrayList( ShareConstants.PEOPLE_IDS, new ArrayList<>(peopleIds)); } ShareHashtag shareHashtag = content.getShareHashtag(); if (shareHashtag != null) { Utility.putNonEmptyString(params, ShareConstants.HASHTAG, shareHashtag.getHashtag()); } return params; } }