Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

For #7364 - Adds sessionId to DownloadState and populates it in DowloadFeature #7365

Merged
merged 1 commit into from
Jun 16, 2020

Conversation

codrut-topliceanu
Copy link
Contributor


For #7364

Pull Request checklist

  • Quality: This PR builds and passes detekt/ktlint checks.
  • Tests: This PR doesn't include tests as it is only a minor change.
  • Changelog: This PR does not need a changelog entry.
  • Accessibility: The code in this PR does not include any user facing features.

After merge

  • Milestone: Make sure issues closed by this pull request are added to the milestone of the version currently in development.
  • Breaking Changes: If this is a breaking change, please push a draft PR on Reference Browser to address the breaking issues.

@codecov
Copy link

codecov bot commented Jun 12, 2020

Codecov Report

Merging #7365 into master will increase coverage by 0.19%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #7365      +/-   ##
============================================
+ Coverage     77.37%   77.56%   +0.19%     
+ Complexity     5064     4919     -145     
============================================
  Files           675      652      -23     
  Lines         24774    23926     -848     
  Branches       3663     3563     -100     
============================================
- Hits          19168    18558     -610     
+ Misses         4094     3909     -185     
+ Partials       1512     1459      -53     
Impacted Files Coverage Δ Complexity Δ
...nents/browser/state/reducer/ContentStateReducer.kt 81.08% <ø> (ø) 26.00 <0.00> (ø)
...a/components/feature/downloads/DownloadsFeature.kt 85.07% <ø> (ø) 23.00 <0.00> (ø)
...nents/browser/state/state/content/DownloadState.kt 91.66% <100.00%> (+9.84%) 5.00 <2.00> (+2.00)
...omponents/lib/crash/handler/CrashHandlerService.kt
...illa/components/lib/crash/service/SentryService.kt
...a/mozilla/components/lib/crash/db/CrashDatabase.kt
...ozilla/components/lib/crash/ui/CrashListAdapter.kt
.../components/feature/intent/ext/IntentExtensions.kt
...la/components/lib/crash/BreadcrumbPriorityQueue.kt
...ts/feature/intent/processing/TabIntentProcessor.kt
... and 19 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7cb2889...fc06a09. Read the comment docs.

@codrut-topliceanu
Copy link
Contributor Author

Some unit tests are failing. :( Looking into them now.

Copy link
Contributor

@Amejia481 Amejia481 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one suggestion.

val download = state.content.download
if (download != null) {
processDownload(state, download)
state.content.download?.let { downloadState ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think will be better if we populate this property when the download request is issued

This way we are going to have a consistent state in BrowserStore. what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Amejia481 Thanks for taking a look at this. That's a really good solution that hadn't occurred to me! I just tried it now and it works great. Thank you.

Copy link
Contributor

@csadilek csadilek Jun 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Amejia481 @codrut-topliceanu Thanks and sorry for the late response.

When creating a DownloadState we always know the sessionId. So, we can simply set the sessionId here when creating the download: https://github.com/mozilla-mobile/android-components/blob/master/components/browser/session/src/main/java/mozilla/components/browser/session/engine/EngineObserver.kt#L185

It doesn't need to be a side-effect / unexpected change of reducing.

Copy link
Contributor Author

@codrut-topliceanu codrut-topliceanu Jun 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already tried that and it didn't work, I'm afraid. It only worked for downloads that had skip confirmation == true.

Copy link
Contributor

@csadilek csadilek Jun 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codrut-topliceanu Hm can you share some more details? It effectively shouldn't matter when the sessionId is added, so why not add it directly when the download is created? It seems like a potential source of error to do this "later" (when updating in the store).

Copy link
Contributor

@Amejia481 Amejia481 Jun 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean that when you try to download a file in some cases this line doesn't get executed? If that it's the case then this is a GeckoView issue and it's a separate issue from this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep that's the case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind opening a bug in Bugzilla describing the the issue and the step to reproduce it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll give it a try. I've never opened one in Bugzilla before.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you need any help just let me know, happy to help!

Copy link
Contributor

@csadilek csadilek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have one comment below to set the sessionId when the download is created as opposed to when it's added to the store.

But, otherwise, good from my side.

@codrut-topliceanu
Copy link
Contributor Author

bors r=csadilek

@bors
Copy link

bors bot commented Jun 16, 2020

Build succeeded:

@bors bors bot merged commit a261a24 into mozilla-mobile:master Jun 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants