-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added ability to handle course errors (#397)
* fix: bug when unable to see downloaded html content * feat: added ability to handle course errors --------- Co-authored-by: Omer Habib <30689349+omerhabib26@users.noreply.github.com>
- Loading branch information
1 parent
773dac5
commit 88dfc54
Showing
45 changed files
with
956 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
core/src/main/java/org/openedx/core/data/model/CourseAccessDetails.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.openedx.core.data.model | ||
|
||
import com.google.gson.annotations.SerializedName | ||
import org.openedx.core.data.model.room.discovery.CourseAccessDetailsDb | ||
import org.openedx.core.utils.TimeUtils | ||
import org.openedx.core.domain.model.CourseAccessDetails as DomainCourseAccessDetails | ||
|
||
data class CourseAccessDetails( | ||
@SerializedName("has_unmet_prerequisites") | ||
val hasUnmetPrerequisites: Boolean, | ||
@SerializedName("is_too_early") | ||
val isTooEarly: Boolean, | ||
@SerializedName("is_staff") | ||
val isStaff: Boolean, | ||
@SerializedName("audit_access_expires") | ||
val auditAccessExpires: String?, | ||
@SerializedName("courseware_access") | ||
var coursewareAccess: CoursewareAccess?, | ||
) { | ||
fun mapToDomain() = DomainCourseAccessDetails( | ||
hasUnmetPrerequisites = hasUnmetPrerequisites, | ||
isTooEarly = isTooEarly, | ||
isStaff = isStaff, | ||
auditAccessExpires = TimeUtils.iso8601ToDate(auditAccessExpires ?: ""), | ||
coursewareAccess = coursewareAccess?.mapToDomain(), | ||
) | ||
|
||
fun mapToRoomEntity(): CourseAccessDetailsDb = | ||
CourseAccessDetailsDb( | ||
hasUnmetPrerequisites = hasUnmetPrerequisites, | ||
isTooEarly = isTooEarly, | ||
isStaff = isStaff, | ||
auditAccessExpires = auditAccessExpires, | ||
coursewareAccess = coursewareAccess?.mapToRoomEntity() | ||
) | ||
} |
36 changes: 36 additions & 0 deletions
36
core/src/main/java/org/openedx/core/data/model/CourseEnrollmentDetails.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.openedx.core.data.model | ||
|
||
import com.google.gson.annotations.SerializedName | ||
import org.openedx.core.domain.model.CourseEnrollmentDetails as DomainCourseEnrollmentDetails | ||
|
||
data class CourseEnrollmentDetails( | ||
@SerializedName("id") | ||
val id: String, | ||
@SerializedName("course_updates") | ||
val courseUpdates: String?, | ||
@SerializedName("course_handouts") | ||
val courseHandouts: String?, | ||
@SerializedName("discussion_url") | ||
val discussionUrl: String?, | ||
@SerializedName("course_access_details") | ||
val courseAccessDetails: CourseAccessDetails, | ||
@SerializedName("certificate") | ||
val certificate: Certificate?, | ||
@SerializedName("enrollment_details") | ||
val enrollmentDetails: EnrollmentDetails, | ||
@SerializedName("course_info_overview") | ||
val courseInfoOverview: CourseInfoOverview, | ||
) { | ||
fun mapToDomain(): DomainCourseEnrollmentDetails { | ||
return DomainCourseEnrollmentDetails( | ||
id = id, | ||
courseUpdates = courseUpdates ?: "", | ||
courseHandouts = courseHandouts ?: "", | ||
discussionUrl = discussionUrl ?: "", | ||
courseAccessDetails = courseAccessDetails.mapToDomain(), | ||
certificate = certificate?.mapToDomain(), | ||
enrollmentDetails = enrollmentDetails.mapToDomain(), | ||
courseInfoOverview = courseInfoOverview.mapToDomain(), | ||
) | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
core/src/main/java/org/openedx/core/data/model/CourseInfoOverview.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package org.openedx.core.data.model | ||
|
||
import com.google.gson.annotations.SerializedName | ||
import org.openedx.core.utils.TimeUtils | ||
import org.openedx.core.domain.model.CourseInfoOverview as DomainCourseInfoOverview | ||
|
||
data class CourseInfoOverview( | ||
@SerializedName("name") | ||
val name: String, | ||
@SerializedName("number") | ||
val number: String, | ||
@SerializedName("org") | ||
val org: String, | ||
@SerializedName("start") | ||
val start: String?, | ||
@SerializedName("start_display") | ||
val startDisplay: String, | ||
@SerializedName("start_type") | ||
val startType: String, | ||
@SerializedName("end") | ||
val end: String?, | ||
@SerializedName("is_self_paced") | ||
val isSelfPaced: Boolean, | ||
@SerializedName("media") | ||
var media: Media?, | ||
@SerializedName("course_sharing_utm_parameters") | ||
val courseSharingUtmParameters: CourseSharingUtmParameters, | ||
@SerializedName("course_about") | ||
val courseAbout: String, | ||
) { | ||
fun mapToDomain() = DomainCourseInfoOverview( | ||
name = name, | ||
number = number, | ||
org = org, | ||
start = TimeUtils.iso8601ToDate(start ?: ""), | ||
startDisplay = startDisplay, | ||
startType = startType, | ||
end = TimeUtils.iso8601ToDate(end ?: ""), | ||
isSelfPaced = isSelfPaced, | ||
media = media?.mapToDomain(), | ||
courseSharingUtmParameters = courseSharingUtmParameters.mapToDomain(), | ||
courseAbout = courseAbout, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
core/src/main/java/org/openedx/core/data/model/EnrollmentDetails.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.openedx.core.data.model | ||
|
||
import android.os.Parcelable | ||
import com.google.gson.annotations.SerializedName | ||
import kotlinx.parcelize.Parcelize | ||
import org.openedx.core.data.model.room.discovery.EnrollmentDetailsDB | ||
import org.openedx.core.utils.TimeUtils | ||
|
||
import org.openedx.core.domain.model.EnrollmentDetails as DomainEnrollmentDetails | ||
|
||
data class EnrollmentDetails( | ||
@SerializedName("created") | ||
var created: String?, | ||
@SerializedName("date") | ||
val date: String?, | ||
@SerializedName("mode") | ||
val mode: String?, | ||
@SerializedName("is_active") | ||
val isActive: Boolean = false, | ||
@SerializedName("upgrade_deadline") | ||
val upgradeDeadline: String?, | ||
) { | ||
fun mapToDomain() = DomainEnrollmentDetails( | ||
created = TimeUtils.iso8601ToDate(date ?: ""), | ||
mode = mode, | ||
isActive = isActive, | ||
upgradeDeadline = TimeUtils.iso8601ToDate(upgradeDeadline ?: ""), | ||
) | ||
|
||
fun mapToRoomEntity() = EnrollmentDetailsDB( | ||
created = created, | ||
mode = mode, | ||
isActive = isActive, | ||
upgradeDeadline = upgradeDeadline, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.