Floating messages - KaleyraVideo/VideoiOSSDK GitHub Wiki

Starting from 4.1.0 version the Kaleyra Video iOS SDK allows clients to present floating messages to the Call UI. You can use this feature when you want to present custom messages to your users while a call is in progress.

Presenting a message

Floating messages must be created providing a body string representing the message body, and an optional button. For example, let's pretend you want to present a floating message to the user having a button she can touch to perform some action. In order to do that, you must create a message object and call the present(message:) method on the CallViewController instance.

let message = FloatingMessage(body: "I'm a custom floating message", 
                              button: .init(text: "Press me", icon: .init(symbol: "location"), action: {
                                  print("I was pressed")
                              }))
controller.present(message: message)

[!CAUTION] Capturing the controller or self in the action closure may result in memory leaks. If you need to capture self or the controller instance make sure to capture a weak reference.

Here's the result:

Floating message example

Dismissing a message

Once presented you can change the body of the message as well as its button. If you want to dismiss the presented floating message you can do so by calling the dismiss method on the controller object

controller.dismiss(message: message)