2016-10-09 14:50:04 +02:00
|
|
|
/**
|
|
|
|
* Sample React Native App
|
|
|
|
* https://github.com/facebook/react-native
|
|
|
|
* @flow
|
|
|
|
*/
|
|
|
|
|
2016-10-11 16:19:50 +02:00
|
|
|
import { NativeModules, NativeAppEventEmitter } from 'react-native';
|
2016-10-09 14:50:04 +02:00
|
|
|
|
|
|
|
let {Instabug} = NativeModules;
|
|
|
|
|
|
|
|
module.exports = {
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Starts the SDK.
|
|
|
|
* This is the main SDK method that does all the magic. This is the only
|
|
|
|
* method that SHOULD be called.
|
|
|
|
* Should be called in constructor of the app registery component
|
|
|
|
* @param {string} token The token that identifies the app, you can find
|
|
|
|
* it on your dashboard.
|
|
|
|
* @param {constants.invocationEvent} invocationEvent The event that invokes
|
|
|
|
* the SDK's UI.
|
|
|
|
*/
|
|
|
|
startWithToken: function(token, invocationEvent) {
|
2016-10-09 14:50:04 +02:00
|
|
|
Instabug.startWithToken(token, invocationEvent);
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Invokes the SDK manually with the default invocation mode.
|
|
|
|
* Shows a view that asks the user whether they want to start a chat, report
|
|
|
|
* a problem or suggest an improvement.
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
invoke: function() {
|
|
|
|
Instabug.invoke();
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Invokes the SDK with a specific mode.
|
|
|
|
* Invokes the SDK and show a specific view, instead of showing a prompt for
|
|
|
|
* users to choose from.
|
|
|
|
* @param {constants.invocationMode} invocationMode Specifies which mode the
|
|
|
|
* SDK is going to start with.
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
invokeWithInvocationMode: function(invocationMode) {
|
|
|
|
Instabug.invokeWithInvocationMode(invocationMode);
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Dismisses any Instabug views that are currently being shown.
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
dismiss: function () {
|
|
|
|
Instabug.dismiss();
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Attaches a file to each report being sent.
|
|
|
|
* A new copy of the file at fileLocation will be attached with each bug
|
|
|
|
* report being sent.
|
|
|
|
* Each call to this method overrides the file to be attached.
|
|
|
|
* The file has to be available locally at the provided path.
|
|
|
|
* @param {string} fileLocation Path to a file that's going to be attached
|
|
|
|
* to each report.
|
|
|
|
*/
|
2016-10-11 16:19:50 +02:00
|
|
|
// Not yet testsed
|
2016-10-09 14:50:04 +02:00
|
|
|
setFileAttachment: function(fileLocation) {
|
|
|
|
Instabug.setFileAttachment(fileLocation);
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Attaches user data to each report being sent.
|
|
|
|
* Each call to this method overrides the user data to be attached.
|
|
|
|
* Maximum size of the string is 1,000 characters.
|
|
|
|
* @param {string} userData A string to be attached to each report, with a
|
|
|
|
* maximum size of 1,000 characters.
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
setUserData: function(userData) {
|
|
|
|
Instabug.setUserData(userData);
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Adds custom logs that will be sent with each report.
|
|
|
|
* @param {string} log Message to be logged.
|
|
|
|
*/
|
2016-10-11 16:19:50 +02:00
|
|
|
// Needs renaming
|
2016-10-09 14:50:04 +02:00
|
|
|
IBGLog: function(log) {
|
|
|
|
Instabug.IBGLog(log);
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Sets whether the SDK is tracking user steps or not.
|
|
|
|
* Enabling user steps would give you an insight on the scenario a user has
|
|
|
|
* performed before encountering a bug or a crash. User steps are attached
|
|
|
|
* with each report being sent.
|
|
|
|
* @param {boolean} isUserStepsEnabled A boolean to set user steps tracking
|
|
|
|
* to being enabled or disabled.
|
|
|
|
*/
|
|
|
|
// Not working
|
2016-10-09 14:50:04 +02:00
|
|
|
setUserStepsEnabled: function(isUserStepsEnabled) {
|
|
|
|
Instabug.setUserStepsEnabled(isUserStepsEnabled);
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Sets a block of code to be executed before sending each report.
|
|
|
|
* This block is executed in the background before sending each report. Could
|
|
|
|
* be used for attaching logs and extra data to reports.
|
|
|
|
* @callback handler - A callback that gets executed before sending each bug
|
|
|
|
* report.
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
setPreSendingHandler: function(handler) {
|
2016-10-11 16:19:50 +02:00
|
|
|
Instabug.addListener('IBGpreSendingHandler');
|
|
|
|
NativeAppEventEmitter.addListener(
|
|
|
|
'IBGpreSendingHandler',
|
|
|
|
handler
|
|
|
|
);
|
|
|
|
|
2016-10-09 14:50:04 +02:00
|
|
|
Instabug.setPreSendingHandler(handler);
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Sets a block of code to be executed just before the SDK's UI is presented.
|
|
|
|
* This block is executed on the UI thread. Could be used for performing any
|
|
|
|
* UI changes before the SDK's UI is shown.
|
|
|
|
* @callback handler - A callback that gets executed before sending each bug report.
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
setPreInvocationHandler: function(handler) {
|
2016-10-11 16:19:50 +02:00
|
|
|
Instabug.addListener('IBGpreInvocationHandler');
|
|
|
|
NativeAppEventEmitter.addListener(
|
|
|
|
'IBGpreInvocationHandler',
|
|
|
|
handler
|
|
|
|
);
|
|
|
|
|
2016-10-09 14:50:04 +02:00
|
|
|
Instabug.setPreInvocationHandler(handler);
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Sets a block of code to be executed right after the SDK's UI is dismissed.
|
|
|
|
* This block is executed on the UI thread. Could be used for performing any
|
|
|
|
* UI changes after the SDK's UI is dismissed.
|
|
|
|
* @callback handler - A callback that gets executed after the SDK's UI is dismissed.
|
2016-10-11 16:19:50 +02:00
|
|
|
* @param {constants.dismissType} dismissType How the SDK was dismissed.
|
|
|
|
* @param {constants.reportType} reportType Type of report that has been sent. Will be set
|
2016-10-10 18:08:20 +02:00
|
|
|
* to IBGReportTypeBug in case the SDK has been dismissed without selecting a
|
|
|
|
* report type, so you might need to check issueState before reportType
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
setPostInvocatioHandler: function(handler) {
|
2016-10-11 16:19:50 +02:00
|
|
|
Instabug.addListener('IBGpostInvocationHandler');
|
|
|
|
NativeAppEventEmitter.addListener(
|
|
|
|
'IBGpostInvocationHandler',
|
|
|
|
function(payload) {
|
|
|
|
handler(payload['dismissType'], payload['reportType']);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2016-10-09 14:50:04 +02:00
|
|
|
Instabug.setPostInvocatioHandler(handler);
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Present a view that educates the user on how to invoke the SDK with the
|
|
|
|
* currently set invocation event.
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
showIntroMessage: function() {
|
|
|
|
Instabug.showIntroMessage();
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Sets the default value of the user's email and hides the email field
|
|
|
|
* from the reporting UI.
|
|
|
|
* Defaults to an empty string.
|
|
|
|
* @param {string} userEmail An email address to be set as the user's email.
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
setUserEmail: function(userEmail) {
|
|
|
|
Instabug.setUserEmail(userEmail);
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Sets the default value of the user's name to be included with all reports.
|
|
|
|
* Defaults to an empty string.
|
|
|
|
* @param {string} userName Name of the user to be set.
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
setUserName: function(userName) {
|
|
|
|
Instabug.setUserName(userName);
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Enables/disables screenshot view when reporting a bug/improvement.
|
|
|
|
* By default, screenshot view is shown when reporting a bug, but not when
|
|
|
|
* sending feedback.
|
|
|
|
* @param {boolean} willSkipeScreenshotAnnotation sets whether screenshot view is
|
|
|
|
* shown or not. Passing YES will show screenshot view for both feedback and
|
|
|
|
* bug reporting, while passing NO will disable it for both.
|
|
|
|
*/
|
2016-10-11 16:19:50 +02:00
|
|
|
// Doesn't work on existing SDK
|
2016-10-09 14:50:04 +02:00
|
|
|
setWillSkipScreenshotAnnotation: function(willSkipeScreenshotAnnotation) {
|
|
|
|
Instabug.setWillSkipScreenshotAnnotation(willSkipeScreenshotAnnotation);
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Returns the number of unread messages the user currently has.
|
|
|
|
* Use this method to get the number of unread messages the user
|
|
|
|
* has, then possibly notify them about it with your own UI.
|
|
|
|
* @callback responseCallback
|
|
|
|
* @param {number} responseCount Notifications count, or -1 incase the SDK has
|
|
|
|
* not been initialized.
|
|
|
|
*/
|
|
|
|
getUnreadMessagesCount: function(responseCallBack) {
|
|
|
|
Instabug.getUnreadMessagesCount(responseCallBack);
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the event that invoke the feedback form.
|
|
|
|
* Default is set by `Instabug.startWithToken`.
|
|
|
|
* @param {constants.invocattionEvent} invocationEvent Event that invokes the
|
|
|
|
* feedback form.
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
setInvocationEvent: function(invocationEvent) {
|
|
|
|
Instabug.setInvocationEvent(invocationEvent);
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Enables/disables the use of push notifications in the SDK.
|
|
|
|
* Defaults to YES.
|
|
|
|
* @param {boolean} isPushNotificationEnabled A boolean to indicate whether push
|
|
|
|
* notifications are enabled or disabled.
|
|
|
|
*/
|
2016-10-11 16:19:50 +02:00
|
|
|
// Not tested
|
2016-10-09 14:50:04 +02:00
|
|
|
setPushNotificationsEnabled: function(isPushNotificationEnabled) {
|
|
|
|
Instabug.setPushNotificationsEnabled(isPushNotificationEnabled);
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Sets whether users are required to enter an email address or not when
|
|
|
|
* sending reports.
|
|
|
|
* Defaults to YES.
|
|
|
|
* @param {boolean} isEmailFieldRequired A boolean to indicate whether email
|
|
|
|
* field is required or not.
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
setEmailFieldRequired: function(isEmailFieldRequired) {
|
|
|
|
Instabug.setEmailFieldRequired(isEmailFieldRequired);
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Sets whether users are required to enter a comment or not when sending reports.
|
|
|
|
* Defaults to NO.
|
|
|
|
* @param {boolean} isCommentFieldRequired A boolean to indicate whether comment
|
|
|
|
* field is required or not.
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
setCommentFieldRequired: function(isCommentFieldRequired) {
|
|
|
|
Instabug.setCommentFieldRequired(isCommentFieldRequired);
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Sets the threshold value of the shake gesture for iPhone/iPod Touch and iPad.
|
|
|
|
* Default for iPhone is 2.5.
|
|
|
|
* Default for iPad is 0.6.
|
|
|
|
* @param {number} iPhoneShakingThreshold Threshold for iPhone.
|
|
|
|
* @param {number} iPadShakingThreshold Threshold for iPad.
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
setShakingThresholdForiPhone: function(iphoneThreshold, ipadThreshold) {
|
|
|
|
Instabug.setShakingThresholdForiPhone(iphoneThreshold, ipadThreshold);
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Sets the default edge and offset from the top at which the floating button
|
|
|
|
* will be shown. Different orientations are already handled.
|
|
|
|
* Default for `floatingButtonEdge` is `constants.rectEdge.maxX`.
|
|
|
|
* Default for `floatingButtonOffsetFromTop` is 50
|
|
|
|
* @param {constants.rectEdge} floatingButtonEdge `maxX` to show on the right,
|
|
|
|
* or `minX` to show on the left.
|
|
|
|
* @param {numnber} offsetFromTop floatingButtonOffsetFromTop Top offset for
|
|
|
|
* floating button.
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
setFloatingButtonEdge: function(floatingButtonEdge, offsetFromTop) {
|
|
|
|
Instabug.setFloatingButtonEdge(floatingButtonEdge, offsetFromTop);
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Sets the SDK's locale.
|
|
|
|
* Use to change the SDK's UI to different language.
|
|
|
|
* Defaults to the device's current locale.
|
|
|
|
* @param {constants.locale} locale A locale to set the SDK to.
|
|
|
|
*/
|
|
|
|
setLocale: function(locale) {
|
|
|
|
Instabug.setLocale(locale);
|
2016-10-09 14:50:04 +02:00
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Sets whether the intro message that gets shown on launching the app is
|
|
|
|
* enabled or not.
|
|
|
|
* Defaults to YES.
|
|
|
|
* @param {boolean} isIntroMessageEnabled A boolean to indicate whether the
|
|
|
|
* intro message is enabled or not.
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
setIntroMessageEnabled: function(isIntroMessageEnabled) {
|
|
|
|
Instabug.setIntroMessageEnabled(isIntroMessageEnabled);
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Sets the color theme of the SDK's whole UI.
|
|
|
|
* @param {contants.colorTheme) colorTheme An `constants.colorTheme` to set
|
|
|
|
* the SDK's UI to.
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
setColorTheme: function(colorTheme) {
|
|
|
|
Instabug.setColorTheme(colorTheme);
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Sets the primary color of the SDK's UI.
|
|
|
|
* Sets the color of UI elements indicating interactivity or call to action.
|
|
|
|
* To use, import processColor and pass to it with argument the color hex
|
|
|
|
* as argument.
|
|
|
|
* @param {color} color A color to set the UI elements of the SDK to.
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
setPrimaryColor: function(primaryColor) {
|
|
|
|
Instabug.setPrimaryColor(primaryColor);
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Appends a set of tags to previously added tags of reported feedback,
|
|
|
|
* bug or crash.
|
|
|
|
* @param {string[]} tags An array of tags to append to current tags.
|
|
|
|
*/
|
|
|
|
appendTags: function(tags) {
|
|
|
|
Instabug.appendTags(tags);
|
2016-10-09 14:50:04 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
// TODO: research this: vvvv
|
|
|
|
// + (void)setScreenshotCapturingHandler:(UIImage *(^)())screenshotCapturingHandler;
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Manually removes all tags of reported feedback, bug or crash.
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
resetTags: function () {
|
|
|
|
Instabug.resetTags();
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Gets all tags of reported feedback, bug or crash.
|
|
|
|
* @callback responseCallback
|
|
|
|
* @param {string[]} tags of reported feedback, bug or crash.
|
|
|
|
*/
|
|
|
|
getTags: function(responseCallBack) {
|
|
|
|
Instabug.getTags(responseCallBack);
|
2016-10-09 14:50:04 +02:00
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Overrides any of the strings shown in the SDK with custom ones.
|
|
|
|
* Allows you to customize any of the strings shown to users in the SDK.
|
|
|
|
* @param {string} string String value to override the default one.
|
|
|
|
* @param {constants.strings} key Key of string to override.
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
setStringToKey: function(string, key) {
|
|
|
|
Instabug.setString(string, key);
|
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Sets whether attachments in bug reporting and in-app messaging are enabled or not.
|
|
|
|
* @param {boolean} screenShot A boolean to enable or disable screenshot attachments.
|
|
|
|
* @param {boolean} extraScreenShot A boolean to enable or disable extra
|
|
|
|
* screenshot attachments.
|
|
|
|
* @param {boolean} galleryImage A boolean to enable or disable gallery image
|
|
|
|
* attachments. In iOS 10+,NSPhotoLibraryUsageDescription should be set in
|
|
|
|
* info.plist to enable gallery image attachments.
|
|
|
|
* @param {boolean} voiceNote A boolean to enable or disable voice note attachments.
|
|
|
|
* In iOS 10+, NSMicrophoneUsageDescription should be set in info.plist to enable
|
|
|
|
* voiceNote attachments.
|
|
|
|
* @param {boolean} screenRecording A boolean to enable or disable screen recording attachments.
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
// TODO: investigate doing it in more like JS pattern
|
2016-10-10 18:08:20 +02:00
|
|
|
setAttachmentTypesEnabled: function(screenshot, extraScreenshot, galleryImage, voiceNote, screenRecording) {
|
|
|
|
Instabug.setAttachmentTypesEnabled(screenshot, extraScreenshot, galleryImage, voiceNote, screenRecording);
|
2016-10-09 14:50:04 +02:00
|
|
|
},
|
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Enables/disables showing in-app notifications when the user receives a
|
|
|
|
* new message.
|
|
|
|
* @param {boolean} isChatNotificationEnabled A boolean to set whether
|
|
|
|
* notifications are enabled or disabled.
|
|
|
|
*/
|
2016-10-11 16:19:50 +02:00
|
|
|
// Not tested
|
2016-10-09 14:50:04 +02:00
|
|
|
setChatNotificationEnabled: function(isChatNotificationEnabled) {
|
|
|
|
Instabug.setChatNotificationEnabled(isChatNotificationEnabled);
|
|
|
|
},
|
|
|
|
|
2016-10-11 13:41:24 +02:00
|
|
|
/**
|
|
|
|
* Sets a block of code that gets executed when a new message is received.
|
|
|
|
* @callback handler - A callback that gets executed when a new message
|
|
|
|
* is received.
|
|
|
|
*/
|
|
|
|
setOnNewMessageHandler: function(handler) {
|
2016-10-11 16:19:50 +02:00
|
|
|
Instabug.addListener('IBGonNewMessageHandler');
|
|
|
|
NativeAppEventEmitter.addListener(
|
|
|
|
'IBGonNewMessageHandler',
|
|
|
|
handler
|
|
|
|
);
|
|
|
|
|
2016-10-11 13:41:24 +02:00
|
|
|
Instabug.setOnNewMessageHandler(handler);
|
|
|
|
},
|
2016-10-09 14:50:04 +02:00
|
|
|
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Enables/disables prompt options when SDK is invoked.
|
|
|
|
* When only a single option is enabled, it become the default invocation mode.
|
|
|
|
* If all options are disabled, bug reporting becomes the default invocation mode.
|
|
|
|
* By default, all three options are enabled.
|
|
|
|
* @param {boolean} bugReportEnabled A boolean to indicate whether bug reports
|
|
|
|
* are enabled or disabled.
|
|
|
|
* @param {boolean} feedbackEnabled A boolean to indicate whether feedback is
|
|
|
|
* enabled or disabled.
|
|
|
|
* @param {boolean} chatEnabled A boolean to indicate whether chat is enabled
|
|
|
|
* or disabled.
|
|
|
|
*/
|
|
|
|
setPromptOptions: function(isBugReportingEnabled, isFeedbackReportingEnabled, isChatEnabled) {
|
|
|
|
Instabug.setPromptOptions(isBugReportingEnabled, isFeedbackReportingEnabled, isChatEnabled);
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks if a notification is from Instabug.
|
|
|
|
* If you are using push notifications, use this method to check whether an
|
|
|
|
* incoming notification is from Instabug or not. If this method returns YES,
|
|
|
|
* you should call didReceiveRemoteNotification: to let the Instabug handle
|
|
|
|
* the notification. Otherwise, handle the notification on your own.
|
|
|
|
* @param {Object} dict Notification's userInfo
|
|
|
|
* @callback responseCallback
|
|
|
|
* @param {boolean} isInstabugNotification
|
|
|
|
*/
|
|
|
|
// Not tested
|
|
|
|
isInstabugNotification: function(dict, responseCallback) {
|
|
|
|
Instabug.isInstabugNotification(dict, responseCallback);
|
|
|
|
},
|
|
|
|
|
|
|
|
constants: {
|
|
|
|
/**
|
|
|
|
* The event used to invoke the feedback form
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
invocationEvent: {
|
2016-10-10 18:08:20 +02:00
|
|
|
none: Instabug.invocationEventNone,
|
|
|
|
shake: Instabug.invocationEventShake,
|
|
|
|
screenshot: Instabug.invocationEventScreenshot,
|
|
|
|
twoFingersSwipe: Instabug.invocationEventTwoFingersSwipe,
|
|
|
|
rightEdgePan: Instabug.invocationEventRightEdgePan,
|
|
|
|
floatingButton: Instabug.invocationEventFloatingButton
|
2016-10-09 14:50:04 +02:00
|
|
|
},
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Type of SDK dismiss
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
dismissType: {
|
2016-10-10 18:08:20 +02:00
|
|
|
submit: Instabug.dismissTypeSubmit,
|
|
|
|
cancel: Instabug.dismissTypeCancel,
|
|
|
|
addAttachment: Instabug.dismissTypeAddAttachment
|
2016-10-09 14:50:04 +02:00
|
|
|
},
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* Type of report to be submit
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
reportType: {
|
2016-10-10 18:08:20 +02:00
|
|
|
bug: Instabug.reportTypeBug,
|
|
|
|
feedback: Instabug.reportTypeFeedback
|
2016-10-09 14:50:04 +02:00
|
|
|
},
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* The mode used upon invocating the SDK
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
invocationMode: {
|
|
|
|
NA: Instabug.invocationModeNA,
|
2016-10-10 18:08:20 +02:00
|
|
|
newBug: Instabug.invocationModeNewBug,
|
|
|
|
newFeedback: Instabug.invocationModeNewFeedback,
|
|
|
|
newChat: Instabug.invocationModeNewChat,
|
|
|
|
chatsList: Instabug.invocationModeChatsList
|
2016-10-09 14:50:04 +02:00
|
|
|
},
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* The supported locales
|
|
|
|
*/
|
|
|
|
locale: {
|
|
|
|
arabic: Instabug.localeArabic,
|
|
|
|
chineseSimplified: Instabug.localeChineseSimplified,
|
|
|
|
chineseTraditional: Instabug.localeChineseTraditional,
|
|
|
|
czech: Instabug.localeCzech,
|
|
|
|
danish: Instabug.localeDanish,
|
|
|
|
english: Instabug.localeEnglish,
|
|
|
|
french: Instabug.localeFrench,
|
|
|
|
german: Instabug.localeGerman,
|
|
|
|
italian: Instabug.localeItalian,
|
|
|
|
japanese: Instabug.localeJapanese,
|
|
|
|
polish: Instabug.localePolish,
|
|
|
|
portugueseBrazil: Instabug.localePortugueseBrazil,
|
|
|
|
russian: Instabug.localeRussian,
|
|
|
|
spanish: Instabug.localeSpanish,
|
|
|
|
swedish: Instabug.localeSwedish,
|
|
|
|
turkish: Instabug.localeTurkish
|
2016-10-09 14:50:04 +02:00
|
|
|
},
|
2016-10-10 18:08:20 +02:00
|
|
|
/**
|
|
|
|
* The color theme of the different UI elements
|
|
|
|
*/
|
2016-10-09 14:50:04 +02:00
|
|
|
colorTheme: {
|
2016-10-10 18:08:20 +02:00
|
|
|
light: Instabug.colorThemeLight,
|
|
|
|
dark: Instabug.colorThemeDark
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* Rectangle edges
|
|
|
|
*/
|
|
|
|
rectEdge: {
|
|
|
|
minX: Instabug.rectMinXEdge,
|
|
|
|
minY: Instabug.rectMinYEdge,
|
|
|
|
maxX: Instabug.rectMaxXEdge,
|
|
|
|
maxY: Instabug.rectMaxYEdge
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* Instabug strings
|
|
|
|
*/
|
|
|
|
strings: {
|
|
|
|
shakeHint: Instabug.shakeHint,
|
|
|
|
swipeHint: Instabug.swipeHint,
|
|
|
|
edgeSwipeStartHint: Instabug.edgeSwipeStartHint,
|
|
|
|
startAlertText: Instabug.startAlertText,
|
|
|
|
invalidEmailMessage: Instabug.invalidEmailMessage,
|
|
|
|
invalidEmailTitle: Instabug.invalidEmailTitle,
|
|
|
|
invalidCommentMessage: Instabug.invalidCommentMessage,
|
|
|
|
invalidCommentTitle: Instabug.invalidCommentTitle,
|
|
|
|
invocationHeader: Instabug.invocationHeader,
|
|
|
|
talkToUs: Instabug.talkToUs,
|
|
|
|
reportBug: Instabug.reportBug,
|
|
|
|
reportFeedback: Instabug.reportFeedback,
|
|
|
|
emailFieldHint: Instabug.emailFieldHint,
|
|
|
|
commentFieldHintForBugReport: Instabug.commentFieldHintForBugReport,
|
|
|
|
commentFieldHintForFeedback: Instabug.commentFieldHintForFeedback,
|
|
|
|
addVideoMessage: Instabug.addVideoMessage,
|
|
|
|
addVoiceMessage: Instabug.addVoiceMessage,
|
|
|
|
addImageFromGallery: Instabug.addImageFromGallery,
|
|
|
|
addExtraScreenshot: Instabug.addExtraScreenshot,
|
|
|
|
audioRecordingPermissionDeniedTitle: Instabug.audioRecordingPermissionDeniedTitle,
|
|
|
|
audioRecordingPermissionDeniedMessage: Instabug.audioRecordingPermissionDeniedMessage,
|
|
|
|
microphonePermissionAlertSettingsButtonText: Instabug.microphonePermissionAlertSettingsButtonText,
|
|
|
|
recordingMessageToHoldText: Instabug.recordingMessageToHoldText,
|
|
|
|
recordingMessageToReleaseText: Instabug.recordingMessageToReleaseText,
|
|
|
|
conversationsHeaderTitle: Instabug.conversationsHeaderTitle,
|
|
|
|
screenshotHeaderTitle: Instabug.screenshotHeaderTitle,
|
|
|
|
chatsNoConversationsHeadlineText: Instabug.chatsNoConversationsHeadlineText,
|
|
|
|
doneButtonText: Instabug.doneButtonText,
|
|
|
|
okButtonText: Instabug.okButtonText,
|
|
|
|
cancelButtonText: Instabug.cancelButtonText,
|
|
|
|
thankYouText: Instabug.thankYouText,
|
|
|
|
audio: Instabug.audio,
|
|
|
|
video: Instabug.video,
|
|
|
|
image: Instabug.image,
|
|
|
|
chatsHeaderTitle: Instabug.chatsHeaderTitle,
|
|
|
|
team: Instabug.team,
|
|
|
|
messageNotification: Instabug.messageNotification,
|
|
|
|
messagesNotifiactionAndOthers: Instabug.messagesNotifiactionAndOthers
|
2016-10-09 14:50:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|