mirror of
https://github.com/status-im/instabug-reactnative.git
synced 2025-03-01 13:40:42 +00:00
🤝 Merge pull request #107 from Instabug/refactoring
📝 Adjusted code styles
This commit is contained in:
commit
81f119db1a
@ -112,8 +112,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
private final String ADD_EXTRA_SCREENSHOT = "addExtraScreenshot";
|
||||
private final String ADD_VIDEO = "addVideoMessage";
|
||||
|
||||
private final String AUDIO_RECORDING_PERMISSION_DENIED =
|
||||
"audioRecordingPermissionDeniedMessage";
|
||||
private final String AUDIO_RECORDING_PERMISSION_DENIED = "audioRecordingPermissionDeniedMessage";
|
||||
|
||||
private final String VOICE_MESSAGE_PRESS_AND_HOLD_TO_RECORD = "recordingMessageToHoldText";
|
||||
private final String VOICE_MESSAGE_RELEASE_TO_ATTACH = "recordingMessageToReleaseText";
|
||||
@ -237,7 +236,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
/**
|
||||
* Change Locale of Instabug UI elements(defaults to English)
|
||||
*
|
||||
* @param String instabugLocale
|
||||
* @param instabugLocale
|
||||
*/
|
||||
@ReactMethod
|
||||
public void changeLocale(String instabugLocale) {
|
||||
@ -353,7 +352,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
/**
|
||||
* Set the primary color that the SDK will use to tint certain UI elements in the SDK
|
||||
*
|
||||
* @param primaryColorValue The value of the primary color ,
|
||||
* @param primaryColor The value of the primary color ,
|
||||
* whatever this color was parsed from a resource color or hex color
|
||||
* or RGB color values
|
||||
*/
|
||||
@ -387,12 +386,8 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
|
||||
/**
|
||||
* Appends a log message to Instabug internal log
|
||||
* <p>
|
||||
* These logs are then sent along the next uploaded report. All log messages are timestamped
|
||||
* <br/>
|
||||
* Logs aren't cleared per single application run. If you wish to reset the logs, use
|
||||
* {@link #clearLog()}
|
||||
* </p>
|
||||
* Note: logs passed to this method are <b>NOT</b> printed to Logcat
|
||||
*
|
||||
* @param message log message
|
||||
@ -409,7 +404,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
/**
|
||||
* Gets tags.
|
||||
*
|
||||
* @return all tags added using {@link #addTags(String...)}
|
||||
* @return all tags added
|
||||
* @see #resetTags()
|
||||
*/
|
||||
@ReactMethod
|
||||
@ -432,8 +427,8 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
* Set the user identity.
|
||||
* Instabug will pre-fill the user email in reports.
|
||||
*
|
||||
* @param username Username.
|
||||
* @param email User's default email
|
||||
* @param userName Username.
|
||||
* @param userEmail User's default email
|
||||
*/
|
||||
@ReactMethod
|
||||
public void identifyUser(String userName, String userEmail) {
|
||||
@ -445,7 +440,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset ALL tags added using {@link #addTags(String...)}
|
||||
* Reset ALL tags added
|
||||
*/
|
||||
@ReactMethod
|
||||
public void resetTags() {
|
||||
@ -601,7 +596,9 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
/**
|
||||
* Report a caught exception to Instabug dashboard
|
||||
*
|
||||
* @param throwable the exception to be reported
|
||||
* @param stack the exception to be reported
|
||||
* @param message the message of the exception to be reported
|
||||
* @param errorIdentifier used to group issues manually reported
|
||||
*/
|
||||
@ReactMethod
|
||||
public void reportJsException(ReadableArray stack, String message, String errorIdentifier) {
|
||||
@ -640,7 +637,6 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
* </p>
|
||||
* Note: logs passed to this method are <b>NOT</b> printed to Logcat
|
||||
*
|
||||
* @param logMessage The message you would like logged
|
||||
* @param level the level
|
||||
* @param message the message
|
||||
*/
|
||||
@ -825,7 +821,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
* shows up on your Instabug dashboard as a tag to make filtering
|
||||
* through issues easier.
|
||||
*
|
||||
* @param reportCategories the report categories list which is a list of ReportCategory model
|
||||
* @param categoriesTitles the report categories list which is a list of ReportCategory model
|
||||
*/
|
||||
@ReactMethod
|
||||
public void setReportCategories(ReadableArray categoriesTitles) {
|
||||
@ -849,7 +845,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
* sending reports.
|
||||
* Defaults to YES.
|
||||
*
|
||||
* @param {boolean} isEmailFieldRequired A boolean to indicate whether email
|
||||
* @param isEmailFieldRequired A boolean to indicate whether email
|
||||
* field is required or not.
|
||||
*/
|
||||
@ReactMethod
|
||||
@ -865,7 +861,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
* 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
|
||||
* @param isCommentFieldRequired A boolean to indicate whether comment
|
||||
* field is required or not.
|
||||
*/
|
||||
@ReactMethod
|
||||
@ -881,8 +877,8 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
* 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 {strings} key Key of string to override.
|
||||
* @param string String value to override the default one.
|
||||
* @param key Key of string to override.
|
||||
*/
|
||||
@ReactMethod
|
||||
public void setString(String string, String key) {
|
||||
@ -914,7 +910,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
* By default, screenshot view is shown when reporting a bug, but not when
|
||||
* sending feedback.
|
||||
*
|
||||
* @param {boolean} willSkipScreenshotAnnotation sets whether screenshot view is
|
||||
* @param willSkipScreenshotAnnotation 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.
|
||||
*/
|
||||
@ -931,7 +927,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
* Logs a user event that happens through the lifecycle of the application.
|
||||
* Logged user events are going to be sent with each report, as well as at the end of a session.
|
||||
*
|
||||
* @param {string} name Event name.
|
||||
* @param name Event name.
|
||||
*/
|
||||
@ReactMethod
|
||||
public void logUserEventWithName(String name) {
|
||||
@ -947,8 +943,8 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
* Logged user events are going to be sent with each report, as well as at the end of a
|
||||
* session.
|
||||
*
|
||||
* @param {string} name Event name.
|
||||
* @param {ReadableMap} params An optional ReadableMap to be associated with the event.
|
||||
* @param name Event name.
|
||||
* @param params An optional ReadableMap to be associated with the event.
|
||||
*/
|
||||
@ReactMethod
|
||||
public void logUserEventWithNameAndParams(String name, ReadableMap params) {
|
||||
@ -975,7 +971,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
* This block is executed on the UI thread. Could be used for performing any
|
||||
* UI changes before the SDK's UI is shown.
|
||||
*
|
||||
* @param {preInvocationHandler} preInvocationHandler - A callback that gets executed before
|
||||
* @param preInvocationHandler - A callback that gets executed before
|
||||
* invoking the SDK
|
||||
*/
|
||||
@ReactMethod
|
||||
@ -998,7 +994,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
* This block is executed in the background before sending each report. Could
|
||||
* be used for attaching logs and extra data to reports.
|
||||
*
|
||||
* @param {preSendingHandler} preSendingHandler - A callback that gets executed before
|
||||
* @param preSendingHandler - A callback that gets executed before
|
||||
* sending each bug
|
||||
* report.
|
||||
*/
|
||||
@ -1022,7 +1018,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
* This block is executed on the UI thread. Could be used for performing any
|
||||
* UI changes after the SDK's UI is dismissed.
|
||||
*
|
||||
* @param {postInvocationHandler} postInvocationHandler - A callback to get executed after
|
||||
* @param postInvocationHandler - A callback to get executed after
|
||||
* dismissing the SDK.
|
||||
*/
|
||||
@ReactMethod
|
||||
@ -1047,7 +1043,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
/**
|
||||
* Show any valid survey if exist
|
||||
*
|
||||
* @return return true if a valid survey was shown otherwise false
|
||||
* @return true if a valid survey was shown otherwise false
|
||||
*/
|
||||
@ReactMethod
|
||||
public void showSurveysIfAvailable() {
|
||||
@ -1061,7 +1057,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
/**
|
||||
* Show any valid survey if exist
|
||||
*
|
||||
* @return return true if a valid survey was shown otherwise false
|
||||
* @return true if a valid survey was shown otherwise false
|
||||
*/
|
||||
@ReactMethod
|
||||
public void setSurveysEnabled(boolean surveysEnabled) {
|
||||
@ -1091,7 +1087,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
* WARNING: This runs on your application's main UI thread. Please do not include
|
||||
* any blocking operations to avoid ANRs.
|
||||
*
|
||||
* @param preShowingSurveyRunnable to run on the UI thread before showing any valid survey
|
||||
* @param willShowSurveyHandler to run on the UI thread before showing any valid survey
|
||||
*/
|
||||
@ReactMethod
|
||||
public void setWillShowSurveyHandler(final Callback willShowSurveyHandler) {
|
||||
@ -1113,7 +1109,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
* WARNING: This runs on your application's main UI thread. Please do not include
|
||||
* any blocking operations to avoid ANRs.
|
||||
*
|
||||
* @param afterShowingSurveyRunnable to run on the UI thread after showing any valid survey
|
||||
* @param didDismissSurveyHandler to run on the UI thread after showing any valid survey
|
||||
*/
|
||||
@ReactMethod
|
||||
public void setDidDismissSurveyHandler(final Callback didDismissSurveyHandler) {
|
||||
@ -1137,9 +1133,9 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
* none is enabled, Bug
|
||||
* reporting becomes the default invocation option.
|
||||
*
|
||||
* @param {boolean} chat weather Talk to us is enable or not
|
||||
* @param {boolean} bug weather Report a Problem is enable or not
|
||||
* @param {boolean} feedback weather General Feedback is enable or not
|
||||
* @param chat weather Talk to us is enable or not
|
||||
* @param bug weather Report a Problem is enable or not
|
||||
* @param feedback weather General Feedback is enable or not
|
||||
*/
|
||||
@ReactMethod
|
||||
public void setPromptOptionsEnabled(boolean chat, boolean bug, boolean feedback) {
|
||||
@ -1169,7 +1165,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
* you could increase the shaking difficulty level by
|
||||
* increasing the `350` value and vice versa.
|
||||
*
|
||||
* @param {number} androidThreshold Threshold for android devices.
|
||||
* @param androidThreshold Threshold for android devices.
|
||||
*/
|
||||
@ReactMethod
|
||||
public void setShakingThresholdForAndroid(int androidThreshold) {
|
||||
@ -1183,7 +1179,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
/**
|
||||
* Sets a block of code that gets executed when a new message is received.
|
||||
*
|
||||
* @param {onNewMessageHandler} onNewMessageHandler - A callback that gets
|
||||
* @param onNewMessageHandler - A callback that gets
|
||||
* executed when a new message is received.
|
||||
*/
|
||||
@ReactMethod
|
||||
|
53
index.js
53
index.js
@ -405,6 +405,7 @@ module.exports = {
|
||||
* voiceNote attachments.
|
||||
* @param {boolean} screenRecording A boolean to enable or disable screen recording attachments.
|
||||
*/
|
||||
|
||||
setAttachmentTypesEnabled: function (screenshot, extraScreenshot, galleryImage, voiceNote, screenRecording) {
|
||||
Instabug.setEnabledAttachmentTypes(screenshot, extraScreenshot, galleryImage, screenRecording);
|
||||
},
|
||||
@ -471,7 +472,8 @@ module.exports = {
|
||||
/**
|
||||
* Sets the default value of the user's email and hides the email field from the reporting UI
|
||||
* and set the user's name to be included with all reports.
|
||||
* It also reset the chats on device to that email and removes user attributes, user data and completed surveys.
|
||||
* It also reset the chats on device to that email and removes user attributes,
|
||||
* user data and completed surveys.
|
||||
* @param {string} email Email address to be set as the user's email.
|
||||
* @param {string} name Name of the user to be set.
|
||||
*/
|
||||
@ -484,7 +486,8 @@ module.exports = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the default value of the user's email to nil and show email field and remove user name from all reports
|
||||
* Sets the default value of the user's email to nil and show email field and remove user name
|
||||
* from all reports
|
||||
* It also reset the chats on device and removes user attributes, user data and completed surveys.
|
||||
*/
|
||||
logOut: function () {
|
||||
@ -492,10 +495,10 @@ module.exports = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets an array of report categories to be shown for users to select from before reporting a bug or sending
|
||||
* feedback.
|
||||
* Use this method to give users a list of choices of categories their bug report or feedback might be related
|
||||
* to. Selected category will be shown as a tag on your dashboard.
|
||||
* Sets an array of report categories to be shown for users to select from before reporting a
|
||||
* bug or sending feedback.
|
||||
* Use this method to give users a list of choices of categories their bug report or feedback
|
||||
* might be related to. Selected category will be shown as a tag on your dashboard.
|
||||
* @param {Array} titles titles to be shown in the list.
|
||||
*/
|
||||
setReportCategories: function (...titles) {
|
||||
@ -671,8 +674,8 @@ module.exports = {
|
||||
|
||||
/**
|
||||
* @summary Returns all user attributes.
|
||||
* @param {function} userAttributesCallback callback with argument A new dictionary containing all the currently set user attributes,
|
||||
* or an empty dictionary if no user attributes have been set.
|
||||
* @param {function} userAttributesCallback callback with argument A new dictionary containing
|
||||
* all the currently set user attributes, or an empty dictionary if no user attributes have been set.
|
||||
*/
|
||||
getAllUserAttributes: function (userAttributesCallback) {
|
||||
Instabug.getAllUserAttributes(userAttributesCallback);
|
||||
@ -687,7 +690,8 @@ module.exports = {
|
||||
|
||||
/**
|
||||
* @summary Enables/disables inspect view hierarchy when reporting a bug/feedback.
|
||||
* @param {boolean} viewHierarchyEnabled A boolean to set whether view hierarchy are enabled or disabled.
|
||||
* @param {boolean} viewHierarchyEnabled A boolean to set whether view hierarchy are enabled
|
||||
* or disabled.
|
||||
*/
|
||||
setViewHierarchyEnabled: function (viewHierarchyEnabled) {
|
||||
Instabug.setViewHierarchyEnabled(viewHierarchyEnabled);
|
||||
@ -696,7 +700,8 @@ module.exports = {
|
||||
/**
|
||||
* @summary Sets whether surveys are enabled or not.
|
||||
* If you disable surveys on the SDK but still have active surveys on your Instabug dashboard,
|
||||
* those surveys are still going to be sent to the device, but are not going to be shown automatically.
|
||||
* those surveys are still going to be sent to the device, but are not going to be
|
||||
* shown automatically.
|
||||
* To manually display any available surveys, call `Instabug.showSurveyIfAvailable()`.
|
||||
* Defaults to `true`.
|
||||
* @param {boolean} surveysEnabled A boolean to set whether Instabug Surveys is enabled or disabled.
|
||||
@ -706,8 +711,10 @@ module.exports = {
|
||||
},
|
||||
|
||||
/**
|
||||
* @summary Shows one of the surveys that were not shown before, that also have conditions that match the current device/user.
|
||||
* Does nothing if there are no available surveys or if a survey has already been shown in the current session.
|
||||
* @summary Shows one of the surveys that were not shown before, that also have conditions
|
||||
* that match the current device/user.
|
||||
* Does nothing if there are no available surveys or if a survey has already been shown
|
||||
* in the current session.
|
||||
*/
|
||||
showSurveysIfAvailable: function () {
|
||||
Instabug.showSurveysIfAvailable()
|
||||
@ -717,8 +724,8 @@ module.exports = {
|
||||
* @summary Sets a block of code to be executed just before the survey's UI is presented.
|
||||
* This block is executed on the UI thread. Could be used for performing any UI changes before
|
||||
* the survey's UI is shown.
|
||||
* @param {function} willShowSurveyHandler - A block of code that gets executed before presenting the survey's UI.
|
||||
* report.
|
||||
* @param {function} willShowSurveyHandler - A block of code that gets executed before
|
||||
* presenting the survey's UI.
|
||||
*/
|
||||
setWillShowSurveyHandler: function (willShowSurveyHandler) {
|
||||
if (Platform.OS === 'ios') {
|
||||
@ -737,9 +744,10 @@ module.exports = {
|
||||
|
||||
/**
|
||||
* @summary Sets a block of code to be executed right after the survey's UI is dismissed.
|
||||
* This block is executed on the UI thread. Could be used for performing any UI changes after the survey's UI
|
||||
* is dismissed.
|
||||
* @param {function} didDismissSurveyHandler - A block of code that gets executed after the survey's UI is dismissed.
|
||||
* This block is executed on the UI thread. Could be used for performing any UI
|
||||
* changes after the survey's UI is dismissed.
|
||||
* @param {function} didDismissSurveyHandler - A block of code that gets executed after
|
||||
* the survey's UI is dismissed.
|
||||
*/
|
||||
setDidDismissSurveyHandler: function (didDismissSurveyHandler) {
|
||||
if (Platform.OS === 'ios') {
|
||||
@ -806,8 +814,8 @@ module.exports = {
|
||||
/**
|
||||
* @summary Checks whether app is development/Beta testing OR live
|
||||
* Note: This API is iOS only
|
||||
* It returns in the callback false if in development or beta testing on Test Flight, and true if app is live on the
|
||||
* app store.
|
||||
* It returns in the callback false if in development or beta testing on Test Flight, and
|
||||
* true if app is live on the app store.
|
||||
* @param {function} runningLiveCallBack callback with argument as return value 'isLive'
|
||||
*/
|
||||
isRunningLive: function(runningLiveCallBack) {
|
||||
@ -838,11 +846,12 @@ module.exports = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the default position at which the Instabug screen recording button will be shown. Different orientations are already handled.
|
||||
*
|
||||
* Sets the default position at which the Instabug screen recording button will be shown.
|
||||
* Different orientations are already handled.
|
||||
* (Default for `position` is `bottomRight`)
|
||||
*
|
||||
* @param position is of type IBGPosition `topLeft` to show on the top left of screen , or `bottomRight` to show on the bottom right of scrren.
|
||||
* @param position is of type IBGPosition `topLeft` to show on the top left of screen,
|
||||
* or `bottomRight` to show on the bottom right of scrren.
|
||||
*/
|
||||
setVideoRecordingFloatingButtonPosition: function(position) {
|
||||
Instabug.setVideoRecordingFloatingButtonPosition(position);
|
||||
|
Loading…
x
Reference in New Issue
Block a user