diff --git a/Course/Course/Presentation/Outline/CourseOutlineView.swift b/Course/Course/Presentation/Outline/CourseOutlineView.swift index 023b3c97f..6b4c02544 100644 --- a/Course/Course/Presentation/Outline/CourseOutlineView.swift +++ b/Course/Course/Presentation/Outline/CourseOutlineView.swift @@ -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) } } } diff --git a/Course/Course/Presentation/Unit/CourseUnitView.swift b/Course/Course/Presentation/Unit/CourseUnitView.swift index 8f0d365d1..3aa2eecce 100644 --- a/Course/Course/Presentation/Unit/CourseUnitView.swift +++ b/Course/Course/Presentation/Unit/CourseUnitView.swift @@ -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)!) diff --git a/Podfile b/Podfile index 45a097010..3777caffe 100644 --- a/Podfile +++ b/Podfile @@ -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 diff --git a/Podfile.lock b/Podfile.lock index 4732e7f16..20ab398af 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -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) @@ -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`) @@ -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