Displays outgoing call interface while waiting for recipient to answer
The CometChatOutgoingCall component is a visual representation of a user-initiated call, whether voice or video. It serves as an interface for managing outgoing calls, providing users with essential options to control the call experience.
CometChatOutgoingCall is a custom view controller that offers versatility in its integration. It can be seamlessly launched via button clicks or any user-triggered action, enhancing the overall user experience and facilitating smoother interactions within the application.
Swift
Report incorrect code
Copy
Ask AI
let cometChatOutgoingCall = CometChatOutgoingCall()cometChatOutgoingCall.set(call: call)cometChatOutgoingCall.modalPresentationStyle = .fullScreenself.present(cometChatOutgoingCall, animated: true)
If you are already using a navigation controller, you can use the pushViewController function instead of presenting the view controller.
Actions dictate how a component functions. They are divided into two types: Predefined and User-defined. You can override either type, allowing you to tailor the behavior of the component to fit your specific needs.
The setOnCancelClick action is typically triggered when the call is canceled, carrying out default actions. You can customize or override this default behavior using the following code snippet:
Swift
Report incorrect code
Copy
Ask AI
let cometChatOutgoingCall = CometChatOutgoingCall()cometChatOutgoingCall.set(onCancelClick: { call, controller in // Perform your action})
Filters allow you to customize the data displayed in a list within a Component. You can filter the list based on your specific criteria for a more customized experience. Filters can be applied using RequestBuilders of the Chat SDK.The OutgoingCall component does not have any exposed filters.
Events are emitted by a Component. By using events, you can extend existing functionality. Being global events, they can be applied in multiple locations and can be added or removed as needed.
Event
Description
onOutgoingCallAccepted
Triggers when the outgoing call is accepted.
onOutgoingCallRejected
Triggers when the outgoing call is rejected.
Add Listener
Report incorrect code
Copy
Ask AI
// View controller from your project where you want to listen to eventspublic class ViewController: UIViewController { public override func viewDidLoad() { super.viewDidLoad() // Subscribe to the listener for call events CometChatCallEvents.addListener("UNIQUE_ID", self as CometChatCallEventListener) }}// Listener for call eventsextension ViewController: CometChatCallEventListener { func onOutgoingCallAccepted(call: Call) { // Handle call accepted } func onOutgoingCallRejected(call: Call) { // Handle call rejected }}
Emitting Call Events
Report incorrect code
Copy
Ask AI
// Emit this when the other user accepts the callCometChatCallEvents.emitOnOutgoingCallAccepted(call: Call)// Emit this when the other user rejects a callCometChatCallEvents.emitOnOutgoingCallRejected(call: Call)
Remove Listener
Report incorrect code
Copy
Ask AI
public override func viewWillDisappear(_ animated: Bool) { // Unsubscribe from the listener CometChatCallEvents.removeListener("LISTENER_ID_USED_FOR_ADDING_THIS_LISTENER")}
To fit your app’s design requirements, you can customize the appearance of the component. We provide exposed methods that allow you to modify the experience and behavior according to your specific needs.
Using Style, you can customize the look and feel of the component in your app. These parameters typically control elements such as the color, size, shape, and fonts used within the component.
For advanced-level customization, you can set custom views to the component. This lets you tailor each aspect of the component to fit your exact needs and application aesthetics. You can create and define your own views, layouts, and UI elements and then incorporate those into the component.