Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [Unreleased](https://github.com/Instabug/Instabug-React-Native/compare/v11.14.0...dev)

### Changed

- **BREAKING** Remove deprecated APIs ([#1027](https://github.com/Instabug/Instabug-React-Native/pull/1027)). See migration guide for more details.

## [11.14.0](https://github.com/Instabug/Instabug-React-Native/compare/v11.13.0...v11.14.0) (September 15, 2023)

### Added
Expand Down
6 changes: 0 additions & 6 deletions android/sourcemaps.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ boolean isUploadSourcemapsEnabled() {
def envValue = System.getenv('INSTABUG_SOURCEMAPS_UPLOAD_DISABLE')?.toBoolean()
def defaultValue = true

if (rootProject.hasProperty('instabugUploadEnable')) {
project.logger.warn "The property instabugUploadEnable is deprecated and will be removed in an upcoming version. \n" +
"You can use INSTABUG_SOURCEMAPS_UPLOAD_DISABLE environment variable instead."
defaultValue = rootProject.property('instabugUploadEnable')
}

return (envValue != null) ? !envValue : defaultValue
}

Expand Down
36 changes: 0 additions & 36 deletions android/src/main/java/com/instabug/reactlibrary/ArgsRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,20 @@

import androidx.annotation.NonNull;

import com.instabug.apm.model.LogLevel;
import com.instabug.bug.BugReporting;
import com.instabug.bug.invocation.Option;
import com.instabug.featuresrequest.ActionType;

import com.instabug.library.OnSdkDismissCallback;
import com.instabug.library.InstabugColorTheme;
import com.instabug.library.InstabugCustomTextPlaceHolder.Key;
import com.instabug.library.OnSdkDismissCallback.DismissType;
import com.instabug.library.ReproMode;
import com.instabug.library.core.plugin.PluginPromptOption;
import com.instabug.library.extendedbugreport.ExtendedBugReport;
import com.instabug.library.internal.module.InstabugLocale;
import com.instabug.library.invocation.InstabugInvocationEvent;
import com.instabug.library.invocation.util.InstabugFloatingButtonEdge;
import com.instabug.library.invocation.util.InstabugVideoRecordingButtonPosition;
import com.instabug.library.ui.onboarding.WelcomeMessage;
import com.instabug.library.visualusersteps.State;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down Expand Up @@ -47,7 +43,6 @@ public ArrayList<T> getAll(ArrayList<String> keys) {
@SuppressWarnings("deprecation")
static Map<String, Object> getAll() {
return new HashMap<String, Object>() {{
putAll(logLevels);
putAll(invocationEvents);
putAll(invocationOptions);
putAll(colorThemes);
Expand All @@ -58,24 +53,13 @@ static Map<String, Object> getAll() {
putAll(dismissTypes);
putAll(actionTypes);
putAll(extendedBugReportStates);
putAll(reproStates);
putAll(reproModes);
putAll(sdkLogLevels);
putAll(promptOptions);
putAll(locales);
putAll(placeholders);
}};
}

static final ArgsMap<Integer> logLevels = new ArgsMap<Integer>() {{
put("logLevelNone", LogLevel.NONE);
put("logLevelError", LogLevel.ERROR);
put("logLevelWarning", LogLevel.WARNING);
put("logLevelInfo", LogLevel.INFO);
put("logLevelDebug", LogLevel.DEBUG);
put("logLevelVerbose", LogLevel.VERBOSE);
}};

static ArgsMap<InstabugInvocationEvent> invocationEvents = new ArgsMap<InstabugInvocationEvent>() {{
put("invocationEventNone", InstabugInvocationEvent.NONE);
put("invocationEventShake", InstabugInvocationEvent.SHAKE);
Expand Down Expand Up @@ -132,7 +116,6 @@ static Map<String, Object> getAll() {

static final ArgsMap<Integer> actionTypes = new ArgsMap<Integer>() {{
put("allActions", ActionType.REQUEST_NEW_FEATURE | ActionType.ADD_COMMENT_TO_FEATURE);
put("reportBugAction", 0); // Deprecated
put("requestNewFeature", ActionType.REQUEST_NEW_FEATURE);
put("addCommentToFeature", ActionType.ADD_COMMENT_TO_FEATURE);
}};
Expand All @@ -143,13 +126,6 @@ static Map<String, Object> getAll() {
put("disabled", ExtendedBugReport.State.DISABLED);
}};

@Deprecated()
static final ArgsMap<State> reproStates = new ArgsMap<State>() {{
put("reproStepsEnabledWithNoScreenshots", State.ENABLED_WITH_NO_SCREENSHOTS);
put("reproStepsEnabled", State.ENABLED);
put("reproStepsDisabled", State.DISABLED);
}};

static final ArgsMap<Integer> reproModes = new ArgsMap<Integer>() {{
put("reproStepsEnabledWithNoScreenshots", ReproMode.EnableWithNoScreenshots);
put("reproStepsEnabled", ReproMode.EnableWithScreenshots);
Expand All @@ -163,13 +139,6 @@ static Map<String, Object> getAll() {
put("sdkDebugLogsLevelVerbose", com.instabug.library.LogLevel.VERBOSE);
}};

@Deprecated
static final ArgsMap<Integer> promptOptions = new ArgsMap<Integer>() {{
put("promptOptionBug", PluginPromptOption.PromptOptionIdentifier.BUG_REPORT);
put("promptOptionChat", PluginPromptOption.PromptOptionIdentifier.CHAT_LIST);
put("promptOptionFeedback", PluginPromptOption.PromptOptionIdentifier.FEEDBACK);
}};

static final ArgsMap<InstabugLocale> locales = new ArgsMap<InstabugLocale>() {{
put("localeArabic", InstabugLocale.ARABIC);
put("localeAzerbaijani", InstabugLocale.AZERBAIJANI);
Expand Down Expand Up @@ -201,8 +170,6 @@ static Map<String, Object> getAll() {
put("shakeHint", Key.SHAKE_HINT);
put("swipeHint", Key.SWIPE_HINT);
put("invalidEmailMessage", Key.INVALID_EMAIL_MESSAGE);
// Deprecated
put("invalidCommentMessage", Key.INVALID_COMMENT_MESSAGE);
put("emailFieldHint", Key.EMAIL_FIELD_HINT);
put("commentFieldHintForBugReport", Key.COMMENT_FIELD_HINT_FOR_BUG_REPORT);
put("commentFieldHintForFeedback", Key.COMMENT_FIELD_HINT_FOR_FEEDBACK);
Expand Down Expand Up @@ -243,8 +210,6 @@ static Map<String, Object> getAll() {

put("discardAlertTitle", Key.REPORT_DISCARD_DIALOG_TITLE);
put("discardAlertMessage", Key.REPORT_DISCARD_DIALOG_BODY);
put("discardAlertCancel", Key.REPORT_DISCARD_DIALOG_NEGATIVE_ACTION);
put("discardAlertAction", Key.REPORT_DISCARD_DIALOG_POSITIVE_ACTION);
put("discardAlertStay", Key.REPORT_DISCARD_DIALOG_NEGATIVE_ACTION);
put("discardAlertDiscard", Key.REPORT_DISCARD_DIALOG_POSITIVE_ACTION);

Expand All @@ -256,7 +221,6 @@ static Map<String, Object> getAll() {
put("reproStepsListHeader", Key.REPRO_STEPS_LIST_HEADER);
put("reproStepsListDescription", Key.REPRO_STEPS_LIST_DESCRIPTION);
put("reproStepsListEmptyStateDescription", Key.REPRO_STEPS_LIST_EMPTY_STATE_DESCRIPTION);
put("reproStepsListItemTitle", Key.REPRO_STEPS_LIST_ITEM_NUMBERING_TITLE);
put("reproStepsListItemNumberingTitle", Key.REPRO_STEPS_LIST_ITEM_NUMBERING_TITLE);
put("okButtonTitle", Key.BUG_ATTACHMENT_DIALOG_OK_BUTTON);
put("audio", Key.CHATS_TYPE_AUDIO);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import com.instabug.library.invocation.InstabugInvocationEvent;
import com.instabug.reactlibrary.utils.InstabugUtil;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class RNInstabug {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,6 @@ public void run() {
});
}

/**
* Sets the printed logs priority. Filter to one of the following levels.
*
* @param logLevel the priority level.
*/
@ReactMethod
public void setLogLevel(final String logLevel) {
MainThreadHandler.runOnMainThread(new Runnable() {
@Override
public void run() {
try {
final Integer parsedLevel = ArgsRegistry.logLevels.get(logLevel);
if (parsedLevel == null) return;
APM.setLogLevel(parsedLevel);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}

/**
* Enables or disables APM.
* @param isEnabled boolean indicating enabled or disabled.
Expand Down Expand Up @@ -101,7 +80,7 @@ public void setAppLaunchEnabled(final boolean isEnabled) {
@Override
public void run() {
try {
APM.setAppLaunchEnabled(isEnabled);
APM.setColdAppLaunchEnabled(isEnabled);
} catch (Exception e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.instabug.reactlibrary;

import android.annotation.SuppressLint;
import android.os.Handler;
import android.os.Looper;

import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
Expand All @@ -11,11 +9,9 @@
import com.instabug.featuresrequest.FeatureRequests;
import com.instabug.library.Feature;
import com.instabug.reactlibrary.utils.ArrayUtil;
import com.instabug.reactlibrary.utils.InstabugUtil;
import com.instabug.reactlibrary.utils.MainThreadHandler;

import java.util.ArrayList;
import java.util.Arrays;

import javax.annotation.Nonnull;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.facebook.react.uimanager.NativeViewHierarchyManager;
import com.facebook.react.uimanager.UIBlock;
import com.facebook.react.uimanager.UIManagerModule;
import com.instabug.bug.instabugdisclaimer.Internal;
import com.instabug.library.Feature;
import com.instabug.library.Instabug;
import com.instabug.library.InstabugColorTheme;
Expand All @@ -33,7 +32,6 @@
import com.instabug.library.model.NetworkLog;
import com.instabug.library.model.Report;
import com.instabug.library.ui.onboarding.WelcomeMessage;
import com.instabug.library.visualusersteps.State;
import com.instabug.reactlibrary.utils.ArrayUtil;
import com.instabug.reactlibrary.utils.EventEmitterModule;
import com.instabug.reactlibrary.utils.MainThreadHandler;
Expand All @@ -51,8 +49,6 @@
import java.util.Locale;
import java.util.Map;

import javax.annotation.Nullable;


/**
* The type Rn instabug reactnative module.
Expand Down Expand Up @@ -304,26 +300,6 @@ public void run() {
});
}

/**
* Enable/Disable debug logs from Instabug SDK
* Default state: disabled
*
* @param isDebugEnabled whether debug logs should be printed or not into LogCat
*/
@ReactMethod
public void setDebugEnabled(final boolean isDebugEnabled) {
MainThreadHandler.runOnMainThread(new Runnable() {
@Override
public void run() {
try {
Instabug.setDebugEnabled(isDebugEnabled);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}

@ReactMethod
public void logVerbose(final String message) {
MainThreadHandler.runOnMainThread(new Runnable() {
Expand Down Expand Up @@ -765,29 +741,6 @@ public void run() {
});
}

/**
* Sets whether user steps tracking is visual, non visual or disabled.
*
* @param reproStepsMode A string to set user steps tracking to be
* enabled, non visual or disabled.
*/
@SuppressWarnings("deprecation")
@Deprecated()
@ReactMethod
public void setReproStepsMode(final String reproStepsMode) {
MainThreadHandler.runOnMainThread(new Runnable() {
@Override
public void run() {
try {
final State parsedState = ArgsRegistry.reproStates.get(reproStepsMode);
Instabug.setReproStepsState(parsedState);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}

@ReactMethod
public void setReproStepsConfig(final String bugMode, final String crashMode) {
MainThreadHandler.runOnMainThread(new Runnable() {
Expand Down Expand Up @@ -864,24 +817,6 @@ public void run() {
});
}

@ReactMethod
public void callPrivateApi(String apiName, String param) {
try {
if (param == null) {
Method m = Internal.class.getDeclaredMethod(apiName);
m.setAccessible(true);
m.invoke(null);
} else {
Method m = Internal.class.getDeclaredMethod(apiName, param.getClass());
m.setAccessible(true);
m.invoke(null, param);
}

} catch (Exception e) {
e.printStackTrace();
}
}

/**
* Enable/disable session profiler
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.facebook.react.uimanager.ViewManager;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
package com.instabug.reactlibrary.utils;

import android.os.Handler;
import android.os.Looper;

import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.instabug.survey.Survey;

import org.json.JSONArray;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@
import com.facebook.react.bridge.ReadableMapKeySetIterator;
import com.facebook.react.bridge.ReadableType;
import com.facebook.react.bridge.WritableArray;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.bridge.WritableNativeArray;
import com.instabug.library.model.Report;
import com.instabug.library.model.a;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.instabug.reactlibrary;
import android.os.Looper;

import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.Promise;
import com.instabug.apm.APM;

Expand Down Expand Up @@ -92,7 +91,7 @@ public void givenTruesetEnabled_whenQuery_thenShouldCallNativeApiWithEnabled() {
apmModule.setAppLaunchEnabled(false);
// then
verify(APM.class, times(1));
APM.setAppLaunchEnabled(false);
APM.setColdAppLaunchEnabled(false);
}

@Test
Expand All @@ -102,7 +101,7 @@ public void givenTruesetEnabled_whenQuery_thenShouldCallNativeApiWithEnabled() {
apmModule.setAppLaunchEnabled(true);
// then
verify(APM.class, times(1));
APM.setAppLaunchEnabled(true);
APM.setColdAppLaunchEnabled(true);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,16 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Matchers;
import org.mockito.MockedStatic;
import org.mockito.internal.verification.VerificationModeFactory;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.mockStatic;
Expand Down
Loading