Skip to content

Commit

Permalink
iOS: Improve table problem with one option flow (#1124)
Browse files Browse the repository at this point in the history
^ALTAPPS-1288
  • Loading branch information
ivan-magda authored Jul 26, 2024
1 parent 2316ffe commit 1b9e0c4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ final class StepQuizTableSelectColumnsView: UIView {
}
}

var isMultipleChoice = false
var isMultipleChoice = false {
didSet {
confirmButtonContainerView.isHidden = !isMultipleChoice
}
}

init(
frame: CGRect = .zero,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import UIKit

extension StepQuizTableSelectColumnsViewController {
enum Animation {
static let dismissAnimationDelay: TimeInterval = 0.33
static let dismissAnimationDelayAfterDidTapConfirm: TimeInterval = 0.33
static let dismissAnimationDelayAfterChoiceSelected: TimeInterval = 0.5
}
}

Expand Down Expand Up @@ -83,14 +84,14 @@ extension StepQuizTableSelectColumnsViewController: StepQuizTableSelectColumnsVi
}

tableQuizSelectColumnsView?.update(selectedColumnsIDs: selectedColumnsIDs)

if !isMultipleChoice {
confirmSelection(delay: Animation.dismissAnimationDelayAfterChoiceSelected)
}
}

func tableQuizSelectColumnsViewDidTapConfirm(_ view: StepQuizTableSelectColumnsView) {
onColumnsSelected(selectedColumnsIDs)

DispatchQueue.main.asyncAfter(deadline: .now() + Animation.dismissAnimationDelay) {
self.dismiss(animated: true)
}
confirmSelection(delay: Animation.dismissAnimationDelayAfterDidTapConfirm)
}

func tableQuizSelectColumnsViewDidLoadContent(_ view: StepQuizTableSelectColumnsView) {
Expand All @@ -99,4 +100,12 @@ extension StepQuizTableSelectColumnsViewController: StepQuizTableSelectColumnsVi
self.panModalTransition(to: .longForm)
}
}

private func confirmSelection(delay: TimeInterval) {
onColumnsSelected(selectedColumnsIDs)

DispatchQueue.main.asyncAfter(deadline: .now() + delay) {
self.dismiss(animated: true)
}
}
}

0 comments on commit 1b9e0c4

Please sign in to comment.