Skip to content

Commit 4b622a7

Browse files
fix: Remove shift due date banner from home and content all tabs (#474)
1 parent 671546a commit 4b622a7

File tree

9 files changed

+1
-238
lines changed

9 files changed

+1
-238
lines changed

course/src/main/java/org/openedx/course/presentation/container/CourseContainerFragment.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,9 +477,6 @@ private fun DashboardPager(
477477
),
478478
fragmentManager = fragmentManager,
479479
homePagerState = homePagerState,
480-
onResetDatesClick = {
481-
viewModel.onRefresh(CourseContainerTab.DATES)
482-
},
483480
onNavigateToContent = { contentTab ->
484481
scope.launch {
485482
// First scroll to CONTENT tab

course/src/main/java/org/openedx/course/presentation/home/CourseCompletionHomePagerCardContent.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ private fun CourseCompletionHomePagerCardContentPreview() {
142142
resumeUnitTitle = "Resumed Unit",
143143
courseSubSections = mapOf(),
144144
subSectionsDownloadsCount = mapOf(),
145-
datesBannerInfo = CoreMocks.mockCourseDatesBannerInfo,
146145
useRelativeDates = true,
147146
courseVideos = mapOf(),
148147
courseAssignments = emptyList(),

course/src/main/java/org/openedx/course/presentation/home/CourseHomeScreen.kt

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ import org.openedx.core.ui.theme.appShapes
6262
import org.openedx.core.ui.theme.appTypography
6363
import org.openedx.course.R
6464
import org.openedx.course.presentation.container.CourseContentTab
65-
import org.openedx.course.presentation.ui.CourseDatesBanner
66-
import org.openedx.course.presentation.ui.CourseDatesBannerTablet
6765
import org.openedx.course.presentation.ui.CourseMessage
6866
import org.openedx.course.presentation.ui.ResumeCourseButton
6967
import org.openedx.course.presentation.unit.container.CourseViewMode
@@ -80,7 +78,6 @@ fun CourseHomeScreen(
8078
viewModel: CourseHomeViewModel,
8179
fragmentManager: FragmentManager,
8280
homePagerState: PagerState,
83-
onResetDatesClick: () -> Unit,
8481
onNavigateToContent: (CourseContentTab) -> Unit = {},
8582
onNavigateToProgress: () -> Unit = {},
8683
) {
@@ -136,13 +133,6 @@ fun CourseHomeScreen(
136133
fragmentManager = fragmentManager,
137134
)
138135
},
139-
onResetDatesClick = {
140-
viewModel.resetCourseDatesBanner(
141-
onResetDates = {
142-
onResetDatesClick()
143-
}
144-
)
145-
},
146136
onCertificateClick = {
147137
viewModel.viewCertificateTappedEvent()
148138
it.takeIfNotEmpty()
@@ -185,7 +175,6 @@ private fun CourseHomeUI(
185175
onSubSectionClick: (Block) -> Unit,
186176
onResumeClick: (String) -> Unit,
187177
onDownloadClick: (blockIds: List<String>) -> Unit,
188-
onResetDatesClick: () -> Unit,
189178
onCertificateClick: (String) -> Unit,
190179
onVideoClick: (Block) -> Unit,
191180
onAssignmentClick: (Block) -> Unit,
@@ -234,25 +223,6 @@ private fun CourseHomeUI(
234223
.fillMaxSize()
235224
.verticalScroll(rememberScrollState()),
236225
) {
237-
if (uiState.datesBannerInfo.isBannerAvailableForDashboard()) {
238-
Box(
239-
modifier = Modifier
240-
.padding(all = 8.dp)
241-
) {
242-
if (windowSize.isTablet) {
243-
CourseDatesBannerTablet(
244-
banner = uiState.datesBannerInfo,
245-
resetDates = onResetDatesClick,
246-
)
247-
} else {
248-
CourseDatesBanner(
249-
banner = uiState.datesBannerInfo,
250-
resetDates = onResetDatesClick,
251-
)
252-
}
253-
}
254-
}
255-
256226
val certificate = uiState.courseStructure.certificate
257227
if (certificate?.isCertificateEarned() == true) {
258228
CourseMessage(
@@ -459,7 +429,6 @@ private fun CourseHomeScreenPreview() {
459429
resumeUnitTitle = "Resumed Unit",
460430
courseSubSections = mapOf(),
461431
subSectionsDownloadsCount = mapOf(),
462-
datesBannerInfo = CoreMocks.mockCourseDatesBannerInfo,
463432
useRelativeDates = true,
464433
courseVideos = mapOf(),
465434
courseAssignments = emptyList(),
@@ -471,7 +440,6 @@ private fun CourseHomeScreenPreview() {
471440
onSubSectionClick = {},
472441
onResumeClick = {},
473442
onDownloadClick = {},
474-
onResetDatesClick = {},
475443
onCertificateClick = {},
476444
onVideoClick = {},
477445
onAssignmentClick = {},
@@ -506,7 +474,6 @@ private fun CourseHomeScreenTabletPreview() {
506474
resumeUnitTitle = "Resumed Unit",
507475
courseSubSections = mapOf(),
508476
subSectionsDownloadsCount = mapOf(),
509-
datesBannerInfo = CoreMocks.mockCourseDatesBannerInfo,
510477
useRelativeDates = true,
511478
courseVideos = mapOf(),
512479
courseAssignments = emptyList(),
@@ -518,7 +485,6 @@ private fun CourseHomeScreenTabletPreview() {
518485
onSubSectionClick = {},
519486
onResumeClick = {},
520487
onDownloadClick = {},
521-
onResetDatesClick = {},
522488
onCertificateClick = {},
523489
onVideoClick = {},
524490
onAssignmentClick = {},

course/src/main/java/org/openedx/course/presentation/home/CourseHomeUIState.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.openedx.course.presentation.home
22

33
import org.openedx.core.domain.model.Block
4-
import org.openedx.core.domain.model.CourseDatesBannerInfo
54
import org.openedx.core.domain.model.CourseProgress
65
import org.openedx.core.domain.model.CourseStructure
76
import org.openedx.core.module.db.DownloadedState
@@ -17,7 +16,6 @@ sealed class CourseHomeUIState {
1716
val resumeUnitTitle: String,
1817
val courseSubSections: Map<String, List<Block>>,
1918
val subSectionsDownloadsCount: Map<String, Int>,
20-
val datesBannerInfo: CourseDatesBannerInfo,
2119
val useRelativeDates: Boolean,
2220
val courseVideos: Map<String, List<Block>>,
2321
val courseAssignments: List<Block>,

course/src/main/java/org/openedx/course/presentation/home/CourseHomeViewModel.kt

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@ import kotlinx.coroutines.flow.collectLatest
1414
import kotlinx.coroutines.flow.combine
1515
import kotlinx.coroutines.launch
1616
import org.openedx.core.BlockType
17-
import org.openedx.core.R
1817
import org.openedx.core.config.Config
1918
import org.openedx.core.data.storage.CorePreferences
2019
import org.openedx.core.domain.helper.VideoPreviewHelper
2120
import org.openedx.core.domain.model.Block
2221
import org.openedx.core.domain.model.CourseComponentStatus
23-
import org.openedx.core.domain.model.CourseDatesBannerInfo
2422
import org.openedx.core.domain.model.CourseProgress
2523
import org.openedx.core.domain.model.CourseStructure
2624
import org.openedx.core.extension.getChapterBlocks
@@ -34,7 +32,6 @@ import org.openedx.core.module.download.DownloadHelper
3432
import org.openedx.core.presentation.CoreAnalytics
3533
import org.openedx.core.presentation.dialog.downloaddialog.DownloadDialogManager
3634
import org.openedx.core.system.connection.NetworkConnection
37-
import org.openedx.core.system.notifier.CourseDatesShifted
3835
import org.openedx.core.system.notifier.CourseNotifier
3936
import org.openedx.core.system.notifier.CourseOpenBlock
4037
import org.openedx.core.system.notifier.CourseProgressLoaded
@@ -129,7 +126,6 @@ class CourseHomeViewModel(
129126
resumeUnitTitle = resumeVerticalBlock?.displayName ?: "",
130127
courseSubSections = courseSubSections,
131128
subSectionsDownloadsCount = subSectionsDownloadsCount,
132-
datesBannerInfo = state.datesBannerInfo,
133129
useRelativeDates = preferencesManager.isRelativeDatesEnabled,
134130
next = state.next,
135131
courseProgress = state.courseProgress,
@@ -182,13 +178,11 @@ class CourseHomeViewModel(
182178
) { courseStructure, courseStatus, courseDatesResult, courseProgress ->
183179
if (courseStructure == null) return@combine
184180
val blocks = courseStructure.blockData
185-
val datesBannerInfo = courseDatesResult.courseBanner
186181

187182
initializeCourseData(
188183
blocks,
189184
courseStructure,
190185
courseStatus,
191-
datesBannerInfo,
192186
courseProgress
193187
)
194188
}.catch { e ->
@@ -201,7 +195,6 @@ class CourseHomeViewModel(
201195
blocks: List<Block>,
202196
courseStructure: CourseStructure,
203197
courseStatus: CourseComponentStatus,
204-
datesBannerInfo: CourseDatesBannerInfo,
205198
courseProgress: CourseProgress
206199
) {
207200
setBlocks(blocks)
@@ -253,7 +246,6 @@ class CourseHomeViewModel(
253246
resumeUnitTitle = resumeVerticalBlock?.displayName ?: "",
254247
courseSubSections = courseSubSections,
255248
subSectionsDownloadsCount = subSectionsDownloadsCount,
256-
datesBannerInfo = datesBannerInfo,
257249
useRelativeDates = preferencesManager.isRelativeDatesEnabled,
258250
courseProgress = courseProgress,
259251
courseVideos = courseVideos,
@@ -365,23 +357,6 @@ class CourseHomeViewModel(
365357
return sequentialBlocks.find { !it.isCompleted() }
366358
}
367359

368-
fun resetCourseDatesBanner(onResetDates: (Boolean) -> Unit) {
369-
viewModelScope.launch {
370-
try {
371-
interactor.resetCourseDates(courseId = courseId)
372-
getCourseData()
373-
courseNotifier.send(CourseDatesShifted)
374-
onResetDates(true)
375-
} catch (e: Exception) {
376-
handleErrorUiMessage(
377-
throwable = e,
378-
defaultErrorRes = R.string.core_dates_shift_dates_unsuccessful_msg,
379-
)
380-
onResetDates(false)
381-
}
382-
}
383-
}
384-
385360
fun openBlock(fragmentManager: FragmentManager, blockId: String) {
386361
viewModelScope.launch {
387362
val courseStructure = interactor.getCourseStructure(courseId, false)

course/src/main/java/org/openedx/course/presentation/outline/CourseContentAllScreen.kt

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ import org.openedx.core.ui.theme.OpenEdXTheme
4747
import org.openedx.core.ui.theme.appColors
4848
import org.openedx.course.R
4949
import org.openedx.course.presentation.contenttab.CourseContentAllEmptyState
50-
import org.openedx.course.presentation.ui.CourseDatesBanner
51-
import org.openedx.course.presentation.ui.CourseDatesBannerTablet
5250
import org.openedx.course.presentation.ui.CourseMessage
5351
import org.openedx.course.presentation.ui.CourseProgress
5452
import org.openedx.course.presentation.ui.CourseSection
@@ -130,9 +128,6 @@ fun CourseContentAllScreen(
130128
fragmentManager = fragmentManager,
131129
)
132130
},
133-
onResetDatesClick = {
134-
viewModel.resetCourseDatesBanner()
135-
},
136131
onCertificateClick = {
137132
viewModel.viewCertificateTappedEvent()
138133
it.takeIfNotEmpty()
@@ -151,7 +146,6 @@ private fun CourseContentAllUI(
151146
onSubSectionClick: (Block) -> Unit,
152147
onResumeClick: (String) -> Unit,
153148
onDownloadClick: (blockIds: List<String>) -> Unit,
154-
onResetDatesClick: () -> Unit,
155149
onCertificateClick: (String) -> Unit,
156150
) {
157151
val scaffoldState = rememberScaffoldState()
@@ -214,27 +208,6 @@ private fun CourseContentAllUI(
214208
modifier = Modifier.fillMaxSize(),
215209
contentPadding = listBottomPadding
216210
) {
217-
if (uiState.datesBannerInfo.isBannerAvailableForDashboard()) {
218-
item {
219-
Box(
220-
modifier = Modifier
221-
.padding(all = 8.dp)
222-
) {
223-
if (windowSize.isTablet) {
224-
CourseDatesBannerTablet(
225-
banner = uiState.datesBannerInfo,
226-
resetDates = onResetDatesClick,
227-
)
228-
} else {
229-
CourseDatesBanner(
230-
banner = uiState.datesBannerInfo,
231-
resetDates = onResetDatesClick,
232-
)
233-
}
234-
}
235-
}
236-
}
237-
238211
val certificate = uiState.courseStructure.certificate
239212
if (certificate?.isCertificateEarned() == true) {
240213
item {
@@ -363,15 +336,13 @@ private fun CourseOutlineScreenPreview() {
363336
mapOf(),
364337
mapOf(),
365338
mapOf(),
366-
CoreMocks.mockCourseDatesBannerInfo,
367339
true
368340
),
369341
uiMessage = null,
370342
onExpandClick = {},
371343
onSubSectionClick = {},
372344
onResumeClick = {},
373345
onDownloadClick = {},
374-
onResetDatesClick = {},
375346
onCertificateClick = {},
376347
onNavigateToHome = {},
377348
)
@@ -393,15 +364,13 @@ private fun CourseContentAllScreenTabletPreview() {
393364
mapOf(),
394365
mapOf(),
395366
mapOf(),
396-
CoreMocks.mockCourseDatesBannerInfo,
397367
true
398368
),
399369
uiMessage = null,
400370
onExpandClick = {},
401371
onSubSectionClick = {},
402372
onResumeClick = {},
403373
onDownloadClick = {},
404-
onResetDatesClick = {},
405374
onCertificateClick = {},
406375
onNavigateToHome = {},
407376
)

course/src/main/java/org/openedx/course/presentation/outline/CourseContentAllUIState.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.openedx.course.presentation.outline
22

33
import org.openedx.core.domain.model.Block
4-
import org.openedx.core.domain.model.CourseDatesBannerInfo
54
import org.openedx.core.domain.model.CourseStructure
65
import org.openedx.core.module.db.DownloadedState
76

@@ -14,7 +13,6 @@ sealed class CourseContentAllUIState {
1413
val courseSubSections: Map<String, List<Block>>,
1514
val courseSectionsState: Map<String, Boolean>,
1615
val subSectionsDownloadsCount: Map<String, Int>,
17-
val datesBannerInfo: CourseDatesBannerInfo,
1816
val useRelativeDates: Boolean,
1917
) : CourseContentAllUIState()
2018

0 commit comments

Comments
 (0)