fix: My Courses screen detached fragment issue for ViewModel
App crashes when the learner receives a delayed response from
Firebase Remote Config on a detached 'MyCourseListFragment' and
tries to initialize the viewModel on it. We will restrict the app
from initializing ViewModel on a detached fragment to fix this
issue.
Fixes:
@@ -160,7 +160,7 @@ class MyCoursesListFragment : OfflineSupportBaseFragment(), RefreshListener {
}
private fun initInAppPurchaseSetup() {
- if (environment.remoteFeaturePrefs.isValuePropEnabled()) {
+ if (isAdded && environment.remoteFeaturePrefs.isValuePropEnabled()) {
initFullscreenLoader()
initObservers()
}
