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. |
| ) | ||
| courseDao.insertCourseStructureEntity(response.mapToRoomEntity()) | ||
| courseStructure[courseId] = response.mapToDomain() | ||
|
|
There was a problem hiding this comment.
Please remove the extra line
| fun updateData() { | ||
| viewModelScope.launch { | ||
| try { | ||
| interactor.preloadCourseStructure(courseId) | ||
| interactor.getCourseStructure(courseId) |
There was a problem hiding this comment.
Will it actually update the data, or will it just return the last cached course?
There was a problem hiding this comment.
no, but I changed how it works and right now it should update the data )
|
The overall approach looks good. |
|
Resuming the review |
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