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

feat: [FC-0047] Course progress and collapsing sections #446

Merged
3 changes: 0 additions & 3 deletions Core/Core.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@
BA8FA6702AD59EA300EA029A /* MicrosoftAuthProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA8FA66F2AD59EA300EA029A /* MicrosoftAuthProvider.swift */; };
BA981BCE2B8F5C49005707C2 /* Sequence+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA981BCD2B8F5C49005707C2 /* Sequence+Extensions.swift */; };
BA981BD02B91ED50005707C2 /* FullScreenProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA981BCF2B91ED50005707C2 /* FullScreenProgressView.swift */; };
BAAD62C62AFCF00B000E6103 /* CustomDisclosureGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAAD62C52AFCF00B000E6103 /* CustomDisclosureGroup.swift */; };
BAD9CA2F2B289B3500DE790A /* ajaxHandler.js in Resources */ = {isa = PBXBuildFile; fileRef = BAD9CA2E2B289B3500DE790A /* ajaxHandler.js */; };
BAD9CA332B28A8F300DE790A /* AjaxProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAD9CA322B28A8F300DE790A /* AjaxProvider.swift */; };
BAD9CA422B2B140100DE790A /* AgreementConfigTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAD9CA412B2B140100DE790A /* AgreementConfigTests.swift */; };
Expand Down Expand Up @@ -359,7 +358,6 @@
BA8FA66F2AD59EA300EA029A /* MicrosoftAuthProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MicrosoftAuthProvider.swift; sourceTree = "<group>"; };
BA981BCD2B8F5C49005707C2 /* Sequence+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Sequence+Extensions.swift"; sourceTree = "<group>"; };
BA981BCF2B91ED50005707C2 /* FullScreenProgressView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FullScreenProgressView.swift; sourceTree = "<group>"; };
BAAD62C52AFCF00B000E6103 /* CustomDisclosureGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomDisclosureGroup.swift; sourceTree = "<group>"; };
BAD9CA2E2B289B3500DE790A /* ajaxHandler.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = ajaxHandler.js; sourceTree = "<group>"; };
BAD9CA322B28A8F300DE790A /* AjaxProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AjaxProvider.swift; sourceTree = "<group>"; };
BAD9CA412B2B140100DE790A /* AgreementConfigTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AgreementConfigTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -748,7 +746,6 @@
023A1137291432FD00D0D354 /* FieldConfiguration.swift */,
BA4AFB412B5A7A0900A21367 /* VideoDownloadQualityView.swift */,
BA593F1A2AF8E487009ADB51 /* ScrollSlidingTabBar */,
BAAD62C52AFCF00B000E6103 /* CustomDisclosureGroup.swift */,
BA8FA6672AD59A5700EA029A /* SocialAuthButton.swift */,
02E93F862AEBAED4006C4750 /* AppReview */,
BA981BCF2B91ED50005707C2 /* FullScreenProgressView.swift */,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "Frame-17.svg",
"filename" : "deleteDownloading.svg",
"idiom" : "universal"
}
],
Expand Down

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
{
"images" : [
{
"filename" : "Frame-16.svg",
"filename" : "download_light.svg",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "download_dark.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions Core/Core/Assets.xcassets/finished_sequence.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "finished_sequence.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions Core/Core/Configuration/Config/UIComponentsConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
import Foundation

private enum Keys: String, RawStringExtractable {
case courseNestedListEnabled = "COURSE_NESTED_LIST_ENABLED"
case courseDropDownNavigationEnabled = "COURSE_DROPDOWN_NAVIGATION_ENABLED"
case courseUnitProgressEnabled = "COURSE_UNIT_PROGRESS_ENABLED"
}

public class UIComponentsConfig: NSObject {
public var courseNestedListEnabled: Bool
public var courseDropDownNavigationEnabled: Bool
public var courseUnitProgressEnabled: Bool

init(dictionary: [String: Any]) {
courseNestedListEnabled = dictionary[Keys.courseNestedListEnabled] as? Bool ?? false
courseDropDownNavigationEnabled = dictionary[Keys.courseDropDownNavigationEnabled] as? Bool ?? false
courseUnitProgressEnabled = dictionary[Keys.courseUnitProgressEnabled] as? Bool ?? false
super.init()
}
Expand Down
2 changes: 1 addition & 1 deletion Core/Core/Data/Model/Data_PrimaryEnrollment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public extension DataLayer {
public let certificate: DataLayer.Certificate?
public let courseModes: [CourseMode]?
public let courseStatus: CourseStatus?
public let progress: CourseProgress?
public let progress: DataLayer.CourseProgress?
public let courseAssignments: CourseAssignments?

enum CodingKeys: String, CodingKey {
Expand Down
38 changes: 36 additions & 2 deletions Core/Core/Domain/Model/CourseBlockModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public struct CourseStructure: Equatable {
public let certificate: Certificate?
public let org: String
public let isSelfPaced: Bool
public let courseProgress: CourseProgress?

public init(
id: String,
Expand All @@ -37,7 +38,8 @@ public struct CourseStructure: Equatable {
media: DataLayer.CourseMedia,
certificate: Certificate?,
org: String,
isSelfPaced: Bool
isSelfPaced: Bool,
courseProgress: CourseProgress?
) {
self.id = id
self.graded = graded
Expand All @@ -51,6 +53,7 @@ public struct CourseStructure: Equatable {
self.certificate = certificate
self.org = org
self.isSelfPaced = isSelfPaced
self.courseProgress = courseProgress
}

public func totalVideosSizeInBytes(downloadQuality: DownloadQuality) -> Int {
Expand Down Expand Up @@ -78,6 +81,16 @@ public struct CourseStructure: Equatable {
}
}

public struct CourseProgress {
public let totalAssignmentsCount: Int?
public let assignmentsCompleted: Int?

public init(totalAssignmentsCount: Int, assignmentsCompleted: Int) {
self.totalAssignmentsCount = totalAssignmentsCount
self.assignmentsCompleted = assignmentsCompleted
}
}

public struct CourseChapter: Identifiable {

public let blockId: String
Expand Down Expand Up @@ -109,6 +122,8 @@ public struct CourseSequential: Identifiable {
public let type: BlockType
public let completion: Double
public var childs: [CourseVertical]
public let sequentialProgress: SequentialProgress?
public let due: Date?

public var isDownloadable: Bool {
return childs.first(where: { $0.isDownloadable }) != nil
Expand All @@ -120,14 +135,18 @@ public struct CourseSequential: Identifiable {
displayName: String,
type: BlockType,
completion: Double,
childs: [CourseVertical]
childs: [CourseVertical],
sequentialProgress: SequentialProgress?,
due: Date?
) {
self.blockId = blockId
self.id = id
self.displayName = displayName
self.type = type
self.completion = completion
self.childs = childs
self.sequentialProgress = sequentialProgress
self.due = due
}
}

Expand Down Expand Up @@ -177,6 +196,18 @@ public struct SubtitleUrl: Equatable {
}
}

public struct SequentialProgress {
public let assignmentType: String?
public let numPointsEarned: Int?
public let numPointsPossible: Int?

public init(assignmentType: String?, numPointsEarned: Int?, numPointsPossible: Int?) {
self.assignmentType = assignmentType
self.numPointsEarned = numPointsEarned
self.numPointsPossible = numPointsPossible
}
}

public struct CourseBlock: Hashable, Identifiable {
public static func == (lhs: CourseBlock, rhs: CourseBlock) -> Bool {
lhs.id == rhs.id &&
Expand All @@ -193,6 +224,7 @@ public struct CourseBlock: Hashable, Identifiable {
public let courseId: String
public let topicId: String?
public let graded: Bool
public let due: Date?
public var completion: Double
public let type: BlockType
public let displayName: String
Expand All @@ -212,6 +244,7 @@ public struct CourseBlock: Hashable, Identifiable {
courseId: String,
topicId: String? = nil,
graded: Bool,
due: Date?,
completion: Double,
type: BlockType,
displayName: String,
Expand All @@ -226,6 +259,7 @@ public struct CourseBlock: Hashable, Identifiable {
self.courseId = courseId
self.topicId = topicId
self.graded = graded
self.due = due
self.completion = completion
self.type = type
self.displayName = displayName
Expand Down
1 change: 1 addition & 0 deletions Core/Core/SwiftGen/Assets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public enum CoreAssets {
public static let clearInput = ImageAsset(name: "clearInput")
public static let edit = ImageAsset(name: "edit")
public static let favorite = ImageAsset(name: "favorite")
public static let finishedSequence = ImageAsset(name: "finished_sequence")
public static let goodWork = ImageAsset(name: "goodWork")
public static let learnEmpty = ImageAsset(name: "learn_empty")
public static let airmail = ImageAsset(name: "airmail")
Expand Down
49 changes: 0 additions & 49 deletions Core/Core/View/Base/CustomDisclosureGroup.swift

This file was deleted.

5 changes: 2 additions & 3 deletions Core/Core/View/Base/DownloadView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public struct DownloadAvailableView: View {
.resizable()
.scaledToFit()
.frame(width: 24, height: 24)
.foregroundColor(Theme.Colors.textPrimary)
}
.frame(width: 30, height: 30)
}
Expand All @@ -41,6 +40,7 @@ public struct DownloadProgressView: View {
.resizable()
.scaledToFit()
.frame(width: 20, height: 20)
.foregroundStyle(Theme.Colors.snackbarErrorColor)
.foregroundColor(Theme.Colors.textPrimary)
}
}
Expand All @@ -52,11 +52,10 @@ public struct DownloadFinishedView: View {

public var body: some View {
VStack(spacing: 0) {
CoreAssets.deleteDownloading.swiftUIImage.renderingMode(.template)
CoreAssets.deleteDownloading.swiftUIImage
.resizable()
.scaledToFit()
.frame(width: 24, height: 24)
.foregroundColor(Theme.Colors.textPrimary)
}
.frame(width: 30, height: 30)
}
Expand Down
1 change: 1 addition & 0 deletions Core/Core/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"DATE.COURSE_STARTS" = "Course Starts";
"DATE.COURSE_ENDS" = "Course Ends";
"DATE.COURSE_ENDED" = "Course Ended";

"DATE.ENDED" = "Ended";
"DATE.START" = "Start";
"DATE.STARTED" = "Started";
Expand Down
Loading
Loading