From 9efccdf6ed1598ef6f2b6bb337bdc808fce246ad Mon Sep 17 00:00:00 2001 From: Salma ElTarzi Date: Mon, 25 Dec 2017 11:15:37 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=93=9D=20Adjusted=20code=20styles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RNInstabugReactnativeModule.java | 3 +- index.js | 63 ++++++++++++------- 2 files changed, 40 insertions(+), 26 deletions(-) diff --git a/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java b/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java index a7d0635..9c82bfd 100644 --- a/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java +++ b/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java @@ -111,8 +111,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"; diff --git a/index.js b/index.js index a4db955..7070a85 100644 --- a/index.js +++ b/index.js @@ -381,8 +381,15 @@ module.exports = { * voiceNote attachments. * @param {boolean} screenRecording A boolean to enable or disable screen recording attachments. */ - setAttachmentTypesEnabled: function (screenshot, extraScreenshot, galleryImage, voiceNote, screenRecording) { - Instabug.setAttachmentTypesEnabled(screenshot, extraScreenshot, galleryImage, voiceNote, screenRecording); + setAttachmentTypesEnabled: function (screenshot, extraScreenshot, galleryImage, voiceNote, + screenRecording) { + Instabug.setAttachmentTypesEnabled( + screenshot, + extraScreenshot, + galleryImage, + voiceNote, + screenRecording + ); }, /** @@ -433,7 +440,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. */ @@ -446,7 +454,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 () { @@ -454,10 +463,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) { @@ -633,8 +642,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); @@ -649,7 +658,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) { if (Platform.OS === 'ios') { @@ -660,7 +670,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. @@ -670,8 +681,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() @@ -681,8 +694,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') { @@ -701,9 +714,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') { @@ -770,8 +784,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) { @@ -802,11 +816,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); From de386ca329b42ce3511965e90ea46ee48470d8a3 Mon Sep 17 00:00:00 2001 From: Salma ElTarzi Date: Sun, 4 Feb 2018 12:02:11 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9D=20Java=20module=20code=20refac?= =?UTF-8?q?tore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RNInstabugReactnativeModule.java | 63 +++++++++---------- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java b/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java index 9c82bfd..7458258 100644 --- a/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java +++ b/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java @@ -235,7 +235,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) { @@ -337,7 +337,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 */ @@ -372,12 +372,8 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule { /** * Appends a log message to Instabug internal log - *

* These logs are then sent along the next uploaded report. All log messages are timestamped - *
* Logs aren't cleared per single application run. If you wish to reset the logs, use - * {@link #clearLog()} - *

* Note: logs passed to this method are NOT printed to Logcat * * @param message log message @@ -394,7 +390,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule { /** * Gets tags. * - * @return all tags added using {@link #addTags(String...)} + * @return all tags added * @see #resetTags() */ @ReactMethod @@ -417,8 +413,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) { @@ -430,7 +426,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule { } /** - * Reset ALL tags added using {@link #addTags(String...)} + * Reset ALL tags added */ @ReactMethod public void resetTags() { @@ -586,7 +582,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) { @@ -625,7 +623,6 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule { *

* Note: logs passed to this method are NOT printed to Logcat * - * @param logMessage The message you would like logged * @param level the level * @param message the message */ @@ -774,7 +771,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) { @@ -798,7 +795,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 @@ -814,7 +811,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 @@ -830,8 +827,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) { @@ -863,7 +860,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. */ @@ -880,7 +877,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) { @@ -896,8 +893,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) { @@ -924,7 +921,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 @@ -947,7 +944,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. */ @@ -971,7 +968,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 @@ -996,7 +993,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() { @@ -1010,7 +1007,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) { @@ -1040,7 +1037,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) { @@ -1062,7 +1059,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) { @@ -1086,9 +1083,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) { @@ -1118,7 +1115,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) { @@ -1132,7 +1129,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