185: Network connectivity warning and error handling#286
185: Network connectivity warning and error handling#286eliserichards merged 11 commits intomasterfrom
Conversation
79b2715 to
1c84c1f
Compare
jhugman
left a comment
There was a problem hiding this comment.
Quick drive by!
I think that the store can be doing more, and we can remove the need for presenters to explicitly request a connectivity check.
Otherwise, looking good so far!
2a3e033 to
98e294d
Compare
5d236a1 to
f00faf5
Compare
f00faf5 to
eae36be
Compare
jhugman
left a comment
There was a problem hiding this comment.
So three areas of concern/in need of attention:
- The NetworkStore api should be less reliant on
CheckConnectivityactions, and more reliant ondoOnSubscribeanddoOnDisposeof theisConnectedobservable. - I don't know what the retry button is supposed to do. This is presenter dependent, and should be more than displaying or hiding the error message, but I don't know what.
- The
NetworkErrorHelpercould be made a little smaller. How can we delete some of this code by changing the XML in someway.
|
@jhugman :
✅
Right now the retry button is simply checking the connection status again. The thought being that, if the network is not connected, the user can recheck the connection once they reconnect to wifi or what have you. This should be addressed in a followup issue, making the retry logic more explicit (e.g. re-sync, reload a web page, etc). Also see @linuxwolf 's input on retry logic: #185 (comment)
I agree that the fragments should be made more consistent. I addressed this in a comment above, but I found that it was taking up too much time and abandoned it for now. Maybe address this in a followup issue as well? I'm not sure what the priority of doing a refactor like that would be. |
2fdf729 to
3d01cc2
Compare
f4ebb46 to
eaeda6d
Compare
|
@jhugman, question about Currently, in my networkStore.isConnected
.doOnSubscribe { dispatcher.dispatch(NetworkAction.CheckConnectivity) }
.subscribe(view::handleNetworkError).addTo(compositeDisposable)We discussed this morning that init {
...
isConnected
.doOnSubscribe { dispatcher.dispatch(NetworkAction.CheckConnectivity) }
.addTo(compositeDisposable)
}Is this the right path to go down? Or am I going down a rabbit hole and missing the point of the |
Yes, this looks like the right way to go about it. The If you think: presenters are subscribing to the store and the store is looking after the subscriptions; then the store will want to do something each time it receives a subscription. -- Another thing you may consider is eliminating the |
|
Hey @eliserichards I've pulled our 'needs-review' request for now. The latest builds have failed, so I figured I'd wait for you and @jhugman to sort out some of the functionality before we come in to test the experience. Feel free to throw us back on once complete. Let me know if you want to discuss further. |
d0c7ece to
b00e69c
Compare
293a21d to
815d108
Compare
nickbrandt
left a comment
There was a problem hiding this comment.
@eliserichards I'm having some issues with this build. I first tried signing in without an internet connection, and received a dialog that there was No Network. Are we unable to display this to the user as designed (toast message at top of screen under navbar, which we plan to use in other situations without network connection)?
Also, when I connect back to the internet, and try to sign in, the app crashes every time. I tried deleting the app and reinstalling, but still when I go to sign in the app crashes, therefore I am unable to test the other use cases.
Let me know once this is fixed and I'll retest. Thanks!
Insert warning into fragment Add message to webview Add store and action to check connection Add actions to webview fragment and presenter. Passing network availability to fragment Successfully sending network connection status\! Adding fragment to item list, item detail, and fxa login. Still commented out in FxA login. Added logic for retry button. NetworkStore tests AppWebPagePresenter test Fixing network store tests All errors visible. Next step: make them disappear. Making fxa default invisible Finishing warning visibility. Setup for presenter network tests Retry button functionality and error helper Tests, rebase, lint Add network checks to presenter tests Fix presenter tests Rebase & cleanup
815d108 to
95b08c0
Compare
|
@nickbrandt there is a followup issue for the crash you're seeing. That was the "temporary" fix that we implemented before we released. The issue #356 is On Deck right now, hopefully to be fixed soon. My PR covers once you get to the FxA login screen and then turn the network off/on. Could you try it again and let me know if you're still getting crashes? |
jhugman
left a comment
There was a problem hiding this comment.
👏🏼👏🏼👏🏼👏🏼👏🏼👏🏼
This is looking really really nice now. Well done.
There are things you should look at/do before landing:
- file a followup to rationalize the methods and apparatuses for testing if we're running in a [unit-] testing environment.
- fix the the tiny amount of nits left on this PR.
You've worked hard on this PR. Well done.
| private fun leakCanary(): Boolean { | ||
| if (LeakCanary.isInAnalyzerProcess(this)) { | ||
| // disable LeakCanary when unitTesting | ||
| if (unitTesting) return false |
There was a problem hiding this comment.
We have at least one method to detect if we're unit testing. See isTesting and isUnitTesting. We probably shouldn't have two, but pick one of those, and use that; that'll likely do the same job as using a separate Application object.
| dispatcher.register.subscribe(dispatcherObserver) | ||
|
|
||
| subject = FxALoginPresenter(view, accountStore = accountStore) | ||
| networkStore.connectivityManager = connectivityManager |
There was a problem hiding this comment.
Not sure I understand this. The networkStore is a mock, and you're giving it mock connectivityManager?
There was a problem hiding this comment.
you can't create an instance of a ConnectivityManager, it has to be mocked. And the network store's connectivity manager has to be instantiated or it will break
| } | ||
|
|
||
| override val unitTesting = true | ||
| } No newline at end of file |
There was a problem hiding this comment.
I'm not sure this is useful, given that we have isTesting methods.
There was a problem hiding this comment.
The application was failing on Leak Canary, even before it reached the isTesting method. I'm going to file a followup for this
|
@eliserichards I tried downloading the build again this morning, and I'm still experiencing crashes on going to the FxA screen with my network available. |
|
I just tried the release binary, from scratch (uninstall Lockbox, install from bitrise, launch). It crashes when I try to "Get Started". It appears, for some reason, that |
| ~ License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| ~ file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
| --> | ||
| <android.support.constraint.ConstraintLayout |
There was a problem hiding this comment.
This should now be androidx.constraintlayout.widget.ConstraintLayout.
There was a problem hiding this comment.
yep! already fixed 😄
Fixed crash, time to try again :)
There was a problem hiding this comment.
@eliserichards this looks great! Thanks for your hard work on this. 👏 🎉
The Retry button/link doesn't currently work, but I noticed you already have a follow-up issue for that 👍
✅ Entry List (No Entries) - Note: Assuming this won't change anything, but will want to test this again once our Empty State PR (#397 ) is merged.

✅ FAQ/Ask Question/Feedback webviews

✅ Even added a nice dialog informing user they are not connected to the internet on Welcome/Get Started screen

* Message bar Insert warning into fragment Add message to webview Add store and action to check connection Add actions to webview fragment and presenter. Passing network availability to fragment Successfully sending network connection status\! Adding fragment to item list, item detail, and fxa login. Still commented out in FxA login. Added logic for retry button. NetworkStore tests AppWebPagePresenter test Fixing network store tests All errors visible. Next step: make them disappear. Making fxa default invisible Finishing warning visibility. Setup for presenter network tests Retry button functionality and error helper Tests, rebase, lint Add network checks to presenter tests Fix presenter tests Rebase & cleanup * Remove consumers from fragments * Adding string descriptions * Change subscriptions * Naming changes, lint errors * Refactor network error helper * fix lint error * Finalizing network store subscriptions * Presenter tests * Fixing tests and lint * Fixing rebase




Fixes #185
Testing and Review Notes
Note: there are a number of followup stories to implement thorough retry logic, etc.
To Do
review todo
NetworkStoreetcNetworkErrorHelperFxALoginFragment-- Network error retry logic #373
engineering
- [x] add tests for NetworkStore- [x] change tests for views to add new observers- [x] finish visible/invisible error- [x] implement sync/retest networkon "Retry"-- when the network is down on one page and you navigate to another, Android "network unvailable" page shows up in addition to the message??- [x] figure out what's going on with FxAlogin fragment- [x] file issue in A-C for network availability and applicable followups for our board-- #355
-- #356
-- #369
reviews