SDK 8.1 Migration Guide
The main objective of this release is to give you more control over the Instabug products you use.
For example, let's say that from the Prompt Options menu, you want your app users to be able to "Report a problem" and "Suggest an improvement", but not "Ask a question"¹, but you still want to be able to have conversations with users who send you bugs and feedback.
Starting from SDK V8.1, you can achieve this by keeping BugReporting
/IBGBugReporting
enabled, disabling a new class for Chats
/IBGChats
, and enabling a new class for Replies
/IBGReplies
.
To provide this level of control, we introduced new classes, moved some APIs, renamed others and deprecated old versions. These changes affect users of all Instabug products across all OS platforms.
This migration guide explains the details related to each change, how to drop the old APIs, and how to adopt the new ones.
¹ "Ask a question" is the new default copy in the Prompt Options menu, replacing "Talk to us"
Summary of Changes
- Introduced new classes:
IBGChats
IBGReplies
- Added new APIs and properties to the following classes:
IBGBugReporting
Instabug
- Moved some APIs from
Instabug
toIBGReplies
. - Renamed some APIs & properties.
- Deprecated some APIs in
IBGBugReporting
.
When used from Swift, drop the IBG
prefix from the classes mentioned above to become:
BugReporting
Chats
Replies
In the following sections, you can find detailed changes related to each class.
invoke
Previous Usage
BugReporting.invoke()
[IBGBugReporting invoke];
New Usage
Instabug.show()
[Instabug show];
invoke(with: or invokeWithMode
Previous Usage
// Compose a new bug report
BugReporting.invoke(with: .newBug, options: [])
// Compose new feedback
BugReporting.invoke(with: .newFeedback, options: [])
// Compose new chat
BugReporting.invoke(with: .newChat, options: [])
// Show chat history
BugReporting.invoke(with: .chatsList, options: [])
// Compose a new bug report
[IBGBugReporting invokeWithMode:IBGInvocationModeNewBug options:0];
// Compose new feedback
[IBGBugReporting invokeWithMode:IBGInvocationModeNewFeedback options:0];
// Compose new chat
[IBGBugReporting invokeWithMode:IBGInvocationModeNewChat options:0];
// Show chat history
[IBGBugReporting invokeWithMode:IBGInvocationModeChatsList options:0];
New Usage
// Compose a new bug report
BugReporting.show(with: .bug, options: [])
// Compose new feedback
BugReporting.show(with: .feedback, options: [])
// Compose new chat
Chats.show()
// Show chat history only if the user already has a chat history. Calling this API won't have an effect otherwise.
Replies.show()
// Compose a new bug report
[IBGBugReporting showWithReportType:IBGBugReportingReportTypeBug options:0];
// Compose new feedback
[IBGBugReporting showWithReportType:IBGBugReportingReportTypeFeedback options:0];
// Compose new chat
[IBGChats show];
// Show chat history only if the user already has a chat history. Calling this API won't have an effect otherwise.
[IBGReplies show];
hasChats
New Usage
Check if your user has a chat history with you
The
show
API inside the Replies class opens the list of messages in your app only if the user already has a chat history. Otherwise, this API has no effect. If you manually show the replies page, we recommend using the new APIhasChats
.
Use the API below to check whether the user has a chat history with your team, then show them the replies page or not.
Replies.hasChats()
[IBGReplies hasChats];
invocationOptions
Previous Usage
BugReporting.invocationOptions = [.emailFieldOptional, .commentFieldRequired]
IBGBugReporting.invocationOptions = IBGBugReportingOptionCommentFieldRequired;
New Usage
BugReporting.bugReportingOptions = .emailFieldOptional
IBGBugReporting.bugReportingOptions = IBGBugReportingOptionEmailFieldOptional;
promptOptions
Previous Usage
BugReporting.promptOptions = [.bug, .chat]
IBGBugReporting.promptOptions = IBGPromptOptionBug|IBGPromptOptionChat;
New Usage
New Prompt Options Experience
In older versions of the SDK, the "Talk to us" option would open a new chat if the user did not have a chat history with you. If the user did have a chat history, selecting this option would open the list of conversations.
Starting from SDK V8.1, the default copy for this button is now "Ask a question", and selecting this option will now always open a new chat. If the user has a chat history with you, a new button appears in the top-right of the modal that opens the list of replies. "Ask a question" and the button to open the list of replies can be enabled and disabled independently of one another.
// Disable Bug Reporting & Feedback. If disabled, both "Report a problem" and "Suggest an improvement" are removed from the Prompt Options menu, and manually showing Bug Reporting & Feedback has no effect.
BugReporting.enabled = false
// Disable In-App Chat. If disabled, "Ask a question" (new default copy instead of "Talk to us") is removed from the Prompt Options menu, the compose button in the replies list is removed, and manually showing the compose view of In-App Chat has no effect.
Chats.enabled = false
// Disable Replies. If disabled, the button to view the replies list is removed from the Prompt Options menu, in-app notifications are disabled, and manually showing the replies list has no effect.
Replies.enabled = false
// Disable Bug Reporting & Feedback. If disabled, both "Report a problem" and "Suggest an improvement" are removed from the Prompt Options menu, and manually showing Bug Reporting & Feedback has no effect.
IBGBugReporting.enabled = NO;
// Disable In-App Chat. If disabled, "Ask a question" (new default copy instead of "Talk to us") is removed from the Prompt Options menu, the compose button in the replies list is removed, and manually showing the compose view of In-App Chat has no effect.
IBGChats.enabled = NO;
// Disable Replies. If disabled, the button to view the replies list is removed from the Prompt Options menu, in-app notifications are disabled, and manually showing the replies list has no effect.
IBGReplies.enabled = NO;
promptOptionsEnabledReportTypes
New Usage
If you want to enable or disable the "Report a problem" (submit a bug report) and/or "Suggest an improvement" (submit feedback) Prompt Options independently, you can use the promptOptionsEnabledReportTypes
property as displayed below.
BugReporting.promptOptionsEnabledReportTypes = [.bug, .feedback]
IBGBugReporting.promptOptionsEnabledReportTypes = IBGBugReportingReportTypeBug | IBGBugReportingReportTypeFeedback;
didRecieveReplyHandler
Previous Usage
Instabug.didRecieveReplyHandler = {
// Notify users about new message.
}
Instabug.didRecieveReplyHandler = ^{
// Notify users about new message.
};
New Usage
Replies.didReceiveReplyHandler = {
// Notify users about new message.
}
IBGReplies.didReceiveReplyHandler = ^{
// Notify users about new message.
};
replyNotificationsEnabled
Previous Usage
Instabug.replyNotificationsEnabled = false
Instabug.replyNotificationsEnabled = NO;
New Usage
Replies.inAppNotificationsEnabled = false
IBGReplies.inAppNotificationsEnabled = NO;
unreadMessagesCount
Previous Usage
let messageCount = Instabug.unreadMessagesCount
NSUInteger messageCount = Instabug.unreadMessagesCount;
New Usage
let messageCount = Replies.unreadRepliesCount
NSUInteger messageCount = IBGReplies.unreadRepliesCount;
setPushNotificationsEnabled
Previous Usage
Instabug.setPushNotificationsEnabled(false)
[Instabug setPushNotificationsEnabled:NO];
New Usage
Replies.pushNotificationsEnabled = false
[IBGReplies setPushNotificationsEnabled:NO];
didReceiveRemoteNotification
Previous Usage
let isInstabugNotification = Instabug.didReceiveRemoteNotification(userInfo)
BOOL isInstabugNotification = [Instabug didReceiveRemoteNotification:notificationDictionary];
New Usage
let isInstabugNotification = Replies.didReceiveRemoteNotification(userInfo)
BOOL isInstabugNotification = [IBGReplies didReceiveRemoteNotification:notificationDictionary];
didRegisterForRemoteNotifications(withDeviceToken: or didRegisterForRemoteNotificationsWithDeviceToken
Previous Usage
Instabug.didRegisterForRemoteNotifications(withDeviceToken: deviceToken)
[Instabug didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
New Usage
Replies.didRegisterForRemoteNotifications(withDeviceToken: deviceToken)
[IBGReplies didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
setValue
Previous Usage
Instabug.setValue("STRING", forStringWithKey: kIBGTalkToUsStringName)
[Instabug setValue:@"STRING" forStringWithKey:kIBGTalkToUsStringName];
New Usage
Instabug.setValue("STRING", forStringWithKey: kIBGAskAQuestionStringName)
[Instabug setValue:@"STRING" forStringWithKey:kIBGAskAQuestionStringName];
Updated almost 5 years ago