Skip to content

Commit 6ccb241

Browse files
committed
feat(android): enabling auto masking
1 parent 934acfa commit 6ccb241

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

android/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ android {
4444
}
4545

4646
dependencies {
47-
api 'com.instabug.library:instabug:14.0.0'
47+
api 'com.instabug.library:instabug:14.0.0.6407912-SNAPSHOT'
4848
testImplementation 'junit:junit:4.13.2'
49-
testImplementation "org.mockito:mockito-inline:3.12.1"
49+
testImplementation "org.mockito:mockito-inline:5.0.0"
5050
testImplementation "io.mockk:mockk:1.13.13"
51-
51+
testImplementation 'org.robolectric:robolectric:4.12.2'
5252
}
5353

5454
// add upload_symbols task

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,4 +492,16 @@ public Map<String, Boolean> isW3CFeatureFlagsEnabled() {
492492
public void willRedirectToStore() {
493493
Instabug.willRedirectToStore();
494494
}
495+
496+
@Override
497+
public void setAutoMaskingEnabled(@NonNull Boolean isEnabled) {
498+
try {
499+
if (isEnabled)
500+
Instabug.setNetworkAutoMaskingState(Feature.State.ENABLED);
501+
else
502+
Instabug.setNetworkAutoMaskingState(Feature.State.DISABLED);
503+
} catch (Exception e) {
504+
e.printStackTrace();
505+
}
506+
}
495507
}

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,20 @@ public void testWillRedirectToStore() {
622622
api.willRedirectToStore();
623623
mInstabug.verify(Instabug::willRedirectToStore);
624624
}
625+
@Test
626+
public void testSetAutoMaskingEnabledGivenFalse() {
627+
boolean isEnabled = false;
625628

629+
api.setAutoMaskingEnabled(isEnabled);
630+
mInstabug.verify(() -> Instabug.setNetworkAutoMaskingState(Feature.State.DISABLED));
631+
}
632+
@Test
633+
public void testSetAutoMaskingEnabledGivenTrue() {
634+
boolean isEnabled = true;
635+
636+
api.setAutoMaskingEnabled(isEnabled);
637+
mInstabug.verify(() -> Instabug.setNetworkAutoMaskingState(Feature.State.ENABLED));
638+
}
626639

627640
@Test
628641
public void isW3CFeatureFlagsEnabled() {

0 commit comments

Comments
 (0)