Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions app/schemas/org.openedx.app.room.AppDatabase/4.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"formatVersion": 1,
"database": {
"version": 4,
"identityHash": "488bd2b78e977fef626afb28014c80f2",
"identityHash": "7ea446decde04c9c16700cb3981703c2",
"entities": [
{
"tableName": "course_discovery_table",
Expand Down Expand Up @@ -1008,7 +1008,7 @@
},
{
"tableName": "video_progress_table",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`block_id` TEXT NOT NULL, `video_url` TEXT NOT NULL, `video_time` INTEGER NOT NULL, `duration` INTEGER NOT NULL, PRIMARY KEY(`block_id`))",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`block_id` TEXT NOT NULL, `video_url` TEXT NOT NULL, `video_time` INTEGER, `duration` INTEGER, PRIMARY KEY(`block_id`))",
"fields": [
{
"fieldPath": "blockId",
Expand All @@ -1026,13 +1026,13 @@
"fieldPath": "videoTime",
"columnName": "video_time",
"affinity": "INTEGER",
"notNull": true
"notNull": false
},
{
"fieldPath": "duration",
"columnName": "duration",
"affinity": "INTEGER",
"notNull": true
"notNull": false
}
],
"primaryKey": {
Expand Down Expand Up @@ -1230,7 +1230,7 @@
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '488bd2b78e977fef626afb28014c80f2')"
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '7ea446decde04c9c16700cb3981703c2')"
]
}
}
10 changes: 8 additions & 2 deletions app/src/main/java/org/openedx/app/AppActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package org.openedx.app

import android.content.Intent
import android.content.res.Configuration
import android.graphics.Color
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.view.View
import android.view.WindowManager
Expand Down Expand Up @@ -158,8 +160,12 @@ class AppActivity : AppCompatActivity(), InsetHolder, WindowSizeHolder {
WindowCompat.setDecorFitsSystemWindows(this, false)
val insetsController = WindowInsetsControllerCompat(this, binding.root)
insetsController.isAppearanceLightStatusBars = !isUsingNightModeResources()
insetsController.systemBarsBehavior =
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
insetsController.systemBarsBehavior =
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
} else {
window.statusBarColor = Color.TRANSPARENT
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/org/openedx/app/AppRouter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import org.openedx.auth.presentation.signin.SignInFragment
import org.openedx.auth.presentation.signup.SignUpFragment
import org.openedx.core.CalendarRouter
import org.openedx.core.FragmentViewType
import org.openedx.core.presentation.course.CourseViewMode
import org.openedx.core.presentation.global.appupgrade.AppUpgradeRouter
import org.openedx.core.presentation.global.appupgrade.UpgradeRequiredFragment
import org.openedx.core.presentation.global.webview.WebContentFragment
Expand All @@ -24,6 +23,7 @@ import org.openedx.course.presentation.handouts.HandoutsType
import org.openedx.course.presentation.handouts.HandoutsWebViewFragment
import org.openedx.course.presentation.section.CourseSectionFragment
import org.openedx.course.presentation.unit.container.CourseUnitContainerFragment
import org.openedx.course.presentation.unit.container.CourseViewMode
import org.openedx.course.presentation.unit.video.VideoFullScreenFragment
import org.openedx.course.presentation.unit.video.YoutubeVideoFullScreenFragment
import org.openedx.course.settings.download.DownloadQueueFragment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import org.openedx.auth.presentation.signin.SignInFragment
import org.openedx.core.FragmentViewType
import org.openedx.core.config.Config
import org.openedx.core.data.storage.CorePreferences
import org.openedx.core.presentation.course.CourseViewMode
import org.openedx.course.domain.interactor.CourseInteractor
import org.openedx.course.presentation.handouts.HandoutsType
import org.openedx.course.presentation.unit.container.CourseViewMode
import org.openedx.discovery.domain.interactor.DiscoveryInteractor
import org.openedx.discovery.domain.model.Course
import org.openedx.discovery.presentation.catalog.WebViewLink
Expand Down
22 changes: 22 additions & 0 deletions app/src/main/java/org/openedx/app/di/ScreenModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import org.openedx.course.presentation.container.CourseContainerViewModel
import org.openedx.course.presentation.contenttab.ContentTabViewModel
import org.openedx.course.presentation.dates.CourseDatesViewModel
import org.openedx.course.presentation.handouts.HandoutsViewModel
import org.openedx.course.presentation.home.CourseHomeViewModel
import org.openedx.course.presentation.offline.CourseOfflineViewModel
import org.openedx.course.presentation.outline.CourseContentAllViewModel
import org.openedx.course.presentation.progress.CourseProgressViewModel
Expand Down Expand Up @@ -309,6 +310,27 @@ val screenModule = module {
get(),
)
}
viewModel { (courseId: String, courseTitle: String) ->
CourseHomeViewModel(
courseId,
courseTitle,
get(),
get(),
get(),
get(),
get(),
get(),
get(),
get(),
get(),
get(),
get(),
get(),
get(),
get(),
get()
)
}
viewModel { (courseId: String) ->
CourseSectionViewModel(
courseId,
Expand Down
263 changes: 263 additions & 0 deletions core/src/main/java/org/openedx/core/Mock.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
package org.openedx.core

import org.openedx.core.data.model.room.VideoProgressEntity
import org.openedx.core.domain.model.AssignmentProgress
import org.openedx.core.domain.model.Block
import org.openedx.core.domain.model.BlockCounts
import org.openedx.core.domain.model.CourseComponentStatus
import org.openedx.core.domain.model.CourseDatesBannerInfo
import org.openedx.core.domain.model.CourseDatesResult
import org.openedx.core.domain.model.CourseProgress
import org.openedx.core.domain.model.CourseStructure
import org.openedx.core.domain.model.CoursewareAccess
import org.openedx.core.domain.model.EncodedVideos
import org.openedx.core.domain.model.OfflineDownload
import org.openedx.core.domain.model.Progress
import org.openedx.core.domain.model.ResetCourseDates
import org.openedx.core.domain.model.StudentViewData
import org.openedx.core.domain.model.VideoInfo
import org.openedx.core.module.db.DownloadModel
import org.openedx.core.module.db.DownloadedState
import org.openedx.core.module.db.FileType
import java.util.Date

object Mock {
private val mockAssignmentProgress = AssignmentProgress(
assignmentType = "Home",
numPointsEarned = 1f,
numPointsPossible = 3f,
shortLabel = "HM1"
)
val mockChapterBlock = Block(
id = "id",
blockId = "blockId",
lmsWebUrl = "lmsWebUrl",
legacyWebUrl = "legacyWebUrl",
studentViewUrl = "studentViewUrl",
type = BlockType.CHAPTER,
displayName = "Chapter",
graded = false,
studentViewData = null,
studentViewMultiDevice = false,
blockCounts = BlockCounts(1),
descendants = emptyList(),
descendantsType = BlockType.CHAPTER,
completion = 0.0,
containsGatedContent = false,
assignmentProgress = mockAssignmentProgress,
due = Date(),
offlineDownload = null
)
private val mockSequentialBlock = Block(
id = "id",
blockId = "blockId",
lmsWebUrl = "lmsWebUrl",
legacyWebUrl = "legacyWebUrl",
studentViewUrl = "studentViewUrl",
type = BlockType.SEQUENTIAL,
displayName = "Sequential",
graded = false,
studentViewData = null,
studentViewMultiDevice = false,
blockCounts = BlockCounts(1),
descendants = emptyList(),
descendantsType = BlockType.CHAPTER,
completion = 0.0,
containsGatedContent = false,
assignmentProgress = mockAssignmentProgress,
due = Date(),
offlineDownload = OfflineDownload("fileUrl", "", 1),
)

val mockCourseStructure = CourseStructure(
root = "",
blockData = listOf(mockSequentialBlock, mockSequentialBlock),
id = "id",
name = "Course name",
number = "",
org = "Org",
start = Date(),
startDisplay = "",
startType = "",
end = Date(),
coursewareAccess = CoursewareAccess(
true,
"",
"",
"",
"",
""
),
media = null,
certificate = null,
isSelfPaced = false,
progress = Progress(1, 3),
)

val mockCourseComponentStatus = CourseComponentStatus(
lastVisitedBlockId = "video1"
)

val mockCourseDatesBannerInfo = CourseDatesBannerInfo(
missedDeadlines = false,
missedGatedContent = false,
contentTypeGatingEnabled = false,
verifiedUpgradeLink = "",
hasEnded = false
)

val mockCourseDatesResult = CourseDatesResult(
datesSection = linkedMapOf(),
courseBanner = mockCourseDatesBannerInfo
)

val mockCourseProgress = CourseProgress(
verifiedMode = "audit",
accessExpiration = "",
certificateData = null,
completionSummary = null,
courseGrade = null,
creditCourseRequirements = "",
end = "",
enrollmentMode = "audit",
gradingPolicy = null,
hasScheduledContent = false,
sectionScores = emptyList(),
studioUrl = "",
username = "testuser",
userHasPassingGrade = false,
verificationData = null,
disableProgressGraph = false
)

val mockVideoProgress = VideoProgressEntity(
blockId = "video1",
videoUrl = "test-video-url",
videoTime = 1000L,
duration = 5000L
)

val mockResetCourseDates = ResetCourseDates(
message = "Dates reset successfully",
body = "Your course dates have been reset",
header = "Success",
link = "",
linkText = ""
)

val mockDownloadModel = DownloadModel(
id = "video1",
title = "Video 1",
courseId = "test-course-id",
size = 1000L,
path = "/test/path/video1",
url = "test-url",
type = FileType.VIDEO,
downloadedState = DownloadedState.NOT_DOWNLOADED,
lastModified = null
)

val mockVideoBlock = Block(
id = "video1",
blockId = "video1",
lmsWebUrl = "lmsWebUrl",
legacyWebUrl = "legacyWebUrl",
studentViewUrl = "studentViewUrl",
type = BlockType.VIDEO,
displayName = "Video 1",
graded = false,
studentViewData = StudentViewData(
onlyOnWeb = false,
duration = "",
transcripts = null,
encodedVideos = EncodedVideos(
youtube = null,
hls = null,
fallback = null,
desktopMp4 = null,
mobileHigh = null,
mobileLow = VideoInfo(
url = "test-url",
fileSize = 1000L
)
),
topicId = ""
),
studentViewMultiDevice = false,
blockCounts = BlockCounts(0),
descendants = emptyList(),
descendantsType = BlockType.VIDEO,
completion = 0.0,
containsGatedContent = false,
assignmentProgress = null,
due = null,
offlineDownload = null,
)

val mockSequentialBlockForDownload = Block(
id = "sequential1",
blockId = "sequential1",
lmsWebUrl = "lmsWebUrl",
legacyWebUrl = "legacyWebUrl",
studentViewUrl = "studentViewUrl",
type = BlockType.SEQUENTIAL,
displayName = "Sequential 1",
graded = false,
studentViewData = null,
studentViewMultiDevice = false,
blockCounts = BlockCounts(0),
descendants = listOf("vertical1"),
descendantsType = BlockType.VERTICAL,
completion = 0.0,
containsGatedContent = false,
assignmentProgress = null,
due = null,
offlineDownload = null,
)

val mockVerticalBlock = Block(
id = "vertical1",
blockId = "vertical1",
lmsWebUrl = "lmsWebUrl",
legacyWebUrl = "legacyWebUrl",
studentViewUrl = "studentViewUrl",
type = BlockType.VERTICAL,
displayName = "Vertical 1",
graded = false,
studentViewData = null,
studentViewMultiDevice = false,
blockCounts = BlockCounts(0),
descendants = listOf("video1"),
descendantsType = BlockType.VIDEO,
completion = 0.0,
containsGatedContent = false,
assignmentProgress = null,
due = null,
offlineDownload = null,
)

val mockCourseStructureForDownload = CourseStructure(
root = "sequential1",
blockData = listOf(mockSequentialBlockForDownload, mockVerticalBlock, mockVideoBlock),
id = "test-course-id",
name = "Test Course",
number = "CS101",
org = "TestOrg",
start = Date(),
startDisplay = "2024-01-01",
startType = "timestamped",
end = Date(),
coursewareAccess = CoursewareAccess(
true,
"",
"",
"",
"",
""
),
media = null,
certificate = null,
isSelfPaced = false,
progress = null
)
}
Loading
Loading