Skip to content

Commit

Permalink
fix: handle studentViewData for video and discussion blocks
Browse files Browse the repository at this point in the history
- Add checks to show appropriate view in case studentViewData is NullOrEmpty
  • Loading branch information
omerhabib26 committed Dec 11, 2023
1 parent 1393a28 commit 044da26
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class CourseUnitContainerAdapter(

private fun unitBlockFragment(block: Block): Fragment {
return when {
block.isVideoBlock -> {
val encodedVideos = block.studentViewData!!.encodedVideos!!
(block.isVideoBlock && block.studentViewData?.encodedVideos != null) -> {
val encodedVideos = block.studentViewData?.encodedVideos!!
val transcripts = block.studentViewData!!.transcripts
with(encodedVideos) {
var isDownloaded = false
Expand Down Expand Up @@ -65,7 +65,7 @@ class CourseUnitContainerAdapter(
}
}

block.isDiscussionBlock -> {
(block.isDiscussionBlock && block.studentViewData?.topicId.isNullOrEmpty().not()) -> {
DiscussionThreadsFragment.newInstance(
DiscussionTopicsFragment.TOPIC,
viewModel.courseId,
Expand Down

0 comments on commit 044da26

Please sign in to comment.