-
Notifications
You must be signed in to change notification settings - Fork 271
Paging with network and database #51
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
24273d4 to
1265543
Compare
1265543 to
cca3f30
Compare
dc004a5 to
adba8cd
Compare
adba8cd to
15f9225
Compare
| } | ||
| LoadType.START -> { | ||
| val remoteKeys = getRemoteKeyForFirstItem(state) | ||
| if (remoteKeys == null) { |
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.
You could replace this with a checkNotNull which might be more idiomatic, it throws IllegalStateException which might be more apt here though.
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.
Although this will be obsolete once yigit's change lands.
https://android-review.googlesource.com/c/platform/frameworks/support/+/1295842
Might want to just wait for this.
| } | ||
| LoadType.END -> { | ||
| val remoteKeys = getRemoteKeyForLastItem(state) | ||
| if (remoteKeys?.nextKey == null) { |
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.
Same as above about checkNotNull from kotlin stdlib.
| try { | ||
| val apiResponse = service.searchRepos(apiQuery, page, state.config.pageSize) | ||
|
|
||
| return if (apiResponse.isSuccessful) { |
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.
Do we still gain anything by using the callback call adapter if we still need to check for HttpException and IOException? I feel like we should just use the suspend adapter from Retrofit, since that will likely be more relatable to users who are interested in using Coroutines. Sorry to flip back and forth on this, chris may disagree with me here though and in that case we can just keep this :D
Fix RemoteMediator endOfPagination logic
No description provided.