package com.bugsnag.android.unity;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.bugsnag.android.Error;
import com.bugsnag.android.Event;
import com.bugsnag.android.OnErrorCallback;

public class BugsnagUnity {
    static {
        System.loadLibrary("bugsnag-unity");
    }

    public static native boolean isJNIAttached();

    public static OnErrorCallback getNativeCallback() {
        String discardedEventErrorClass = "java.lang.Error";
        Pattern pattern = Pattern.compile("signal \\d+ \\(SIG\\w+\\)", Pattern.CASE_INSENSITIVE);
        return new OnErrorCallback() {
            @Override
            // Discard any messages matching native Android events as they are captured (and more
            // accurate) via bugsnag-android. For Unity 2018.3+
            public boolean onError(Event event) {
                Error error = event.getErrors().get(0);
                String errorClass = error.getErrorClass();
                String message = error.getErrorMessage();
                if(discardedEventErrorClass.equals(errorClass))
                {
                    if(message == null || !pattern.matcher(message).find())
                    {
                        return false;
                    }
                }
                return true;
            }
        };
    }
}

@@ -1075,32 +1075,16 @@
 rClass))
-%0A               
  %7B%0A     
@@ -1098,19 +1098,23 @@
         
-if(
+return 
 message 
@@ -1160,91 +1160,9 @@
 nd()
-)%0A                    %7B%0A                        return false;%0A                    %7D
+;
 %0A   

Update bugsnag-android-unity/src/main/java/com/bugsnag/android/unity/BugsnagUnity.java