From 3cde2aba9ac0aae2889ef77ce7b01ccb63c35837 Mon Sep 17 00:00:00 2001 From: rhunk <101876869+rhunk@users.noreply.github.com> Date: Fri, 1 Sep 2023 20:54:04 +0200 Subject: [PATCH] feat(media_downloader): download the whole dash media --- .../ui/manager/sections/downloads/DownloadsSection.kt | 1 + .../features/impl/downloader/MediaDownloader.kt | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/ui/manager/sections/downloads/DownloadsSection.kt b/app/src/main/kotlin/me/rhunk/snapenhance/ui/manager/sections/downloads/DownloadsSection.kt index 1514d8ea..5c1ab34e 100644 --- a/app/src/main/kotlin/me/rhunk/snapenhance/ui/manager/sections/downloads/DownloadsSection.kt +++ b/app/src/main/kotlin/me/rhunk/snapenhance/ui/manager/sections/downloads/DownloadsSection.kt @@ -229,6 +229,7 @@ class DownloadsSection : Section() { } //open FilledIconButton(onClick = { + if (download.outputFile == null) return@FilledIconButton val fileType = runCatching { context.androidContext.contentResolver.openInputStream(Uri.parse(download.outputFile))?.use { input -> FileType.fromInputStream(input) diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/features/impl/downloader/MediaDownloader.kt b/core/src/main/kotlin/me/rhunk/snapenhance/features/impl/downloader/MediaDownloader.kt index b8233079..cf0dbdc9 100644 --- a/core/src/main/kotlin/me/rhunk/snapenhance/features/impl/downloader/MediaDownloader.kt +++ b/core/src/main/kotlin/me/rhunk/snapenhance/features/impl/downloader/MediaDownloader.kt @@ -364,6 +364,14 @@ class MediaDownloader : MessagingRuleFeature("MediaDownloader", MessagingRuleTyp selectedChapters.remove(which) } } + setNegativeButton("Cancel") { dialog, _ -> dialog.dismiss() } + setNeutralButton("Download all") { _, _ -> + provideDownloadManagerClient( + mediaIdentifier = paramMap["STORY_ID"].toString(), + downloadSource = MediaDownloadSource.PUBLIC_STORY, + mediaAuthor = storyName + ).downloadDashMedia(playlistUrl, 0, null) + } setPositiveButton("Download") { dialog, which -> val groups = mutableListOf>() var currentGroup = mutableListOf()