Version 8.0 of the Instabug Cordova SDK contains various changes to our APIs. This document contains detailed instructions on how to migrate from previous versions of the SDK to version 8.0+.
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 has been marked as deprecated. While those APIs are still functional, they will be completely removed from a future release of the SDK, so please make sure to migrate all Instabug usage to the new APIs at the nearest opportunity.
Deprecated, Renamed and Moved Methods
setInvocationEvent
Previous Usage
cordova.plugins.instabug.setInvocationEvent(event, success, error);
New Usage
cordova.plugins.bugreporting.setInvocationEvents(
[cordova.plugins.bugReporting.invocationEvents.shake, cordova.plugins.bugReporting.invocationEvents.button],
function () {
console.log(‘Instabug invocation events set!’);
},
function (error) {
console.log(‘Instabug invocation events could not be set - ’ + error);
}
);
//where `events` is an array of InvocationEvent, list can be found in the InvocationEvent section at the bottom of the page
setPreInvocationHandler
Previous Usage
cordova.plugins.instabug.setPreInvocationHandler(success, error);
New Usage
cordova.plugins.bugReporting.setOnInvokeHandler(
function () {
//Add any logic you want to do here
console.log('On invocation logic');
},
function (error) {
console.log('On Invoke handler could not be set ' + error);
}
);
setPostInvocationHandler
Previous Usage
cordova.plugins.instabug.setPostInvocationHandler(success, error);
New Usage
cordova.plugins.bugReporting.setOnDismissHandler(
function () {
//Add any logic you want to do here
console.log('On invocation logic');
},
function (error) {
console.log('On Invoke handler could not be set ' + error);
}
);
dismiss
Previous Usage
cordova.plugins.instabug.dismiss(success, error);
New Usage
cordova.plugins.bugReporting.dismiss(success, error);
setAttachmentTypesEnabled
Previous Usage
cordova.plugins.instabug.setAttachmentTypesEnabled(screenshot, extraScreenshot,
galleryImage, screenRecording,
success, error);
New Usage
cordova.plugins.bugReporting.setEnabledAttachmentTypes(screenshot,
extraScreenshot,
galleryImage,
screenRecording,
success,
error);
//All properties are boolean values
invoke
Previous Usage
cordova.plugins.instabug.invoke();
New Usage
cordova.plugins.bugReporting.invoke(
cordova.plugins.bugReporting.invocationModes.chat, // this is optional
[cordova.plugins.bugReporting.invocationOptions.emailFieldHidden,
cordova.plugins.bugReporting.invocationOptions.commentFieldRequired], // this is optional
function () {
console.log('Invoke method successful');
},
function (error) {
console.log('Invoke method not successful ' + error);
}
);
setDidSelectPromptOptionHandler
Previous Usage
cordova.plugins.instabug.setDidSelectPromptOptionHandler(success, error);
New Usage
cordova.plugins.bugReporting.setDidSelectPromptOptionHandler(
function (promptOption) {
//Add any logic you want to do here
alert("Prompt option handler set succesfully. Prompt Option: " + promptOption);
},
function (error) {
console.log('Prompt option handler was not set succesfully - ' + error);
}
);
setExtendedBugReportMode
Previous Usage
cordova.plugins.instabug.setExtendedBugReportMode(extendedBugReportMode, success, error);
New Usage
cordova.plugins.bugReporting.setExtendedBugReportMode(
cordova.plugins.bugReporting.extendedBugReportMode.enabledWithRequiredFields,
function () {
console.log('Set extended bug report mode set successfully!');
},
function (error) {
console.log('Extended bug report mode could not be set - ' + error);
}
);
setSurveyEnabled
Previous Usage
cordova.plugins.instabug.setSurveysEnabled(isEnabled, success, error);
New Usage
cordova.plugins.surveys.setEnabled(isEnabled, success, error);
showSurveyIfAvailable
Previous Usage
cordova.plugins.instabug.showSurveyIfAvailable(success, error);
New Usage
cordova.plugins.surveys.showSurveyIfAvailable(success, error);(
function () {
console.log('Survey shown succesfully!');
},
function (error) {
console.log('Survey could not be shown successfully - ' + error);
}
);
setThresholdForReshowingSurveyAfterDismiss
Previous Usage
cordova.plugins.instabug.setThresholdForReshowingSurveyAfterDismiss(sessionsCount, daysCount, success, error);
New Usage
cordova.plugins.surveys.setThresholdForReshowingSurveyAfterDismiss(sessionsCount, daysCount, success, error);
getAvailableSurveys
Previous Usage
cordova.plugins.instabug.getAvailableSurveys(success, error);
New Usage
cordova.plugins.surveys.getAvailableSurveys(success, error);
setAutoShowingSurveysEnabled
Previous Usage
cordova.plugins.instabug.setAutoShowingSurveysEnabled(autoShowingSurveysEnabled, success, error);
New Usage
cordova.plugins.surveys.setAutoShowingEnabled(autoShowingSurveysEnabled, success, error);
setWillShowSurveyHandler
Previous Usage
cordova.plugins.instabug.setWillShowSurveyHandler(success, error);
New Usage
cordova.plugins.surveys.setOnShowHandler(success, error);
setDidDismissSurveyHandler
Previous Usage
cordova.plugins.instabug.setDidDismissSurveyHandler(success, error);
New Usage
cordova.plugins.surveys.setOnDismissHandler(success, error);(
function () {
//Add any logic you want here
console.log('On dismiss survey handler set successfully!');
},
function (error) {
console.log('On dismiss survey handler could not be set successfully - ' + error);
}
);
showSurveyWithToken
Previous Usage
cordova.plugins.instabug.showSurveyWithToken(surveyToken, success, error);
New Usage
cordova.plugins.surveys.showSurveyWithToken(surveyToken, success, error);
hasRespondedToSurveyWithToken
Previous Usage
cordova.plugins.instabug.hasRespondedToSurveyWithToken(surveyToken, success, error);
New Usage
cordova.plugins.surveys.hasRespondedToSurveyWithToken(surveyToken, success, error);
setShouldShowSurveysWelcomeScreen
Previous Usage
cordova.plugins.instabug.setShouldShowSurveysWelcomeScreen(shouldShowWelcomeScreen, success, error);
New Usage
cordova.plugins.surveys.setShouldShowSurveysWelcomeScreen(shouldShowWelcomeScreen, success, error);
showFeatureRequests
Previous Usage
cordova.plugins.instabug.showFeatureRequests(success, error);
New Usage
cordova.plugins.featureRequests.show(success, error);
setEmailFieldRequiredForFeatureRequests
Previous Usage
cordova.plugins.instabug.setEmailFieldRequiredForFeatureRequests(isRequired, actionTypes, success, error);
New Usage
cordova.plugins.featureRequests.setEmailFieldRequired(
true,
[cordova.plugins.featureRequests.actionTypes.requestNewFeature],
function () {
console.log('Email field required for feature requests is set successfully!');
},
function (error) {
console.log('Email field required for feature requests could not be set successfully - ' + error);
}
);
New Methods
setInvocationOptions
cordova.plugins.bugreporting.setInvocationOptions(
[cordova.plugins.bugReporting.invocationOptions.emailFieldHidden
,cordova.plugins.bugReporting.invocationOptions.commentFieldRequired],
function () {
console.log('Instabug invocation options set!');
},
function (error) {
console.log('Instabug invocation options set!' could not be set - ' + error);
}
);
//where `options` is an array of InvocationOption which can be found below in the New Properties section
New and Modified Properties
InvocationOption Enums
cordova.plugins.bugReporting.invocationOptions.emailFieldHidden
cordova.plugins.bugReporting.invocationOptions.emailFieldOptional
cordova.plugins.bugReporting.invocationOptions.commentFieldRequired
cordova.plugins.bugReporting.invocationOptions.disablePostSendingDialog
InvocationMode Enums
cordova.plugins.bugReporting.invocationModes.chat
cordova.plugins.bugReporting.invocationModes.chats
cordova.plugins.bugReporting.invocationModes.bug
cordova.plugins.bugReporting.invocationModes.feedback
cordova.plugins.bugReporting.invocationModes.options
InvocationEvent Enums
cordova.plugins.bugReporting.invocationEvents.shake
cordova.plugins.bugReporting.invocationEvents.button
cordova.plugins.bugReporting.invocationEvents.screenshot
cordova.plugins.bugReporting.invocationEvents.swipe
cordova.plugins.bugReporting.invocationEvents.none
ExtendedBugReportMode Enums
cordova.plugins.bugReporting.extendedBugReportMode.enabledWithRequiredFields
cordova.plugins.bugReporting.extendedBugReportMode.enabledWithOptionalFields
cordova.plugins.bugReporting.extendedBugReportMode.disabled
PromptOption Enums
cordova.plugins.bugReporting.promptOptions.bug
cordova.plugins.bugReporting.promptOptions.chat
cordova.plugins.bugReporting.promptOptions.feedback
ActionType
cordova.plugins.featureRequests.actionTypes.requestNewFeature
cordova.plugins.featureRequests.actionTypes.addCommentToFeature
Updated 2 years ago