Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
fix: CourseUnitNavigationActivity resume crashes after free up
Browse files Browse the repository at this point in the history
resources.

- App crashes when the user resumes the app when memory is low and the
user tries to change the unit/component through the next/previous buttons
or swipe left/right, to fix these issues store state using
`onSaveInstanceState`, and restore state on `onRestoreInstanceState` to
make sure the availability of data.

fixes:
- LEARNER-8984
- LEARNER-8985
  • Loading branch information
farhan-arshad-dev authored and omerhabib26 committed Aug 18, 2022
1 parent c0087fd commit fd21986
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public void onSaveInstanceState(Bundle outState) {
}

protected void restore(Bundle savedInstanceState) {
blocksApiVersion = config.getApiUrlVersionConfig().getBlocksApiVersion();
if (savedInstanceState != null) {
courseData = (EnrolledCoursesResponse) savedInstanceState.getSerializable(Router.EXTRA_COURSE_DATA);
courseUpgradeData = savedInstanceState.getParcelable(Router.EXTRA_COURSE_UPGRADE_DATA);
Expand All @@ -115,7 +116,6 @@ protected void restore(Bundle savedInstanceState) {
* Method to force update the course structure from server.
*/
protected void updateCourseStructure(String courseId, String componentId) {
blocksApiVersion = config.getApiUrlVersionConfig().getBlocksApiVersion();
getHierarchyCall = courseApi.getCourseStructureWithoutStale(blocksApiVersion, courseId);
getHierarchyCall.enqueue(new CourseAPI.GetCourseStructureCallback(this, courseId,
new ProgressViewController(binding.loadingIndicator.loadingIndicator), errorNotification,
Expand Down

0 comments on commit fd21986

Please sign in to comment.