mirror of
https://github.com/status-im/instabug-reactnative.git
synced 2025-03-03 14:40:54 +00:00
Merge pull request #50 from Instabug/SALMAT/testRelease
Salmat/test release
This commit is contained in:
commit
fb4cedbcd5
@ -19,6 +19,7 @@ import {
|
|||||||
TouchableHighlight,
|
TouchableHighlight,
|
||||||
RecyclerViewBackedScrollView,
|
RecyclerViewBackedScrollView,
|
||||||
ActionSheetIOS,
|
ActionSheetIOS,
|
||||||
|
TextInput
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
|
|
||||||
import Instabug from'instabug-reactnative';
|
import Instabug from'instabug-reactnative';
|
||||||
@ -36,6 +37,8 @@ export default class InstabugSample extends Component {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
|
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
|
||||||
this.state = {
|
this.state = {
|
||||||
dataSource: ds.cloneWithRows(this._genRows({})),
|
dataSource: ds.cloneWithRows(this._genRows({})),
|
||||||
@ -256,12 +259,18 @@ export default class InstabugSample extends Component {
|
|||||||
render() {
|
render() {
|
||||||
console.log(JSON.stringify(this.state));
|
console.log(JSON.stringify(this.state));
|
||||||
return (
|
return (
|
||||||
|
<View>
|
||||||
<ListView
|
<ListView
|
||||||
dataSource={this.state.dataSource}
|
dataSource={this.state.dataSource}
|
||||||
renderRow={this._renderRow.bind(this)}
|
renderRow={this._renderRow.bind(this)}
|
||||||
renderScrollComponent={props => <RecyclerViewBackedScrollView {...props} />}
|
renderScrollComponent={props => <RecyclerViewBackedScrollView {...props} />}
|
||||||
style={styles.listView}
|
style={styles.listView}
|
||||||
/>
|
/>
|
||||||
|
<TextInput
|
||||||
|
style={{height: 40}}
|
||||||
|
placeholder="Type here to translate!"
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,9 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
|||||||
private final String INVOCATION_MODE_NEW_FEEDBACK = "feedback";
|
private final String INVOCATION_MODE_NEW_FEEDBACK = "feedback";
|
||||||
private final String INVOCATION_MODE_NEW_CHAT = "chat";
|
private final String INVOCATION_MODE_NEW_CHAT = "chat";
|
||||||
private final String INVOCATION_MODE_CHATS_LIST = "chats";
|
private final String INVOCATION_MODE_CHATS_LIST = "chats";
|
||||||
|
//FloatingButtonEdge
|
||||||
|
private final String FLOATING_BUTTON_EDGE_RIGHT = "right";
|
||||||
|
private final String FLOATING_BUTTON_EDGE_LEFT = "left";
|
||||||
//locales
|
//locales
|
||||||
private final String LOCALE_ARABIC = "arabic";
|
private final String LOCALE_ARABIC = "arabic";
|
||||||
private final String LOCALE_CHINESE_SIMPLIFIED = "chinesesimplified";
|
private final String LOCALE_CHINESE_SIMPLIFIED = "chinesesimplified";
|
||||||
@ -991,6 +994,20 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the default value of the intro message guide that gets shown on launching the app
|
||||||
|
*
|
||||||
|
* @param enabled true to show intro message guide
|
||||||
|
*/
|
||||||
|
@ReactMethod
|
||||||
|
public void setIntroMessageEnabled(boolean enabled) {
|
||||||
|
try {
|
||||||
|
mInstabug.setIntroMessageEnabled(enabled);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the runnable that gets executed just before showing any valid survey<br/>
|
* Sets the runnable that gets executed just before showing any valid survey<br/>
|
||||||
@ -1232,6 +1249,9 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
|||||||
constants.put("invocationModeNewChat", INVOCATION_MODE_NEW_CHAT);
|
constants.put("invocationModeNewChat", INVOCATION_MODE_NEW_CHAT);
|
||||||
constants.put("invocationModeChatsList", INVOCATION_MODE_CHATS_LIST);
|
constants.put("invocationModeChatsList", INVOCATION_MODE_CHATS_LIST);
|
||||||
|
|
||||||
|
constants.put("floatingButtonEdgeLeft",FLOATING_BUTTON_EDGE_LEFT);
|
||||||
|
constants.put("floatingButtonEdgeRight",FLOATING_BUTTON_EDGE_RIGHT);
|
||||||
|
|
||||||
constants.put("localeArabic", LOCALE_ARABIC);
|
constants.put("localeArabic", LOCALE_ARABIC);
|
||||||
constants.put("localeChineseSimplified", LOCALE_CHINESE_SIMPLIFIED);
|
constants.put("localeChineseSimplified", LOCALE_CHINESE_SIMPLIFIED);
|
||||||
constants.put("localeChineseTraditional", LOCALE_CHINESE_TRADITIONAL);
|
constants.put("localeChineseTraditional", LOCALE_CHINESE_TRADITIONAL);
|
||||||
|
@ -10,6 +10,7 @@ import com.facebook.react.uimanager.ViewManager;
|
|||||||
import com.instabug.library.Instabug;
|
import com.instabug.library.Instabug;
|
||||||
import com.instabug.library.InstabugColorTheme;
|
import com.instabug.library.InstabugColorTheme;
|
||||||
import com.instabug.library.invocation.InstabugInvocationEvent;
|
import com.instabug.library.invocation.InstabugInvocationEvent;
|
||||||
|
import com.instabug.library.invocation.util.InstabugFloatingButtonEdge;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -26,7 +27,8 @@ public class RNInstabugReactnativePackage implements ReactPackage {
|
|||||||
private InstabugColorTheme instabugColorTheme = InstabugColorTheme.InstabugColorThemeLight;
|
private InstabugColorTheme instabugColorTheme = InstabugColorTheme.InstabugColorThemeLight;
|
||||||
|
|
||||||
public RNInstabugReactnativePackage(String androidApplicationToken, Application androidApplication,
|
public RNInstabugReactnativePackage(String androidApplicationToken, Application androidApplication,
|
||||||
String invocationEventValue, String primaryColor) {
|
String invocationEventValue, String primaryColor,
|
||||||
|
InstabugFloatingButtonEdge floatingButtonEdge, int offset) {
|
||||||
this.androidApplication = androidApplication;
|
this.androidApplication = androidApplication;
|
||||||
this.mAndroidApplicationToken = androidApplicationToken;
|
this.mAndroidApplicationToken = androidApplicationToken;
|
||||||
|
|
||||||
@ -55,9 +57,75 @@ public class RNInstabugReactnativePackage implements ReactPackage {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
Instabug.setPrimaryColor(Color.parseColor(primaryColor));
|
Instabug.setPrimaryColor(Color.parseColor(primaryColor));
|
||||||
|
Instabug.setFloatingButtonEdge(floatingButtonEdge);
|
||||||
|
Instabug.setFloatingButtonOffsetFromTop(offset);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RNInstabugReactnativePackage(String androidApplicationToken, Application androidApplication,
|
||||||
|
String invocationEventValue, String primaryColor) {
|
||||||
|
new RNInstabugReactnativePackage(androidApplicationToken,androidApplication,invocationEventValue,primaryColor,
|
||||||
|
InstabugFloatingButtonEdge.LEFT,250);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 primaryColor;
|
||||||
|
InstabugFloatingButtonEdge floatingButtonEdge;
|
||||||
|
int offset;
|
||||||
|
|
||||||
|
public Builder(String androidApplicationToken, Application application) {
|
||||||
|
this.androidApplicationToken = androidApplicationToken;
|
||||||
|
this.application = application;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setInvocationEvent(String invocationEvent) {
|
||||||
|
this.invocationEvent = invocationEvent;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setPrimaryColor(String primaryColor) {
|
||||||
|
this.primaryColor = primaryColor;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setFloatingEdge(String floatingEdge) {
|
||||||
|
this.floatingButtonEdge = getFloatingButtonEdge(floatingEdge);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setFloatingButtonOffsetFromTop(int offset) {
|
||||||
|
this.offset = offset;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RNInstabugReactnativePackage build() {
|
||||||
|
return new RNInstabugReactnativePackage(androidApplicationToken,application,invocationEvent,primaryColor,floatingButtonEdge,offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
private InstabugFloatingButtonEdge getFloatingButtonEdge(String floatingButtonEdgeValue) {
|
||||||
|
InstabugFloatingButtonEdge floatingButtonEdge = InstabugFloatingButtonEdge.RIGHT;
|
||||||
|
try {
|
||||||
|
if (floatingButtonEdgeValue.equals(FLOATING_BUTTON_EDGE_LEFT)) {
|
||||||
|
floatingButtonEdge = InstabugFloatingButtonEdge.LEFT;
|
||||||
|
} else if (floatingButtonEdgeValue.equals(FLOATING_BUTTON_EDGE_RIGHT)) {
|
||||||
|
floatingButtonEdge = InstabugFloatingButtonEdge.RIGHT;
|
||||||
|
}
|
||||||
|
return floatingButtonEdge;
|
||||||
|
|
||||||
|
} catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return floatingButtonEdge;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
||||||
List<NativeModule> modules = new ArrayList<>();
|
List<NativeModule> modules = new ArrayList<>();
|
||||||
|
9
index.js
9
index.js
@ -296,7 +296,6 @@ module.exports = {
|
|||||||
* intro message is enabled or not.
|
* intro message is enabled or not.
|
||||||
*/
|
*/
|
||||||
setIntroMessageEnabled: function (isIntroMessageEnabled) {
|
setIntroMessageEnabled: function (isIntroMessageEnabled) {
|
||||||
if (Platform.OS === 'ios')
|
|
||||||
Instabug.setIntroMessageEnabled(isIntroMessageEnabled);
|
Instabug.setIntroMessageEnabled(isIntroMessageEnabled);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -852,11 +851,9 @@ module.exports = {
|
|||||||
* @readonly
|
* @readonly
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
rectEdge: {
|
floatingButtonEdge: {
|
||||||
minX: Instabug.rectMinXEdge,
|
left: Instabug.rectMinXEdge,
|
||||||
minY: Instabug.rectMinYEdge,
|
right: Instabug.rectMaxXEdge,
|
||||||
maxX: Instabug.rectMaxXEdge,
|
|
||||||
maxY: Instabug.rectMaxYEdge
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
"homepage": "https://github.com/Instabug/instabug-reactnative#readme",
|
"homepage": "https://github.com/Instabug/instabug-reactnative#readme",
|
||||||
"rnpm": {
|
"rnpm": {
|
||||||
"android": {
|
"android": {
|
||||||
"packageInstance": "new RNInstabugReactnativePackage(\"YOUR_ANDROID_APPLICATION_TOKEN\",MainApplication.this,\"shake\",\"#1D82DC\")"
|
"packageInstance": "new RNInstabugReactnativePackage.Builder(\"YOUR_ANDROID_APPLICATION_TOKEN\",MainApplication.this)\n.setInvocationEvent(\"shake\")\n.setPrimaryColor(\"#1D82DC\")\n.setFloatingEdge(\"left\")\n.setFloatingButtonOffsetFromTop(250)\n.build()"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user