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

Merge of DownloadManager with upstream/develop #562

Merged
merged 43 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
2774689
refactor: migrate project to swift 6
IvanStepanok Nov 19, 2024
9c6e859
fix: remove task in do after
IvanStepanok Nov 19, 2024
e38a7de
fix: address feedback
IvanStepanok Nov 19, 2024
723b45a
fix: address feedback
IvanStepanok Nov 20, 2024
bb42d08
fix: update pods
IvanStepanok Nov 20, 2024
74b3f5f
Merge branch 'develop' into chore/migration-to-swift6
IvanStepanok Nov 20, 2024
f694ae7
fix: update task priority
IvanStepanok Nov 23, 2024
2502a8c
fix: download issues (#43)
forgotvas Jul 29, 2024
ef89dac
fix: download of html
forgotvas Nov 27, 2024
260adfb
chore: fixed tryDownloadAgain
forgotvas Nov 28, 2024
7dcf825
chore: merge issues
forgotvas Nov 28, 2024
abae893
chore: regenerate mocks
forgotvas Nov 28, 2024
39c76c3
chore: fix bug with downloading
forgotvas Nov 28, 2024
1f4924d
fix: download issue
forgotvas Nov 29, 2024
769aea8
fix: download issue
forgotvas Dec 2, 2024
d776ed2
Merge branch 'chore/migration-to-swift6' into chore/swift6-merge
forgotvas Dec 2, 2024
93f65c2
fix: swift 6 bug with evaluate java script method
IvanStepanok Dec 2, 2024
20a9b62
Merge branch 'chore/migration-to-swift6' into chore/swift6-merge
forgotvas Dec 2, 2024
4f384cf
chore: merge swift6 branch
forgotvas Dec 2, 2024
a17ffd7
chore: disable file length
forgotvas Dec 2, 2024
6dbca78
chore: fix tests
forgotvas Dec 2, 2024
3fd6a3f
chore: removed useless code
forgotvas Dec 2, 2024
0407df3
chore: fix freezes during download
forgotvas Jan 14, 2025
b3bf8fa
fix: download states
forgotvas Jan 17, 2025
af28eed
chore: fixed tests
forgotvas Jan 17, 2025
50c430d
Merge remote-tracking branch 'upstream/develop' into chore/swift6-con…
forgotvas Jan 20, 2025
914f20b
chore: merge conflicts
forgotvas Jan 20, 2025
4c6e408
chore: merge issues
forgotvas Jan 20, 2025
e7ed984
fix: some download bugs
forgotvas Jan 20, 2025
f850eb7
fix: for condition race
forgotvas Jan 21, 2025
78392dd
fix: size in DownloadActionView
forgotvas Jan 23, 2025
5acc29b
chore: remove extra line
forgotvas Jan 23, 2025
41669f0
chore: fix crash
forgotvas Jan 24, 2025
6595cb2
chore: tests fix
forgotvas Jan 24, 2025
6abb89f
chore: added tests for CourseDownloadHelperTests
forgotvas Jan 24, 2025
2b14da7
chore: added more tests
forgotvas Jan 25, 2025
77fdabc
chore: fix test
forgotvas Jan 25, 2025
435e2d8
chore: fix test
forgotvas Jan 27, 2025
1df7322
chore: commit to re-run jobs
forgotvas Jan 29, 2025
d85b69f
chore: increased waiting time for test
forgotvas Jan 29, 2025
819b480
chore: test fix
forgotvas Jan 29, 2025
3381c16
chore: trying to fix unit tests
forgotvas Jan 29, 2025
67af055
chore: removed multiple publisher tests
forgotvas Jan 29, 2025
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
941 changes: 444 additions & 497 deletions Authorization/AuthorizationTests/AuthorizationMock.generated.swift

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions Core/Core/Analytics/CoreAnalytics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ public enum AnalyticsEvent: String {
case courseViewCertificateClicked = "Course:View Certificate Clicked"
case bulkDownloadVideosToggle = "Video:Bulk Download Toggle"
case bulkDownloadVideosSubsection = "Video:Bulk Download Subsection"
case bulkDownloadVideosSection = "Video:Bulk Download Section"
case bulkDeleteVideosSubsection = "Videos:Delete Subsection Videos"
case bulkDeleteVideosSection = "Videos:Delete Section Videos"
case videoLoaded = "Video:Loaded"
case videoSpeedChange = "Video:Change Speed"
case videoPlayed = "Video:Played"
Expand Down Expand Up @@ -204,6 +206,8 @@ public enum EventBIValue: String {
case bulkDownloadVideosToggle = "edx.bi.app.videos.download.toggle"
case bulkDownloadVideosSubsection = "edx.bi.video.subsection.bulkdownload"
case bulkDeleteVideosSubsection = "edx.bi.app.video.delete.subsection"
case bulkDownloadVideosSection = "edx.bi.video.section.bulkdownload"
case bulkDeleteVideosSection = "edx.bi.app.video.delete.section"
case videoLoaded = "edx.bi.app.videos.loaded"
case videoSpeedChange = "edx.bi.app.videos.speed.changed"
case videoPlayed = "edx.bi.app.videos.played"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="22758" systemVersion="23F79" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="23605" systemVersion="24A335" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<entity name="CDDownloadData" representedClassName="CDDownloadData" syncable="YES" codeGenerationType="class">
<attribute name="actualSize" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="blockId" optional="YES" attributeType="String"/>
<attribute name="courseId" optional="YES" attributeType="String"/>
<attribute name="displayName" optional="YES" attributeType="String"/>
<attribute name="fileName" optional="YES" attributeType="String"/>
<attribute name="fileSize" optional="YES" attributeType="Integer 32" defaultValueString="0.0" usesScalarValueType="YES"/>
<attribute name="fileSize" optional="YES" attributeType="Integer 64" defaultValueString="0.0" usesScalarValueType="YES"/>
<attribute name="id" optional="YES" attributeType="String"/>
<attribute name="lastModified" optional="YES" attributeType="String"/>
<attribute name="progress" optional="YES" attributeType="Double" defaultValueString="0.0" usesScalarValueType="YES"/>
Expand Down
21 changes: 8 additions & 13 deletions Core/Core/Data/Persistence/CorePersistenceProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,44 +13,39 @@ public protocol CorePersistenceProtocol: Sendable {
func set(userId: Int)
func getUserID() -> Int?
@MainActor func publisher() throws -> AnyPublisher<Int, Never>
func addToDownloadQueue(tasks: [DownloadDataTask]) async
func addToDownloadQueue(tasks: [DownloadDataTask])
func saveOfflineProgress(progress: OfflineProgress) async
func loadProgress(for blockID: String) async -> OfflineProgress?
func loadAllOfflineProgress() async -> [OfflineProgress]
func deleteProgress(for blockID: String) async
func deleteAllProgress() async

func addToDownloadQueue(blocks: [CourseBlock], downloadQuality: DownloadQuality) async
func nextBlockForDownloading() async -> DownloadDataTask?
func updateDownloadState(id: String, state: DownloadState, resumeData: Data?) async
func deleteDownloadDataTask(id: String) async throws
func saveDownloadDataTask(_ task: DownloadDataTask) async
func addToDownloadQueue(blocks: [CourseBlock], downloadQuality: DownloadQuality)
func updateTask(task: DownloadDataTask)
func downloadDataTask(for blockId: String) async -> DownloadDataTask?
func getDownloadDataTasks() async -> [DownloadDataTask]
func getDownloadDataTasksForCourse(_ courseId: String) async -> [DownloadDataTask]
func deleteDownloadDataTasks(ids: [String])
}

#if DEBUG
public final class CorePersistenceMock: CorePersistenceProtocol, @unchecked Sendable {

public init() {}
public func set(userId: Int) {}
public func getUserID() -> Int? {1}
public func publisher() -> AnyPublisher<Int, Never> { Just(0).eraseToAnyPublisher() }
public func addToDownloadQueue(blocks: [CourseBlock], downloadQuality: DownloadQuality) async {}
public func addToDownloadQueue(tasks: [DownloadDataTask]) async {}
public func nextBlockForDownloading() async -> DownloadDataTask? { nil }
public func updateDownloadState(id: String, state: DownloadState, resumeData: Data?) async {}
public func deleteDownloadDataTask(id: String) async throws {}
public func addToDownloadQueue(blocks: [CourseBlock], downloadQuality: DownloadQuality) {}
public func addToDownloadQueue(tasks: [DownloadDataTask]) {}
public func updateTask(task: DownloadDataTask) {}
public func downloadDataTask(for blockId: String) async -> DownloadDataTask? { nil }
public func saveOfflineProgress(progress: OfflineProgress) async {}
public func loadProgress(for blockID: String) async -> OfflineProgress? { nil }
public func loadAllOfflineProgress() async -> [OfflineProgress] { [] }
public func deleteProgress(for blockID: String) async {}
public func deleteAllProgress() async {}
public func saveDownloadDataTask(_ task: DownloadDataTask) async {}
public func getDownloadDataTasks() async -> [DownloadDataTask] {[]}
public func getDownloadDataTasksForCourse(_ courseId: String) async -> [DownloadDataTask] {[]}
public func deleteDownloadDataTasks(ids: [String]) {}
}
#endif

Expand Down
5 changes: 1 addition & 4 deletions Core/Core/Domain/Model/CourseBlockModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -269,16 +269,13 @@ public struct CourseBlock: Hashable, Identifiable, Sendable, Equatable {
public let encodedVideo: CourseBlockEncodedVideo?
public let multiDevice: Bool?
public var offlineDownload: OfflineDownload?
public var actualFileSize: Int?

public var isDownloadable: Bool {
encodedVideo?.isDownloadable ?? false || offlineDownload?.isDownloadable ?? false
}

public var fileSize: Int? {
if let actualFileSize {
return actualFileSize
} else if let fileSize = encodedVideo?.desktopMP4?.fileSize {
if let fileSize = encodedVideo?.desktopMP4?.fileSize {
return fileSize
} else if let fileSize = encodedVideo?.fallback?.fileSize {
return fileSize
Expand Down
Loading
Loading