Share logic for saving page/cover (#6787)

* Use MediaStore on newer Android Q or newer

* Use flow instead of Observable

* Review comment fixes

* Use suspended function instead of flow
This commit is contained in:
Andreas
2022-03-19 21:46:23 +01:00
committed by GitHub
parent ddb856edc7
commit 1163aa4e4e
10 changed files with 265 additions and 143 deletions
@@ -6,10 +6,11 @@ import android.content.Intent
import android.net.Uri
import eu.kanade.tachiyomi.R
fun Uri.toShareIntent(context: Context, type: String = "image/*"): Intent {
fun Uri.toShareIntent(context: Context, type: String = "image/*", message: String? = null): Intent {
val uri = this
val shareIntent = Intent(Intent.ACTION_SEND).apply {
if (message != null) putExtra(Intent.EXTRA_TEXT, message)
putExtra(Intent.EXTRA_STREAM, uri)
clipData = ClipData.newRawUri(null, uri)
setType(type)