Skip to content

Commit

Permalink
Send manga/chapter/page details when sharing a chapter page
Browse files Browse the repository at this point in the history
(cherry picked from commit 32aea55)
  • Loading branch information
Jays2Kings authored and jobobby04 committed Sep 15, 2020
1 parent 63617f3 commit 89427ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -857,9 +857,15 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
* Called from the presenter when a page is ready to be shared. It shows Android's default
* sharing tool.
*/
fun onShareImageResult(file: File) {
fun onShareImageResult(file: File, page: ReaderPage) {
val manga = presenter.manga ?: return
val chapter = page.chapter.chapter

val text = "${manga.title}: ${chapter.name}, ${getString(R.string.chapter_progress, page.number)}"

val stream = file.getUriCompat(this)
val intent = Intent(Intent.ACTION_SEND).apply {
putExtra(Intent.EXTRA_TEXT, text)
putExtra(Intent.EXTRA_STREAM, stream)
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_GRANT_READ_URI_PERMISSION
type = "image/*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ class ReaderPresenter(
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribeFirst(
{ view, file -> view.onShareImageResult(file) },
{ view, file -> view.onShareImageResult(file, page) },
{ _, _ -> /* Empty */ }
)
}
Expand Down

0 comments on commit 89427ff

Please sign in to comment.