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
133 changes: 66 additions & 67 deletions Course/Course/Presentation/Outline/CourseOutlineView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,75 +91,74 @@ public struct CourseOutlineView: View {
if let courseStructure = isVideo ? viewModel.courseVideosStructure : viewModel.courseStructure {
// MARK: - Sections list

if let chapters = courseStructure.childs {
ForEach(chapters, id: \.id) { chapter in
let index = chapters.firstIndex(where: {$0.id == chapter.id })
Text(chapter.displayName)
.font(Theme.Fonts.titleMedium)
.multilineTextAlignment(.leading)
.foregroundColor(CoreAssets.textSecondary.swiftUIColor)
.padding(.horizontal, 24)
.padding(.top, 40)
ForEach(chapter.childs, id: \.id) { child in
VStack(alignment: .leading) {
Button(action: {
viewModel.router.showCourseVerticalView(title: child.displayName,
verticals: child.childs)
}, label: {
Group {
child.type.image
Text(child.displayName)
.font(Theme.Fonts.titleMedium)
.multilineTextAlignment(.leading)
}.foregroundColor(CoreAssets.textPrimary.swiftUIColor)
Spacer()
if let state = viewModel.downloadState[child.id] {
switch state {
case .available:
DownloadAvailableView()
.onTapGesture {
viewModel.onDownloadViewTap(
chapter: chapter,
blockId: child.id,
state: state
)
}
.onForeground {
viewModel.onForeground()
}
case .downloading:
DownloadProgressView()
.onTapGesture {
viewModel.onDownloadViewTap(
chapter: chapter,
blockId: child.id,
state: state
)
}
.onBackground {
viewModel.onBackground()
}
case .finished:
DownloadFinishedView()
.onTapGesture {
viewModel.onDownloadViewTap(
chapter: chapter,
blockId: child.id,
state: state
)
}
}
let chapters = courseStructure.childs
ForEach(chapters, id: \.id) { chapter in
let index = chapters.firstIndex(where: {$0.id == chapter.id })
Text(chapter.displayName)
.font(Theme.Fonts.titleMedium)
.multilineTextAlignment(.leading)
.foregroundColor(CoreAssets.textSecondary.swiftUIColor)
.padding(.horizontal, 24)
.padding(.top, 40)
ForEach(chapter.childs, id: \.id) { child in
VStack(alignment: .leading) {
Button(action: {
viewModel.router.showCourseVerticalView(title: child.displayName,
verticals: child.childs)
}, label: {
Group {
child.type.image
Text(child.displayName)
.font(Theme.Fonts.titleMedium)
.multilineTextAlignment(.leading)
}.foregroundColor(CoreAssets.textPrimary.swiftUIColor)
Spacer()
if let state = viewModel.downloadState[child.id] {
switch state {
case .available:
DownloadAvailableView()
.onTapGesture {
viewModel.onDownloadViewTap(
chapter: chapter,
blockId: child.id,
state: state
)
}
.onForeground {
viewModel.onForeground()
}
case .downloading:
DownloadProgressView()
.onTapGesture {
viewModel.onDownloadViewTap(
chapter: chapter,
blockId: child.id,
state: state
)
}
.onBackground {
viewModel.onBackground()
}
case .finished:
DownloadFinishedView()
.onTapGesture {
viewModel.onDownloadViewTap(
chapter: chapter,
blockId: child.id,
state: state
)
}
}
Image(systemName: "chevron.right")
.foregroundColor(CoreAssets.accentColor.swiftUIColor)
}).padding(.horizontal, 36)
.padding(.vertical, 20)
if index != chapters.count - 1 {
Divider()
.frame(height: 1)
.overlay(CoreAssets.cardViewStroke.swiftUIColor)
.padding(.horizontal, 24)
}
Image(systemName: "chevron.right")
.foregroundColor(CoreAssets.accentColor.swiftUIColor)
}).padding(.horizontal, 36)
.padding(.vertical, 20)
if index != chapters.count - 1 {
Divider()
.frame(height: 1)
.overlay(CoreAssets.cardViewStroke.swiftUIColor)
.padding(.horizontal, 24)
}
}
}
Expand Down
30 changes: 14 additions & 16 deletions Course/Course/Presentation/Unit/CourseUnitView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,21 @@ public struct CourseUnitView: View {
Spacer()
}.background(CoreAssets.background.swiftUIColor)
case let .video(encodedUrl, blockID):
if let encodedUrl {
Text(viewModel.selectedLesson().displayName)
.font(Theme.Fonts.titleLarge)
.padding(.horizontal, 24)
EncodedVideoPlayer(
url: viewModel.urlForVideoFileOrFallback(blockId: blockID, url: encodedUrl),
isViewed: { [weak viewModel] isViewed in
if isViewed {
Task {
await viewModel?.blockCompletionRequest(blockID: blockID)
}
Text(viewModel.selectedLesson().displayName)
.font(Theme.Fonts.titleLarge)
.padding(.horizontal, 24)
EncodedVideoPlayer(
url: viewModel.urlForVideoFileOrFallback(blockId: blockID, url: encodedUrl),
isViewed: { [weak viewModel] isViewed in
if isViewed {
Task {
await viewModel?.blockCompletionRequest(blockID: blockID)
}
},
killPlayer: $viewModel.killPlayer
)
Spacer()
}
}
},
killPlayer: $viewModel.killPlayer
)
Spacer()
case .web(let url):
VStack {
WebUnitView(url: url, viewModel: Container.shared.resolve(WebUnitViewModel.self)!)
Expand Down
2 changes: 1 addition & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ abstract_target "App" do
pod 'KeychainSwift', '~> 20.0'
#SwiftUI backward UIKit access
pod 'Introspect', '0.1.4'
pod 'Kingfisher', '~> 7.4.1'
pod 'Kingfisher', '~> 7.6.2'
pod 'Swinject', '2.8.2'
end

Expand Down
10 changes: 5 additions & 5 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PODS:
- Alamofire (5.6.4)
- Introspect (0.1.4)
- KeychainSwift (20.0.0)
- Kingfisher (7.4.1)
- Kingfisher (7.6.2)
- Sourcery (1.8.0):
- Sourcery/CLI-Only (= 1.8.0)
- Sourcery/CLI-Only (1.8.0)
Expand All @@ -16,7 +16,7 @@ DEPENDENCIES:
- Alamofire (= 5.6.4)
- Introspect (= 0.1.4)
- KeychainSwift (~> 20.0)
- Kingfisher (~> 7.4.1)
- Kingfisher (~> 7.6.2)
- SwiftGen (~> 6.0)
- SwiftLint (= 0.49.1)
- SwiftyMocky (from `https://github.com/MakeAWishFoundation/SwiftyMocky.git`, tag `4.2.0`)
Expand Down Expand Up @@ -47,13 +47,13 @@ SPEC CHECKSUMS:
Alamofire: 4e95d97098eacb88856099c4fc79b526a299e48c
Introspect: b62c4dd2063072327c21d618ef2bedc3c87bc366
KeychainSwift: 0ce6a4d13f7228054d1a71bb1b500448fb2ab837
Kingfisher: cd762a593a61b2fbecf7645c00f9a801a3ebfc9c
Kingfisher: 6c5449c6450c5239166510ba04afe374a98afc4f
Sourcery: 6f5fe49b82b7e02e8c65560cbd52e1be67a1af2e
SwiftGen: 1366a7f71aeef49954ca5a63ba4bef6b0f24138c
SwiftLint: 32ee33ded0636d0905ef6911b2b67bbaeeedafa5
SwiftyMocky: c5e96e4ff76ec6dbf5a5941aeb039b5a546954a0
Swinject: b4a11b31992e8668308dc594ba1cb9b3164a37ab

PODFILE CHECKSUM: 67cd5593ff29aa398ea6aece16832ff1ee032791
PODFILE CHECKSUM: 581ff8dcee79309f445fdcb8360e69b153117532

COCOAPODS: 1.11.3
COCOAPODS: 1.12.0