Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
fix: Bulk Download Warning Popup
Browse files Browse the repository at this point in the history
Fixes: LEARNER-9625
  • Loading branch information
HamzaIsrar12 committed Sep 27, 2023
1 parent 69f6cd5 commit fe807fb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.edx.mobile.model.course.VideoData;
import org.edx.mobile.model.course.VideoInfo;
import org.edx.mobile.model.db.DownloadEntry;
import org.edx.mobile.model.video.VideoQuality;

/**
* Model Factory class for the database models.
Expand Down Expand Up @@ -87,9 +88,10 @@ public static VideoModel getModel(VideoResponseModel vrm) {
* Returns an object of IVideoModel which has all the fields copied from given VideoData.
*
* @param vrm
* @param videoQuality
* @return
*/
public static VideoModel getModel(VideoData vrm, VideoBlockModel block) {
public static VideoModel getModel(VideoData vrm, VideoBlockModel block, VideoQuality videoQuality) {
DownloadEntry e = new DownloadEntry();
//FIXME - current database schema is not suitable for arbitary level of course structure tree
//solution - store the navigation path info in into one column field in the database,
Expand All @@ -100,7 +102,7 @@ public static VideoModel getModel(VideoData vrm, VideoBlockModel block) {
IBlock root = block.getRoot();
e.eid = root.getCourseId();
e.duration = vrm.duration;
final VideoInfo preferredVideoInfo = vrm.encodedVideos.getPreferredNativeVideoInfo();
final VideoInfo preferredVideoInfo = vrm.encodedVideos.getPreferredVideoInfoForDownloading(videoQuality);
e.size = preferredVideoInfo.fileSize;
e.title = block.getDisplayName();
e.url = preferredVideoInfo.url;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ public VideoModel getDownloadEntryFromVideoModel(VideoBlockModel block){
return video;
}

return DatabaseModelFactory.getModel(block.getData(), block);
return DatabaseModelFactory.getModel(block.getData(), block, userPrefs.getVideoQuality());
}

@Override
Expand Down

0 comments on commit fe807fb

Please sign in to comment.