Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -477,9 +477,6 @@ private fun DashboardPager(
),
fragmentManager = fragmentManager,
homePagerState = homePagerState,
onResetDatesClick = {
viewModel.onRefresh(CourseContainerTab.DATES)
},
onNavigateToContent = { contentTab ->
scope.launch {
// First scroll to CONTENT tab
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ private fun CourseCompletionHomePagerCardContentPreview() {
resumeUnitTitle = "Resumed Unit",
courseSubSections = mapOf(),
subSectionsDownloadsCount = mapOf(),
datesBannerInfo = CoreMocks.mockCourseDatesBannerInfo,
useRelativeDates = true,
courseVideos = mapOf(),
courseAssignments = emptyList(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ import org.openedx.core.ui.theme.appShapes
import org.openedx.core.ui.theme.appTypography
import org.openedx.course.R
import org.openedx.course.presentation.container.CourseContentTab
import org.openedx.course.presentation.ui.CourseDatesBanner
import org.openedx.course.presentation.ui.CourseDatesBannerTablet
import org.openedx.course.presentation.ui.CourseMessage
import org.openedx.course.presentation.ui.ResumeCourseButton
import org.openedx.course.presentation.unit.container.CourseViewMode
Expand All @@ -80,7 +78,6 @@ fun CourseHomeScreen(
viewModel: CourseHomeViewModel,
fragmentManager: FragmentManager,
homePagerState: PagerState,
onResetDatesClick: () -> Unit,
onNavigateToContent: (CourseContentTab) -> Unit = {},
onNavigateToProgress: () -> Unit = {},
) {
Expand Down Expand Up @@ -136,13 +133,6 @@ fun CourseHomeScreen(
fragmentManager = fragmentManager,
)
},
onResetDatesClick = {
viewModel.resetCourseDatesBanner(
onResetDates = {
onResetDatesClick()
}
)
},
onCertificateClick = {
viewModel.viewCertificateTappedEvent()
it.takeIfNotEmpty()
Expand Down Expand Up @@ -185,7 +175,6 @@ private fun CourseHomeUI(
onSubSectionClick: (Block) -> Unit,
onResumeClick: (String) -> Unit,
onDownloadClick: (blockIds: List<String>) -> Unit,
onResetDatesClick: () -> Unit,
onCertificateClick: (String) -> Unit,
onVideoClick: (Block) -> Unit,
onAssignmentClick: (Block) -> Unit,
Expand Down Expand Up @@ -234,25 +223,6 @@ private fun CourseHomeUI(
.fillMaxSize()
.verticalScroll(rememberScrollState()),
) {
if (uiState.datesBannerInfo.isBannerAvailableForDashboard()) {
Box(
modifier = Modifier
.padding(all = 8.dp)
) {
if (windowSize.isTablet) {
CourseDatesBannerTablet(
banner = uiState.datesBannerInfo,
resetDates = onResetDatesClick,
)
} else {
CourseDatesBanner(
banner = uiState.datesBannerInfo,
resetDates = onResetDatesClick,
)
}
}
}

val certificate = uiState.courseStructure.certificate
if (certificate?.isCertificateEarned() == true) {
CourseMessage(
Expand Down Expand Up @@ -459,7 +429,6 @@ private fun CourseHomeScreenPreview() {
resumeUnitTitle = "Resumed Unit",
courseSubSections = mapOf(),
subSectionsDownloadsCount = mapOf(),
datesBannerInfo = CoreMocks.mockCourseDatesBannerInfo,
useRelativeDates = true,
courseVideos = mapOf(),
courseAssignments = emptyList(),
Expand All @@ -471,7 +440,6 @@ private fun CourseHomeScreenPreview() {
onSubSectionClick = {},
onResumeClick = {},
onDownloadClick = {},
onResetDatesClick = {},
onCertificateClick = {},
onVideoClick = {},
onAssignmentClick = {},
Expand Down Expand Up @@ -506,7 +474,6 @@ private fun CourseHomeScreenTabletPreview() {
resumeUnitTitle = "Resumed Unit",
courseSubSections = mapOf(),
subSectionsDownloadsCount = mapOf(),
datesBannerInfo = CoreMocks.mockCourseDatesBannerInfo,
useRelativeDates = true,
courseVideos = mapOf(),
courseAssignments = emptyList(),
Expand All @@ -518,7 +485,6 @@ private fun CourseHomeScreenTabletPreview() {
onSubSectionClick = {},
onResumeClick = {},
onDownloadClick = {},
onResetDatesClick = {},
onCertificateClick = {},
onVideoClick = {},
onAssignmentClick = {},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.openedx.course.presentation.home

import org.openedx.core.domain.model.Block
import org.openedx.core.domain.model.CourseDatesBannerInfo
import org.openedx.core.domain.model.CourseProgress
import org.openedx.core.domain.model.CourseStructure
import org.openedx.core.module.db.DownloadedState
Expand All @@ -17,7 +16,6 @@ sealed class CourseHomeUIState {
val resumeUnitTitle: String,
val courseSubSections: Map<String, List<Block>>,
val subSectionsDownloadsCount: Map<String, Int>,
val datesBannerInfo: CourseDatesBannerInfo,
val useRelativeDates: Boolean,
val courseVideos: Map<String, List<Block>>,
val courseAssignments: List<Block>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.launch
import org.openedx.core.BlockType
import org.openedx.core.R
import org.openedx.core.config.Config
import org.openedx.core.data.storage.CorePreferences
import org.openedx.core.domain.helper.VideoPreviewHelper
import org.openedx.core.domain.model.Block
import org.openedx.core.domain.model.CourseComponentStatus
import org.openedx.core.domain.model.CourseDatesBannerInfo
import org.openedx.core.domain.model.CourseProgress
import org.openedx.core.domain.model.CourseStructure
import org.openedx.core.extension.getChapterBlocks
Expand All @@ -34,7 +32,6 @@ import org.openedx.core.module.download.DownloadHelper
import org.openedx.core.presentation.CoreAnalytics
import org.openedx.core.presentation.dialog.downloaddialog.DownloadDialogManager
import org.openedx.core.system.connection.NetworkConnection
import org.openedx.core.system.notifier.CourseDatesShifted
import org.openedx.core.system.notifier.CourseNotifier
import org.openedx.core.system.notifier.CourseOpenBlock
import org.openedx.core.system.notifier.CourseProgressLoaded
Expand Down Expand Up @@ -129,7 +126,6 @@ class CourseHomeViewModel(
resumeUnitTitle = resumeVerticalBlock?.displayName ?: "",
courseSubSections = courseSubSections,
subSectionsDownloadsCount = subSectionsDownloadsCount,
datesBannerInfo = state.datesBannerInfo,
useRelativeDates = preferencesManager.isRelativeDatesEnabled,
next = state.next,
courseProgress = state.courseProgress,
Expand Down Expand Up @@ -182,13 +178,11 @@ class CourseHomeViewModel(
) { courseStructure, courseStatus, courseDatesResult, courseProgress ->
if (courseStructure == null) return@combine
val blocks = courseStructure.blockData
val datesBannerInfo = courseDatesResult.courseBanner

initializeCourseData(
blocks,
courseStructure,
courseStatus,
datesBannerInfo,
courseProgress
)
}.catch { e ->
Expand All @@ -201,7 +195,6 @@ class CourseHomeViewModel(
blocks: List<Block>,
courseStructure: CourseStructure,
courseStatus: CourseComponentStatus,
datesBannerInfo: CourseDatesBannerInfo,
courseProgress: CourseProgress
) {
setBlocks(blocks)
Expand Down Expand Up @@ -253,7 +246,6 @@ class CourseHomeViewModel(
resumeUnitTitle = resumeVerticalBlock?.displayName ?: "",
courseSubSections = courseSubSections,
subSectionsDownloadsCount = subSectionsDownloadsCount,
datesBannerInfo = datesBannerInfo,
useRelativeDates = preferencesManager.isRelativeDatesEnabled,
courseProgress = courseProgress,
courseVideos = courseVideos,
Expand Down Expand Up @@ -365,23 +357,6 @@ class CourseHomeViewModel(
return sequentialBlocks.find { !it.isCompleted() }
}

fun resetCourseDatesBanner(onResetDates: (Boolean) -> Unit) {
viewModelScope.launch {
try {
interactor.resetCourseDates(courseId = courseId)
getCourseData()
courseNotifier.send(CourseDatesShifted)
onResetDates(true)
} catch (e: Exception) {
handleErrorUiMessage(
throwable = e,
defaultErrorRes = R.string.core_dates_shift_dates_unsuccessful_msg,
)
onResetDates(false)
}
}
}

fun openBlock(fragmentManager: FragmentManager, blockId: String) {
viewModelScope.launch {
val courseStructure = interactor.getCourseStructure(courseId, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ import org.openedx.core.ui.theme.OpenEdXTheme
import org.openedx.core.ui.theme.appColors
import org.openedx.course.R
import org.openedx.course.presentation.contenttab.CourseContentAllEmptyState
import org.openedx.course.presentation.ui.CourseDatesBanner
import org.openedx.course.presentation.ui.CourseDatesBannerTablet
import org.openedx.course.presentation.ui.CourseMessage
import org.openedx.course.presentation.ui.CourseProgress
import org.openedx.course.presentation.ui.CourseSection
Expand Down Expand Up @@ -130,9 +128,6 @@ fun CourseContentAllScreen(
fragmentManager = fragmentManager,
)
},
onResetDatesClick = {
viewModel.resetCourseDatesBanner()
},
onCertificateClick = {
viewModel.viewCertificateTappedEvent()
it.takeIfNotEmpty()
Expand All @@ -151,7 +146,6 @@ private fun CourseContentAllUI(
onSubSectionClick: (Block) -> Unit,
onResumeClick: (String) -> Unit,
onDownloadClick: (blockIds: List<String>) -> Unit,
onResetDatesClick: () -> Unit,
onCertificateClick: (String) -> Unit,
) {
val scaffoldState = rememberScaffoldState()
Expand Down Expand Up @@ -214,27 +208,6 @@ private fun CourseContentAllUI(
modifier = Modifier.fillMaxSize(),
contentPadding = listBottomPadding
) {
if (uiState.datesBannerInfo.isBannerAvailableForDashboard()) {
item {
Box(
modifier = Modifier
.padding(all = 8.dp)
) {
if (windowSize.isTablet) {
CourseDatesBannerTablet(
banner = uiState.datesBannerInfo,
resetDates = onResetDatesClick,
)
} else {
CourseDatesBanner(
banner = uiState.datesBannerInfo,
resetDates = onResetDatesClick,
)
}
}
}
}

val certificate = uiState.courseStructure.certificate
if (certificate?.isCertificateEarned() == true) {
item {
Expand Down Expand Up @@ -363,15 +336,13 @@ private fun CourseOutlineScreenPreview() {
mapOf(),
mapOf(),
mapOf(),
CoreMocks.mockCourseDatesBannerInfo,
true
),
uiMessage = null,
onExpandClick = {},
onSubSectionClick = {},
onResumeClick = {},
onDownloadClick = {},
onResetDatesClick = {},
onCertificateClick = {},
onNavigateToHome = {},
)
Expand All @@ -393,15 +364,13 @@ private fun CourseContentAllScreenTabletPreview() {
mapOf(),
mapOf(),
mapOf(),
CoreMocks.mockCourseDatesBannerInfo,
true
),
uiMessage = null,
onExpandClick = {},
onSubSectionClick = {},
onResumeClick = {},
onDownloadClick = {},
onResetDatesClick = {},
onCertificateClick = {},
onNavigateToHome = {},
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.openedx.course.presentation.outline

import org.openedx.core.domain.model.Block
import org.openedx.core.domain.model.CourseDatesBannerInfo
import org.openedx.core.domain.model.CourseStructure
import org.openedx.core.module.db.DownloadedState

Expand All @@ -14,7 +13,6 @@ sealed class CourseContentAllUIState {
val courseSubSections: Map<String, List<Block>>,
val courseSectionsState: Map<String, Boolean>,
val subSectionsDownloadsCount: Map<String, Int>,
val datesBannerInfo: CourseDatesBannerInfo,
val useRelativeDates: Boolean,
) : CourseContentAllUIState()

Expand Down
Loading
Loading