Skip to content

Commit dd56b78

Browse files
feat: Collapsing course sections
1 parent eb64023 commit dd56b78

File tree

17 files changed

+418
-521
lines changed

17 files changed

+418
-521
lines changed

Documentation/ConfigurationManagement.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ android:
8888
- **PRE_LOGIN_EXPERIENCE_ENABLED:** Enables the pre login courses discovery experience.
8989
- **WHATS_NEW_ENABLED:** Enables the "What's New" feature to present the latest changes to the user.
9090
- **SOCIAL_AUTH_ENABLED:** Enables SSO buttons on the SignIn and SignUp screens.
91-
- **COURSE_NESTED_LIST_ENABLED:** Enables an alternative visual representation for the course structure.
9291
- **COURSE_UNIT_PROGRESS_ENABLED:** Enables the display of the unit progress within the courseware.
9392

9493
## Future Support
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package org.openedx.core.data.model
2+
3+
import com.google.gson.annotations.SerializedName
4+
import org.openedx.core.data.model.room.AssignmentProgressDb
5+
6+
data class AssignmentProgress(
7+
@SerializedName("assignment_type")
8+
val assignmentType: String?,
9+
@SerializedName("num_points_earned")
10+
val numPointsEarned: Float?,
11+
@SerializedName("num_points_possible")
12+
val numPointsPossible: Float?,
13+
) {
14+
fun mapToDomain() = org.openedx.core.domain.model.AssignmentProgress(
15+
assignmentType = assignmentType ?: "",
16+
numPointsEarned = numPointsEarned ?: 0f,
17+
numPointsPossible = numPointsPossible ?: 0f
18+
)
19+
20+
fun mapToRoomEntity() = AssignmentProgressDb(
21+
assignmentType = assignmentType,
22+
numPointsEarned = numPointsEarned,
23+
numPointsPossible = numPointsPossible
24+
)
25+
}

core/src/main/java/org/openedx/core/data/model/Block.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package org.openedx.core.data.model
33
import com.google.gson.annotations.SerializedName
44
import org.openedx.core.BlockType
55
import org.openedx.core.domain.model.Block
6+
import org.openedx.core.utils.TimeUtils
67

78
data class Block(
89
@SerializedName("id")
@@ -33,6 +34,10 @@ data class Block(
3334
val completion: Double?,
3435
@SerializedName("contains_gated_content")
3536
val containsGatedContent: Boolean?,
37+
@SerializedName("assignment_progress")
38+
val assignmentProgress: AssignmentProgress?,
39+
@SerializedName("due")
40+
val due: String?
3641
) {
3742
fun mapToDomain(blockData: Map<String, org.openedx.core.data.model.Block>): Block {
3843
val blockType = BlockType.getBlockType(type ?: "")
@@ -61,7 +66,9 @@ data class Block(
6166
studentViewMultiDevice = studentViewMultiDevice ?: false,
6267
blockCounts = blockCounts?.mapToDomain()!!,
6368
completion = completion ?: 0.0,
64-
containsGatedContent = containsGatedContent ?: false
69+
containsGatedContent = containsGatedContent ?: false,
70+
assignmentProgress = assignmentProgress?.mapToDomain(),
71+
due = TimeUtils.iso8601ToDate(due ?: ""),
6572
)
6673
}
6774
}

core/src/main/java/org/openedx/core/data/model/room/BlockDb.kt

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ package org.openedx.core.data.model.room
33
import androidx.room.ColumnInfo
44
import androidx.room.Embedded
55
import org.openedx.core.BlockType
6-
import org.openedx.core.domain.model.*
6+
import org.openedx.core.domain.model.Block
7+
import org.openedx.core.domain.model.BlockCounts
8+
import org.openedx.core.domain.model.EncodedVideos
9+
import org.openedx.core.domain.model.StudentViewData
10+
import org.openedx.core.domain.model.VideoInfo
11+
import org.openedx.core.utils.TimeUtils
712

813
data class BlockDb(
914
@ColumnInfo("id")
@@ -33,7 +38,11 @@ data class BlockDb(
3338
@ColumnInfo("completion")
3439
val completion: Double,
3540
@ColumnInfo("contains_gated_content")
36-
val containsGatedContent: Boolean
41+
val containsGatedContent: Boolean,
42+
@Embedded
43+
val assignmentProgress: AssignmentProgressDb?,
44+
@ColumnInfo("due")
45+
val due: String?
3746
) {
3847
fun mapToDomain(blocks: List<BlockDb>): Block {
3948
val blockType = BlockType.getBlockType(type)
@@ -62,7 +71,9 @@ data class BlockDb(
6271
descendants = descendants,
6372
descendantsType = descendantsType,
6473
completion = completion,
65-
containsGatedContent = containsGatedContent
74+
containsGatedContent = containsGatedContent,
75+
assignmentProgress = assignmentProgress?.mapToDomain(),
76+
due = TimeUtils.iso8601ToDate(due ?: ""),
6677
)
6778
}
6879

@@ -86,7 +97,9 @@ data class BlockDb(
8697
studentViewMultiDevice = studentViewMultiDevice ?: false,
8798
blockCounts = BlockCountsDb.createFrom(blockCounts),
8899
completion = completion ?: 0.0,
89-
containsGatedContent = containsGatedContent ?: false
100+
containsGatedContent = containsGatedContent ?: false,
101+
assignmentProgress = assignmentProgress?.mapToRoomEntity(),
102+
due = due
90103
)
91104
}
92105
}
@@ -201,3 +214,18 @@ data class BlockCountsDb(
201214
}
202215
}
203216
}
217+
218+
data class AssignmentProgressDb(
219+
@ColumnInfo("assignment_type")
220+
val assignmentType: String?,
221+
@ColumnInfo("num_points_earned")
222+
val numPointsEarned: Float?,
223+
@ColumnInfo("num_points_possible")
224+
val numPointsPossible: Float?,
225+
) {
226+
fun mapToDomain() = org.openedx.core.domain.model.AssignmentProgress(
227+
assignmentType = assignmentType ?: "",
228+
numPointsEarned = numPointsEarned ?: 0f,
229+
numPointsPossible = numPointsPossible ?: 0f
230+
)
231+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package org.openedx.core.domain.model
2+
3+
data class AssignmentProgress(
4+
val assignmentType: String,
5+
val numPointsEarned: Float,
6+
val numPointsPossible: Float
7+
)

core/src/main/java/org/openedx/core/domain/model/Block.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import org.openedx.core.module.db.DownloadModel
77
import org.openedx.core.module.db.DownloadedState
88
import org.openedx.core.module.db.FileType
99
import org.openedx.core.utils.VideoUtil
10+
import java.util.Date
1011

1112

1213
data class Block(
@@ -25,7 +26,9 @@ data class Block(
2526
val descendantsType: BlockType,
2627
val completion: Double,
2728
val containsGatedContent: Boolean = false,
28-
val downloadModel: DownloadModel? = null
29+
val downloadModel: DownloadModel? = null,
30+
val assignmentProgress: AssignmentProgress?,
31+
val due: Date?
2932
) {
3033
val isDownloadable: Boolean
3134
get() {

core/src/main/java/org/openedx/core/ui/theme/AppColors.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ data class AppColors(
3636
val inactiveButtonBackground: Color,
3737
val inactiveButtonText: Color,
3838

39-
val accessGreen: Color,
39+
val successGreen: Color,
4040

4141
val datesSectionBarPastDue: Color,
4242
val datesSectionBarToday: Color,

core/src/main/java/org/openedx/core/ui/theme/Theme.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ private val DarkColorPalette = AppColors(
5656
inactiveButtonBackground = dark_inactive_button_background,
5757
inactiveButtonText = dark_button_text,
5858

59-
accessGreen = dark_access_green,
59+
successGreen = dark_success_green,
6060

6161
datesSectionBarPastDue = dark_dates_section_bar_past_due,
6262
datesSectionBarToday = dark_dates_section_bar_today,
@@ -130,7 +130,7 @@ private val LightColorPalette = AppColors(
130130
inactiveButtonBackground = light_inactive_button_background,
131131
inactiveButtonText = light_button_text,
132132

133-
accessGreen = light_access_green,
133+
successGreen = light_success_green,
134134

135135
datesSectionBarPastDue = light_dates_section_bar_past_due,
136136
datesSectionBarToday = light_dates_section_bar_today,

core/src/openedx/org/openedx/core/ui/theme/Colors.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ val light_info = Color(0xFF42AAFF)
3838
val light_rate_stars = Color(0xFFFFC94D)
3939
val light_inactive_button_background = Color(0xFFCCD4E0)
4040
val light_inactive_button_text = Color(0xFF3D4964)
41-
val light_access_green = Color(0xFF23BCA0)
41+
val light_success_green = Color(0xFF198571)
4242
val light_dates_section_bar_past_due = light_warning
4343
val light_dates_section_bar_today = light_info
4444
val light_dates_section_bar_this_week = light_text_primary_variant
@@ -96,7 +96,7 @@ val dark_info = Color(0xFF0095FF)
9696
val dark_rate_stars = Color(0xFFFFC94D)
9797
val dark_inactive_button_background = Color(0xFFCCD4E0)
9898
val dark_inactive_button_text = Color(0xFF3D4964)
99-
val dark_access_green = Color(0xFF23BCA0)
99+
val dark_success_green = Color(0xFF198571)
100100
val dark_dates_section_bar_past_due = dark_warning
101101
val dark_dates_section_bar_today = dark_info
102102
val dark_dates_section_bar_this_week = dark_text_primary_variant

0 commit comments

Comments
 (0)