Skip to content

Commit 51508a2

Browse files
fix: fixes according PR review feedback
1 parent bcbea1b commit 51508a2

5 files changed

Lines changed: 18 additions & 10 deletions

File tree

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import org.openedx.core.system.connection.NetworkConnection
3434
import org.openedx.core.system.notifier.CalendarSyncEvent.CreateCalendarSyncEvent
3535
import org.openedx.core.system.notifier.CourseDatesShifted
3636
import org.openedx.core.system.notifier.CourseNotifier
37-
import org.openedx.core.system.notifier.CourseOpenBlock
3837
import org.openedx.core.system.notifier.CourseStructureUpdated
3938
import org.openedx.course.domain.interactor.CourseInteractor
4039
import org.openedx.course.presentation.CourseAnalytics
@@ -107,10 +106,6 @@ class CourseContentAllViewModel(
107106
getCourseData()
108107
}
109108
}
110-
111-
is CourseOpenBlock -> {
112-
_resumeBlockId.emit(event.blockId)
113-
}
114109
}
115110
}
116111
}

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import androidx.compose.material.pullrefresh.pullRefresh
3030
import androidx.compose.material.pullrefresh.rememberPullRefreshState
3131
import androidx.compose.material.rememberScaffoldState
3232
import androidx.compose.runtime.Composable
33+
import androidx.compose.runtime.LaunchedEffect
3334
import androidx.compose.runtime.derivedStateOf
3435
import androidx.compose.runtime.getValue
3536
import androidx.compose.runtime.mutableStateOf
@@ -183,10 +184,12 @@ fun DatesScreen(
183184
val lastVisibleItemIndex =
184185
layoutInfo.visibleItemsInfo.lastOrNull()?.index ?: 0
185186
val totalItemsCount = layoutInfo.totalItemsCount
186-
if (totalItemsCount > 0 &&
187+
val shouldLoadMore = totalItemsCount > 0 &&
187188
lastVisibleItemIndex >= (totalItemsCount * LOAD_MORE_THRESHOLD).toInt()
188-
) {
189-
onAction(DatesViewActions.LoadMore)
189+
LaunchedEffect(shouldLoadMore) {
190+
if (shouldLoadMore) {
191+
onAction(DatesViewActions.LoadMore)
192+
}
190193
}
191194
}
192195
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class DatesViewModel(
5858

5959
private var page = 1
6060
private var fetchDataJob: Job? = null
61+
private var lastNavigationTime = 0L
6162

6263
init {
6364
preloadFirstPageCachedDates()
@@ -199,6 +200,11 @@ class DatesViewModel(
199200
fragmentManager: FragmentManager,
200201
courseDate: CourseDate,
201202
) {
203+
val currentTime = System.currentTimeMillis()
204+
if (currentTime - lastNavigationTime < NAVIGATION_DEBOUNCE_MS) {
205+
return
206+
}
207+
lastNavigationTime = currentTime
202208
logEvent(DatesAnalyticsEvent.ASSIGNMENT_CLICK)
203209
datesRouter.navigateToCourseOutline(
204210
fm = fragmentManager,
@@ -209,6 +215,10 @@ class DatesViewModel(
209215
)
210216
}
211217

218+
companion object {
219+
private const val NAVIGATION_DEBOUNCE_MS = 500L
220+
}
221+
212222
private fun groupCourseDates(dates: List<CourseDate>): Map<DatesSection, List<CourseDate>> {
213223
val now = Date()
214224
val calendar = Calendar.getInstance().apply { time = now }

default_config/prod/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ EXPERIMENTAL_FEATURES:
6868
APP_LEVEL_DOWNLOADS:
6969
ENABLED: false
7070
APP_LEVEL_DATES:
71-
ENABLED: true
71+
ENABLED: false
7272

7373
#Platform names
7474
PLATFORM_NAME: "OpenEdX"

default_config/stage/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ EXPERIMENTAL_FEATURES:
6868
APP_LEVEL_DOWNLOADS:
6969
ENABLED: false
7070
APP_LEVEL_DATES:
71-
ENABLED: true
71+
ENABLED: false
7272

7373
#Platform names
7474
PLATFORM_NAME: "OpenEdX"

0 commit comments

Comments
 (0)