📝 Java module code refactore

This commit is contained in:
Salma ElTarzi 2018-02-04 12:02:11 +02:00
parent 9efccdf6ed
commit de386ca329

View File

@ -235,7 +235,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
/** /**
* Change Locale of Instabug UI elements(defaults to English) * Change Locale of Instabug UI elements(defaults to English)
* *
* @param String instabugLocale * @param instabugLocale
*/ */
@ReactMethod @ReactMethod
public void changeLocale(String instabugLocale) { 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 * 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 * whatever this color was parsed from a resource color or hex color
* or RGB color values * or RGB color values
*/ */
@ -372,12 +372,8 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
/** /**
* Appends a log message to Instabug internal log * Appends a log message to Instabug internal log
* <p>
* These logs are then sent along the next uploaded report. All log messages are timestamped * 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 * 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 * Note: logs passed to this method are <b>NOT</b> printed to Logcat
* *
* @param message log message * @param message log message
@ -394,7 +390,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
/** /**
* Gets tags. * Gets tags.
* *
* @return all tags added using {@link #addTags(String...)} * @return all tags added
* @see #resetTags() * @see #resetTags()
*/ */
@ReactMethod @ReactMethod
@ -417,8 +413,8 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
* Set the user identity. * Set the user identity.
* Instabug will pre-fill the user email in reports. * Instabug will pre-fill the user email in reports.
* *
* @param username Username. * @param userName Username.
* @param email User's default email * @param userEmail User's default email
*/ */
@ReactMethod @ReactMethod
public void identifyUser(String userName, String userEmail) { 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 @ReactMethod
public void resetTags() { public void resetTags() {
@ -586,7 +582,9 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
/** /**
* Report a caught exception to Instabug dashboard * 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 @ReactMethod
public void reportJsException(ReadableArray stack, String message, String errorIdentifier) { public void reportJsException(ReadableArray stack, String message, String errorIdentifier) {
@ -625,7 +623,6 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
* </p> * </p>
* Note: logs passed to this method are <b>NOT</b> printed to Logcat * 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 level the level
* @param message the message * @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 * shows up on your Instabug dashboard as a tag to make filtering
* through issues easier. * 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 @ReactMethod
public void setReportCategories(ReadableArray categoriesTitles) { public void setReportCategories(ReadableArray categoriesTitles) {
@ -798,7 +795,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
* sending reports. * sending reports.
* Defaults to YES. * 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. * field is required or not.
*/ */
@ReactMethod @ReactMethod
@ -814,7 +811,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
* Sets whether users are required to enter a comment or not when sending reports. * Sets whether users are required to enter a comment or not when sending reports.
* Defaults to NO. * 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. * field is required or not.
*/ */
@ReactMethod @ReactMethod
@ -830,8 +827,8 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
* Overrides any of the strings shown in the SDK with custom ones. * 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. * 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 string String value to override the default one.
* @param {strings} key Key of string to override. * @param key Key of string to override.
*/ */
@ReactMethod @ReactMethod
public void setString(String string, String key) { 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 * By default, screenshot view is shown when reporting a bug, but not when
* sending feedback. * 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 * shown or not. Passing YES will show screenshot view for both feedback and
* bug reporting, while passing NO will disable it for both. * 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. * 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. * 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 @ReactMethod
public void logUserEventWithName(String name) { 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 * Logged user events are going to be sent with each report, as well as at the end of a
* session. * session.
* *
* @param {string} name Event name. * @param name Event name.
* @param {ReadableMap} params An optional ReadableMap to be associated with the event. * @param params An optional ReadableMap to be associated with the event.
*/ */
@ReactMethod @ReactMethod
public void logUserEventWithNameAndParams(String name, ReadableMap params) { 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 * This block is executed on the UI thread. Could be used for performing any
* UI changes before the SDK's UI is shown. * 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 * invoking the SDK
*/ */
@ReactMethod @ReactMethod
@ -947,7 +944,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
* This block is executed in the background before sending each report. Could * This block is executed in the background before sending each report. Could
* be used for attaching logs and extra data to reports. * 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 * sending each bug
* report. * report.
*/ */
@ -971,7 +968,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
* This block is executed on the UI thread. Could be used for performing any * This block is executed on the UI thread. Could be used for performing any
* UI changes after the SDK's UI is dismissed. * 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. * dismissing the SDK.
*/ */
@ReactMethod @ReactMethod
@ -996,7 +993,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
/** /**
* Show any valid survey if exist * 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 @ReactMethod
public void showSurveysIfAvailable() { public void showSurveysIfAvailable() {
@ -1010,7 +1007,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
/** /**
* Show any valid survey if exist * 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 @ReactMethod
public void setSurveysEnabled(boolean surveysEnabled) { 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 * WARNING: This runs on your application's main UI thread. Please do not include
* any blocking operations to avoid ANRs. * 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 @ReactMethod
public void setWillShowSurveyHandler(final Callback willShowSurveyHandler) { 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 * WARNING: This runs on your application's main UI thread. Please do not include
* any blocking operations to avoid ANRs. * 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 @ReactMethod
public void setDidDismissSurveyHandler(final Callback didDismissSurveyHandler) { public void setDidDismissSurveyHandler(final Callback didDismissSurveyHandler) {
@ -1086,9 +1083,9 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
* none is enabled, Bug * none is enabled, Bug
* reporting becomes the default invocation option. * reporting becomes the default invocation option.
* *
* @param {boolean} chat weather Talk to us is enable or not * @param chat weather Talk to us is enable or not
* @param {boolean} bug weather Report a Problem is enable or not * @param bug weather Report a Problem is enable or not
* @param {boolean} feedback weather General Feedback is enable or not * @param feedback weather General Feedback is enable or not
*/ */
@ReactMethod @ReactMethod
public void setPromptOptionsEnabled(boolean chat, boolean bug, boolean feedback) { 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 * you could increase the shaking difficulty level by
* increasing the `350` value and vice versa. * increasing the `350` value and vice versa.
* *
* @param {number} androidThreshold Threshold for android devices. * @param androidThreshold Threshold for android devices.
*/ */
@ReactMethod @ReactMethod
public void setShakingThresholdForAndroid(int androidThreshold) { 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. * 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. * executed when a new message is received.
*/ */
@ReactMethod @ReactMethod