Skip to content

MigrationGuide from 1.7.x to 2.0.0

Marco Brescianini edited this page Aug 30, 2024 · 2 revisions

This guide will introduce you to the changes made to the BandyerSDK in version 2.0. There are some breaking change you must take into account in order to use the 2.0 version of the SDK if you are still using a 1.x version.

Table of contents

Minimum deployment target

The BandyerSDK minimum deployment target has been raised from iOS 9.0 to iOS 10.0. We dropped support for devices running iOS 9.0.

Consistent naming convention

Starting from 2.0 version all types will follow a consistent naming convention. Any type provided by the BandyerSDK is now prefixed with the BDK prefix. If you are using the BandyerSDK in a "Swift" project you must update all references to BandyerSDK types removing any prefix, whereas if you are using the BandyerSDK in an "Objective-c" project you must update all references to BandyerSDK types using the BDK prefix instead of the old ones. For example, the call client protocol was called BCXCallClient in version 1.7.3, now it has been renamed to BDKCallClient. As mentioned above, "Objective-c" code referencing the BCXCallClient must be updated referencing BDKCallClient type instead, whereas "Swift" code must be updated referencing CallClient instead.

Swift

The following snippet shows you how your "Swift" code should be changed referencing the new types instead of the old ones.

extension ContactsViewController: BCXCallClientObserver {
    ...
    
    public func callClientDidStart(_ client: BCXCallClient) {
       // Do something when client starts
    }
    
    ...
}

BCXCallClientObserver conformance using the BandyerSDK 1.7 version

extension ContactsViewController: CallClientObserver {
	...

    public func callClientDidStart(_ client: CallClient) {
       // Do something when client starts
    }
    
    ...

BDKCallClientObserver conformance using the BandyerSDK 2.0 version

Objective-c

The following snippet shows you how your "Objective-c" code should be changed referencing the new types instead of the old ones.

@interface ContactsViewController () <BCXCallClientObserver>
@end

@implementation ContactsViewController

...

- (void)callClientDidStart:(id <BCXCallClient>)client
{
// Do something when client starts
}

...

@end

BCXCallClientObserver conformance using the BandyerSDK 1.7 version

@interface ContactsViewController () <BDKCallClientObserver>
@end

@implementation ContactsViewController

...

- (void)callClientDidStart:(id <BDKCallClient>)client
{
// Do something when client starts
}

...

@end

BDKCallClientObserver conformance using the BandyerSDK 2.0 version

Deprecations

All deprecated types, methods and properties have been removed from 2.0 version. So if you were using one of deprecated method or type, you must update your code using the new APIs.

Call and Chat clients

Starting from 2.0 version the start methods of the call and chat clients have been changed removing the userAlias parameter. Now both start methods take no parameters but there's a catch, you must open an user session before calling start on any client. The BandyerSDK singleton instance gained two new methods openSession(userId:) and closeSession() that must be called when an user is logged in and when an user is logged out of your application respectively. You MUST call openSession(userId:) ([openSessionWithUserId:] in Objective-c) before starting any client otherwise the client will fail starting. As a side note, the closeSession() ([closeSession] in Objective-c) method will stop any running client.

Call intents

The old BDKMakeOutgoingCallIntent and BDKIncomingCallHandlingIntent have been renamed and updated. The BDKMakeOutgoingCallIntent has been renamed to StartOutgoingCallIntent and all its initializers have been updated taking a CallOptions object as parameter. The BDKIncomingCallHandlingIntent has been renamed to HandleIncomingCallIntent and its initializer takes a mandatory call object as parameter. Take a look at our making an outgoing call guide and at our receiving an incoming call guide for some detailed examples of how the two intents now look like.

User info fetcher

The old BDKUserInfoFetcher protocol and its related BDKUserDisplayItem type have changed and updated with the goal of moving towards a consistent API between all Bandyer supported platforms. The BDKUserDisplayItem has been renamed to UserDetails. UserDetails objects are now immutable and cannot be modified once created. The UserDetails class exposes a lot of convenience initializers useful for creating an object with all the user details your app can provide. The BDKUserInfoFetcher protocol has been renamed to UserDetailsProvider. It has lost conformance to the NSCopying and the NSObjectProtocol protocols. The old BCXHandleProvider protocol has been merged in the UserDetailsProvider protocol. Take a look at our customizing user information guide for some detailed examples of how the UserDetailsProvider now looks like.

Call banner controller delegate

The CallBannerControllerDelegate protocol methods have changed signature. You must update your object conforming to this protocol with the new methods signatures. Here's a snippet showing you how they changed:

Swift

extension ViewController: CallBannerControllerDelegate {
    func callBannerController(_ controller: CallBannerController, didTouch banner: CallBannerView) {
    }

    func callBannerController(_ controller: CallBannerController, willShow banner: CallBannerView) {
    }

    func callBannerController(_ controller: CallBannerController, willHide banner: CallBannerView) {
    }
}

CallBannerDelegate conformance in BandyerSDK 1.7 version

Becomes:

extension ViewController: CallBannerControllerDelegate {
    func callBannerControllerDidTouchBanner(_ controller: CallBannerController) {
    }
    
    func callBannerControllerWillShowBanner(_ controller: CallBannerController) {
    }
    
    func callBannerControllerWillHideBanner(_ controller: CallBannerController) {
    }
}

CallBannerDelegate conformance in BandyerSDK 2.0 version

Objective-c

- (void)callBannerController:(BDKCallBannerController *_Nonnull)controller willHide:(BDKCallBannerView *_Nonnull)banner
{
}

- (void)callBannerController:(BDKCallBannerController *_Nonnull)controller willShow:(BDKCallBannerView *_Nonnull)banner
{
}

- (void)callBannerController:(BDKCallBannerController *_Nonnull)controller didTouch:(BDKCallBannerView *_Nonnull)banner
{
}

CallBannerDelegate conformance in BandyerSDK 1.7 version

Becomes:

- (void)callBannerControllerWillHideBanner:(BDKCallBannerController *)controller
{
}

- (void)callBannerControllerWillShowBanner:(BDKCallBannerController *)controller
{
}

- (void)callBannerControllerDidTouchBanner:(BDKCallBannerController *)controller
{
}

CallBannerDelegate conformance in BandyerSDK 2.0 version

Channel view controller

The ChannelViewController does not show the call banner anymore. The ChannelViewControllerDelegate has been updated removing methods related to in-app notifications and the call banner from its signature. Here's a snippet showing you how it changed:

Swift

extension ViewController: ChannelViewControllerDelegate {
    func channelViewControllerDidFinish(_ controller: ChannelViewController) {
    }

    func channelViewController(_ controller: ChannelViewController, didTouch notification: ChatNotification) {
    }

    func channelViewController(_ controller: ChannelViewController, didTouch banner: CallBannerView) {
    }

    func channelViewController(_ controller: ChannelViewController, willHide banner: CallBannerView) {
    }

    func channelViewController(_ controller: ChannelViewController, willShow banner: CallBannerView) {
    }

    func channelViewController(_ controller: ChannelViewController, didTapAudioCallWith users: [String]) {
    }

    func channelViewController(_ controller: ChannelViewController, didTapVideoCallWith users: [String]) {
    }
}

ChannelViewControllerDelegate conformance in BandyerSDK 1.7 version

Becomes:

extension ContactsViewController: ChannelViewControllerDelegate {
    func channelViewControllerDidFinish(_ controller: ChannelViewController) {
    }

    func channelViewController(_ controller: ChannelViewController, didTapAudioCallWith users: [String]) {
    }

    func channelViewController(_ controller: ChannelViewController, didTapVideoCallWith users: [String]) {
    }
}

ChannelViewControllerDelegate conformance in BandyerSDK 2.0 version

Objective-c

- (void)channelViewControllerDidFinish:(BCHChannelViewController *)controller
{
}

- (void)channelViewController:(BCHChannelViewController *)controller didTapAudioCallWith:(NSArray *)users
{
}

- (void)channelViewController:(BCHChannelViewController *)controller didTapVideoCallWith:(NSArray *)users
{
}

- (void)channelViewController:(BCHChannelViewController *)controller willHide:(BDKCallBannerView *)banner
{
}

- (void)channelViewController:(BCHChannelViewController *)controller willShow:(BDKCallBannerView *)banner
{
}

- (void)channelViewController:(BCHChannelViewController *)controller didTouchBanner:(BDKCallBannerView *)banner
{
}

ChannelViewControllerDelegate conformance in BandyerSDK 1.7 version

Becomes:

- (void)channelViewControllerDidFinish:(BDKChannelViewController *)controller
{
}

- (void)channelViewController:(BDKChannelViewController *)controller didTapAudioCallWith:(NSArray *)users
{
}

- (void)channelViewController:(BDKChannelViewController *)controller didTapVideoCallWith:(NSArray *)users
{
}

ChannelViewControllerDelegate conformance in BandyerSDK 2.0 version

Clone this wiki locally