Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

[WIP] Select a start screen based upon datastore state. #169

Closed
wants to merge 12 commits into from

Conversation

jhugman
Copy link
Contributor

@jhugman jhugman commented Oct 25, 2018

Fixes #144
Fixed #239
Depends on #22
Depends on #68

This PR continues to split up the graph into subgraphs, but starts sending UI actions through the DataStore.

@jhugman jhugman requested a review from a team as a code owner October 25, 2018 13:22
@ghost ghost assigned jhugman Oct 25, 2018
@ghost ghost added the in progress label Oct 25, 2018
@devinreams
Copy link
Contributor

Holding on #22 and #68

@sashei sashei mentioned this pull request Nov 2, 2018
5 tasks
@jhugman jhugman force-pushed the jhugman/144-start-screen-based-on-state branch from 53752c5 to 7837587 Compare November 6, 2018 15:20
@sashei
Copy link
Contributor

sashei commented Nov 10, 2018

Ok!!!

I've taken a look at the integration tests & identified a few things that are going on here. The fixes / changes I've implemented are kind of hacky, so I'm going to push them up in a separate branch and you can take a look at them before you decide what you'd like to incorporate @jhugman .

I think my lack of expertise with the nav graph stuff is hindering getting this 💯 over the finish line, but I have at least introduced a new set of failures!! Maybe this will give you some ideas :)

Solutions:

I disabled animations in the tests by setting animationsDisabled = true in the build.gradle file, which I feel is a good idea but had no actual bearing on getting any of the integration tests to pass consistently.

Re-populating the item list when using in-memory Logins storage

All of the tests related to the ItemDetail screen were failing because after we reset the DataStore once, we never re-populated it, so it was impossible to tap on anything in the item list. The item detail and filter tests failed consistently, so I made sure to call updateList in the reset block of the DataStore for in-memory logins only.

Removing graph_welcome as the startDestination

The app was routing to the Welcome screen twice in many cases, first because it is the startDestination screen in the nav graph, and second because that's where it goes when a DataStoreAction.Reset comes down the queue. Many of the tests failed when looking for something related to the FxA login screen, because they had found the Get Started button & tapped on it but were promptly scooted back to the Welcome screen when the datastore finished resetting.

To fix that issue, I created an fragment_app_startup_placeholder that is displayed, as the name might indicate, as the startDestination in the graph_main. The RoutePresenter then displays the Welcome screen as dictated by data store state, not in relation to the nav graph at all.

I'll note that this solution is the one needing the most attention (see lack of expertise disclaimer above 😅), because the tests that are still failing do so when they try to tap on buttonGetStarted before anything is displayed.

@sashei sashei mentioned this pull request Nov 13, 2018
6 tasks
@devinreams
Copy link
Contributor

Will rebase against latest version, test, and then get reviewed...

Copy link
Contributor

@ioana-farcas ioana-farcas left a comment

Choose a reason for hiding this comment

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

Quick review: Code-wise looks great :) I was not able to see it working, maybe because of the sync issue. The list was not displayed and Lock Now was not displaying Lock screen.

dispatcher.dispatch(RouteAction.FingerprintDialog)
} else {
unlockFallback()
when {
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

}
}
.addTo(compositeDisposable)

lockedStore.onAuthentication
.filterByType(FingerprintAuthAction.OnAuthentication::class.java)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice :)

@@ -139,22 +157,22 @@ class RoutePresenter(
// This maps two nodes in the graph_main.xml to the edge between them.
// If a RouteAction is called from a place the graph doesn't know about then
// the app will log.error.
when (Pair(from, to)) {
Pair(R.id.fragment_welcome, R.id.fragment_fxa_login) -> return R.id.action_welcome_to_fxaLogin
return when (Pair(from, to)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice :)

@@ -62,6 +63,7 @@ open class DataStore(
is DataStoreAction.Lock -> lock()
is DataStoreAction.Unlock -> unlock()
is DataStoreAction.Sync -> sync()
is DataStoreAction.Reset -> reset()
Copy link
Contributor

Choose a reason for hiding this comment

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

Reset Action is only for test purpose? Did not see it dispatched from anywhere else beside test.

@jhugman
Copy link
Contributor Author

jhugman commented Nov 30, 2018

Closing in favour of a new one.

@jhugman jhugman closed this Nov 30, 2018
@ghost ghost removed the in progress label Nov 30, 2018
@devinreams devinreams deleted the jhugman/144-start-screen-based-on-state branch December 13, 2018 17:19
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.

None yet

4 participants