Skip to content

Commit

Permalink
fix: fixed issues after PR
Browse files Browse the repository at this point in the history
  • Loading branch information
dixidroid committed Feb 22, 2024
1 parent 3a7acdf commit 5adba97
Show file tree
Hide file tree
Showing 25 changed files with 949 additions and 896 deletions.
4 changes: 3 additions & 1 deletion app/src/main/java/org/openedx/app/di/AppModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import org.openedx.core.system.notifier.CourseNotifier
import org.openedx.course.domain.interactor.CourseInteractor
import org.openedx.dashboard.notifier.DashboardNotifier
import org.openedx.core.system.notifier.DownloadNotifier
import org.openedx.core.system.notifier.VideoNotifier
import org.openedx.course.presentation.CourseAnalytics
import org.openedx.course.presentation.CourseRouter
import org.openedx.dashboard.presentation.dashboard.DashboardAnalytics
Expand All @@ -55,7 +56,7 @@ import org.openedx.discussion.system.notifier.DiscussionNotifier
import org.openedx.profile.data.storage.ProfilePreferences
import org.openedx.profile.presentation.ProfileAnalytics
import org.openedx.profile.presentation.ProfileRouter
import org.openedx.core.system.notifier.ProfileNotifier
import org.openedx.profile.system.notifier.ProfileNotifier
import org.openedx.whatsnew.WhatsNewManager
import org.openedx.whatsnew.WhatsNewRouter
import org.openedx.whatsnew.data.storage.WhatsNewPreferences
Expand All @@ -82,6 +83,7 @@ val appModule = module {
single { AppUpgradeNotifier() }
single { DownloadNotifier() }
single { DashboardNotifier() }
single { VideoNotifier() }

single { AppRouter() }
single<AuthRouter> { get<AppRouter>() }
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/org/openedx/core/AppDataConstants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ object AppDataConstants {
const val VIDEO_FORMAT_M3U8 = ".m3u8"
const val VIDEO_FORMAT_MP4 = ".mp4"

const val DOWNLOADS_CONFIRMATION_SIZE = 1073741824L
// Equal 1GB
const val DOWNLOADS_CONFIRMATION_SIZE = 1024 * 1024 * 1024L
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ class VideoQualityFragment : Fragment() {

val title = stringResource(
id = if (viewModel.getQualityType() == VideoQualityType.Streaming)
R.string.core_video_streaming_quality else
R.string.core_video_streaming_quality
else
R.string.core_video_download_quality
)
val videoQuality by viewModel.videoQuality.observeAsState(viewModel.getCurrentVideoQuality())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import kotlinx.coroutines.launch
import org.openedx.core.BaseViewModel
import org.openedx.core.data.storage.CorePreferences
import org.openedx.core.domain.model.VideoQuality
import org.openedx.core.system.notifier.ProfileNotifier
import org.openedx.core.system.notifier.VideoNotifier
import org.openedx.core.system.notifier.VideoQualityChanged

class VideoQualityViewModel(
private val preferencesManager: CorePreferences,
private val notifier: ProfileNotifier,
private val notifier: VideoNotifier,
private val qualityType: String
) : BaseViewModel() {

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package org.openedx.core.system.notifier

interface ProfileEvent
interface VideoEvent
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.openedx.core.system.notifier

import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.asSharedFlow

class VideoNotifier {

private val channel = MutableSharedFlow<VideoEvent>(replay = 0, extraBufferCapacity = 0)

val notifier: Flow<VideoEvent> = channel.asSharedFlow()

suspend fun send(event: VideoQualityChanged) = channel.emit(event)
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package org.openedx.core.system.notifier

class VideoQualityChanged : ProfileEvent
class VideoQualityChanged : VideoEvent
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ import org.openedx.core.extension.nonZero
import org.openedx.core.extension.toFileSize
import org.openedx.core.module.db.DownloadModel
import org.openedx.core.module.db.DownloadedState
import org.openedx.core.module.db.FileType
import org.openedx.core.ui.BackBtn
import org.openedx.core.ui.IconText
import org.openedx.core.ui.OpenEdXButton
Expand Down Expand Up @@ -1282,6 +1283,31 @@ private fun CourseDatesBannerTabletPreview() {
}
}

@Preview(uiMode = Configuration.UI_MODE_NIGHT_NO)
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
@Composable
private fun OfflineQueueCardPreview() {
OpenEdXTheme {
Surface(color = MaterialTheme.appColors.background) {
OfflineQueueCard(
downloadModel = DownloadModel(
id = "",
title = "Problems of society",
size = 4000,
path = "",
url = "",
type = FileType.VIDEO,
downloadedState = DownloadedState.DOWNLOADING,
progress = 0f
),
progressValue = 10,
progressSize = 30,
onDownloadClick = {}
)
}
}
}

private val mockCourse = EnrolledCourse(
auditAccessExpires = Date(),
created = "created",
Expand Down
Loading

0 comments on commit 5adba97

Please sign in to comment.