Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class AboutUtilInstrumentedTest {

// Test list is not empty.
assertThat(communityList.items).isNotEmpty()
assertThat(communityList.items).hasSize(5)
assertThat(communityList.items).hasSize(3)

// Test each item has required fields.
communityList.items.forEach { item ->
Expand All @@ -149,11 +149,11 @@ class AboutUtilInstrumentedTest {
assertThat(githubItem.leadingIcon).isEqualTo(R.drawable.github_logo)
assertThat(githubItem.title).isEqualTo(R.string.app_about_community_github)

val shareItem = communityList.items[3] as ScribeItem.ExternalLinkItem
val shareItem = communityList.items[1] as ScribeItem.ExternalLinkItem
assertThat(shareItem.leadingIcon).isEqualTo(R.drawable.share_icon)
assertThat(shareItem.title).isEqualTo(R.string.app_about_community_share_scribe)

val wikimediaItem = communityList.items[4] as ScribeItem.ExternalLinkItem
val wikimediaItem = communityList.items[2] as ScribeItem.ExternalLinkItem
assertThat(wikimediaItem.leadingIcon).isEqualTo(R.drawable.wikimedia_logo_black)
assertThat(wikimediaItem.title).isEqualTo(R.string.app_about_community_wikimedia)

Expand Down
28 changes: 28 additions & 0 deletions app/src/main/java/be/scri/helpers/ui/ShareHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,34 @@ import android.content.Context
import android.content.Intent
import android.util.Log

/** Interface for sharing functionality. */
interface ShareHelperInterface {
/**
* Shares scribe.
* @param context The Android context used to perform the share action.
*/
fun shareScribe(context: Context)
}

/** Implementation of ShareHelperInterface to handle sharing a scribe. */
class ShareHelperImpl : ShareHelperInterface {
/**
* Shares a text message about Scribe using Android's share intent.
*
* @param context The context from which to launch the share intent.
*/
override fun shareScribe(context: Context) {
val sendIntent =
Intent().apply {
action = Intent.ACTION_SEND
putExtra(Intent.EXTRA_TEXT, "Check out Scribe!")
type = "text/plain"
}
val shareIntent = Intent.createChooser(sendIntent, "Share Scribe via…")
context.startActivity(shareIntent)
}
}

/**
* A helper to facilitate sharing of the application and contacting the team.
*/
Expand Down
Loading
Loading