Skip to content

Commit

Permalink
Fix "Engagement Ended" after the survey if the attachment view is opened
Browse files Browse the repository at this point in the history
MUIC-775
  • Loading branch information
dukhovnyi committed May 13, 2022
1 parent 738378e commit ed2692b
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions GliaWidgets/ViewModel/EngagementViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,23 @@ class EngagementViewModel {

func viewWillAppear() {
if interactor.state == .ended(.byOperator) {
EngagementViewModel.alertPresenters.insert(self)
engagementAction?(
.showSingleActionAlert(
alertConfiguration.operatorEndedEngagement,
actionTapped: { [weak self] in
self?.endSession()
}
)
)
interactor.currentEngagement?.getSurvey { [weak self] result in
guard let self = self else { return }
switch result {
case .success(let survey) where survey != nil:
return
default:
EngagementViewModel.alertPresenters.insert(self)
self.engagementAction?(
.showSingleActionAlert(
self.alertConfiguration.operatorEndedEngagement,
actionTapped: { [weak self] in
self?.endSession()
}
)
)
}
}
}
}

Expand Down

0 comments on commit ed2692b

Please sign in to comment.