-
Notifications
You must be signed in to change notification settings - Fork 25
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
fix: crash when restoring the app after a long period of inactivity #290
fix: crash when restoring the app after a long period of inactivity #290
Conversation
Reviewing |
Hey @dixidroid, just a heads-up, this PR will remain in a stale position until we merge #278, as it will update the underlying code fixed in this PR. 🕐 |
@dixidroid The base PR has been merged. Could you please reassess the scope of this ticket? Thank You |
787ba1c
to
fabe057
Compare
@HamzaIsrar12 we still need this PR. All conflicts were resolved. |
courseId | ||
) | ||
courseDao.insertCourseStructureEntity(response.mapToRoomEntity()) | ||
courseStructure[courseId] = response.mapToDomain() | ||
|
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.
Please remove the extra line
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.
done
fun updateData() { | ||
viewModelScope.launch { | ||
try { | ||
interactor.preloadCourseStructure(courseId) | ||
interactor.getCourseStructure(courseId) |
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.
Will it actually update the data, or will it just return the last cached course?
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.
no, but I changed how it works and right now it should update the data )
The overall approach looks good. |
Resuming the review |
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.
LGTM
fabe057
to
bc43dcc
Compare
bc43dcc
to
498f0ef
Compare
Changed the way course data is loaded.
Previously there was the preloadCourseStructure function that was called when we opened a course. Then all data was cached and used in other places such as open content and etc. When the app was in the background for a long time all the data was cleared by the system and if the user tries to open the app - it crashes.
I changed the way the Course Structure is retrieved and added a check for empty data.
#139