Skip to content

Commit 0e7ee99

Browse files
chore: remove deprecated apis (#614)
* feat: support advanced UI customization * chore: add change log * fix: delete setFullScreen * fix: linting * fix: unit test * fix: linting * fix: resolve comments * chore: remove deprecated apis * chore: add changelog * fix: setTheme calling * fix: formatte * fix: formate * fix: formatting * fix: ios tests * fix: ios tests * fix: e2e tests * fix: formate analyze * fix: e2e ios testing * fix: format --------- Co-authored-by: ahmed alaa <[email protected]>
1 parent acdcda7 commit 0e7ee99

File tree

26 files changed

+73
-795
lines changed

26 files changed

+73
-795
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,18 @@
55
### Added
66

77
- Add support for Advanced UI customization with comprehensive theming capabilities ([#599](https://github.com/Instabug/Instabug-Flutter/pull/599))
8+
-
9+
- Add support for App variant. ([#585](https://github.com/Instabug/Instabug-Flutter/pull/585))
10+
11+
### Changed
12+
13+
- **BREAKING** Remove deprecated APIs ([#614](https://github.com/Instabug/Instabug-Flutter/pull/614)). See migration guide for more details.
814

915

1016
## [15.0.2](https://github.com/Instabug/Instabug-Flutter/compare/v14.3.0...15.0.2) (Jul 7, 2025)
1117

1218
### Added
1319

14-
- Add support for App variant. ([#585](https://github.com/Instabug/Instabug-Flutter/pull/585))
1520

1621
- Add support for xCode 16. ([#574](https://github.com/Instabug/Instabug-Flutter/pull/574))
1722

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

Lines changed: 1 addition & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import com.instabug.apm.InternalAPM;
1010
import com.instabug.apm.configuration.cp.APMFeature;
1111
import com.instabug.apm.configuration.cp.FeatureAvailabilityCallback;
12-
import com.instabug.apm.model.ExecutionTrace;
1312
import com.instabug.apm.networking.APMNetworkLogger;
1413
import com.instabug.apm.networkinterception.cp.APMCPNetworkLog;
1514
import com.instabug.flutter.generated.ApmPigeon;
@@ -26,7 +25,6 @@
2625

2726
public class ApmApi implements ApmPigeon.ApmHostApi {
2827
private final String TAG = ApmApi.class.getName();
29-
private final HashMap<String, ExecutionTrace> traces = new HashMap<>();
3028

3129
public static void init(BinaryMessenger messenger) {
3230
final ApmApi api = new ApmApi();
@@ -98,45 +96,7 @@ public void setAutoUITraceEnabled(@NonNull Boolean isEnabled) {
9896
*
9997
* @deprecated see {@link #startFlow}
10098
*/
101-
@Override
102-
public void startExecutionTrace(@NonNull String id, @NonNull String name, ApmPigeon.Result<String> result) {
103-
ThreadManager.runOnBackground(
104-
new Runnable() {
105-
@Override
106-
public void run() {
107-
try {
108-
ExecutionTrace trace = APM.startExecutionTrace(name);
109-
if (trace != null) {
110-
traces.put(id, trace);
111-
112-
ThreadManager.runOnMainThread(new Runnable() {
113-
@Override
114-
public void run() {
115-
result.success(id);
116-
}
117-
});
118-
} else {
119-
ThreadManager.runOnMainThread(new Runnable() {
120-
@Override
121-
public void run() {
122-
result.success(null);
123-
}
124-
});
125-
}
126-
} catch (Exception e) {
127-
e.printStackTrace();
128-
129-
ThreadManager.runOnMainThread(new Runnable() {
130-
@Override
131-
public void run() {
132-
result.success(null);
133-
}
134-
});
135-
}
136-
}
137-
}
138-
);
139-
}
99+
140100

141101
/**
142102
* Starts an AppFlow with the specified name.
@@ -201,39 +161,7 @@ public void endFlow(@NonNull String name) {
201161
}
202162
}
203163

204-
/**
205-
* Adds a new attribute to trace
206-
*
207-
* @param id String id of the trace.
208-
* @param key attribute key
209-
* @param value attribute value. Null to remove attribute
210-
*
211-
* @deprecated see {@link #setFlowAttribute}
212-
*/
213-
@Override
214-
public void setExecutionTraceAttribute(@NonNull String id, @NonNull String key, @NonNull String value) {
215-
try {
216-
traces.get(id).setAttribute(key, value);
217-
} catch (Exception e) {
218-
e.printStackTrace();
219-
}
220-
}
221164

222-
/**
223-
* Ends a trace
224-
*
225-
* @param id string id of the trace.
226-
*
227-
* @deprecated see {@link #endFlow}
228-
*/
229-
@Override
230-
public void endExecutionTrace(@NonNull String id) {
231-
try {
232-
traces.get(id).end();
233-
} catch (Exception e) {
234-
e.printStackTrace();
235-
}
236-
}
237165

238166
/**
239167
* Starts a UI trace.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public void setCommentMinimumCharacterCount(@NonNull Long limit, @Nullable List<
184184
reportTypesArray[i] = ArgsRegistry.reportTypes.get(key);
185185
}
186186
}
187-
BugReporting.setCommentMinimumCharacterCount(limit.intValue(), reportTypesArray);
187+
BugReporting.setCommentMinimumCharacterCountForBugReportType(limit.intValue(), reportTypesArray);
188188
}
189189

190190
@Override

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

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ public void setWelcomeMessageMode(@NonNull String mode) {
197197

198198
@Override
199199
public void setPrimaryColor(@NonNull Long color) {
200-
Instabug.setPrimaryColor(color.intValue());
201200
}
202201

203202
@Override
@@ -249,20 +248,7 @@ public void run() {
249248
);
250249
}
251250

252-
@Override
253-
public void addExperiments(@NonNull List<String> experiments) {
254-
Instabug.addExperiments(experiments);
255-
}
256251

257-
@Override
258-
public void removeExperiments(@NonNull List<String> experiments) {
259-
Instabug.removeExperiments(experiments);
260-
}
261-
262-
@Override
263-
public void clearAllExperiments() {
264-
Instabug.clearAllExperiments();
265-
}
266252

267253
@Override
268254
public void addFeatureFlags(@NonNull Map<String, String> featureFlags) {
@@ -535,7 +521,7 @@ public void setNetworkLogBodyEnabled(@NonNull Boolean isEnabled) {
535521
public void setTheme(@NonNull Map<String, Object> themeConfig) {
536522
try {
537523
Log.d(TAG, "setTheme called with config: " + themeConfig.toString());
538-
524+
539525
com.instabug.library.model.IBGTheme.Builder builder = new com.instabug.library.model.IBGTheme.Builder();
540526

541527
if (themeConfig.containsKey("primaryColor")) {
@@ -582,7 +568,7 @@ public void setTheme(@NonNull Map<String, Object> themeConfig) {
582568

583569
/**
584570
* Retrieves a color value from the Map.
585-
*
571+
*
586572
* @param map The Map object.
587573
* @param key The key to look for.
588574
* @return The parsed color as an integer, or black if missing or invalid.
@@ -601,7 +587,7 @@ private int getColor(Map<String, Object> map, String key) {
601587

602588
/**
603589
* Retrieves a text style from the Map.
604-
*
590+
*
605591
* @param map The Map object.
606592
* @param key The key to look for.
607593
* @return The corresponding Typeface style, or Typeface.NORMAL if missing or invalid.
@@ -630,7 +616,7 @@ private int getTextStyle(Map<String, Object> map, String key) {
630616

631617
/**
632618
* Sets a font on the theme builder if the font configuration is present in the theme config.
633-
*
619+
*
634620
* @param themeConfig The theme configuration map
635621
* @param builder The theme builder
636622
* @param fileKey The key for font file path
@@ -659,17 +645,17 @@ private void setFontIfPresent(Map<String, Object> themeConfig, com.instabug.libr
659645

660646
private Typeface getTypeface(Map<String, Object> map, String fileKey, String assetKey) {
661647
String fontName = null;
662-
648+
663649
if (assetKey != null && map.containsKey(assetKey) && map.get(assetKey) != null) {
664650
fontName = (String) map.get(assetKey);
665651
} else if (fileKey != null && map.containsKey(fileKey) && map.get(fileKey) != null) {
666652
fontName = (String) map.get(fileKey);
667653
}
668-
654+
669655
if (fontName == null) {
670656
return Typeface.DEFAULT;
671657
}
672-
658+
673659
try {
674660
String assetPath = "fonts/" + fontName;
675661
return Typeface.createFromAsset(context.getAssets(), assetPath);

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

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import com.instabug.apm.InternalAPM;
1818
import com.instabug.apm.configuration.cp.APMFeature;
1919
import com.instabug.apm.configuration.cp.FeatureAvailabilityCallback;
20-
import com.instabug.apm.model.ExecutionTrace;
2120
import com.instabug.apm.networking.APMNetworkLogger;
2221
import com.instabug.flutter.generated.ApmPigeon;
2322
import com.instabug.flutter.modules.ApmApi;
@@ -68,16 +67,6 @@ public void cleanUp() {
6867
GlobalMocks.close();
6968
}
7069

71-
private ExecutionTrace mockTrace(String id) {
72-
String name = "trace-name";
73-
ExecutionTrace mTrace = mock(ExecutionTrace.class);
74-
75-
mAPM.when(() -> APM.startExecutionTrace(name)).thenReturn(mTrace);
76-
77-
api.startExecutionTrace(id, name, makeResult());
78-
79-
return mTrace;
80-
}
8170

8271
@Test
8372
public void testInit() {
@@ -115,53 +104,7 @@ public void testSetAutoUITraceEnabled() {
115104
mAPM.verify(() -> APM.setAutoUITraceEnabled(isEnabled));
116105
}
117106

118-
@Test
119-
public void testStartExecutionTraceWhenTraceNotNull() {
120-
String expectedId = "trace-id";
121-
String name = "trace-name";
122-
ApmPigeon.Result<String> result = makeResult((String actualId) -> assertEquals(expectedId, actualId));
123-
124-
mAPM.when(() -> APM.startExecutionTrace(name)).thenReturn(new ExecutionTrace(name));
125-
126-
api.startExecutionTrace(expectedId, name, result);
127-
128-
mAPM.verify(() -> APM.startExecutionTrace(name));
129-
}
130-
131-
@Test
132-
public void testStartExecutionTraceWhenTraceIsNull() {
133-
String id = "trace-id";
134-
String name = "trace-name";
135-
ApmPigeon.Result<String> result = makeResult(Assert::assertNull);
136-
137-
mAPM.when(() -> APM.startExecutionTrace(name)).thenReturn(null);
138-
139-
api.startExecutionTrace(id, name, result);
140-
141-
mAPM.verify(() -> APM.startExecutionTrace(name));
142-
}
143-
144-
@Test
145-
public void testSetExecutionTraceAttribute() {
146-
String id = "trace-id";
147-
String key = "is_premium";
148-
String value = "true";
149-
ExecutionTrace mTrace = mockTrace(id);
150-
151-
api.setExecutionTraceAttribute(id, key, value);
152-
153-
verify(mTrace).setAttribute(key, value);
154-
}
155-
156-
@Test
157-
public void testEndExecutionTrace() {
158-
String id = "trace-id";
159-
ExecutionTrace mTrace = mockTrace(id);
160-
161-
api.endExecutionTrace(id);
162107

163-
verify(mTrace).end();
164-
}
165108

166109
@Test
167110
public void testStartFlow() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public void testSetCommentMinimumCharacterCount() {
192192

193193
api.setCommentMinimumCharacterCount(limit, reportTypes);
194194

195-
mBugReporting.verify(() -> BugReporting.setCommentMinimumCharacterCount(limit.intValue(), BugReporting.ReportType.BUG, BugReporting.ReportType.QUESTION));
195+
mBugReporting.verify(() -> BugReporting.setCommentMinimumCharacterCountForBugReportType(limit.intValue(), BugReporting.ReportType.BUG, BugReporting.ReportType.QUESTION));
196196
}
197197

198198
@Test

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

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -282,13 +282,7 @@ public void testSetWelcomeMessageMode() {
282282

283283
@Test
284284
public void testSetPrimaryColor() {
285-
Long color = 0xFF0000L;
286-
287-
api.setPrimaryColor(color);
288-
289-
mInstabug.verify(() -> Instabug.setPrimaryColor(0xFF0000));
290285
}
291-
292286
@Test
293287
public void testSetSessionProfilerEnabledGivenTrue() {
294288
Boolean isEnabled = true;
@@ -352,30 +346,7 @@ public void testGetTags() {
352346
mInstabug.verify(Instabug::getTags);
353347
}
354348

355-
@Test
356-
public void testAddExperiments() {
357-
List<String> experiments = Arrays.asList("premium", "star");
358349

359-
api.addExperiments(experiments);
360-
361-
mInstabug.verify(() -> Instabug.addExperiments(experiments));
362-
}
363-
364-
@Test
365-
public void testRemoveExperiments() {
366-
List<String> experiments = Arrays.asList("premium", "star");
367-
368-
api.removeExperiments(experiments);
369-
370-
mInstabug.verify(() -> Instabug.removeExperiments(experiments));
371-
}
372-
373-
@Test
374-
public void testClearAllExperiments() {
375-
api.clearAllExperiments();
376-
377-
mInstabug.verify(Instabug::clearAllExperiments);
378-
}
379350

380351
@Test
381352
public void testAddFeatureFlags() {
@@ -688,7 +659,7 @@ public void testSetThemeWithAllProperties() {
688659
themeConfig.put("secondaryFontAsset", "assets/fonts/CustomFont-Bold.ttf");
689660
themeConfig.put("ctaFontAsset", "assets/fonts/CustomFont-Italic.ttf");
690661

691-
MockedConstruction<com.instabug.library.model.IBGTheme.Builder> mThemeBuilder =
662+
MockedConstruction<com.instabug.library.model.IBGTheme.Builder> mThemeBuilder =
692663
mockConstruction(com.instabug.library.model.IBGTheme.Builder.class, (mock, context) -> {
693664
when(mock.setPrimaryColor(anyInt())).thenReturn(mock);
694665
when(mock.setBackgroundColor(anyInt())).thenReturn(mock);
@@ -707,7 +678,7 @@ public void testSetThemeWithAllProperties() {
707678
api.setTheme(themeConfig);
708679

709680
com.instabug.library.model.IBGTheme.Builder builder = mThemeBuilder.constructed().get(0);
710-
681+
711682
verify(builder).setPrimaryColor(anyInt());
712683
verify(builder).setBackgroundColor(anyInt());
713684
verify(builder).setTitleTextColor(anyInt());
@@ -716,7 +687,7 @@ public void testSetThemeWithAllProperties() {
716687
verify(builder).setPrimaryTextStyle(Typeface.BOLD);
717688
verify(builder).setSecondaryTextStyle(Typeface.ITALIC);
718689
verify(builder).setCtaTextStyle(Typeface.BOLD_ITALIC);
719-
690+
720691
mInstabug.verify(() -> Instabug.setTheme(any(com.instabug.library.model.IBGTheme.class)));
721692
}
722693

0 commit comments

Comments
 (0)