This repository was archived by the owner on Nov 1, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
browser/state/src/main/java/mozilla/components/browser/state/state/content
feature/downloads/src/main/java/mozilla/components/feature/downloads Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ import kotlin.random.Random
2222 * @property referrerUrl The site that linked to this download.
2323 * @property skipConfirmation Whether or not the confirmation dialog should be shown before the download begins.
2424 * @property id The unique identifier of this download.
25+ * @property sessionId Identifier of the session that spawned the download.
26+ * @
2527 */
2628@Suppress(" Deprecation" )
2729@Parcelize
@@ -34,7 +36,8 @@ data class DownloadState(
3436 val destinationDirectory : String = Environment .DIRECTORY_DOWNLOADS ,
3537 val referrerUrl : String? = null ,
3638 val skipConfirmation : Boolean = false ,
37- val id : Long = Random .nextLong()
39+ val id : Long = Random .nextLong(),
40+ val sessionId : String? = null
3841) : Parcelable {
3942 val filePath: String get() =
4043 Environment .getExternalStoragePublicDirectory(destinationDirectory).path + " /" + fileName
Original file line number Diff line number Diff line change @@ -93,9 +93,8 @@ class DownloadsFeature(
9393 flow.mapNotNull { state -> state.findTabOrCustomTabOrSelectedTab(tabId) }
9494 .ifChanged { it.content.download }
9595 .collect { state ->
96- val download = state.content.download
97- if (download != null ) {
98- processDownload(state, download)
96+ state.content.download?.let { downloadState ->
97+ processDownload(state, downloadState.copy(sessionId = state.id))
9998 }
10099 }
101100 }
You can’t perform that action at this time.
0 commit comments