Skip to content

Commit

Permalink
Fix quiz config for teacher
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-magda committed Aug 25, 2021
1 parent a32edcc commit 34db5c0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions Stepic/Sources/Modules/Step/StepViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ final class StepViewController: UIViewController, ControllerWithStepikPlaceholde
step: stepViewModel.step,
instructionType: instructionType,
isTeacher: stepViewModel.isTeacher,
hasNextStep: self.canNavigateToNextStep,
output: nil
)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@ final class StepQuizReviewAssembly: Assembly {
private let step: Step
private let instructionType: InstructionType
private let isTeacher: Bool
private let hasNextStep: Bool

private weak var moduleOutput: StepQuizReviewOutputProtocol?

init(
step: Step,
instructionType: InstructionType,
isTeacher: Bool,
hasNextStep: Bool,
output: StepQuizReviewOutputProtocol? = nil
) {
self.step = step
self.instructionType = instructionType
self.isTeacher = isTeacher
self.hasNextStep = hasNextStep
self.moduleOutput = output
}

Expand All @@ -39,6 +42,7 @@ final class StepQuizReviewAssembly: Assembly {
interactor: interactor,
step: self.step,
isTeacher: self.isTeacher,
hasNextStep: self.hasNextStep,
analytics: StepikAnalytics.shared
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ final class StepQuizReviewViewController: UIViewController, ControllerWithStepik

private let step: Step
private let isTeacher: Bool
private let hasNextStep: Bool
private var state: StepQuizReview.ViewControllerState

private let analytics: Analytics
Expand All @@ -34,12 +35,14 @@ final class StepQuizReviewViewController: UIViewController, ControllerWithStepik
interactor: StepQuizReviewInteractorProtocol,
step: Step,
isTeacher: Bool,
hasNextStep: Bool,
initialState: StepQuizReview.ViewControllerState = .loading,
analytics: Analytics
) {
self.interactor = interactor
self.step = step
self.isTeacher = isTeacher
self.hasNextStep = hasNextStep
self.state = initialState
self.analytics = analytics
super.init(nibName: nil, bundle: nil)
Expand Down Expand Up @@ -96,15 +99,18 @@ final class StepQuizReviewViewController: UIViewController, ControllerWithStepik
// MARK: Private API

private func setupQuizChildModule() {
let assembly = BaseQuizAssembly(
step: self.step,
config: .init(
let config: BaseQuiz.Config = self.isTeacher
? .init(hasNextStep: self.hasNextStep)
: .init(
hasNextStep: false,
isTopSeparatorHidden: true,
isTitleHidden: true,
isReviewControlsAvailable: true,
withHorizontalInsets: false
),
)
let assembly = BaseQuizAssembly(
step: self.step,
config: config,
output: self.interactor as? BaseQuizOutputProtocol
)
let quizChildViewController = assembly.makeModule()
Expand Down

0 comments on commit 34db5c0

Please sign in to comment.