Skip to content

Commit

Permalink
🎉 Bump version to v8.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SalmaAli authored and SalmaAli committed Jul 15, 2018
2 parents 4cc7483 + 43a96f8 commit e854800
Show file tree
Hide file tree
Showing 49 changed files with 2,313 additions and 580 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ android {

dependencies {
compile 'com.facebook.react:react-native:0.20.+'
compile ('com.instabug.library:instabug:4.15.3'){
compile ('com.instabug.library:instabug:8.0.1'){
exclude group: 'com.android.support:appcompat-v7'
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,79 +7,108 @@
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import com.instabug.bug.BugReporting;
import com.instabug.library.Feature;
import com.instabug.library.Instabug;
import com.instabug.library.InstabugColorTheme;
import com.instabug.library.invocation.InstabugInvocationEvent;
import com.instabug.library.invocation.util.InstabugFloatingButtonEdge;
import com.instabug.library.visualusersteps.State;
import android.graphics.Color;
import android.util.Log;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class RNInstabugReactnativePackage implements ReactPackage {

private static final String TAG = RNInstabugReactnativePackage.class.getSimpleName();

private Application androidApplication;
private String mAndroidApplicationToken;
private Instabug mInstabug;
private Instabug.Builder mBuilder;
private InstabugInvocationEvent invocationEvent = InstabugInvocationEvent.FLOATING_BUTTON;
private ArrayList<InstabugInvocationEvent> invocationEvents = new ArrayList<>();
private InstabugColorTheme instabugColorTheme = InstabugColorTheme.InstabugColorThemeLight;

public RNInstabugReactnativePackage(String androidApplicationToken, Application androidApplication,
String invocationEventValue, String primaryColor,
String[] invocationEventValues, String primaryColor,
InstabugFloatingButtonEdge floatingButtonEdge, int offset) {
this.androidApplication = androidApplication;
this.mAndroidApplicationToken = androidApplicationToken;

//setting invocation event
if (invocationEventValue.equals("button")) {
this.invocationEvent = InstabugInvocationEvent.FLOATING_BUTTON;
} else if (invocationEventValue.equals("swipe")) {
this.invocationEvent = InstabugInvocationEvent.TWO_FINGER_SWIPE_LEFT;

} else if (invocationEventValue.equals("shake")) {
this.invocationEvent = InstabugInvocationEvent.SHAKE;

} else if (invocationEventValue.equals("screenshot")) {
this.invocationEvent = InstabugInvocationEvent.SCREENSHOT_GESTURE;

} else if (invocationEventValue.equals("none")) {
this.invocationEvent = InstabugInvocationEvent.NONE;

} else {
this.invocationEvent = InstabugInvocationEvent.SHAKE;
}

this.parseInvocationEvent(invocationEventValues);

mInstabug = new Instabug.Builder(this.androidApplication, this.mAndroidApplicationToken)
.setInvocationEvent(this.invocationEvent)
.setInvocationEvents(this.invocationEvents.toArray(new InstabugInvocationEvent[0]))
.setCrashReportingState(Feature.State.ENABLED)
.setReproStepsState(State.DISABLED)
.build();

Instabug.setPrimaryColor(Color.parseColor(primaryColor));
Instabug.setFloatingButtonEdge(floatingButtonEdge);
Instabug.setFloatingButtonOffsetFromTop(offset);
BugReporting.setFloatingButtonEdge(floatingButtonEdge);
BugReporting.setFloatingButtonOffset(offset);

}

public RNInstabugReactnativePackage(String androidApplicationToken, Application androidApplication,
String invocationEventValue, String primaryColor) {
new RNInstabugReactnativePackage(androidApplicationToken,androidApplication,invocationEventValue,primaryColor,
String[] invocationEventValues, String primaryColor) {
new RNInstabugReactnativePackage(androidApplicationToken,androidApplication,invocationEventValues,primaryColor,
InstabugFloatingButtonEdge.LEFT,250);
}

private void parseInvocationEvent(String[] invocationEventValues) {

for (int i = 0; i < invocationEventValues.length; i++) {
if (invocationEventValues[i].equals("button")) {
this.invocationEvents.add(InstabugInvocationEvent.FLOATING_BUTTON);
} else if (invocationEventValues[i].equals("swipe")) {
this.invocationEvents.add(InstabugInvocationEvent.TWO_FINGER_SWIPE_LEFT);

} else if (invocationEventValues[i].equals("shake")) {
this.invocationEvents.add(InstabugInvocationEvent.SHAKE);

} else if (invocationEventValues[i].equals("screenshot")) {
this.invocationEvents.add(InstabugInvocationEvent.SCREENSHOT_GESTURE);

} else if (invocationEventValues[i].equals("none")) {
this.invocationEvents.add(InstabugInvocationEvent.NONE);
}
}

if (invocationEvents.isEmpty()) {
invocationEvents.add(InstabugInvocationEvent.SHAKE);
}
}

@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
List<NativeModule> modules = new ArrayList<>();
modules.add(new RNInstabugReactnativeModule(reactContext, this.androidApplication, this.mInstabug));
return modules;
}

public List<Class<? extends JavaScriptModule>> createJSModules() {
return Collections.emptyList();
}

@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
return Collections.emptyList();
}


public static class Builder {
//FloatingButtonEdge
private final String FLOATING_BUTTON_EDGE_RIGHT = "right";
private final String FLOATING_BUTTON_EDGE_LEFT = "left";

String androidApplicationToken;
Application application;
String invocationEvent;
String[] invocationEvents;
String primaryColor;
InstabugFloatingButtonEdge floatingButtonEdge;
int offset;
Expand All @@ -89,8 +118,8 @@ public Builder(String androidApplicationToken, Application application) {
this.application = application;
}

public Builder setInvocationEvent(String invocationEvent) {
this.invocationEvent = invocationEvent;
public Builder setInvocationEvent(String... invocationEvents) {
this.invocationEvents = invocationEvents;
return this;
}

Expand All @@ -110,7 +139,7 @@ public Builder setFloatingButtonOffsetFromTop(int offset) {
}

public RNInstabugReactnativePackage build() {
return new RNInstabugReactnativePackage(androidApplicationToken,application,invocationEvent,primaryColor,floatingButtonEdge,offset);
return new RNInstabugReactnativePackage(androidApplicationToken,application,invocationEvents,primaryColor,floatingButtonEdge,offset);
}

private InstabugFloatingButtonEdge getFloatingButtonEdge(String floatingButtonEdgeValue) {
Expand All @@ -130,20 +159,4 @@ private InstabugFloatingButtonEdge getFloatingButtonEdge(String floatingButtonEd
}
}

@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
List<NativeModule> modules = new ArrayList<>();
modules.add(new RNInstabugReactnativeModule(reactContext, this.androidApplication, this.mInstabug));
return modules;
}

public List<Class<? extends JavaScriptModule>> createJSModules() {
return Collections.emptyList();
}

@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
return Collections.emptyList();
}

}
Loading

0 comments on commit e854800

Please sign in to comment.