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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

* Adds BugReporting.setFloatingButtonEdge API
* Supports starting SDK from Dart only.
* Fixes an issue with Android screenshots being black on release mode on SDK v10.13.0

## v10.13.0 (2022-03-31)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;

import com.instabug.apm.APM;
import com.instabug.apm.model.ExecutionTrace;
Expand Down Expand Up @@ -165,7 +166,7 @@ public void startWithToken(String token, ArrayList<String> invocationEvents) {
.setInvocationEvents(invocationEventsArray)
.build();

enableScreenShotByMediaProjection();
enableScreenShotByMediaProjection(true);
}

/**
Expand Down Expand Up @@ -429,20 +430,9 @@ public void setValue(String value, String forStringWithKey) {
/**
* Enables taking screenshots by media projection.
*/
private void enableScreenShotByMediaProjection() {
try {
Method method = getMethod(Class.forName("com.instabug.bug.BugReporting"),
"setScreenshotByMediaProjectionEnabled", boolean.class);
if (method != null) {
method.invoke(null, true);
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
@VisibleForTesting
public static void enableScreenShotByMediaProjection(boolean isScreenshotByMediaProjectionEnabled) {
BugReporting.setScreenshotByMediaProjectionEnabled(isScreenshotByMediaProjectionEnabled);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import static androidx.test.espresso.matcher.ViewMatchers.withResourceName;
import static androidx.test.espresso.matcher.ViewMatchers.withText;

import com.instabug.instabugflutter.InstabugFlutterPlugin;

@RunWith(AndroidJUnit4.class)
public class InvokeInstabugUITest {

Expand All @@ -37,18 +39,7 @@ public void ensureInstabugInvocati1on() throws InterruptedException {
}

private void disableScreenShotByMediaProjection() {
try {
Method method = getMethod(Class.forName("com.instabug.bug.BugReporting"), "setScreenshotByMediaProjectionEnabled", boolean.class);
if (method != null) {
method.invoke(null, false);
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
InstabugFlutterPlugin.enableScreenShotByMediaProjection(false);
}

public static Method getMethod(Class clazz, String methodName, Class... parameterType) {
Expand Down