Skip to content

Commit

Permalink
Address unavailability banner showing up for SC flow
Browse files Browse the repository at this point in the history
Hide send message unavailability banner for SC flow.

MOB-3834
  • Loading branch information
igorkravchenko authored and Egor Egorov committed Dec 13, 2024
1 parent 65006d1 commit 8e77a4a
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ extension SecureConversations.ChatWithTranscriptModel {
}
}

var isSecureConversationsAvailable: Bool {
var isSendMessageAvailable: Bool {
switch self {
case .chat:
false
true
case let .transcript(model):
model.isSecureConversationsAvailable
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,12 @@ final class ChatViewController: EngagementViewController, PopoverPresenter {
// For regular chat engagement bottom banner is hidden.
chatView.setSecureMessagingBottomBannerHidden(true)
chatView.setSecureMessagingTopBannerHidden(true)
chatView.setSendingMessageUnavailabilityBannerHidden(viewModel.isSendMessageAvailable)
case let .secureTranscript(needsTextInputEnabled):
chatView.props = .init(header: props.secureTranscript)
// Instead of hiding text input, we need to disable it and corresponding buttons.
chatView.messageEntryView.isEnabled = needsTextInputEnabled
chatView.setSendingMessageUnavailabilityBannerHidden(viewModel.isSecureConversationsAvailable)
chatView.setSendingMessageUnavailabilityBannerHidden(viewModel.isSendMessageAvailable)
// For secure messaging bottom banner is visible.
chatView.setSecureMessagingBottomBannerHidden(false)
chatView.setSecureMessagingTopBannerHidden(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,13 @@ final class SecureConversationsChatWithTranscriptModelTests: XCTestCase {
interactor: .mock()
)
)

XCTAssertNil(chatViewModel.entryWidget)
XCTAssertNotNil(transcriptViewModel.entryWidget)
}

func test_isSendMessageAvailableReturnsTrueForChatViewModel() {
let chatViewModel = Model.chat(.mock())
XCTAssertTrue(chatViewModel.isSendMessageAvailable)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ class ChatViewModelTests: XCTestCase {

let upload = FileUpload.mock()
upload.state.value = .uploaded(file: try .mock())
var fileUploadListViewModelEnv = SecureConversations.FileUploadListViewModel.Environment.mock
let fileUploadListViewModelEnv = SecureConversations.FileUploadListViewModel.Environment.mock
fileUploadListViewModelEnv.uploader.uploads = [upload]
viewModelEnv.createFileUploadListModel = { _ in .mock(environment: fileUploadListViewModelEnv) }
viewModelEnv.createSendMessagePayload = { .mock(content: $0, attachment: $1) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,43 @@ final class EngagementLauncherTests: XCTestCase {

func test_startChat() throws {
var chatEngagement: EngagementKind?
var engagementLauncher = EngagementLauncher { engagementKind, _ in
let engagementLauncher = EngagementLauncher { engagementKind, _ in
chatEngagement = engagementKind
}

try engagementLauncher.startChat()

XCTAssertEqual(chatEngagement, .chat)
}

func test_startAudioCall() throws {
var chatEngagement: EngagementKind?
var engagementLauncher = EngagementLauncher { engagementKind, _ in
let engagementLauncher = EngagementLauncher { engagementKind, _ in
chatEngagement = engagementKind
}

try engagementLauncher.startAudioCall()

XCTAssertEqual(chatEngagement, .audioCall)
}

func test_startVideoCall() throws {
var chatEngagement: EngagementKind?
var engagementLauncher = EngagementLauncher { engagementKind, _ in
let engagementLauncher = EngagementLauncher { engagementKind, _ in
chatEngagement = engagementKind
}

try engagementLauncher.startVideoCall()

XCTAssertEqual(chatEngagement, .videoCall)
}

func test_startSecureMessaging() throws {
var chatEngagement: EngagementKind?
var engagementLauncher = EngagementLauncher { engagementKind, _ in
let engagementLauncher = EngagementLauncher { engagementKind, _ in
chatEngagement = engagementKind
}

try engagementLauncher.startSecureMessaging()

XCTAssertEqual(chatEngagement, .messaging(.welcome))
Expand Down
4 changes: 2 additions & 2 deletions GliaWidgetsTests/Sources/EntryWidget/EntryWidgetTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,14 @@ class EntryWidgetTests: XCTestCase {
}
let queuesMonitor = QueuesMonitor(environment: queueMonitorEnvironment)
queuesMonitor.fetchAndMonitorQueues(queuesIds: [mockQueueId])

var environment = EntryWidget.Environment.mock()
environment.queuesMonitor = queuesMonitor
environment.observeSecureUnreadMessageCount = { result in
result(.success(5))
return UUID.mock.uuidString
}
var configuration = EntryWidget.Configuration.mock(filterSecureConversation: true)
let configuration = EntryWidget.Configuration.mock(filterSecureConversation: true)
let entryWidget = EntryWidget(
queueIds: [mockQueueId],
configuration: configuration,
Expand Down

0 comments on commit 8e77a4a

Please sign in to comment.