Skip to content

Commit 43b8db5

Browse files
a7medevHeshamMegid
authored andcommitted
chore: remove deprecated apis (#385)
1 parent ed50086 commit 43b8db5

File tree

23 files changed

+24
-439
lines changed

23 files changed

+24
-439
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [Unreleased](https://github.com/Instabug/Instabug-Flutter/compare/v11.14.0...dev)
4+
5+
### Changed
6+
7+
- **BREAKING** Remove deprecated APIs ([#385](https://github.com/Instabug/Instabug-Flutter/pull/385)). See migration guide for more details.
8+
39
## [11.14.0](https://github.com/Instabug/Instabug-Flutter/compare/v11.13.0...v11.14.0) (September 13, 2023)
410

511
### Added

android/src/main/java/com/instabug/flutter/modules/ApmApi.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import com.instabug.apm.model.ExecutionTrace;
99
import com.instabug.apm.networking.APMNetworkLogger;
1010
import com.instabug.flutter.generated.ApmPigeon;
11-
import com.instabug.flutter.util.ArgsRegistry;
1211
import com.instabug.flutter.util.Reflection;
1312
import com.instabug.flutter.util.ThreadManager;
1413

@@ -41,7 +40,7 @@ public void setEnabled(@NonNull Boolean isEnabled) {
4140
@Override
4241
public void setColdAppLaunchEnabled(@NonNull Boolean isEnabled) {
4342
try {
44-
APM.setAppLaunchEnabled(isEnabled);
43+
APM.setColdAppLaunchEnabled(isEnabled);
4544
} catch (Exception e) {
4645
e.printStackTrace();
4746
}
@@ -56,16 +55,6 @@ public void setAutoUITraceEnabled(@NonNull Boolean isEnabled) {
5655
}
5756
}
5857

59-
@Override
60-
public void setLogLevel(@NonNull String level) {
61-
try {
62-
final int resolvedLevel = ArgsRegistry.logLevels.get(level);
63-
APM.setLogLevel(resolvedLevel);
64-
} catch (Exception e) {
65-
e.printStackTrace();
66-
}
67-
}
68-
6958
@Override
7059
public void startExecutionTrace(@NonNull String id, @NonNull String name, ApmPigeon.Result<String> result) {
7160
ThreadManager.runOnBackground(

android/src/main/java/com/instabug/flutter/modules/InstabugApi.java

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -275,28 +275,6 @@ public void run() {
275275
);
276276
}
277277

278-
@Override
279-
public void setDebugEnabled(@NonNull Boolean enabled) {
280-
Instabug.setDebugEnabled(enabled);
281-
}
282-
283-
@Override
284-
public void setSdkDebugLogsLevel(@NonNull String level) {
285-
// iOS Only
286-
}
287-
288-
@SuppressWarnings("deprecation")
289-
@Override
290-
@Deprecated()
291-
public void setReproStepsMode(@NonNull String mode) {
292-
try {
293-
final State resolvedMode = ArgsRegistry.reproStates.get(mode);
294-
Instabug.setReproStepsState(resolvedMode);
295-
} catch (Exception e) {
296-
e.printStackTrace();
297-
}
298-
}
299-
300278
@Override
301279
public void setReproStepsConfig(@Nullable String bugMode, @Nullable String crashMode) {
302280
try {
@@ -394,16 +372,6 @@ public void clearFileAttachments() {
394372
Instabug.clearFileAttachment();
395373
}
396374

397-
@Override
398-
public void enableAndroid() {
399-
Instabug.enable();
400-
}
401-
402-
@Override
403-
public void disableAndroid() {
404-
Instabug.disable();
405-
}
406-
407375
@Override
408376
public void networkLog(@NonNull Map<String, Object> data) {
409377
try {

android/src/main/java/com/instabug/flutter/util/ArgsRegistry.java

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import com.instabug.library.invocation.util.InstabugFloatingButtonEdge;
1717
import com.instabug.library.invocation.util.InstabugVideoRecordingButtonPosition;
1818
import com.instabug.library.ui.onboarding.WelcomeMessage;
19-
import com.instabug.library.visualusersteps.State;
2019

2120
import java.util.HashMap;
2221
import java.util.Objects;
@@ -34,23 +33,10 @@ public T get(Object key) {
3433
public static final ArgsMap<Integer> sdkLogLevels = new ArgsMap<Integer>() {{
3534
put("LogLevel.none", LogLevel.NONE);
3635
put("LogLevel.error", LogLevel.ERROR);
37-
put("LogLevel.warning", LogLevel.ERROR); // Deprecated
38-
put("LogLevel.info", LogLevel.DEBUG); // Deprecated
3936
put("LogLevel.debug", LogLevel.DEBUG);
4037
put("LogLevel.verbose", LogLevel.VERBOSE);
4138
}};
4239

43-
@SuppressWarnings("DeprecatedIsStillUsed")
44-
@Deprecated()
45-
public static final ArgsMap<Integer> logLevels = new ArgsMap<Integer>() {{
46-
put("LogLevel.none", com.instabug.apm.model.LogLevel.NONE);
47-
put("LogLevel.error", com.instabug.apm.model.LogLevel.ERROR);
48-
put("LogLevel.warning", com.instabug.apm.model.LogLevel.WARNING);
49-
put("LogLevel.info", com.instabug.apm.model.LogLevel.INFO);
50-
put("LogLevel.debug", com.instabug.apm.model.LogLevel.DEBUG);
51-
put("LogLevel.verbose", com.instabug.apm.model.LogLevel.VERBOSE);
52-
}};
53-
5440
public static ArgsMap<InstabugInvocationEvent> invocationEvents = new ArgsMap<InstabugInvocationEvent>() {{
5541
put("InvocationEvent.none", InstabugInvocationEvent.NONE);
5642
put("InvocationEvent.shake", InstabugInvocationEvent.SHAKE);
@@ -112,13 +98,6 @@ public T get(Object key) {
11298
put("ExtendedBugReportMode.disabled", ExtendedBugReport.State.DISABLED);
11399
}};
114100

115-
@Deprecated()
116-
public static final ArgsMap<State> reproStates = new ArgsMap<State>() {{
117-
put("ReproStepsMode.enabledWithNoScreenshots", State.ENABLED_WITH_NO_SCREENSHOTS);
118-
put("ReproStepsMode.enabled", State.ENABLED);
119-
put("ReproStepsMode.disabled", State.DISABLED);
120-
}};
121-
122101
public static final ArgsMap<Integer> reproModes = new ArgsMap<Integer>() {{
123102
put("ReproStepsMode.enabledWithNoScreenshots", ReproMode.EnableWithNoScreenshots);
124103
put("ReproStepsMode.enabled", ReproMode.EnableWithScreenshots);
@@ -158,7 +137,6 @@ public T get(Object key) {
158137
put("CustomTextPlaceHolderKey.shakeHint", Key.SHAKE_HINT);
159138
put("CustomTextPlaceHolderKey.swipeHint", Key.SWIPE_HINT);
160139
put("CustomTextPlaceHolderKey.invalidEmailMessage", Key.INVALID_EMAIL_MESSAGE);
161-
put("CustomTextPlaceHolderKey.invalidCommentMessage", Key.INVALID_COMMENT_MESSAGE);
162140
put("CustomTextPlaceHolderKey.emailFieldHint", Key.EMAIL_FIELD_HINT);
163141
put("CustomTextPlaceHolderKey.commentFieldHintForBugReport", Key.COMMENT_FIELD_HINT_FOR_BUG_REPORT);
164142
put("CustomTextPlaceHolderKey.commentFieldHintForFeedback", Key.COMMENT_FIELD_HINT_FOR_FEEDBACK);

android/src/test/java/com/instabug/flutter/ApmApiTest.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import com.instabug.flutter.modules.ApmApi;
1919
import com.instabug.flutter.util.GlobalMocks;
2020
import com.instabug.flutter.util.MockReflected;
21-
import com.instabug.library.LogLevel;
2221

2322
import org.json.JSONObject;
2423
import org.junit.After;
@@ -82,14 +81,13 @@ public void testSetEnabled() {
8281
mAPM.verify(() -> APM.setEnabled(isEnabled));
8382
}
8483

85-
@SuppressWarnings("deprecation")
8684
@Test
8785
public void testSetColdAppLaunchEnabled() {
8886
boolean isEnabled = false;
8987

9088
api.setColdAppLaunchEnabled(isEnabled);
9189

92-
mAPM.verify(() -> APM.setAppLaunchEnabled(isEnabled));
90+
mAPM.verify(() -> APM.setColdAppLaunchEnabled(isEnabled));
9391
}
9492

9593
@Test
@@ -101,16 +99,6 @@ public void testSetAutoUITraceEnabled() {
10199
mAPM.verify(() -> APM.setAutoUITraceEnabled(isEnabled));
102100
}
103101

104-
@SuppressWarnings("deprecation")
105-
@Test
106-
public void testSetLogLevel() {
107-
String logLevel = "LogLevel.none";
108-
109-
api.setLogLevel(logLevel);
110-
111-
mAPM.verify(() -> APM.setLogLevel(LogLevel.NONE));
112-
}
113-
114102
@Test
115103
public void testStartExecutionTraceWhenTraceNotNull() {
116104
String expectedId = "trace-id";

android/src/test/java/com/instabug/flutter/ArgsRegistryTest.java

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import com.instabug.library.invocation.util.InstabugFloatingButtonEdge;
1818
import com.instabug.library.invocation.util.InstabugVideoRecordingButtonPosition;
1919
import com.instabug.library.ui.onboarding.WelcomeMessage;
20-
import com.instabug.library.visualusersteps.State;
2120

2221
import org.junit.Test;
2322

@@ -36,22 +35,6 @@ public void testSdkLogLevels() {
3635
}
3736
}
3837

39-
@Test
40-
public void testLogLevels() {
41-
Integer[] values = {
42-
com.instabug.apm.model.LogLevel.NONE,
43-
com.instabug.apm.model.LogLevel.ERROR,
44-
com.instabug.apm.model.LogLevel.WARNING,
45-
com.instabug.apm.model.LogLevel.INFO,
46-
com.instabug.apm.model.LogLevel.DEBUG,
47-
com.instabug.apm.model.LogLevel.VERBOSE,
48-
};
49-
50-
for (Integer value : values) {
51-
assertTrue(ArgsRegistry.logLevels.containsValue(value));
52-
}
53-
}
54-
5538
@Test
5639
public void testInvocationEvents() {
5740
InstabugInvocationEvent[] values = {
@@ -183,21 +166,6 @@ public void testExtendedBugReportStates() {
183166
}
184167
}
185168

186-
187-
@SuppressWarnings("deprecation")
188-
@Test
189-
public void testReproStates() {
190-
State[] values = {
191-
State.ENABLED_WITH_NO_SCREENSHOTS,
192-
State.ENABLED,
193-
State.DISABLED,
194-
};
195-
196-
for (State value : values) {
197-
assertTrue(ArgsRegistry.reproStates.containsValue(value));
198-
}
199-
}
200-
201169
@Test
202170
public void testReproModes() {
203171
Integer[] values = {
@@ -255,7 +223,6 @@ public void testPlaceholder() {
255223
Key.SHAKE_HINT,
256224
Key.SWIPE_HINT,
257225
Key.INVALID_EMAIL_MESSAGE,
258-
Key.INVALID_COMMENT_MESSAGE,
259226
Key.EMAIL_FIELD_HINT,
260227
Key.COMMENT_FIELD_HINT_FOR_BUG_REPORT,
261228
Key.COMMENT_FIELD_HINT_FOR_FEEDBACK,

android/src/test/java/com/instabug/flutter/InstabugApiTest.java

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import static org.mockito.ArgumentMatchers.any;
88
import static org.mockito.ArgumentMatchers.anyInt;
99
import static org.mockito.ArgumentMatchers.anyString;
10-
import static org.mockito.ArgumentMatchers.argThat;
1110
import static org.mockito.ArgumentMatchers.eq;
1211
import static org.mockito.Mockito.doReturn;
1312
import static org.mockito.Mockito.mock;
@@ -39,7 +38,6 @@
3938
import com.instabug.library.invocation.InstabugInvocationEvent;
4039
import com.instabug.library.model.NetworkLog;
4140
import com.instabug.library.ui.onboarding.WelcomeMessage;
42-
import com.instabug.library.visualusersteps.State;
4341

4442
import org.json.JSONObject;
4543
import org.junit.After;
@@ -377,26 +375,6 @@ public void testGetUserAttributes() {
377375
mInstabug.verify(Instabug::getAllUserAttributes);
378376
}
379377

380-
@SuppressWarnings("deprecation")
381-
@Test
382-
public void testSetDebugEnabled() {
383-
boolean isEnabled = true;
384-
385-
api.setDebugEnabled(isEnabled);
386-
387-
mInstabug.verify(() -> Instabug.setDebugEnabled(isEnabled));
388-
}
389-
390-
@SuppressWarnings("deprecation")
391-
@Test
392-
public void testSetReproStepsMode() {
393-
String mode = "ReproStepsMode.enabled";
394-
395-
api.setReproStepsMode(mode);
396-
397-
mInstabug.verify(() -> Instabug.setReproStepsState(State.ENABLED));
398-
}
399-
400378
@Test
401379
public void testSetReproStepsConfig() {
402380
String bug = "ReproStepsMode.enabled";

example/ios/InstabugTests/ApmApiTests.m

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ - (void)testSetColdAppLaunchEnabled {
4444

4545
[self.api setColdAppLaunchEnabledIsEnabled:isEnabled error:&error];
4646

47-
OCMVerify([self.mAPM setAppLaunchEnabled:YES]);
47+
OCMVerify([self.mAPM setColdAppLaunchEnabled:YES]);
4848
}
4949

5050
- (void)testSetAutoUITraceEnabled {
@@ -56,15 +56,6 @@ - (void)testSetAutoUITraceEnabled {
5656
OCMVerify([self.mAPM setAutoUITraceEnabled:YES]);
5757
}
5858

59-
- (void)testSetLogLevel {
60-
NSString *level = @"LogLevel.warning";
61-
FlutterError *error;
62-
63-
[self.api setLogLevelLevel:level error:&error];
64-
65-
OCMVerify([self.mAPM setLogLevel:IBGLogLevelWarning]);
66-
}
67-
6859
- (void)testStartExecutionTraceWhenTraceNotNil {
6960
NSString *expectedId = @"trace-id";
7061
NSString *name = @"trace-name";

example/ios/InstabugTests/ArgsRegistryTests.m

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,6 @@ - (void)testSdkLogLevels {
1919
}
2020
}
2121

22-
- (void)testLogLevels {
23-
NSArray *values = @[
24-
@(IBGLogLevelNone),
25-
@(IBGLogLevelError),
26-
@(IBGLogLevelWarning),
27-
@(IBGLogLevelInfo),
28-
@(IBGLogLevelDebug),
29-
@(IBGLogLevelVerbose)
30-
];
31-
32-
for (NSNumber *value in values) {
33-
XCTAssertTrue([[ArgsRegistry.logLevels allValues] containsObject:value]);
34-
}
35-
}
36-
3722
- (void)testInvocationEvents {
3823
NSArray *values = @[
3924
@(IBGInvocationEventNone),
@@ -208,7 +193,6 @@ - (void)testPlaceholders {
208193
kIBGShakeStartAlertTextStringName,
209194
kIBGEdgeSwipeStartAlertTextStringName,
210195
kIBGInvalidEmailMessageStringName,
211-
kIBGInvalidCommentMessageStringName,
212196
kIBGInvocationTitleStringName,
213197
kIBGAskAQuestionStringName,
214198
kIBGReportBugStringName,

example/ios/InstabugTests/InstabugApiTests.m

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -282,24 +282,6 @@ - (void)testGetUserAttributes {
282282
[self waitForExpectations:@[expectation] timeout:5.0];
283283
}
284284

285-
- (void)testSetSdkDebugLogsLevel {
286-
NSString *level = @"IBGSDKDebugLogsLevel.error";
287-
FlutterError *error;
288-
289-
[self.api setSdkDebugLogsLevelLevel:level error:&error];
290-
291-
OCMVerify([self.mInstabug setSdkDebugLogsLevel:IBGSDKDebugLogsLevelError]);
292-
}
293-
294-
- (void)testSetReproStepsMode {
295-
NSString *mode = @"ReproStepsMode.enabled";
296-
FlutterError *error;
297-
298-
[self.api setReproStepsModeMode:mode error:&error];
299-
300-
OCMVerify([self.mInstabug setReproStepsMode:IBGUserStepsModeEnable]);
301-
}
302-
303285
- (void)testSetReproStepsConfig {
304286
NSString *bugMode = @"ReproStepsMode.enabled";
305287
NSString *crashMode = @"ReproStepsMode.disabled";

0 commit comments

Comments
 (0)