Skip to content

Commit

Permalink
Handle follow_up end reason
Browse files Browse the repository at this point in the history
This commit adds handling of `follow_up` end reason the same way as `operator_hung_up`

MOB-3900
  • Loading branch information
Egor Egorov authored and EgorovEI committed Dec 23, 2024
1 parent db2b9a3 commit 6472f01
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion GliaWidgets/Sources/Interactor/Interactor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ extension Interactor: CoreSdkClient.Interactable {
switch reason {
case .visitorHungUp:
state = .ended(.byVisitor)
case .operatorHungUp:
case .operatorHungUp, .followUp:
state = .ended(.byOperator)
case .error:
state = .ended(.byError)
Expand Down
27 changes: 26 additions & 1 deletion GliaWidgetsTests/Sources/InteractorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,32 @@ class InteractorTests: XCTestCase {

XCTAssertEqual(callbacks, [.ended])
}


func test_endWithFollowUpSetsStateToEnded() throws {
enum Callback: Equatable {
case ended
}

var callbacks: [Callback] = []
var interactorEnv = Interactor.Environment.failing
interactorEnv.gcd = .mock
let interactor = Interactor.mock(environment: interactorEnv)
interactor.addObserver(self) { event in
switch event {
case .stateChanged(let state):
if case .ended = state {
callbacks.append(.ended)
}
default:
return
}
}

interactor.end(with: .followUp)

XCTAssertEqual(callbacks, [.ended])
}

func test_sendMessageCallsCoreSdkSendMessageWithAttachment() throws {
enum Callback: Equatable {
case sendMessageWithAttachment
Expand Down
2 changes: 1 addition & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ target 'TestingApp' do
end

target 'GliaWidgets' do
pod 'GliaCoreSDK', '2.0.4'
pod 'GliaCoreSDK'
swiftlint
end

Expand Down

0 comments on commit 6472f01

Please sign in to comment.