Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CM-2111] Crash : closure #1 in ALKConversationViewController.configureChatBar() | iOS Agent App #307

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 10 additions & 23 deletions Sources/Controllers/ALKConversationViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -873,29 +873,16 @@ open class ALKConversationViewController: ALKBaseViewController, Localizable {
}

public func configureChatBar() {
DispatchQueue.main.async { [weak self] in
guard let self = self else { return }
self.chatBar.setDefaultText(self.viewModel.prefilledMessage ?? "")

if ALApplozicSettings.isAgentAppConfigurationEnabled(),
ALUserDefaultsHandler.isTeamModeEnabled(),
let teamID = ALUserDefaultsHandler.getAssignedTeamIds(),
let teamIDArray = teamID as? [String],
let metadata = ALChannelService().getChannelByKey(self.viewModel.channelKey).metadata,
let newTeamID = metadata["KM_TEAM_ID"] as? String,
!teamIDArray.contains(newTeamID) {

self.isChatBarResticted = true
self.chatBar.textView.text = "You are restricted to type or send any message as you are no longer part of this conversation."
return
}

if self.viewModel.isOpenGroup {
self.chatBar.updateMediaViewVisibility(hide: true)
self.chatBar.hideMicButton()
} else {
self.chatBar.updateMediaViewVisibility()
}
self.chatBar.setDefaultText(self.viewModel.prefilledMessage ?? "")
if self.viewModel.isOpenGroup {
self.chatBar.updateMediaViewVisibility(hide: true)
self.chatBar.hideMicButton()
} else {
self.chatBar.updateMediaViewVisibility()
}
if ALApplozicSettings.isAgentAppConfigurationEnabled(),
ALUserDefaultsHandler.isTeamModeEnabled() {
self.checkRestrictedMesssaging()
}
}

Expand Down