-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into upstream-develop-crashfix-3
- Loading branch information
Showing
101 changed files
with
9,230 additions
and
412 deletions.
There are no files selected for viewing
840 changes: 840 additions & 0 deletions
840
Authorization/AuthorizationTests/AuthorizationMock.generated.swift
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
Core/Core/Assets.xcassets/check_circle.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "check_circle.svg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"template-rendering-intent" : "template" | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Core/Core/Assets.xcassets/check_circle.imageset/check_circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "download.svg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"template-rendering-intent" : "template" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "remove.svg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"template-rendering-intent" : "template" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions
15
Core/Core/Assets.xcassets/report_octagon.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "report.svg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"template-rendering-intent" : "template" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions
15
Core/Core/Assets.xcassets/visibility.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "visibility.svg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"template-rendering-intent" : "template" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// | ||
// OfflineSyncRepository.swift | ||
// Core | ||
// | ||
// Created by Stepanok Ivan on 20.06.2024. | ||
// | ||
|
||
import Foundation | ||
|
||
public protocol OfflineSyncRepositoryProtocol { | ||
func submitOfflineProgress(courseID: String, blockID: String, data: String) async throws -> Bool | ||
} | ||
|
||
public class OfflineSyncRepository: OfflineSyncRepositoryProtocol { | ||
|
||
private let api: API | ||
|
||
public init(api: API) { | ||
self.api = api | ||
} | ||
|
||
public func submitOfflineProgress(courseID: String, blockID: String, data: String) async throws -> Bool { | ||
let request = try await api.request( | ||
OfflineSyncEndpoint.submitOfflineProgress( | ||
courseID: courseID, | ||
blockID: blockID, | ||
data: data | ||
) | ||
) | ||
|
||
return request.statusCode == 200 | ||
} | ||
} | ||
|
||
// Mark - For testing and SwiftUI preview | ||
#if DEBUG | ||
class OfflineSyncRepositoryMock: OfflineSyncRepositoryProtocol { | ||
public func submitOfflineProgress(courseID: String, blockID: String, data: String) async throws -> Bool { | ||
true | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// OfflineProgress.swift | ||
// Core | ||
// | ||
// Created by Stepanok Ivan on 20.06.2024. | ||
// | ||
|
||
import Foundation | ||
|
||
public struct OfflineProgress { | ||
public let blockID: String | ||
public let data: String | ||
public let courseID: String | ||
public let progressJson: String | ||
|
||
public init(progressJson: String) { | ||
self.progressJson = progressJson | ||
if let jsonData = progressJson.data(using: .utf8) { | ||
if let jsonObject = try? JSONSerialization.jsonObject(with: jsonData, options: []) as? [String: Any] { | ||
if let url = jsonObject["url"] as? String, | ||
let data = jsonObject["data"] as? String { | ||
self.blockID = extractBlockID(from: url) | ||
self.data = data | ||
self.courseID = extractCourseID(from: url) | ||
return | ||
} | ||
} | ||
} | ||
// Default values if parsing fails | ||
self.blockID = "" | ||
self.data = "" | ||
self.courseID = "" | ||
|
||
func extractBlockID(from url: String) -> String { | ||
if let range = url.range(of: "xblock/")?.upperBound, | ||
let endRange = url.range(of: "/handler", range: range..<url.endIndex)?.lowerBound { | ||
return String(url[range..<endRange]) | ||
} | ||
return "" | ||
} | ||
|
||
func extractCourseID(from url: String) -> String { | ||
if let range = url.range(of: "courses/")?.upperBound, | ||
let endRange = url.range(of: "/xblock", range: range..<url.endIndex)?.lowerBound { | ||
return String(url[range..<endRange]) | ||
} | ||
return "" | ||
} | ||
} | ||
} |
Oops, something went wrong.