-
Notifications
You must be signed in to change notification settings - Fork 116
Update dependencies and fix tests #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| foreignKeys = [ | ||
| ForeignKey(entity = Book::class, parentColumns = [Book.ID], childColumns = [Highlight.BOOK_ID], onDelete = ForeignKey.CASCADE) | ||
| ], | ||
| indices = [Index(value = [Highlight.BOOK_ID])] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely spotted ;)
| else -> { | ||
| Toast.makeText(this, getString(R.string.error), Toast.LENGTH_LONG).show() | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will show the toast when the user start a search in a book. I think instead we should simply add branches for all the available events.
Currently the SearchFragment is handling the StartNewSearch event which is dangerous as if we revert to a single Channel for event handling, it can by default have only a single observer. Best practice would be to handle all the events in the ReaderActivity, and forward downward any event if needed.
For this PR, I suggest we just move the StartNewSearch event to the ReaderViewModel.FeedbackEvent enum and let the EpubReaderFragment take ownership of this event handling, as it has access to the SearchFragment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EpubReaderFragment doesn't have a reference to SearchFragment, all it does show the fragment via the fragment manager, so it's not quite as easy as letting EpubReaderFragment take ownership of event handling for this. But yeah that's an overlook on my part putting a toast error message when it results in showing that when a new search begins. I think the best thing to do is just add an empty else branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good for now, we can always fix this in a dedicated refactoring.
I started out just updating dependencies, but decided to fix some of the issues with unit tests and json.
org.json:jsonlibrary for mocking JSONObject and the like in the tests was not working on newer versions. As it is already usingorg.robolectric:robolectricI annotated each relevant file with@RunWith(RobolectricTestRunner::class)jacksondependencies and deleted theMediaOverlayHandlerclassBOOK_ID, as that warning has been there for several months