Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open assessment and Peer instruction tool contents types #282

Merged
merged 8 commits into from
Feb 19, 2024
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
5 changes: 4 additions & 1 deletion Core/Core/Domain/Model/CourseBlockModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ public struct CourseBlock: Hashable, Identifiable {
public let studentUrl: String
public let subtitles: [SubtitleUrl]?
public let encodedVideo: CourseBlockEncodedVideo?
public let multiDevice: Bool?

public var isDownloadable: Bool {
encodedVideo?.isDownloadable ?? false
Expand All @@ -203,7 +204,8 @@ public struct CourseBlock: Hashable, Identifiable {
displayName: String,
studentUrl: String,
subtitles: [SubtitleUrl]? = nil,
encodedVideo: CourseBlockEncodedVideo?
encodedVideo: CourseBlockEncodedVideo?,
multiDevice: Bool?
) {
self.blockId = blockId
self.id = id
Expand All @@ -216,6 +218,7 @@ public struct CourseBlock: Hashable, Identifiable {
self.studentUrl = studentUrl
self.subtitles = subtitles
self.encodedVideo = encodedVideo
self.multiDevice = multiDevice
}
}

Expand Down
2 changes: 2 additions & 0 deletions Core/Core/Domain/Model/CourseDetailBlock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public enum BlockType: String {
case survey
case unknown
case dragAndDropV2 = "drag-and-drop-v2"
case openassessment
case peerInstructionTool = "ubcpi"

public var image: Image {
switch self {
Expand Down
6 changes: 4 additions & 2 deletions Course/Course/Data/CourseRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ public class CourseRepository: CourseRepositoryProtocol {
mobileHigh: parseVideo(encodedVideo: block.userViewData?.encodedVideo?.mobileHigh),
mobileLow: parseVideo(encodedVideo: block.userViewData?.encodedVideo?.mobileLow),
hls: parseVideo(encodedVideo: block.userViewData?.encodedVideo?.hls)
)
),
multiDevice: block.multiDevice
)
}

Expand Down Expand Up @@ -401,7 +402,8 @@ And there are various ways of describing it-- call it oral poetry or
mobileHigh: parseVideo(encodedVideo: block.userViewData?.encodedVideo?.mobileHigh),
mobileLow: parseVideo(encodedVideo: block.userViewData?.encodedVideo?.mobileLow),
hls: parseVideo(encodedVideo: block.userViewData?.encodedVideo?.hls)
)
),
multiDevice: block.multiDevice
)
}

Expand Down
6 changes: 5 additions & 1 deletion Course/Course/Data/Model/Data_CourseOutlineResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public extension DataLayer {
public let descendants: [String]?
public let allSources: [String]?
public let userViewData: CourseDetailUserViewData?
public let multiDevice: Bool?

public init(
blockId: String,
Expand All @@ -70,7 +71,8 @@ public extension DataLayer {
displayName: String,
descendants: [String]?,
allSources: [String]?,
userViewData: CourseDetailUserViewData?
userViewData: CourseDetailUserViewData?,
multiDevice: Bool?
) {
self.blockId = blockId
self.id = id
Expand All @@ -82,6 +84,7 @@ public extension DataLayer {
self.descendants = descendants
self.allSources = allSources
self.userViewData = userViewData
self.multiDevice = multiDevice
}

public enum CodingKeys: String, CodingKey {
Expand All @@ -91,6 +94,7 @@ public extension DataLayer {
case displayName = "display_name"
case userViewData = "student_view_data"
case allSources = "all_sources"
case multiDevice = "student_view_multi_device"
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="22225" systemVersion="23C64" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="22522" systemVersion="23D56" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<entity name="CDCourseBlock" representedClassName="CDCourseBlock" syncable="YES" codeGenerationType="class">
<attribute name="allSources" optional="YES" attributeType="Transformable" valueTransformerName="NSSecureUnarchiveFromData" customClassName="[String]"/>
<attribute name="blockId" optional="YES" attributeType="String"/>
Expand All @@ -9,6 +9,7 @@
<attribute name="displayName" optional="YES" attributeType="String"/>
<attribute name="graded" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
<attribute name="id" optional="YES" attributeType="String"/>
<attribute name="multiDevice" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
<attribute name="studentUrl" optional="YES" attributeType="String"/>
<attribute name="type" optional="YES" attributeType="String"/>
<relationship name="desktopMP4" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="CDCourseBlockVideo"/>
Expand Down Expand Up @@ -96,4 +97,4 @@
</uniquenessConstraint>
</uniquenessConstraints>
</entity>
</model>
</model>
6 changes: 4 additions & 2 deletions Course/Course/Presentation/Outline/ContinueWithView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ struct ContinueWithView_Previews: PreviewProvider {
type: .html,
displayName: "Continue lesson",
studentUrl: "",
encodedVideo: nil
encodedVideo: nil,
multiDevice: true
),
CourseBlock(
blockId: "2",
Expand All @@ -96,7 +97,8 @@ struct ContinueWithView_Previews: PreviewProvider {
type: .html,
displayName: "Continue lesson",
studentUrl: "",
encodedVideo: nil
encodedVideo: nil,
multiDevice: false

)
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ struct CourseVerticalImageView_Previews: PreviewProvider {
type: .video,
displayName: "Block 1",
studentUrl: "",
encodedVideo: nil
encodedVideo: nil,
multiDevice: true
)
]

Expand All @@ -54,7 +55,8 @@ struct CourseVerticalImageView_Previews: PreviewProvider {
type: .problem,
displayName: "Block 1",
studentUrl: "",
encodedVideo: nil
encodedVideo: nil,
multiDevice: false
)
]
let blocks3 = [
Expand All @@ -68,7 +70,8 @@ struct CourseVerticalImageView_Previews: PreviewProvider {
type: .discussion,
displayName: "Block 1",
studentUrl: "",
encodedVideo: nil
encodedVideo: nil,
multiDevice: true
)
]
let blocks4 = [
Expand All @@ -82,7 +85,8 @@ struct CourseVerticalImageView_Previews: PreviewProvider {
type: .html,
displayName: "Block 1",
studentUrl: "",
encodedVideo: nil
encodedVideo: nil,
multiDevice: false
)
]
let blocks5 = [
Expand All @@ -96,7 +100,8 @@ struct CourseVerticalImageView_Previews: PreviewProvider {
type: .unknown,
displayName: "Block 1",
studentUrl: "",
encodedVideo: nil
encodedVideo: nil,
multiDevice: true
)
]
HStack {
Expand Down
12 changes: 8 additions & 4 deletions Course/Course/Presentation/Unit/CourseUnitView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,8 @@ struct CourseUnitView_Previews: PreviewProvider {
type: .video,
displayName: "Lesson 1",
studentUrl: "",
encodedVideo: nil
encodedVideo: nil,
multiDevice: true
),
CourseBlock(
blockId: "2",
Expand All @@ -456,7 +457,8 @@ struct CourseUnitView_Previews: PreviewProvider {
type: .video,
displayName: "Lesson 2",
studentUrl: "2",
encodedVideo: nil
encodedVideo: nil,
multiDevice: false
),
CourseBlock(
blockId: "3",
Expand All @@ -468,7 +470,8 @@ struct CourseUnitView_Previews: PreviewProvider {
type: .unknown,
displayName: "Lesson 3",
studentUrl: "3",
encodedVideo: nil
encodedVideo: nil,
multiDevice: true
),
CourseBlock(
blockId: "4",
Expand All @@ -480,7 +483,8 @@ struct CourseUnitView_Previews: PreviewProvider {
type: .unknown,
displayName: "4",
studentUrl: "4",
encodedVideo: nil
encodedVideo: nil,
multiDevice: false
),
]

Expand Down
10 changes: 9 additions & 1 deletion Course/Course/Presentation/Unit/CourseUnitViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@ public enum LessonType: Equatable {
static func from(_ block: CourseBlock, streamingQuality: StreamingQuality) -> Self {
let mandatoryInjections: [WebviewInjection] = [.colorInversionCss, .ajaxCallback]
switch block.type {
case .course, .chapter, .vertical, .sequential, .unknown:
case .course, .chapter, .vertical, .sequential:
return .unknown(block.studentUrl)
case .unknown:
if let multiDevice = block.multiDevice, multiDevice {
return .web(url: block.studentUrl, injections: mandatoryInjections)
} else {
return .unknown(block.studentUrl)
}
case .html:
return .web(url: block.studentUrl, injections: mandatoryInjections)
case .discussion:
Expand All @@ -41,6 +47,8 @@ public enum LessonType: Equatable {
return .web(url: block.studentUrl, injections: mandatoryInjections + [.dragAndDropCss])
case .survey:
return .web(url: block.studentUrl, injections: mandatoryInjections + [.surveyCSS])
case .openassessment, .peerInstructionTool:
return .web(url: block.studentUrl, injections: mandatoryInjections)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ struct CourseUnitDropDownCell_Previews: PreviewProvider {
type: .video,
displayName: "Lesson 1",
studentUrl: "",
encodedVideo: nil
encodedVideo: nil,
multiDevice: true
)
]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ struct CourseUnitDropDownList_Previews: PreviewProvider {
type: .video,
displayName: "Lesson 1",
studentUrl: "",
encodedVideo: nil
encodedVideo: nil,
multiDevice: true
),
CourseBlock(
blockId: "2",
Expand All @@ -66,7 +67,8 @@ struct CourseUnitDropDownList_Previews: PreviewProvider {
type: .video,
displayName: "Lesson 2",
studentUrl: "2",
encodedVideo: nil
encodedVideo: nil,
multiDevice: false
),
CourseBlock(
blockId: "3",
Expand All @@ -78,7 +80,8 @@ struct CourseUnitDropDownList_Previews: PreviewProvider {
type: .unknown,
displayName: "Lesson 3",
studentUrl: "3",
encodedVideo: nil
encodedVideo: nil,
multiDevice: true
),
CourseBlock(
blockId: "4",
Expand All @@ -90,7 +93,8 @@ struct CourseUnitDropDownList_Previews: PreviewProvider {
type: .unknown,
displayName: "4",
studentUrl: "4",
encodedVideo: nil
encodedVideo: nil,
multiDevice: false
)
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ struct CourseUnitVerticalsDropdownView_Previews: PreviewProvider {
type: .video,
displayName: "Lesson 1",
studentUrl: "",
encodedVideo: nil
encodedVideo: nil,
multiDevice: true

),
CourseBlock(
Expand All @@ -80,7 +81,8 @@ struct CourseUnitVerticalsDropdownView_Previews: PreviewProvider {
type: .video,
displayName: "Lesson 2",
studentUrl: "2",
encodedVideo: nil
encodedVideo: nil,
multiDevice: false

),
CourseBlock(
Expand All @@ -93,7 +95,8 @@ struct CourseUnitVerticalsDropdownView_Previews: PreviewProvider {
type: .unknown,
displayName: "Lesson 3",
studentUrl: "3",
encodedVideo: nil
encodedVideo: nil,
multiDevice: true

),
CourseBlock(
Expand All @@ -106,7 +109,8 @@ struct CourseUnitVerticalsDropdownView_Previews: PreviewProvider {
type: .unknown,
displayName: "4",
studentUrl: "4",
encodedVideo: nil
encodedVideo: nil,
multiDevice: false
)
]

Expand Down
Loading
Loading