diff --git a/OpenEdXMobile/src/main/java/org/edx/mobile/view/CourseTabsDashboardFragment.kt b/OpenEdXMobile/src/main/java/org/edx/mobile/view/CourseTabsDashboardFragment.kt index 25bf53beaf..f251152ea8 100644 --- a/OpenEdXMobile/src/main/java/org/edx/mobile/view/CourseTabsDashboardFragment.kt +++ b/OpenEdXMobile/src/main/java/org/edx/mobile/view/CourseTabsDashboardFragment.kt @@ -396,7 +396,7 @@ class CourseTabsDashboardFragment : BaseFragment() { } }) - courseDateViewModel.resetCourseDates.observe(viewLifecycleOwner, NonNullObserver { + courseDateViewModel.resetCourseDates.observe(viewLifecycleOwner, EventObserver { if (!CalendarUtils.isCalendarExists(contextOrThrow, accountName, calendarTitle)) { showShiftDateSnackBar(true) binding.toolbar.datesBanner.root.setVisibility(false) diff --git a/OpenEdXMobile/src/main/java/org/edx/mobile/view/CourseUnitWebViewFragment.java b/OpenEdXMobile/src/main/java/org/edx/mobile/view/CourseUnitWebViewFragment.java index 086a6c487d..2981e609c3 100644 --- a/OpenEdXMobile/src/main/java/org/edx/mobile/view/CourseUnitWebViewFragment.java +++ b/OpenEdXMobile/src/main/java/org/edx/mobile/view/CourseUnitWebViewFragment.java @@ -293,14 +293,15 @@ private void initObserver() { PreLoadingListener.State.MAIN_UNIT_LOADING : PreLoadingListener.State.MAIN_UNIT_LOADED)); - courseDateViewModel.getResetCourseDates().observe(getViewLifecycleOwner(), resetCourseDates -> { + courseDateViewModel.getResetCourseDates().observe(getViewLifecycleOwner(), new EventObserver<>(resetCourseDates -> { if (resetCourseDates != null) { binding.authWebview.loadUrl(true, unit.getBlockUrl()); if (!CalendarUtils.INSTANCE.isCalendarExists(getContextOrThrow(), accountName, calendarTitle)) { showShiftDateSnackBar(true); } } - }); + return null; + })); courseDateViewModel.getErrorMessage().observe(getViewLifecycleOwner(), errorMessage -> { if (errorMessage != null) { diff --git a/OpenEdXMobile/src/main/java/org/edx/mobile/viewModel/CourseDateViewModel.kt b/OpenEdXMobile/src/main/java/org/edx/mobile/viewModel/CourseDateViewModel.kt index 3dc4d22b60..63b9154c20 100644 --- a/OpenEdXMobile/src/main/java/org/edx/mobile/viewModel/CourseDateViewModel.kt +++ b/OpenEdXMobile/src/main/java/org/edx/mobile/viewModel/CourseDateViewModel.kt @@ -50,8 +50,8 @@ class CourseDateViewModel @Inject constructor( val bannerInfo: LiveData get() = _bannerInfo - private val _resetCourseDates = MutableLiveData() - val resetCourseDates: LiveData + private val _resetCourseDates = MutableLiveData>() + val resetCourseDates: LiveData> get() = _resetCourseDates private val _errorMessage = MutableLiveData() @@ -182,7 +182,7 @@ class CourseDateViewModel @Inject constructor( callback = object : NetworkResponseCallback { override fun onSuccess(result: Result.Success) { if (result.isSuccessful && result.data != null) { - _resetCourseDates.postValue(result.data) + _resetCourseDates.postEvent(result.data) fetchCourseDates( courseId, forceRefresh = true,