Skip to content

Commit 2a3a72c

Browse files
Merge pull request #625 from Instabug/feat/screen-render-testing
fix: dropping SR data for customUiTrace when disable AutoUiTrace
2 parents 96298dc + 8a3a98c commit 2a3a72c

File tree

22 files changed

+432
-408
lines changed

22 files changed

+432
-408
lines changed

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ android {
5252
}
5353

5454
dependencies {
55-
api 'com.instabug.library:instabug:15.0.2.7140934-SNAPSHOT'
55+
api 'com.instabug.library:instabug:15.0.2.7160278-SNAPSHOT'
5656
testImplementation 'junit:junit:4.13.2'
5757
testImplementation "org.mockito:mockito-inline:3.12.1"
5858
testImplementation "io.mockk:mockk:1.13.13"

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,20 @@ public void isEndScreenLoadingEnabled(@NonNull ApmPigeon.Result<Boolean> result)
374374
isScreenLoadingEnabled(result);
375375
}
376376

377+
@Override
378+
public void isAutoUiTraceEnabled(@NonNull ApmPigeon.Result<Boolean> result) {
379+
try {
380+
InternalAPM._isFeatureEnabledCP(APMFeature.UI_TRACE, "InstabugCaptureScreenLoading", new FeatureAvailabilityCallback() {
381+
@Override
382+
public void invoke(boolean isFeatureAvailable) {
383+
result.success(isFeatureAvailable);
384+
}
385+
});
386+
} catch (Exception e) {
387+
e.printStackTrace();
388+
}
389+
}
390+
377391
@Override
378392
public void isEnabled(@NonNull ApmPigeon.Result<Boolean> result) {
379393
try {

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,28 @@ public void testSetScreenLoadingMonitoringEnabled() {
328328
mAPM.verify(() -> APM.setScreenLoadingEnabled(isEnabled));
329329
}
330330

331+
@Test
332+
public void testIsAutoUiTraceEnabled() {
333+
334+
boolean expected = true;
335+
ApmPigeon.Result<Boolean> result = spy(makeResult((actual) -> assertEquals(expected, actual)));
336+
337+
mInternalApmStatic.when(() -> InternalAPM._isFeatureEnabledCP(any(), any(), any())).thenAnswer(
338+
invocation -> {
339+
FeatureAvailabilityCallback callback = (FeatureAvailabilityCallback) invocation.getArguments()[2];
340+
callback.invoke(expected);
341+
return null;
342+
});
343+
344+
345+
api.isScreenRenderEnabled(result);
346+
347+
mInternalApmStatic.verify(() -> InternalAPM._isFeatureEnabledCP(any(), any(), any()));
348+
mInternalApmStatic.verifyNoMoreInteractions();
349+
350+
verify(result).success(expected);
351+
}
352+
331353
@Test
332354
public void testIsScreenRenderEnabled() {
333355

example/ios/InstabugTests/ApmApiTests.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ - (void)testEndScreenLoading {
199199
OCMVerify([self.mAPM endScreenLoadingCPWithEndTimestampMUS:endScreenLoadingCPWithEndTimestampMUS]);
200200
}
201201

202+
202203
- (void)testIsScreenRenderEnabled {
203204
XCTestExpectation *expectation = [self expectationWithDescription:@"Call completion handler"];
204205

example/ios/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ target 'Runner' do
3030

3131
use_frameworks!
3232
use_modular_headers!
33-
pod 'Instabug', :podspec => 'https://ios-releases.instabug.com/custom/faeture-screen_rendering-release/15.1.29/Instabug.podspec'
33+
pod 'Instabug', :podspec => 'https://ios-releases.instabug.com/custom/faeture-screen_rendering-release/15.1.31/Instabug.podspec'
3434
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
3535
end
3636

example/ios/Podfile.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
PODS:
22
- Flutter (1.0.0)
3-
- Instabug (15.1.29)
3+
- Instabug (15.1.31)
44
- instabug_flutter (14.3.0):
55
- Flutter
6-
- Instabug (= 15.1.29)
6+
- Instabug (= 15.1.31)
77
- OCMock (3.6)
88

99
DEPENDENCIES:
1010
- Flutter (from `Flutter`)
11-
- Instabug (from `https://ios-releases.instabug.com/custom/faeture-screen_rendering-release/15.1.29/Instabug.podspec`)
11+
- Instabug (from `https://ios-releases.instabug.com/custom/faeture-screen_rendering-release/15.1.31/Instabug.podspec`)
1212
- instabug_flutter (from `.symlinks/plugins/instabug_flutter/ios`)
1313
- OCMock (= 3.6)
1414

@@ -20,16 +20,16 @@ EXTERNAL SOURCES:
2020
Flutter:
2121
:path: Flutter
2222
Instabug:
23-
:podspec: https://ios-releases.instabug.com/custom/faeture-screen_rendering-release/15.1.29/Instabug.podspec
23+
:podspec: https://ios-releases.instabug.com/custom/faeture-screen_rendering-release/15.1.31/Instabug.podspec
2424
instabug_flutter:
2525
:path: ".symlinks/plugins/instabug_flutter/ios"
2626

2727
SPEC CHECKSUMS:
2828
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
29-
Instabug: c2ddabc44a1f425615fedba6331a7d1e8805e413
30-
instabug_flutter: 30227104e2ba5857bcd7794dc21e353bdb691f3e
29+
Instabug: 447d3f5a9f1c83120235437e08c9a51aaa8f8605
30+
instabug_flutter: 65aa2dee3036a3c7c8feff8e898c9547239a891d
3131
OCMock: 5ea90566be239f179ba766fd9fbae5885040b992
3232

33-
PODFILE CHECKSUM: 8194fdeb7c217898e3faaeed21926a5fc586751d
33+
PODFILE CHECKSUM: c5b98f57c27da87950775c360d20aaedd3216b8d
3434

3535
COCOAPODS: 1.15.2

example/lib/main.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,17 @@ part 'src/screens/screen_render_page.dart';
3737

3838
void main() {
3939
runZonedGuarded(
40-
() {
40+
() async {
4141
WidgetsFlutterBinding.ensureInitialized();
4242

43-
Instabug.init(
43+
await Instabug.init(
4444
token: 'ed6f659591566da19b67857e1b9d40ab',
4545
invocationEvents: [InvocationEvent.floatingButton],
4646
debugLogsLevel: LogLevel.verbose,
4747
appVariant: 'variant 1',
48-
).then((_) {
49-
APM.setScreenRenderingEnabled(true);
50-
});
51-
48+
);
49+
APM.setScreenRenderingEnabled(true);
50+
APM.setAutoUITraceEnabled(false);
5251
FlutterError.onError = (FlutterErrorDetails details) {
5352
Zone.current.handleUncaughtError(details.exception, details.stack!);
5453
};

0 commit comments

Comments
 (0)