From 0d20922edc8f13ffb1eb2d21b92d65ac6405030e Mon Sep 17 00:00:00 2001 From: "omer.habib" Date: Fri, 12 Jul 2024 19:43:43 +0500 Subject: [PATCH] fix: Update course dates prefix on course cards --- .../java/org/openedx/core/utils/TimeUtils.kt | 4 +-- core/src/main/res/values/strings.xml | 11 ++++---- .../presentation/AllEnrolledCoursesView.kt | 25 ++++++++----------- .../presentation/DashboardGalleryView.kt | 25 ++++++++----------- 4 files changed, 29 insertions(+), 36 deletions(-) diff --git a/core/src/main/java/org/openedx/core/utils/TimeUtils.kt b/core/src/main/java/org/openedx/core/utils/TimeUtils.kt index bb7c320e5..02e0bde2f 100644 --- a/core/src/main/java/org/openedx/core/utils/TimeUtils.kt +++ b/core/src/main/java/org/openedx/core/utils/TimeUtils.kt @@ -170,12 +170,12 @@ object TimeUtils { DateUtils.SECOND_IN_MILLIS, DateUtils.FORMAT_ABBREV_RELATIVE ).toString() - resourceManager.getString(R.string.core_label_expired, timeSpan) + resourceManager.getString(R.string.core_label_access_expired, timeSpan) } } else { formattedDate = if (dayDifferenceInMillis > SEVEN_DAYS_IN_MILLIS) { resourceManager.getString( - R.string.core_label_expires_on, + R.string.core_label_expires, dateToCourseDate(resourceManager, expiry) ) } else { diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index 0b245c7fa..78263a819 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -16,13 +16,12 @@ Cancel Search Select value - Starting %1$s - Ended %1$s + Starts %1$s + Ended on %1$s Ends %1$s - Course access expires %1$s - Course access expires on %1$s - Course access expired %1$s - Course access expired on %1$s + Access expires %1$s + Access expired %1$s + Expired on %1$s Password Soon Offline diff --git a/dashboard/src/main/java/org/openedx/courses/presentation/AllEnrolledCoursesView.kt b/dashboard/src/main/java/org/openedx/courses/presentation/AllEnrolledCoursesView.kt index ef583112b..135f600b0 100644 --- a/dashboard/src/main/java/org/openedx/courses/presentation/AllEnrolledCoursesView.kt +++ b/dashboard/src/main/java/org/openedx/courses/presentation/AllEnrolledCoursesView.kt @@ -453,17 +453,14 @@ fun CourseItem( overflow = TextOverflow.Ellipsis, minLines = 1, maxLines = 2, - text = stringResource( - org.openedx.dashboard.R.string.dashboard_course_date, - TimeUtils.getCourseFormattedDate( - LocalContext.current, - Date(), - course.auditAccessExpires, - course.course.start, - course.course.end, - course.course.startType, - course.course.startDisplay - ) + text = TimeUtils.getCourseFormattedDate( + LocalContext.current, + Date(), + course.auditAccessExpires, + course.course.start, + course.course.end, + course.course.startType, + course.course.startDisplay ) ) Text( @@ -477,9 +474,9 @@ fun CourseItem( maxLines = 2 ) } - if (!course.course.coursewareAccess?.errorCode.isNullOrEmpty()) { - Lock() - } +// if (!course.course.coursewareAccess?.errorCode.isNullOrEmpty()) { +// Lock() +// } } } } diff --git a/dashboard/src/main/java/org/openedx/courses/presentation/DashboardGalleryView.kt b/dashboard/src/main/java/org/openedx/courses/presentation/DashboardGalleryView.kt index 0fd0e2ccd..ae53c2cc4 100644 --- a/dashboard/src/main/java/org/openedx/courses/presentation/DashboardGalleryView.kt +++ b/dashboard/src/main/java/org/openedx/courses/presentation/DashboardGalleryView.kt @@ -446,9 +446,9 @@ private fun CourseListItem( minLines = 2 ) } - if (!course.course.coursewareAccess?.errorCode.isNullOrEmpty()) { - Lock() - } +// if (!course.course.coursewareAccess?.errorCode.isNullOrEmpty()) { +// Lock() +// } } } } @@ -708,17 +708,14 @@ private fun PrimaryCourseTitle( modifier = Modifier.fillMaxWidth(), style = MaterialTheme.appTypography.labelMedium, color = MaterialTheme.appColors.textFieldHint, - text = stringResource( - R.string.dashboard_course_date, - TimeUtils.getCourseFormattedDate( - LocalContext.current, - Date(), - primaryCourse.auditAccessExpires, - primaryCourse.course.start, - primaryCourse.course.end, - primaryCourse.course.startType, - primaryCourse.course.startDisplay - ) + text = TimeUtils.getCourseFormattedDate( + LocalContext.current, + Date(), + primaryCourse.auditAccessExpires, + primaryCourse.course.start, + primaryCourse.course.end, + primaryCourse.course.startType, + primaryCourse.course.startDisplay ) ) }