feat(training): 为请求操作接入通用Loading
This commit is contained in:
@@ -64,6 +64,7 @@ actor TrainingDataStub: TrainingDataServing {
|
||||
var sectionsHandler: (@Sendable (String?) async throws -> TrainingCursorPage<TrainingSectionInfo>)?
|
||||
var sectionHandler: (@Sendable (String) async throws -> TrainingSectionContent)?
|
||||
var attachmentsHandler: (@Sendable (String?) async throws -> TrainingCursorPage<TrainingAttachmentInfo>)?
|
||||
var attachmentURLHandler: (@Sendable (String) async throws -> TrainingAttachmentLink)?
|
||||
var startReadingHandler: (@Sendable (String) async throws -> TrainingStudySession)?
|
||||
var heartbeatHandler: (@Sendable (HeartbeatCall) async throws -> TrainingHeartbeatConfirmation)?
|
||||
var questionsHandler: (@Sendable (Int, Int) async throws -> TrainingQuestionPage)?
|
||||
@@ -151,6 +152,7 @@ actor TrainingDataStub: TrainingDataServing {
|
||||
/// 返回用于 Safari 的授权 HTTPS URL。
|
||||
func attachmentURL(courseID: String, attachmentID: String, taskID: String) async throws -> TrainingAttachmentLink {
|
||||
calls.append(Call(name: "attachmentURL", taskID: taskID))
|
||||
if let handler = configuration.attachmentURLHandler { return try await handler(attachmentID) }
|
||||
return TrainingAttachmentLink(id: attachmentID, name: "培训附件", url: URL(string: "https://example.test/training.pdf")!, expiresAt: TrainingRemoteFixtures.now.addingTimeInterval(3600))
|
||||
}
|
||||
/// 只返回权威读时。
|
||||
|
||||
Reference in New Issue
Block a user