Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Issue #929: Use browser-session component for browser state. #982
Closes #929: This PR removes the custom session code from the app and replaces it with the
There are three missing pieces in the component (webview state, session source, blocking state) that I added via property extensions for now. I created upstream issues to get that into the component and once that has happened we can remove the extensions here.
For now this is almost a 1:1 replacement. In further iterations we can start to clean some things up. I want to look into how we can make usage of the component for "single-session" users a bit easier.
I did test this on a Fire TV 4k stick a bit. I seems to work fine. However as this touches a lot of areas I think this should get good test coverage by QA too.
referenced this pull request
Jul 12, 2018
Codecov: Unfortunately the coverage went down because there were some tests for the removed code. On the positive side the components have a good/better coverage. :)
Sputnik: That's something we saw in other repos too: If we remove files then sputnik fails because it cannot look at those files (obviously). This seems to be a sputnik bug.
Looks pretty good but there are a few areas I'm concerned about that I think we should discuss the best approach on. The detailed comments are inline but to highlight these areas:
- Components as a member of ApplicationContext
- Can we have multiple sessions? We should avoid changing logic around that interaction if it's possible
- The session observer callbacks not passing in a reference to the changed values
- How lifecycle owners work for Fragments with view hierarchies
This is a long PR and GH doesn't have interdiff so I'd prefer if you can make your changes as separate commits and squash at the end!
@mcomella Updated the PR and added a separate commit to address your review comments.
To address your review summary:
As mentioned in the comments: Components will need application context going forward. Especially for #959 and #960. We use a similar concept in our sample browser:
Yes, I changed everything back to handle multiple sessions. Let's address that separately. We are also looking into making single session use cases easier in the components.
As mentioned above: I had the same feeling when using the component here and a patch for that already landed in the components repository.
This was a 1:1 conversion from the previous code where the LiveData observer was bound to the fragment too. I updated this code to bind the observer to the view instead of the Fragment.
lgtm w/ comments addressed. Thanks!
Don't forget to squash! :)