Version 8.0 of the Instabug iOS SDK contains various changes to our APIs. This document contains detailed instructions on how to migrate from previous versions of the SDK to Instabug Version 8.0 and above.
To make our APIs more intuitive, more organized and easier to use, we renamed some of them and restructured them into different classes.
Summary of Changes
In addition to the Instabug
class, Instabug now has the following additional classes:
BugReporting
Surveys
FeatureRequests
Each class contains methods and properties of a single product or feature.
See all changes here:
API Deprecations
For APIs that have been moved to other classes or renamed, the old versions in the
Instabug
class have been deprecated and completely removed from the SDK, so please make sure to migrate all Instabug usage to the new APIs at the nearest opportunity.
Deprecated, Renamed and Moved Methods
Importing
Previous Usage
import Instabug from 'instabug-reactnative';
New Usage
import Instabug, { BugReporting, Surveys, FeatureRequests } from 'instabug-reactnative';
Android Builder
Previous Usage
new RNInstabugReactnativePackage.Builder("TOKEN",MainApplication.this)
.setInvocationEvent("button")
.setPrimaryColor("#1D82DC")
.setFloatingEdge("left")
.setFloatingButtonOffsetFromTop(250)
.build()
New Usage
new RNInstabugReactnativePackage.Builder("TOKEN",MainApplication.this)
.setInvocationEvent("shake", "button", "screenshot")
.setPrimaryColor("#1D82DC")
.setFloatingEdge("left")
.setFloatingButtonOffsetFromTop(250)
.build()
startWithToken
Breaking Change
This is a breaking change and needs to be changed or else it will throw an exception.
startWithToken
now takes an array of events rather than a single event.
Previous Usage
Instabug.startWithToken('IOS_APP_TOKEN', Instabug.invocationEvent.shake);
New Usage
Instabug.startWithToken('IOS_APP_TOKEN', [Instabug.invocationEvent.shake, Instabug.invocationEvent.button]);
invokeWithMode
Previous Usage
Instabug.invokeWithMode(invocationMode);
New Usage
BugReporting.invokeWithInvocationModeAndOptions(invocationMode, invocationOptions);
Note: invocationMode
and invocationOptions
can be found here.
setPreInvocationHandler
Previous Usage
Instabug.setPreInvocationHandler(preInvocationHandler);
New Usage
BugReporting.OnInvokeHandler(onInvokeHandler);
onSDKDismissedHandler
Previous Usage
Instabug.setPostInvocationHandler(postInvocationHandler);
New Usage
BugReporting.onSDKDismissedHandler(postInvocationHandler);
dismiss
Previous Usage
Instabug.dismiss();
New Usage
BugReporting.dismiss();
setPreSendingHandler
Previous Usage
Instabug.setPreSendingHandler(preSendingHandler);
New Usage
BugReporting.onReportSubmitHandler(preSendingHandler);
invoke
Previous Usage
Instabug.invoke();
New Usage
BugReporting.invoke();
setInvocationEvents
Previous Usage
Instabug.setInvocationEvents(invocationEvents);
New Usage
BugReporting.setInvocationEvents(invocationEvents);
setPromptOptionsEnabled
Previous Usage
Instabug.setPromptOptionsEnabled(chat, bug, feedback);
New Usage
BugReporting.setPromptOptionsEnabled(chat, bug, feedback);
setShakingThresholdForIPhone
Previous Usage
Instabug.setShakingThresholdForIPhone(iPhoneShakingThreshold);
New Usage
BugReporting.setShakingThresholdForiPhone(iPhoneShakingThreshold);
BugReporting.setShakingThresholdForiPad(iPadShakingThreshold);
setShakingThresholdForAndroid
Previous Usage
Instabug.setShakingThresholdForAndroid(androidThreshold);
New Usage
BugReporting.setShakingThresholdForAndroid(androidThreshold);
setExtendedBugReportMode
Previous Usage
Instabug.setExtendedBugReportMode(extendedBugReportMode);
New Usage
BugReporting.setExtendedBugReportMode(extendedBugReportMode);
showSurveyIfAvailable
Previous Usage
Instabug.showSurveyIfAvailable();
New Usage
Surveys.showSurveyIfAvailable();
setThresholdForReshowingSurveyAfterDismiss
Previous Usage
Instabug.setThresholdForReshowingSurveyAfterDismiss(sessionCount, daysCount);
New Usage
Surveys.setThresholdForReshowingSurveyAfterDismiss(sessionCount, daysCount);
getAvailableSurveys
Previous Usage
Instabug.getAvailableSurveys(availableSurveysCallback);
New Usage
Surveys.getAvailableSurveys(availableSurveysCallback);
setAutoShowingEnabled
Previous Usage
Instabug.setAutoShowingEnabled(autoShowingSurveysEnabled);
New Usage
Surveys.setAutoShowingEnabled(autoShowingSurveysEnabled);
setWillShowSurveyHandler
Previous Usage
Instabug.setWillShowSurveyHandler(willShowSurveyHandler);
New Usage
Surveys.onShowCallback(willShowSurveyHandler);
setDidDismissSurveyHandler
Previous Usage
Instabug.setDidDismissSurveyHandler(didDismissSurveyHandler);
New Usage
Surveys.onDismissCallback(willShowSurveyHandler);
showSurveyWithToken
Previous Usage
Instabug.showSurveyWithToken(surveyToken);
New Usage
Surveys.showSurvey(surveyToken);
hasRespondedToSurveyWithToken
Previous Usage
Instabug.hasRespondedToSurveyWithToken(surveyToken, surveyTokenCallback);
New Usage
Surveys.hasRespondedToSurvey(surveyToken, surveyTokenCallback);
setShouldShowSurveysWelcomeScreen
Previous Usage
Instabug.setShouldShowSurveysWelcomeScreen(shouldShowWelcomeScreen);
New Usage
Surveys.setShouldShowWelcomeScreen(shouldShowWelcomeScreen);
showFeatureRequests
Previous Usage
Instabug.showFeatureRequests();
New Usage
FeatureRequests.show();
setEmailFieldRequiredForFeatureRequests
Previous Usage
Instabug.setEmailFieldRequiredForFeatureRequests(isEmailFieldRequired, actionTypes);
New Usage
FeatureRequests.setEmailFieldRequired(isEmailFieldRequired, actionTypes);
New Methods
setInvocationOptions
BugReporting.setInvocationOptions(options);
//where `options` is an array of InvocationOption which can be found below in the New Properties section
New and Modified Properties
InvocationOption Enums
BugReporting.invocationOptions.emailFieldHidden;
BugReporting.invocationOptions.emailFieldOptional;
BugReporting.invocationOptions.commentFieldRequired;
BugReporting.invocationOptions.disablePostSendingDialog;
InvocationMode Enums
Previous Usage
Instabug.invocationMode.NA;
Instabug.invocationMode.newBug;
Instabug.invocationMode.newFeedback;
Instabug.invocationMode.newChat;
Instabug.invocationMode.chatsList;
New Usage
BugReporting.invocationMode.NA;
BugReporting.invocationMode.newBug;
BugReporting.invocationMode.newFeedback;
BugReporting.invocationMode.newChat;
BugReporting.invocationMode.chatsList;
InvocationEvent Enums
Previous Usage
Instabug.invocationEvent.none;
Instabug.invocationEvent.shake;
Instabug.invocationEvent.screenshot;
Instabug.invocationEvent.twoFingersSwipe;
Instabug.invocationEvent.floatingButton;
New Usage
BugReporting.invocationEvent.none;
BugReporting.invocationEvent.shake;
BugReporting.invocationEvent.screenshot;
BugReporting.invocationEvent.twoFingersSwipe;
BugReporting.invocationEvent.floatingButton;
ExtendedBugReportMode Enums
Previous Usage
Instabug.extendedBugReportMode.enabledWithRequiredFields;
Instabug.extendedBugReportMode.enabledWithOptionalFields;
Instabug.extendedBugReportMode.disabled;
New Usage
BugReporting.extendedBugReportMode.enabledWithRequiredFields;
BugReporting.extendedBugReportMode.enabledWithOptionalFields;
BugReporting.extendedBugReportMode.disabled;
PromptOption Enums
Previous Usage
Instabug.promptOption.bug;
Instabug.promptOption.chat;
Instabug.promptOption.feedback;
New Usage
BugReporting.promptOption.bug;
BugReporting.promptOption.chat;
BugReporting.promptOption.feedback;
Updated 2 years ago