Last active
June 11, 2020 01:37
-
-
Save cardoso/e27c1e0f059fe75b568311a1027edf85 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import StreamChat | |
import StreamChatClient | |
extension UserViewController { | |
func setupHandlers() { | |
supportButton.target = self | |
supportButton.action = #selector(handleSupportButtonPress) | |
} | |
@objc func handleSupportButtonPress() { | |
let uid = Client.shared.user.id | |
let channel = Client.shared.channel(type: .messaging, id: "support-\(uid)") | |
channel.extraData = ChannelExtraData(name: "\(uid) support") | |
channel.create { _ in | |
channel.add(user: .init(id: "Agent")) { _ in | |
} | |
} | |
let chatVC = ChatViewController() | |
chatVC.presenter = .init(channel: channel) | |
chatVC.title = "Support" | |
let navigation = UINavigationController(rootViewController: chatVC) | |
self.present(navigation, animated: true, completion: { | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment