From 42f518a264d4300c8c2ca349072addd7d16ff91a Mon Sep 17 00:00:00 2001 From: Volodymyr Chekyrta <127732735+volodymyr-chekyrta@users.noreply.github.com> Date: Fri, 5 Jan 2024 10:43:42 +0100 Subject: [PATCH] feat: api migration (#171) * API changes. TODO: find solution for courseware_access and commented logic in CourseContainerFragment * Chenged "dataReady" logic in CourseContainerFragment * Added mobile_search argument to the course search * Fix CourseContainerViewModelTest * fix: code improvements * Removed unused auditAccessExpires from the NoAccessCourseContainerFragment screen * Change CourseApi.getCourseDetail endpoint --------- Co-authored-by: PavloNetrebchuk --- .../main/java/org/openedx/app/AppRouter.kt | 10 +---- .../org/openedx/core/data/api/CourseApi.kt | 14 +++---- .../core/data/model/CourseEnrollments.kt | 8 ++++ .../core/data/model/CourseStructureModel.kt | 4 +- .../core/data/model/EnrolledCourseData.kt | 4 +- .../data/model/room/CourseStructureEntity.kt | 4 +- .../room/discovery/EnrolledCourseEntity.kt | 4 +- .../core/domain/model/CourseStructure.kt | 2 +- .../core/domain/model/EnrolledCourseData.kt | 2 +- .../data/repository/CourseRepository.kt | 4 +- .../course/presentation/CourseRouter.kt | 5 +-- .../container/CourseContainerFragment.kt | 20 ++++------ .../container/CourseContainerViewModel.kt | 11 ++++-- .../NoAccessCourseContainerFragment.kt | 37 ++----------------- course/src/main/res/values-uk/strings.xml | 2 +- course/src/main/res/values/strings.xml | 2 +- .../container/CourseContainerViewModelTest.kt | 3 +- .../data/repository/DashboardRepository.kt | 4 +- .../data/repository/DiscoveryRepository.kt | 8 +++- .../discussion/data/api/DiscussionApi.kt | 2 +- .../openedx/profile/data/api/ProfileApi.kt | 2 +- 21 files changed, 64 insertions(+), 88 deletions(-) create mode 100644 core/src/main/java/org/openedx/core/data/model/CourseEnrollments.kt diff --git a/app/src/main/java/org/openedx/app/AppRouter.kt b/app/src/main/java/org/openedx/app/AppRouter.kt index 287be867c..b601aeaa9 100644 --- a/app/src/main/java/org/openedx/app/AppRouter.kt +++ b/app/src/main/java/org/openedx/app/AppRouter.kt @@ -9,7 +9,6 @@ import org.openedx.auth.presentation.restore.RestorePasswordFragment import org.openedx.auth.presentation.signin.SignInFragment import org.openedx.auth.presentation.signup.SignUpFragment import org.openedx.core.FragmentViewType -import org.openedx.core.domain.model.CoursewareAccess import org.openedx.core.presentation.course.CourseViewMode import org.openedx.core.presentation.global.app_upgrade.AppUpgradeRouter import org.openedx.core.presentation.global.app_upgrade.UpgradeRequiredFragment @@ -134,14 +133,9 @@ class AppRouter : AuthRouter, DiscoveryRouter, DashboardRouter, CourseRouter, Di override fun navigateToNoAccess( fm: FragmentManager, - title: String, - coursewareAccess: CoursewareAccess, - auditAccessExpires: Date? + title: String ) { - replaceFragment( - fm, - NoAccessCourseContainerFragment.newInstance(title, coursewareAccess, auditAccessExpires) - ) + replaceFragment(fm, NoAccessCourseContainerFragment.newInstance(title)) } //endregion diff --git a/core/src/main/java/org/openedx/core/data/api/CourseApi.kt b/core/src/main/java/org/openedx/core/data/api/CourseApi.kt index 9ea1ead5a..e7f97b2e6 100644 --- a/core/src/main/java/org/openedx/core/data/api/CourseApi.kt +++ b/core/src/main/java/org/openedx/core/data/api/CourseApi.kt @@ -6,19 +6,20 @@ import retrofit2.http.* interface CourseApi { - @GET("/mobile_api_extensions/v1/users/{username}/course_enrollments") + @GET("/api/mobile/v3/users/{username}/course_enrollments/") suspend fun getEnrolledCourses( @Header("Cache-Control") cacheControlHeaderParam: String? = null, @Path("username") username: String, @Query("org") org: String? = null, @Query("page") page: Int - ): DashboardCourseList + ): CourseEnrollments - @GET("/mobile_api_extensions/courses/v1/courses/") + @GET("/api/courses/v1/courses/") suspend fun getCourseList( @Query("search_term") searchQuery: String? = null, @Query("page") page: Int, @Query("mobile") mobile: Boolean, + @Query("mobile_search") mobileSearch: Boolean, @Query("username") username: String? = null, @Query("org") org: String? = null, @Query("permissions") permission: List = listOf( @@ -28,15 +29,14 @@ interface CourseApi { ) ): CourseList - @GET("/mobile_api_extensions/v1/courses/{course_id}") + @GET("/api/courses/v1/courses/{course_id}") suspend fun getCourseDetail( @Path("course_id") courseId: String?, - @Query("username") username: String? = null, - @Query("is_enrolled") isEnrolled: Boolean = true, + @Query("username") username: String? = null ): CourseDetails @GET( - "/mobile_api_extensions/{api_version}/blocks/?" + + "/api/mobile/{api_version}/course_info/blocks/?" + "depth=all&" + "requested_fields=contains_gated_content,show_gated_sections,special_exam_info,graded,format,student_view_multi_device,due,completion&" + "student_view_data=video,discussion&" + diff --git a/core/src/main/java/org/openedx/core/data/model/CourseEnrollments.kt b/core/src/main/java/org/openedx/core/data/model/CourseEnrollments.kt new file mode 100644 index 000000000..1c10cfa92 --- /dev/null +++ b/core/src/main/java/org/openedx/core/data/model/CourseEnrollments.kt @@ -0,0 +1,8 @@ +package org.openedx.core.data.model + +import com.google.gson.annotations.SerializedName + +data class CourseEnrollments( + @SerializedName("enrollments") + val enrollments: DashboardCourseList +) diff --git a/core/src/main/java/org/openedx/core/data/model/CourseStructureModel.kt b/core/src/main/java/org/openedx/core/data/model/CourseStructureModel.kt index 004061305..9f22a14a0 100644 --- a/core/src/main/java/org/openedx/core/data/model/CourseStructureModel.kt +++ b/core/src/main/java/org/openedx/core/data/model/CourseStructureModel.kt @@ -51,7 +51,7 @@ data class CourseStructureModel( startDisplay = startDisplay ?: "", startType = startType ?: "", end = TimeUtils.iso8601ToDate(end ?: ""), - coursewareAccess = coursewareAccess?.mapToDomain()!!, + coursewareAccess = coursewareAccess?.mapToDomain(), media = media?.mapToDomain(), certificate = certificate?.mapToDomain(), isSelfPaced = isSelfPaced ?: false @@ -70,7 +70,7 @@ data class CourseStructureModel( startDisplay = startDisplay ?: "", startType = startType ?: "", end = end ?: "", - coursewareAccess = coursewareAccess?.mapToRoomEntity()!!, + coursewareAccess = coursewareAccess?.mapToRoomEntity(), media = MediaDb.createFrom(media), certificate = certificate?.mapToRoomEntity(), isSelfPaced = isSelfPaced ?: false diff --git a/core/src/main/java/org/openedx/core/data/model/EnrolledCourseData.kt b/core/src/main/java/org/openedx/core/data/model/EnrolledCourseData.kt index 74aba5073..4afc9ef71 100644 --- a/core/src/main/java/org/openedx/core/data/model/EnrolledCourseData.kt +++ b/core/src/main/java/org/openedx/core/data/model/EnrolledCourseData.kt @@ -61,7 +61,7 @@ data class EnrolledCourseData( end = TimeUtils.iso8601ToDate(end ?: ""), dynamicUpgradeDeadline = dynamicUpgradeDeadline ?: "", subscriptionId = subscriptionId ?: "", - coursewareAccess = coursewareAccess?.mapToDomain()!!, + coursewareAccess = coursewareAccess?.mapToDomain(), media = media?.mapToDomain(), courseImage = courseImage ?: "", courseAbout = courseAbout ?: "", @@ -86,7 +86,7 @@ data class EnrolledCourseData( end = end ?: "", dynamicUpgradeDeadline = dynamicUpgradeDeadline ?: "", subscriptionId = subscriptionId ?: "", - coursewareAccess = coursewareAccess?.mapToRoomEntity()!!, + coursewareAccess = coursewareAccess?.mapToRoomEntity(), media = MediaDb.createFrom(media), courseImage = courseImage ?: "", courseAbout = courseAbout ?: "", diff --git a/core/src/main/java/org/openedx/core/data/model/room/CourseStructureEntity.kt b/core/src/main/java/org/openedx/core/data/model/room/CourseStructureEntity.kt index 72d793ef5..90352d821 100644 --- a/core/src/main/java/org/openedx/core/data/model/room/CourseStructureEntity.kt +++ b/core/src/main/java/org/openedx/core/data/model/room/CourseStructureEntity.kt @@ -33,7 +33,7 @@ data class CourseStructureEntity( @ColumnInfo("end") val end: String?, @Embedded - val coursewareAccess: CoursewareAccessDb, + val coursewareAccess: CoursewareAccessDb?, @Embedded val media: MediaDb?, @Embedded @@ -54,7 +54,7 @@ data class CourseStructureEntity( startDisplay, startType, TimeUtils.iso8601ToDate(end ?: ""), - coursewareAccess.mapToDomain(), + coursewareAccess?.mapToDomain(), media?.mapToDomain(), certificate?.mapToDomain(), isSelfPaced diff --git a/core/src/main/java/org/openedx/core/data/model/room/discovery/EnrolledCourseEntity.kt b/core/src/main/java/org/openedx/core/data/model/room/discovery/EnrolledCourseEntity.kt index 31eaf463f..05aab3bdd 100644 --- a/core/src/main/java/org/openedx/core/data/model/room/discovery/EnrolledCourseEntity.kt +++ b/core/src/main/java/org/openedx/core/data/model/room/discovery/EnrolledCourseEntity.kt @@ -61,7 +61,7 @@ data class EnrolledCourseDataDb( @ColumnInfo("subscriptionId") val subscriptionId: String, @Embedded - val coursewareAccess: CoursewareAccessDb, + val coursewareAccess: CoursewareAccessDb?, @Embedded val media: MediaDb?, @ColumnInfo(name = "course_image_link") @@ -93,7 +93,7 @@ data class EnrolledCourseDataDb( TimeUtils.iso8601ToDate(end), dynamicUpgradeDeadline, subscriptionId, - coursewareAccess.mapToDomain(), + coursewareAccess?.mapToDomain(), media?.mapToDomain(), courseImage, courseAbout, diff --git a/core/src/main/java/org/openedx/core/domain/model/CourseStructure.kt b/core/src/main/java/org/openedx/core/domain/model/CourseStructure.kt index b3c1004fc..bdb3820de 100644 --- a/core/src/main/java/org/openedx/core/domain/model/CourseStructure.kt +++ b/core/src/main/java/org/openedx/core/domain/model/CourseStructure.kt @@ -13,7 +13,7 @@ data class CourseStructure( val startDisplay: String, val startType: String, val end: Date?, - val coursewareAccess: CoursewareAccess, + val coursewareAccess: CoursewareAccess?, val media: Media?, val certificate: Certificate?, val isSelfPaced: Boolean diff --git a/core/src/main/java/org/openedx/core/domain/model/EnrolledCourseData.kt b/core/src/main/java/org/openedx/core/domain/model/EnrolledCourseData.kt index f5bb23d41..2a66cccde 100644 --- a/core/src/main/java/org/openedx/core/domain/model/EnrolledCourseData.kt +++ b/core/src/main/java/org/openedx/core/domain/model/EnrolledCourseData.kt @@ -16,7 +16,7 @@ data class EnrolledCourseData( val end: Date?, val dynamicUpgradeDeadline: String, val subscriptionId: String, - val coursewareAccess: CoursewareAccess, + val coursewareAccess: CoursewareAccess?, val media: Media?, val courseImage: String, val courseAbout: String, diff --git a/course/src/main/java/org/openedx/course/data/repository/CourseRepository.kt b/course/src/main/java/org/openedx/course/data/repository/CourseRepository.kt index 5db4e9171..fcad0a72f 100644 --- a/course/src/main/java/org/openedx/course/data/repository/CourseRepository.kt +++ b/course/src/main/java/org/openedx/course/data/repository/CourseRepository.kt @@ -21,7 +21,7 @@ class CourseRepository( private var courseStructure: CourseStructure? = null suspend fun getCourseDetail(id: String): Course { - val course = api.getCourseDetail(id) + val course = api.getCourseDetail(id, preferencesManager.user?.username) courseDao.updateCourseEntity(CourseEntity.createFrom(course)) return course.mapToDomain() } @@ -51,7 +51,7 @@ class CourseRepository( suspend fun preloadCourseStructure(courseId: String) { val response = api.getCourseStructure( "stale-if-error=0", - "v1", + "v3", preferencesManager.user?.username, courseId ) diff --git a/course/src/main/java/org/openedx/course/presentation/CourseRouter.kt b/course/src/main/java/org/openedx/course/presentation/CourseRouter.kt index a88080f9a..e4758e220 100644 --- a/course/src/main/java/org/openedx/course/presentation/CourseRouter.kt +++ b/course/src/main/java/org/openedx/course/presentation/CourseRouter.kt @@ -1,7 +1,6 @@ package org.openedx.course.presentation import androidx.fragment.app.FragmentManager -import org.openedx.core.domain.model.CoursewareAccess import org.openedx.core.presentation.course.CourseViewMode import org.openedx.course.presentation.handouts.HandoutsType import java.util.Date @@ -14,9 +13,7 @@ interface CourseRouter { fun navigateToNoAccess( fm: FragmentManager, - title: String, - coursewareAccess: CoursewareAccess, - auditAccessExpires: Date? + title: String ) fun navigateToCourseSubsections( diff --git a/course/src/main/java/org/openedx/course/presentation/container/CourseContainerFragment.kt b/course/src/main/java/org/openedx/course/presentation/container/CourseContainerFragment.kt index 78c161a13..b461116f1 100644 --- a/course/src/main/java/org/openedx/course/presentation/container/CourseContainerFragment.kt +++ b/course/src/main/java/org/openedx/course/presentation/container/CourseContainerFragment.kt @@ -66,18 +66,14 @@ class CourseContainerFragment : Fragment(R.layout.fragment_course_container) { } private fun observe() { - viewModel.dataReady.observe(viewLifecycleOwner) { coursewareAccess -> - if (coursewareAccess != null) { - if (coursewareAccess.hasAccess) { - initViewPager() - } else { - router.navigateToNoAccess( - requireActivity().supportFragmentManager, - courseTitle, - coursewareAccess, - null - ) - } + viewModel.dataReady.observe(viewLifecycleOwner) { isReady -> + if (isReady == true) { + initViewPager() + } else { + router.navigateToNoAccess( + requireActivity().supportFragmentManager, + courseTitle + ) } } viewModel.errorMessage.observe(viewLifecycleOwner) { diff --git a/course/src/main/java/org/openedx/course/presentation/container/CourseContainerViewModel.kt b/course/src/main/java/org/openedx/course/presentation/container/CourseContainerViewModel.kt index ccf73a01e..f627b09f3 100644 --- a/course/src/main/java/org/openedx/course/presentation/container/CourseContainerViewModel.kt +++ b/course/src/main/java/org/openedx/course/presentation/container/CourseContainerViewModel.kt @@ -3,10 +3,10 @@ package org.openedx.course.presentation.container import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.viewModelScope +import kotlinx.coroutines.launch import org.openedx.core.BaseViewModel import org.openedx.core.R import org.openedx.core.SingleEventLiveData -import org.openedx.core.domain.model.CoursewareAccess import org.openedx.core.exception.NoCachedDataException import org.openedx.core.extension.isInternetError import org.openedx.core.system.ResourceManager @@ -15,6 +15,7 @@ import org.openedx.core.system.notifier.CourseNotifier import org.openedx.core.system.notifier.CourseStructureUpdated import org.openedx.course.domain.interactor.CourseInteractor import org.openedx.course.presentation.CourseAnalytics +import java.util.Date import kotlinx.coroutines.launch import org.openedx.core.config.Config import org.openedx.core.system.notifier.CourseCompletionSet @@ -31,8 +32,8 @@ class CourseContainerViewModel( val isCourseTopTabBarEnabled get() = config.isCourseTopTabBarEnabled() - private val _dataReady = MutableLiveData() - val dataReady: LiveData + private val _dataReady = MutableLiveData() + val dataReady: LiveData get() = _dataReady private val _errorMessage = SingleEventLiveData() @@ -70,7 +71,9 @@ class CourseContainerViewModel( } val courseStructure = interactor.getCourseStructureFromCache() courseName = courseStructure.name - _dataReady.value = courseStructure.coursewareAccess + _dataReady.value = courseStructure.start?.let { start -> + start < Date() + } } catch (e: Exception) { if (e.isInternetError() || e is NoCachedDataException) { _errorMessage.value = diff --git a/course/src/main/java/org/openedx/course/presentation/container/NoAccessCourseContainerFragment.kt b/course/src/main/java/org/openedx/course/presentation/container/NoAccessCourseContainerFragment.kt index c23c3c71b..f6f5d8e7d 100644 --- a/course/src/main/java/org/openedx/course/presentation/container/NoAccessCourseContainerFragment.kt +++ b/course/src/main/java/org/openedx/course/presentation/container/NoAccessCourseContainerFragment.kt @@ -25,7 +25,6 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.zIndex import androidx.core.os.bundleOf import androidx.fragment.app.Fragment -import org.openedx.core.domain.model.CoursewareAccess import org.openedx.core.extension.parcelable import org.openedx.core.ui.* import org.openedx.core.ui.theme.OpenEdXTheme @@ -36,19 +35,6 @@ import org.openedx.course.R as courseR class NoAccessCourseContainerFragment : Fragment() { - private var courseTitle = "" - private var coursewareAccess: CoursewareAccess? = null - private var auditAccessExpires: Date? = null - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - with(requireArguments()) { - courseTitle = getString(ARG_TITLE, "") - coursewareAccess = parcelable(ARG_COURSEWARE_ACCESS) - auditAccessExpires = parcelable(ARG_AUDIT_ACCESS_EXPIRES) - } - } - override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, @@ -58,12 +44,9 @@ class NoAccessCourseContainerFragment : Fragment() { setContent { OpenEdXTheme { val windowSize = rememberWindowSize() - val auditAccessExpired = - auditAccessExpires != null && Date().after(auditAccessExpires) NoAccessCourseContainerScreen( windowSize = windowSize, - title = courseTitle, - auditAccessExpired = auditAccessExpired, + title = requireArguments().getString(ARG_TITLE, ""), onBackClick = { requireActivity().supportFragmentManager.popBackStack() } @@ -74,19 +57,13 @@ class NoAccessCourseContainerFragment : Fragment() { companion object { private const val ARG_TITLE = "title" - private const val ARG_COURSEWARE_ACCESS = "coursewareAccess" - private const val ARG_AUDIT_ACCESS_EXPIRES = "auditAccessExpires" fun newInstance( title: String, - coursewareAccess: CoursewareAccess, - auditAccessExpires: Date? ): NoAccessCourseContainerFragment { val fragment = NoAccessCourseContainerFragment() fragment.arguments = bundleOf( - ARG_TITLE to title, - ARG_COURSEWARE_ACCESS to coursewareAccess, - ARG_AUDIT_ACCESS_EXPIRES to auditAccessExpires + ARG_TITLE to title ) return fragment } @@ -99,7 +76,6 @@ class NoAccessCourseContainerFragment : Fragment() { private fun NoAccessCourseContainerScreen( windowSize: WindowSize, title: String, - auditAccessExpired: Boolean, onBackClick: () -> Unit ) { val scaffoldState = rememberScaffoldState() @@ -165,11 +141,7 @@ private fun NoAccessCourseContainerScreen( ) Spacer(modifier = Modifier.height(10.dp)) Text( - text = if (auditAccessExpired) { - stringResource(id = courseR.string.course_access_expired) - } else { - stringResource(id = courseR.string.course_not_started) - }, + text = stringResource(id = courseR.string.course_not_started), color = MaterialTheme.appColors.textPrimary, style = MaterialTheme.appTypography.bodyLarge ) @@ -189,8 +161,7 @@ fun NoAccessCourseContainerScreenPreview() { OpenEdXTheme { NoAccessCourseContainerScreen( windowSize = WindowSize(WindowType.Compact, WindowType.Compact), - title = "Example title", - auditAccessExpired = false, + title = "Course title", onBackClick = {} ) } diff --git a/course/src/main/res/values-uk/strings.xml b/course/src/main/res/values-uk/strings.xml index 98c13cc4c..3fa3fd87d 100644 --- a/course/src/main/res/values-uk/strings.xml +++ b/course/src/main/res/values-uk/strings.xml @@ -33,7 +33,7 @@ Повернутись до модуля Ви не можете записатися на цей курс, оскільки термін запису вже минув. Цей курс ще не розпочався. - Ваш доступ до цього курсу закінчився. + Ви не підключені до Інтернету. Будь ласка, перевірте ваше підключення до Інтернету. Курс Відео Обговорення diff --git a/course/src/main/res/values/strings.xml b/course/src/main/res/values/strings.xml index 84aeaea64..cf64be401 100644 --- a/course/src/main/res/values/strings.xml +++ b/course/src/main/res/values/strings.xml @@ -33,7 +33,7 @@ Next section You cannot enroll in this course because the enrollment date is over. This course hasn’t started yet. - Your access to this course has expired. + You are not connected to the Internet. Please check your Internet connection. Course Video Discussion diff --git a/course/src/test/java/org/openedx/course/presentation/container/CourseContainerViewModelTest.kt b/course/src/test/java/org/openedx/course/presentation/container/CourseContainerViewModelTest.kt index f833bfad2..03695856d 100644 --- a/course/src/test/java/org/openedx/course/presentation/container/CourseContainerViewModelTest.kt +++ b/course/src/test/java/org/openedx/course/presentation/container/CourseContainerViewModelTest.kt @@ -22,6 +22,7 @@ import org.junit.Test import org.junit.rules.TestRule import org.openedx.core.config.Config import java.net.UnknownHostException +import java.util.Date @OptIn(ExperimentalCoroutinesApi::class) class CourseContainerViewModelTest { @@ -48,7 +49,7 @@ class CourseContainerViewModelTest { name = "Course name", number = "", org = "Org", - start = null, + start = Date(0), startDisplay = "", startType = "", end = null, diff --git a/dashboard/src/main/java/org/openedx/dashboard/data/repository/DashboardRepository.kt b/dashboard/src/main/java/org/openedx/dashboard/data/repository/DashboardRepository.kt index b43624364..72cb9f380 100644 --- a/dashboard/src/main/java/org/openedx/dashboard/data/repository/DashboardRepository.kt +++ b/dashboard/src/main/java/org/openedx/dashboard/data/repository/DashboardRepository.kt @@ -19,8 +19,8 @@ class DashboardRepository( page = page ) if (page == 1) dao.clearCachedData() - dao.insertEnrolledCourseEntity(*result.results.map { it.mapToRoomEntity() }.toTypedArray()) - return result.mapToDomain() + dao.insertEnrolledCourseEntity(*result.enrollments.results.map { it.mapToRoomEntity() }.toTypedArray()) + return result.enrollments.mapToDomain() } suspend fun getEnrolledCoursesFromCache(): List { diff --git a/discovery/src/main/java/org/openedx/discovery/data/repository/DiscoveryRepository.kt b/discovery/src/main/java/org/openedx/discovery/data/repository/DiscoveryRepository.kt index 2762cf1aa..db2f02d65 100644 --- a/discovery/src/main/java/org/openedx/discovery/data/repository/DiscoveryRepository.kt +++ b/discovery/src/main/java/org/openedx/discovery/data/repository/DiscoveryRepository.kt @@ -20,6 +20,7 @@ class DiscoveryRepository( val pageResponse = api.getCourseList( page = pageNumber, mobile = true, + mobileSearch = false, username = username, org = organization ) @@ -42,7 +43,12 @@ class DiscoveryRepository( query: String, pageNumber: Int, ): CourseList { - val pageResponse = api.getCourseList(searchQuery = query, page = pageNumber, mobile = true) + val pageResponse = api.getCourseList( + searchQuery = query, + page = pageNumber, + mobile = true, + mobileSearch = true + ) return CourseList( pageResponse.pagination.mapToDomain(), pageResponse.results?.map { it.mapToDomain() } ?: emptyList() diff --git a/discussion/src/main/java/org/openedx/discussion/data/api/DiscussionApi.kt b/discussion/src/main/java/org/openedx/discussion/data/api/DiscussionApi.kt index 6969522fe..ebc911425 100644 --- a/discussion/src/main/java/org/openedx/discussion/data/api/DiscussionApi.kt +++ b/discussion/src/main/java/org/openedx/discussion/data/api/DiscussionApi.kt @@ -98,7 +98,7 @@ interface DiscussionApi { @Query("requested_fields") requestedFields: List = listOf("profile_image") ): CommentsResponse - @POST("/mobile_api_extensions/discussion/v1/comments/") + @POST("/api/discussion/v1/comments/") suspend fun createComment( @Body commentBody: CommentBody ) : CommentResult diff --git a/profile/src/main/java/org/openedx/profile/data/api/ProfileApi.kt b/profile/src/main/java/org/openedx/profile/data/api/ProfileApi.kt index cfe14bdf4..1b9bb6750 100644 --- a/profile/src/main/java/org/openedx/profile/data/api/ProfileApi.kt +++ b/profile/src/main/java/org/openedx/profile/data/api/ProfileApi.kt @@ -42,7 +42,7 @@ interface ProfileApi { suspend fun deleteProfileImage(@Path("username") username: String?): Response @FormUrlEncoded - @POST("/mobile_api_extensions/user/v1/accounts/deactivate_logout/") + @POST("/api/user/v1/accounts/deactivate_logout/") suspend fun deactivateAccount( @Field("password") password: String ): Response