app/src/main/java/com/kickstarter/features/socialshare/README.md
The Social Share feature lets users share a Kickstarter project with their network directly from within the app. When a user taps the share button on a project a bottom sheet slides up presenting a grid of sharing destinations alongside a preview card of the project.
| Icon | Destination | Requires app installed? |
|---|---|---|
| X | X (Twitter) | Yes |
| Instagram Feed | Yes | |
| Instagram Stories | Yes | |
| Facebook Feed | Yes | |
| Facebook Stories | Yes | |
| Yes | ||
| Messages | SMS / iMessage | No (native) |
| No (native) | ||
| More | Native system share sheet | No (native) |
| Copy Link | Clipboard | No |
The feature is structured as a self-contained package under features/socialshare/:
SocialShareService / AndroidSocialShareService — interface that abstracts all Android framework calls (PackageManager, ClipboardManager, FileProvider, intent construction) so the ViewModel never holds a Context.SocialShareViewModel — on creation it detects which platform apps are installed and begins caching the project image in the background. Exposes onPlatformSelected, onCopyLinkClicked, and onCopiedToastShown.SocialShareSheet — a ModalBottomSheet composable. It reads the ViewModel through LocalSocialShareViewModel (a CompositionLocalProvider) so the ViewModel is always created by the caller with the correct shareData rather than inside the composable itself.ShareImageCache — downloads the project image and writes it to the app cache as a content:// URI via FileProvider, which is required to grant read permission to third-party apps.SocialShareIntentBuilder — constructs the correct Intent per platform.Create the ViewModel where you have access to shareData, then wrap the sheet in a CompositionLocalProvider:
shareData?.let { data ->
val shareViewModel = remember(data) {
SocialShareViewModel(
shareService = AndroidSocialShareService(context.applicationContext),
shareData = data
)
}
CompositionLocalProvider(LocalSocialShareViewModel provides shareViewModel) {
SocialShareSheet(
shareData = data,
isVisible = true,
onDismiss = { shareData = null },
onIntentReady = { startActivity(it) }
)
}
}
This section summarizes the content included in the intents generated by SocialShareIntentBuilder for each platform.
| Platform | Includes Image? | Includes Link? | Includes Text (Name)? | Notes |
|---|---|---|---|---|
| X (Twitter) | ✅ | ✅ | ✅ | Supports both image and text/link via ACTION_SEND. |
| ✅ | ✅ | ✅ | Text is rendered as a caption beneath the image. | |
| Messages (SMS) | ❌ | ✅ | ✅ | Text-only via ACTION_SENDTO for reliability across OEMs. |
| ✅ | ✅ | ✅ | Image as inline attachment; falls back to mailto: if no image. | |
| Instagram Feed | ✅ | ✅ | ✅ | Uses EXTRA_TEXT; behavior depends on Instagram app version. |
| Facebook Feed | ✅ | ✅ | ✅ | Uses EXTRA_TEXT; behavior depends on Facebook app version. |
| Native Chooser | ✅ | ✅ | ✅ | Universal fallback for any app not listed explicitly. |
| Stories (IG/FB) | ✅ | ❌ | ❌ | Custom ADD_TO_STORY actions do not have a text/link slot. |