Skip to content

Commit 81f119d

Browse files
authored
🤝 Merge pull request #107 from Instabug/refactoring
📝 Adjusted code styles
2 parents ea8d3e2 + b2ec43f commit 81f119d

File tree

2 files changed

+62
-57
lines changed

2 files changed

+62
-57
lines changed

android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
112112
private final String ADD_EXTRA_SCREENSHOT = "addExtraScreenshot";
113113
private final String ADD_VIDEO = "addVideoMessage";
114114

115-
private final String AUDIO_RECORDING_PERMISSION_DENIED =
116-
"audioRecordingPermissionDeniedMessage";
115+
private final String AUDIO_RECORDING_PERMISSION_DENIED = "audioRecordingPermissionDeniedMessage";
117116

118117
private final String VOICE_MESSAGE_PRESS_AND_HOLD_TO_RECORD = "recordingMessageToHoldText";
119118
private final String VOICE_MESSAGE_RELEASE_TO_ATTACH = "recordingMessageToReleaseText";
@@ -237,7 +236,7 @@ public void appendTags(ReadableArray tags) {
237236
/**
238237
* Change Locale of Instabug UI elements(defaults to English)
239238
*
240-
* @param String instabugLocale
239+
* @param instabugLocale
241240
*/
242241
@ReactMethod
243242
public void changeLocale(String instabugLocale) {
@@ -353,7 +352,7 @@ public void showIntroMessage() {
353352
/**
354353
* Set the primary color that the SDK will use to tint certain UI elements in the SDK
355354
*
356-
* @param primaryColorValue The value of the primary color ,
355+
* @param primaryColor The value of the primary color ,
357356
* whatever this color was parsed from a resource color or hex color
358357
* or RGB color values
359358
*/
@@ -387,12 +386,8 @@ public void setEnabledAttachmentTypes(boolean screenshot, boolean extraScreensho
387386

388387
/**
389388
* Appends a log message to Instabug internal log
390-
* <p>
391389
* These logs are then sent along the next uploaded report. All log messages are timestamped
392-
* <br/>
393390
* Logs aren't cleared per single application run. If you wish to reset the logs, use
394-
* {@link #clearLog()}
395-
* </p>
396391
* Note: logs passed to this method are <b>NOT</b> printed to Logcat
397392
*
398393
* @param message log message
@@ -409,7 +404,7 @@ public void IBGLog(String message) {
409404
/**
410405
* Gets tags.
411406
*
412-
* @return all tags added using {@link #addTags(String...)}
407+
* @return all tags added
413408
* @see #resetTags()
414409
*/
415410
@ReactMethod
@@ -432,8 +427,8 @@ public void getTags(Callback tagsCallback) {
432427
* Set the user identity.
433428
* Instabug will pre-fill the user email in reports.
434429
*
435-
* @param username Username.
436-
* @param email User's default email
430+
* @param userName Username.
431+
* @param userEmail User's default email
437432
*/
438433
@ReactMethod
439434
public void identifyUser(String userName, String userEmail) {
@@ -445,7 +440,7 @@ public void identifyUser(String userName, String userEmail) {
445440
}
446441

447442
/**
448-
* Reset ALL tags added using {@link #addTags(String...)}
443+
* Reset ALL tags added
449444
*/
450445
@ReactMethod
451446
public void resetTags() {
@@ -601,7 +596,9 @@ public void setDebugEnabled(boolean isDebugEnabled) {
601596
/**
602597
* Report a caught exception to Instabug dashboard
603598
*
604-
* @param throwable the exception to be reported
599+
* @param stack the exception to be reported
600+
* @param message the message of the exception to be reported
601+
* @param errorIdentifier used to group issues manually reported
605602
*/
606603
@ReactMethod
607604
public void reportJsException(ReadableArray stack, String message, String errorIdentifier) {
@@ -640,7 +637,6 @@ public void reportJsException(ReadableArray stack, String message, String errorI
640637
* </p>
641638
* Note: logs passed to this method are <b>NOT</b> printed to Logcat
642639
*
643-
* @param logMessage The message you would like logged
644640
* @param level the level
645641
* @param message the message
646642
*/
@@ -825,7 +821,7 @@ public void setColorTheme(String theme) {
825821
* shows up on your Instabug dashboard as a tag to make filtering
826822
* through issues easier.
827823
*
828-
* @param reportCategories the report categories list which is a list of ReportCategory model
824+
* @param categoriesTitles the report categories list which is a list of ReportCategory model
829825
*/
830826
@ReactMethod
831827
public void setReportCategories(ReadableArray categoriesTitles) {
@@ -849,7 +845,7 @@ public void setReportCategories(ReadableArray categoriesTitles) {
849845
* sending reports.
850846
* Defaults to YES.
851847
*
852-
* @param {boolean} isEmailFieldRequired A boolean to indicate whether email
848+
* @param isEmailFieldRequired A boolean to indicate whether email
853849
* field is required or not.
854850
*/
855851
@ReactMethod
@@ -865,7 +861,7 @@ public void setEmailFieldRequired(boolean isEmailFieldRequired) {
865861
* Sets whether users are required to enter a comment or not when sending reports.
866862
* Defaults to NO.
867863
*
868-
* @param {boolean} isCommentFieldRequired A boolean to indicate whether comment
864+
* @param isCommentFieldRequired A boolean to indicate whether comment
869865
* field is required or not.
870866
*/
871867
@ReactMethod
@@ -881,8 +877,8 @@ public void setCommentFieldRequired(boolean isCommentFieldRequired) {
881877
* Overrides any of the strings shown in the SDK with custom ones.
882878
* Allows you to customize any of the strings shown to users in the SDK.
883879
*
884-
* @param {string} string String value to override the default one.
885-
* @param {strings} key Key of string to override.
880+
* @param string String value to override the default one.
881+
* @param key Key of string to override.
886882
*/
887883
@ReactMethod
888884
public void setString(String string, String key) {
@@ -914,7 +910,7 @@ public void logOut() {
914910
* By default, screenshot view is shown when reporting a bug, but not when
915911
* sending feedback.
916912
*
917-
* @param {boolean} willSkipScreenshotAnnotation sets whether screenshot view is
913+
* @param willSkipScreenshotAnnotation sets whether screenshot view is
918914
* shown or not. Passing YES will show screenshot view for both feedback and
919915
* bug reporting, while passing NO will disable it for both.
920916
*/
@@ -931,7 +927,7 @@ public void setWillSkipScreenshotAnnotation(boolean willSkipScreenshotAnnotation
931927
* Logs a user event that happens through the lifecycle of the application.
932928
* Logged user events are going to be sent with each report, as well as at the end of a session.
933929
*
934-
* @param {string} name Event name.
930+
* @param name Event name.
935931
*/
936932
@ReactMethod
937933
public void logUserEventWithName(String name) {
@@ -947,8 +943,8 @@ public void logUserEventWithName(String name) {
947943
* Logged user events are going to be sent with each report, as well as at the end of a
948944
* session.
949945
*
950-
* @param {string} name Event name.
951-
* @param {ReadableMap} params An optional ReadableMap to be associated with the event.
946+
* @param name Event name.
947+
* @param params An optional ReadableMap to be associated with the event.
952948
*/
953949
@ReactMethod
954950
public void logUserEventWithNameAndParams(String name, ReadableMap params) {
@@ -975,7 +971,7 @@ public void logUserEventWithNameAndParams(String name, ReadableMap params) {
975971
* This block is executed on the UI thread. Could be used for performing any
976972
* UI changes before the SDK's UI is shown.
977973
*
978-
* @param {preInvocationHandler} preInvocationHandler - A callback that gets executed before
974+
* @param preInvocationHandler - A callback that gets executed before
979975
* invoking the SDK
980976
*/
981977
@ReactMethod
@@ -998,7 +994,7 @@ public void run() {
998994
* This block is executed in the background before sending each report. Could
999995
* be used for attaching logs and extra data to reports.
1000996
*
1001-
* @param {preSendingHandler} preSendingHandler - A callback that gets executed before
997+
* @param preSendingHandler - A callback that gets executed before
1002998
* sending each bug
1003999
* report.
10041000
*/
@@ -1022,7 +1018,7 @@ public void run() {
10221018
* This block is executed on the UI thread. Could be used for performing any
10231019
* UI changes after the SDK's UI is dismissed.
10241020
*
1025-
* @param {postInvocationHandler} postInvocationHandler - A callback to get executed after
1021+
* @param postInvocationHandler - A callback to get executed after
10261022
* dismissing the SDK.
10271023
*/
10281024
@ReactMethod
@@ -1047,7 +1043,7 @@ public void onSdkDismissed(DismissType issueState, Bug.Type bugType) {
10471043
/**
10481044
* Show any valid survey if exist
10491045
*
1050-
* @return return true if a valid survey was shown otherwise false
1046+
* @return true if a valid survey was shown otherwise false
10511047
*/
10521048
@ReactMethod
10531049
public void showSurveysIfAvailable() {
@@ -1061,7 +1057,7 @@ public void showSurveysIfAvailable() {
10611057
/**
10621058
* Show any valid survey if exist
10631059
*
1064-
* @return return true if a valid survey was shown otherwise false
1060+
* @return true if a valid survey was shown otherwise false
10651061
*/
10661062
@ReactMethod
10671063
public void setSurveysEnabled(boolean surveysEnabled) {
@@ -1091,7 +1087,7 @@ public void setIntroMessageEnabled(boolean enabled) {
10911087
* WARNING: This runs on your application's main UI thread. Please do not include
10921088
* any blocking operations to avoid ANRs.
10931089
*
1094-
* @param preShowingSurveyRunnable to run on the UI thread before showing any valid survey
1090+
* @param willShowSurveyHandler to run on the UI thread before showing any valid survey
10951091
*/
10961092
@ReactMethod
10971093
public void setWillShowSurveyHandler(final Callback willShowSurveyHandler) {
@@ -1113,7 +1109,7 @@ public void run() {
11131109
* WARNING: This runs on your application's main UI thread. Please do not include
11141110
* any blocking operations to avoid ANRs.
11151111
*
1116-
* @param afterShowingSurveyRunnable to run on the UI thread after showing any valid survey
1112+
* @param didDismissSurveyHandler to run on the UI thread after showing any valid survey
11171113
*/
11181114
@ReactMethod
11191115
public void setDidDismissSurveyHandler(final Callback didDismissSurveyHandler) {
@@ -1137,9 +1133,9 @@ public void run() {
11371133
* none is enabled, Bug
11381134
* reporting becomes the default invocation option.
11391135
*
1140-
* @param {boolean} chat weather Talk to us is enable or not
1141-
* @param {boolean} bug weather Report a Problem is enable or not
1142-
* @param {boolean} feedback weather General Feedback is enable or not
1136+
* @param chat weather Talk to us is enable or not
1137+
* @param bug weather Report a Problem is enable or not
1138+
* @param feedback weather General Feedback is enable or not
11431139
*/
11441140
@ReactMethod
11451141
public void setPromptOptionsEnabled(boolean chat, boolean bug, boolean feedback) {
@@ -1169,7 +1165,7 @@ public void clearFileAttachment() {
11691165
* you could increase the shaking difficulty level by
11701166
* increasing the `350` value and vice versa.
11711167
*
1172-
* @param {number} androidThreshold Threshold for android devices.
1168+
* @param androidThreshold Threshold for android devices.
11731169
*/
11741170
@ReactMethod
11751171
public void setShakingThresholdForAndroid(int androidThreshold) {
@@ -1183,7 +1179,7 @@ public void setShakingThresholdForAndroid(int androidThreshold) {
11831179
/**
11841180
* Sets a block of code that gets executed when a new message is received.
11851181
*
1186-
* @param {onNewMessageHandler} onNewMessageHandler - A callback that gets
1182+
* @param onNewMessageHandler - A callback that gets
11871183
* executed when a new message is received.
11881184
*/
11891185
@ReactMethod

index.js

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ module.exports = {
405405
* voiceNote attachments.
406406
* @param {boolean} screenRecording A boolean to enable or disable screen recording attachments.
407407
*/
408+
408409
setAttachmentTypesEnabled: function (screenshot, extraScreenshot, galleryImage, voiceNote, screenRecording) {
409410
Instabug.setEnabledAttachmentTypes(screenshot, extraScreenshot, galleryImage, screenRecording);
410411
},
@@ -471,7 +472,8 @@ module.exports = {
471472
/**
472473
* Sets the default value of the user's email and hides the email field from the reporting UI
473474
* and set the user's name to be included with all reports.
474-
* It also reset the chats on device to that email and removes user attributes, user data and completed surveys.
475+
* It also reset the chats on device to that email and removes user attributes,
476+
* user data and completed surveys.
475477
* @param {string} email Email address to be set as the user's email.
476478
* @param {string} name Name of the user to be set.
477479
*/
@@ -484,18 +486,19 @@ module.exports = {
484486
},
485487

486488
/**
487-
* Sets the default value of the user's email to nil and show email field and remove user name from all reports
489+
* Sets the default value of the user's email to nil and show email field and remove user name
490+
* from all reports
488491
* It also reset the chats on device and removes user attributes, user data and completed surveys.
489492
*/
490493
logOut: function () {
491494
Instabug.logOut();
492495
},
493496

494497
/**
495-
* Sets an array of report categories to be shown for users to select from before reporting a bug or sending
496-
* feedback.
497-
* Use this method to give users a list of choices of categories their bug report or feedback might be related
498-
* to. Selected category will be shown as a tag on your dashboard.
498+
* Sets an array of report categories to be shown for users to select from before reporting a
499+
* bug or sending feedback.
500+
* Use this method to give users a list of choices of categories their bug report or feedback
501+
* might be related to. Selected category will be shown as a tag on your dashboard.
499502
* @param {Array} titles titles to be shown in the list.
500503
*/
501504
setReportCategories: function (...titles) {
@@ -671,8 +674,8 @@ module.exports = {
671674

672675
/**
673676
* @summary Returns all user attributes.
674-
* @param {function} userAttributesCallback callback with argument A new dictionary containing all the currently set user attributes,
675-
* or an empty dictionary if no user attributes have been set.
677+
* @param {function} userAttributesCallback callback with argument A new dictionary containing
678+
* all the currently set user attributes, or an empty dictionary if no user attributes have been set.
676679
*/
677680
getAllUserAttributes: function (userAttributesCallback) {
678681
Instabug.getAllUserAttributes(userAttributesCallback);
@@ -687,7 +690,8 @@ module.exports = {
687690

688691
/**
689692
* @summary Enables/disables inspect view hierarchy when reporting a bug/feedback.
690-
* @param {boolean} viewHierarchyEnabled A boolean to set whether view hierarchy are enabled or disabled.
693+
* @param {boolean} viewHierarchyEnabled A boolean to set whether view hierarchy are enabled
694+
* or disabled.
691695
*/
692696
setViewHierarchyEnabled: function (viewHierarchyEnabled) {
693697
Instabug.setViewHierarchyEnabled(viewHierarchyEnabled);
@@ -696,7 +700,8 @@ module.exports = {
696700
/**
697701
* @summary Sets whether surveys are enabled or not.
698702
* If you disable surveys on the SDK but still have active surveys on your Instabug dashboard,
699-
* those surveys are still going to be sent to the device, but are not going to be shown automatically.
703+
* those surveys are still going to be sent to the device, but are not going to be
704+
* shown automatically.
700705
* To manually display any available surveys, call `Instabug.showSurveyIfAvailable()`.
701706
* Defaults to `true`.
702707
* @param {boolean} surveysEnabled A boolean to set whether Instabug Surveys is enabled or disabled.
@@ -706,8 +711,10 @@ module.exports = {
706711
},
707712

708713
/**
709-
* @summary Shows one of the surveys that were not shown before, that also have conditions that match the current device/user.
710-
* Does nothing if there are no available surveys or if a survey has already been shown in the current session.
714+
* @summary Shows one of the surveys that were not shown before, that also have conditions
715+
* that match the current device/user.
716+
* Does nothing if there are no available surveys or if a survey has already been shown
717+
* in the current session.
711718
*/
712719
showSurveysIfAvailable: function () {
713720
Instabug.showSurveysIfAvailable()
@@ -717,8 +724,8 @@ module.exports = {
717724
* @summary Sets a block of code to be executed just before the survey's UI is presented.
718725
* This block is executed on the UI thread. Could be used for performing any UI changes before
719726
* the survey's UI is shown.
720-
* @param {function} willShowSurveyHandler - A block of code that gets executed before presenting the survey's UI.
721-
* report.
727+
* @param {function} willShowSurveyHandler - A block of code that gets executed before
728+
* presenting the survey's UI.
722729
*/
723730
setWillShowSurveyHandler: function (willShowSurveyHandler) {
724731
if (Platform.OS === 'ios') {
@@ -737,9 +744,10 @@ module.exports = {
737744

738745
/**
739746
* @summary Sets a block of code to be executed right after the survey's UI is dismissed.
740-
* This block is executed on the UI thread. Could be used for performing any UI changes after the survey's UI
741-
* is dismissed.
742-
* @param {function} didDismissSurveyHandler - A block of code that gets executed after the survey's UI is dismissed.
747+
* This block is executed on the UI thread. Could be used for performing any UI
748+
* changes after the survey's UI is dismissed.
749+
* @param {function} didDismissSurveyHandler - A block of code that gets executed after
750+
* the survey's UI is dismissed.
743751
*/
744752
setDidDismissSurveyHandler: function (didDismissSurveyHandler) {
745753
if (Platform.OS === 'ios') {
@@ -806,8 +814,8 @@ module.exports = {
806814
/**
807815
* @summary Checks whether app is development/Beta testing OR live
808816
* Note: This API is iOS only
809-
* It returns in the callback false if in development or beta testing on Test Flight, and true if app is live on the
810-
* app store.
817+
* It returns in the callback false if in development or beta testing on Test Flight, and
818+
* true if app is live on the app store.
811819
* @param {function} runningLiveCallBack callback with argument as return value 'isLive'
812820
*/
813821
isRunningLive: function(runningLiveCallBack) {
@@ -838,11 +846,12 @@ module.exports = {
838846
},
839847

840848
/**
841-
* Sets the default position at which the Instabug screen recording button will be shown. Different orientations are already handled.
842-
*
849+
* Sets the default position at which the Instabug screen recording button will be shown.
850+
* Different orientations are already handled.
843851
* (Default for `position` is `bottomRight`)
844852
*
845-
* @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.
853+
* @param position is of type IBGPosition `topLeft` to show on the top left of screen,
854+
* or `bottomRight` to show on the bottom right of scrren.
846855
*/
847856
setVideoRecordingFloatingButtonPosition: function(position) {
848857
Instabug.setVideoRecordingFloatingButtonPosition(position);

0 commit comments

Comments
 (0)