-
-
Notifications
You must be signed in to change notification settings - Fork 692
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
Refactor ReadingListFragment to use ViewModel. #5214
base: main
Are you sure you want to change the base?
Conversation
} | ||
} | ||
|
||
class ReadingListWrapper(val readingList: ReadingList?) |
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.
Added wrapper class because the data has non-nullable type T
.
open class Resource<T> {
...
class Success<T>(val data: T) : Resource<T>()
...
}
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.
Instead of having a wrapper class, can we send an empty list if the list is null
? or can you please handle the null
list by sending an error?
# Conflicts: # app/src/main/java/org/wikipedia/readinglist/ReadingListFragment.kt
fun getEmptyTitle(context: Context) = context.getString(R.string.reading_lists_preview_header_title) | ||
|
||
fun getEmptyDescription(context: Context) = DateUtil.getTimeAndDateString(context, Date()) | ||
|
||
suspend fun receiveReadingLists(context: Context, json: String, encoded: Boolean): ReadingList { |
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.
The following changes make this function unused, would it be possible to avoid/undo the change below?
} | ||
} | ||
|
||
class ReadingListWrapper(val readingList: ReadingList?) |
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.
Instead of having a wrapper class, can we send an empty list if the list is null
? or can you please handle the null
list by sending an error?
What does this do?
ReadingListFragment
to use ViewModel.ReadingListFragmentViewModel
and moved the update list logic into it.Why is this needed?
Tech-debt.
Reduce complexity by simplifying the UI layer.
Phabricator:
https://phabricator.wikimedia.org/T303935