MigrationGuide from 2.x to 2.5.0 - Bandyer/Bandyer-iOS-SDK GitHub Wiki

This guide will introduce you to the changes made to the BandyerSDK 2.5.0 version.

Table of contents

What's new

The BandyerSDK 2.5.0 version introduce a picture in picture (PIP) mode that is automatically triggered whenever the user tap the back button in the Bandyer call UI. You don't need to make any changes to your code in order to support this feature. It is already baked into the SDK ready to be used. However, there a few caveats:

  • The picture in picture mode is a completely custom implementation made by Bandyer. If the user leaves the app, the picture in picture won't be available on the user's home screen nor it will be available within other apps.
  • The picture in picture mode is available only when embedding the call UI in a CallWindow
  • You must stop using the CallBannerController provided by the SDK
  • You must update the code interfacing with the CallWindow in order to make the picture in picture work as expected

Call banner

The CallBannerController and all its related types have been deprecated. You should remove any usage of this component from your code. It is still going to work, but it has been replaced with the picture in picture mode, and it is not needed anymore.

Call window

If you were hiding the CallWindow or dimissing the call user interface while responding to some SDK events, then you should stop doing it. The CallWindow must be hidden only when the callWindowDidFinish(_:) method of the CallWindowDelegate is invoked.

Example

Let's pretend you have the following code in your app responding to in-app notifications events and to call window events.

Before

Please note that in the following snippets of code there are calls to the isHidden property of the CallWindow.


extension MyObject: InAppChatNotificationTouchListener {

    func onTouch(_ notification: ChatNotification) {
    	// Here we are dismissing the call interface when a chat notification is touched by the user
        if let callWindow = self.callWindow, !callWindow.isHidden {
            callWindow.dismissCallViewController { }
        }

        if currentViewController?.presentedViewController is ChannelViewController {
            currentViewController?.presentedViewController?.dismiss(animated: true) { [weak self] in
                self?.presentChat(from: notification)
            }
        } else {
            presentChat(from: notification)
        }
    }
}

extension MyObject: CallWindowDelegate {
    func callWindowDidFinish(_ window: CallWindow) {
    // This call to isHidden is fine. When the call window finishes its tasks 
    // it should be hidden and removed from the application windows
        callWindow?.isHidden = true
        
        guard let intent = self.infoChat.chatIntent else { return }
        if self.infoChat.isChatOpened, let vc = currentViewController {
            presentChat(from: vc, intent: intent)
        }
    }

    func callWindow(_ window: CallWindow, openChatWith intent: OpenChatIntent) {
    // Here the call window is hidden when the user taps the chat button in the call interface
        callWindow?.isHidden = true
        
        if let vc = currentViewController {
            presentChat(from: vc, intent: intent)
        }
    }
}
After

After updating to the 2.5.0 version those calls are not needed anymore, otherwise the CallWindow and its content will be hidden when they shouldn't.


extension MyObject: InAppChatNotificationTouchListener {

    func onTouch(_ notification: ChatNotification) {
    	// As you have might noticed, we are not hiding or dismissing the call interface anymore
        if currentViewController?.presentedViewController is ChannelViewController {
            currentViewController?.presentedViewController?.dismiss(animated: true) { [weak self] in
                self?.presentChat(from: notification)
            }
        } else {
            presentChat(from: notification)
        }
    }
}

extension MyObject: CallWindowDelegate {
    func callWindowDidFinish(_ window: CallWindow) {
	    // Same as before
        callWindow?.isHidden = true
        
        guard let intent = self.infoChat.chatIntent else { return }
        if self.infoChat.isChatOpened, let vc = currentViewController {
            presentChat(from: vc, intent: intent)
        }
    }

    func callWindow(_ window: CallWindow, openChatWith intent: OpenChatIntent) {
    	// Here we removed the call to isHidden property. From now on the call window must
    	// Not be hidden when the call is in progress
        if let vc = currentViewController {
            presentChat(from: vc, intent: intent)
        }
    }
}

We improved the navigation flows between the Bandyer UI screens and the app screens.