Migration Guide
If you're migrating from an older version of the Chat SDK, this guide will help to highlight some of the key differences.
Prerequisites
Before
- Xcode 10+
- Swift 5
After
- Xcode 11.2+
- Swift 5
Initializing the Chat SDK
The Chat SDK initialization should take place in your AppDelegate
of your iOS application using the QiscusCoreManager
class. Initializing QiscusCore
is a crucial step to set up the chat SDK for your application.. The initialization method takes the following parameters:
- QISCUS_SDK_APP_ID : This can be found on the Chat dashboard. Ask a Chat admin for the key if you don't have access to the dashboard.
Before
QiscusCore.setup(AppID: QISCUS_SDK_APP_ID)
After
In the newer version of the Qiscus Chat SDK (v3.x.x), you can initialize the SDK with multiple App IDs by creating separate QiscusCore
objects for each App ID. This allows you to manage different chat configurations and endpoints for different applications within your IOS project.
1. Create a Class to Manage QiscusCore
Instances
In this step, we will create a Swift class named QiscusCoreManager
to manage multiple instances of the QiscusCore
chat SDK. This class allows you to initialize and handle QiscusCore
instances for different App IDs within your iOS application.
create the QiscusCoreManager
class with two static properties to hold QiscusCore
instances for different App IDs. In this example, we've initialized qiscusCore1
and qiscusCore2
:
import Foundation
import QiscusCore
public class QiscusCoreManager{
public static var qiscusCore1 : QiscusCore = QiscusCore()
public static var qiscusCore2 : QiscusCore = QiscusCore()
}
2. Initialize QiscusCore in the AppDelegate
In your AppDelegate.swift
file, locate the didFinishLaunchingWithOptions
method, and within it, call the setup
method of the QiscusCoreManager
class with your App ID. This example initializes qiscusCore1
andqiscusCore2
// Initialize QiscusCore instances
QiscusCoreManager.qiscusCore1.setup(AppID: "QISCUS_SDK_APP_ID1")
QiscusCoreManager.qiscusCore2.setup(AppID: "QISCUS_SDK_APP_ID2")
3. Usage with Specific QiscusCore
Object
With the QiscusCoreManager
class in place, you can easily manage and access the QiscusCore
instances for different App IDs throughout your application.
For example, to interact with qiscusCore1
:
QiscusCoreManager.qiscusCore1.shared.YOUR_METHOD_HERE()
QiscusCoreManager.qiscusCore2.shared.YOUR_METHOD_HERE()
Notes
-
In the newer version of the Qiscus Chat SDK, you need to create separate
QiscusCore
instances for each App ID you intend to use within your IOS application. -
Initializing each
QiscusCore
object with its respective App ID ensures that chat functionality is correctly configured for each application, and messages are sent and received using the appropriate chat configuration. -
Replace
"QISCUS_SDK_APP_ID1"
and"QISCUS_SDK_APP_ID2"
with your actual Qiscus Chat SDK App IDs.
Renamed Classes, Function, and Models
In version v3.x.x of the Chat SDK, several classes, functions, and models have been renamed to improve clarity, consistency, and alignment with best practices. These changes aim to enhance the overall development experience and maintain compatibility with the evolving standards of the SDK.
This section provides an overview of the renamed components and their new names. Developers should review these changes to ensure a smooth transition when upgrading to this version.
List of Renamed Function/Object
- get .username is renamed to get .name in QUser,QAccount,QParticipant (previous MemberModel,UserModel)
- get .email is renamed to get .id in QUser,QAccount,QParticipant (previous MemberModel,UserModel)
- get .username is renamed to get .sender.name in QMessage (previous CommentModel)
- get .date is renamed to get .timestamp in QMessage (previous CommentModel)
- get .uniqId is renamed to get .uniqueId in QMessage (previous CommentModel)
- get .timestamp is renamed to get .timestampString in QMessage (previous CommentModel)
- get .roomId is renamed to get .chatRoomId in QMessage (previous CommentModel)
- get .commentBeforeId is renamed to get .previousMessageId in QMessage (previous CommentModel)
- get .comment is renamed to get .message in QiscusDatabaseManager
List of Renamed Model
- RoomModel is renamed to QChatRoom.
- UserModel is renamed to QAccount.
- MemberModel is renamed to QUser.
- CommentModel is renamed to QMessage.
- CommentStatus is renamed to QMessageStatus.
- QiscusCommentReceivedEvent is renamed to QMessageReceivedEvent
Important Notes
- Make sure whether multiple APP IDs are used within one app.
- If multiple APP IDs are used within one app, you can use QiscusCore v.3.0.0-beta.16. Sample SDK for multiple APP IDs: link Sample Omnichannel Widget: link
- If different APP IDs are used within one app, meaning that the SDK app and Omnichannel are separate apps, you can use QiscusCore latest v.1.10.4. Sample SDK for a single APP ID: link Sample Omnichannel Widget: link
- See this comparison between older version to v3.x.x and MIGRATION-GUIDE on github for further information
Related to
Comments
0 comments
Please sign in to leave a comment.