reuse shareUri at shareMedium
This commit is contained in:
parent
73856e6769
commit
02dfcd63c0
1 changed files with 1 additions and 10 deletions
|
@ -42,17 +42,8 @@ fun Activity.shareUri(uri: Uri) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Activity.shareMedium(medium: Medium) {
|
fun Activity.shareMedium(medium: Medium) {
|
||||||
val shareTitle = resources.getString(R.string.share_via)
|
|
||||||
val file = File(medium.path)
|
val file = File(medium.path)
|
||||||
val uri = getFilePublicUri(file, BuildConfig.APPLICATION_ID)
|
shareUri(Uri.fromFile(file))
|
||||||
|
|
||||||
Intent().apply {
|
|
||||||
action = Intent.ACTION_SEND
|
|
||||||
putExtra(Intent.EXTRA_STREAM, uri)
|
|
||||||
type = getMimeTypeFromUri(uri)
|
|
||||||
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
|
||||||
startActivity(Intent.createChooser(this, shareTitle))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Activity.shareMedia(media: List<Medium>) {
|
fun Activity.shareMedia(media: List<Medium>) {
|
||||||
|
|
Loading…
Reference in a new issue