Skip to content

Commit 0c93493

Browse files
feat: navigating to block
1 parent fdb1e6e commit 0c93493

File tree

8 files changed

+45
-18
lines changed

8 files changed

+45
-18
lines changed

app/src/main/java/org/openedx/app/deeplink/DeepLinkRouter.kt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,9 @@ class DeepLinkRouter(
212212
fm = fm,
213213
courseId = courseId,
214214
courseTitle = "",
215-
openTab = "VIDEOS"
215+
openTab = "VIDEOS",
216+
resumeBlockId = "",
217+
216218
)
217219
}
218220
}
@@ -223,7 +225,8 @@ class DeepLinkRouter(
223225
fm = fm,
224226
courseId = courseId,
225227
courseTitle = "",
226-
openTab = "DATES"
228+
openTab = "DATES",
229+
resumeBlockId = "",
227230
)
228231
}
229232
}
@@ -234,7 +237,8 @@ class DeepLinkRouter(
234237
fm = fm,
235238
courseId = courseId,
236239
courseTitle = "",
237-
openTab = "DISCUSSIONS"
240+
openTab = "DISCUSSIONS",
241+
resumeBlockId = "",
238242
)
239243
}
240244
}
@@ -245,7 +249,8 @@ class DeepLinkRouter(
245249
fm = fm,
246250
courseId = courseId,
247251
courseTitle = "",
248-
openTab = "MORE"
252+
openTab = "MORE",
253+
resumeBlockId = "",
249254
)
250255
}
251256
}

dashboard/src/main/java/org/openedx/courses/presentation/AllEnrolledCoursesViewModel.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,9 @@ class AllEnrolledCoursesViewModel(
190190
dashboardRouter.navigateToCourseOutline(
191191
fm = fragmentManager,
192192
courseId = courseId,
193-
courseTitle = courseName
193+
courseTitle = courseName,
194+
openTab = "",
195+
resumeBlockId = ""
194196
)
195197
}
196198
}

dashboard/src/main/java/org/openedx/dashboard/presentation/DashboardListFragment.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ class DashboardListFragment : Fragment() {
146146
fm = requireActivity().supportFragmentManager,
147147
courseId = it.course.id,
148148
courseTitle = it.course.name,
149+
resumeBlockId = "",
150+
openTab = ""
149151
)
150152
},
151153
onSwipeRefresh = {

dashboard/src/main/java/org/openedx/dashboard/presentation/DashboardRouter.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ interface DashboardRouter {
99
fm: FragmentManager,
1010
courseId: String,
1111
courseTitle: String,
12-
openTab: String = "",
13-
resumeBlockId: String = ""
12+
openTab: String,
13+
resumeBlockId: String
1414
)
1515

1616
fun navigateToSettings(fm: FragmentManager)

dates/src/main/java/org/openedx/dates/presentation/DatesRouter.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,12 @@ import androidx.fragment.app.FragmentManager
55
interface DatesRouter {
66

77
fun navigateToSettings(fm: FragmentManager)
8+
9+
fun navigateToCourseOutline(
10+
fm: FragmentManager,
11+
courseId: String,
12+
courseTitle: String,
13+
openTab: String,
14+
resumeBlockId: String
15+
)
816
}

dates/src/main/java/org/openedx/dates/presentation/dates/DatesFragment.kt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,13 +239,17 @@ private fun DatesScreen(
239239
}
240240
}
241241
}
242-
if (uiState.isLoading) {
242+
if (uiState.canLoadMore) {
243243
item {
244-
CircularProgressIndicator(
245-
modifier = Modifier
246-
.align(Alignment.Center),
247-
color = MaterialTheme.appColors.primary
248-
)
244+
Box(
245+
Modifier
246+
.fillMaxWidth()
247+
.height(42.dp)
248+
.padding(16.dp),
249+
contentAlignment = Alignment.Center
250+
) {
251+
CircularProgressIndicator(color = MaterialTheme.appColors.primary)
252+
}
249253
}
250254
}
251255
}

dates/src/main/java/org/openedx/dates/presentation/dates/DatesViewModel.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,13 @@ class DatesViewModel(
128128
fragmentManager: FragmentManager,
129129
courseDate: CourseDate,
130130
) {
131-
131+
datesRouter.navigateToCourseOutline(
132+
fm = fragmentManager,
133+
courseId = courseDate.courseId,
134+
courseTitle = courseDate.courseName,
135+
openTab = "",
136+
resumeBlockId = courseDate.assignmentBlockId
137+
)
132138
}
133139

134140
private fun groupCourseDates(dates: List<CourseDate>): Map<DueDateCategory, List<CourseDate>> {

dates/src/main/java/org/openedx/dates/presentation/dates/DueDateCategory.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ enum class DueDateCategory(
1111
@StringRes
1212
val label: Int,
1313
) {
14-
PAST_DUE(R.string.dates_category_past_due),
15-
TODAY(R.string.dates_category_today),
16-
THIS_WEEK(R.string.dates_category_this_week),
14+
UPCOMING(R.string.dates_category_upcoming),
1715
NEXT_WEEK(R.string.dates_category_next_week),
18-
UPCOMING(R.string.dates_category_upcoming);
16+
THIS_WEEK(R.string.dates_category_this_week),
17+
TODAY(R.string.dates_category_today),
18+
PAST_DUE(R.string.dates_category_past_due);
1919

2020
val color: Color
2121
@Composable

0 commit comments

Comments
 (0)