Add more features for the Sample App

This commit is contained in:
Salma ElTarzi 2018-01-15 14:13:55 +02:00
parent a49ebe94b5
commit afd5bf6f73
4 changed files with 312 additions and 41 deletions

View File

@ -10,7 +10,10 @@ import {
StyleSheet,
Text,
View,
TouchableOpacity
TouchableOpacity,
processColor,
Switch,
ScrollView
} from 'react-native';
import Instabug from'instabug-reactnative';
@ -27,15 +30,22 @@ export default class App extends Component<{}> {
constructor(props) {
super(props);
this.state = {
switchValue: false,
colorTheme: 'Dark'
};
Instabug.startWithToken("8020a1fab5139a4be54038a9728c4dc8", Instabug.invocationEvent.shake);
Instabug.setReportCategories("Performance","UI","Flow","Other");
Instabug.setPromptOptionsEnabled(true, true, true);
Instabug.setLocale(Instabug.locale.english);
}
render() {
return (
<View style={styles.container}>
<ScrollView contentContainerStyle={styles.contentContainer} >
<Text style={styles.details}>
Hello Instabug awesome user! The purpose of this application is to show you the different
Hello {"Instabug's"} awesome user! The purpose of this application is to show you the different
options for customizing the SDK and how easy it is to integrate it to your existing app
</Text>
<TouchableOpacity style={styles.button} onPress={()=>this.showIntroMessage()}>
@ -56,10 +66,73 @@ export default class App extends Component<{}> {
<TouchableOpacity style={styles.button} onPress={()=>this.showUnreadMessagesCount()}>
<Text style={styles.text}> GET UNREAD MESSAGES COUNT </Text>
</TouchableOpacity>
{this.invocationEvent()}
<Text style={styles.textColor}> Set primary color </Text>
<View style={styles.rowView}>
<TouchableOpacity style={styles.buttonColor} onPress={()=>this.setPrimaryColor('#FF0000')}>
<Text style={styles.text}> RED </Text>
</TouchableOpacity>
<TouchableOpacity style={styles.buttonColor} onPress={()=>this.setPrimaryColor('#00FF00')}>
<Text style={styles.text}> GREEN </Text>
</TouchableOpacity>
<TouchableOpacity style={styles.buttonColor} onPress={()=>this.setPrimaryColor('#0000FF')}>
<Text style={styles.text}> BLUE </Text>
</TouchableOpacity>
<TouchableOpacity style={styles.buttonColor} onPress={()=>this.setPrimaryColor('#FFFF00')}>
<Text style={styles.text}> YELLOW </Text>
</TouchableOpacity>
</View>
<View style={styles.switchView}>
<Text style={styles.textSwitchStyle}>Color Theme: {this.state.colorTheme}</Text>
<Switch
onValueChange = {this.toggleSwitch}
value = {this.state.switchValue}/>
</View>
</ScrollView>
</View>
);
}
invocationEvent() {
if(Platform.OS === 'ios') {
return(
<View>
<Text style={styles.textColor}> Change Invocation Event </Text>
<View style={styles.rowView}>
<TouchableOpacity style={styles.buttonColor} onPress={()=>this.changeInvocationEvent('Shake')}>
<Text style={styles.textInvoke}> SHAKE </Text>
</TouchableOpacity>
<TouchableOpacity style={styles.buttonColor} onPress={()=>this.changeInvocationEvent('Button')}>
<Text style={styles.textInvoke}> FLOATING BUTTON </Text>
</TouchableOpacity>
<TouchableOpacity style={styles.buttonColor} onPress={()=>this.changeInvocationEvent('Screenshot')}>
<Text style={styles.textInvoke}> SCREENSHOT </Text>
</TouchableOpacity>
<TouchableOpacity style={styles.buttonColor} onPress={()=>this.changeInvocationEvent('None')}>
<Text style={styles.textInvoke}> NONE </Text>
</TouchableOpacity>
</View>
</View>
);
}
return;
}
toggleSwitch = (value) => {
this.setState({switchValue: value})
if(value) {
this.setState({colorTheme: 'Light'});
Instabug.setColorTheme(Instabug.colorTheme.light);
} else {
this.setState({colorTheme: 'Dark'});
Instabug.setColorTheme(Instabug.colorTheme.dark);
}
}
setPrimaryColor(color) {
Instabug.setPrimaryColor(processColor(color));
}
showIntroMessage() {
Instabug.showIntroMessage();
}
@ -76,6 +149,17 @@ export default class App extends Component<{}> {
Instabug.invokeWithInvocationMode(Instabug.invocationMode.newFeedback);
}
changeInvocationEvent(invocationEvent) {
if(invocationEvent === 'Shake')
Instabug.setInvocationEvent(Instabug.invocationEvent.shake);
if(invocationEvent === 'Button')
Instabug.setInvocationEvent(Instabug.invocationEvent.floatingButton);
if(invocationEvent === 'Screenshot')
Instabug.setInvocationEvent(Instabug.invocationEvent.screenshot);
if(invocationEvent === 'None')
Instabug.setInvocationEvent(Instabug.invocationEvent.none);
}
startNewConversation() {
Instabug.invokeWithInvocationMode(Instabug.invocationMode.newChat);
}
@ -96,10 +180,13 @@ const styles = StyleSheet.create({
details: {
textAlign: 'center',
color: '#333333',
margin: 20
margin: 20,
marginTop: Platform.OS === 'ios' ? 40 : 20
},
text: {
color: '#FFFFFF'
color: '#FFFFFF',
fontSize: 12,
fontWeight: 'bold'
},
button: {
marginTop: 10,
@ -107,5 +194,39 @@ const styles = StyleSheet.create({
padding: 10,
alignItems: 'center',
borderRadius: 5
},
rowView: {
flexDirection: 'row',
marginTop: 10
},
textColor: {
fontSize: 14,
fontWeight: 'bold',
marginTop: 10,
},
buttonColor: {
marginTop: 10,
backgroundColor: "#1D82DC",
padding: 10,
alignItems: 'center',
borderRadius: 5,
marginRight: 5
},
textSwitchStyle: {
marginTop: 10,
marginRight: 5,
fontWeight: 'bold'
},
switchView: {
flexDirection: 'row',
marginTop: 20,
},
textInvoke: {
color: '#FFFFFF',
fontSize: 10,
fontWeight: 'bold'
},
contentContainer: {
padding: 10
}
});

View File

@ -87,6 +87,69 @@
remoteGlobalIDString = 13B07F861A680F5B00A75B9A;
remoteInfo = InstabugSample;
};
13174BDE200BB5090092B6A8 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = EBF21BDC1FC498900052F4D5;
remoteInfo = jsinspector;
};
13174BE0200BB5090092B6A8 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = EBF21BFA1FC4989A0052F4D5;
remoteInfo = "jsinspector-tvOS";
};
13174BE2200BB5090092B6A8 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 139D7ECE1E25DB7D00323FB7;
remoteInfo = "third-party";
};
13174BE4200BB5090092B6A8 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 3D383D3C1EBD27B6005632C8;
remoteInfo = "third-party-tvOS";
};
13174BE6200BB5090092B6A8 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 139D7E881E25C6D100323FB7;
remoteInfo = "double-conversion";
};
13174BE8200BB5090092B6A8 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 3D383D621EBD27B9005632C8;
remoteInfo = "double-conversion-tvOS";
};
13174BEA200BB5090092B6A8 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 9936F3131F5F2E4B0010BF04;
remoteInfo = privatedata;
};
13174BEC200BB5090092B6A8 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 9936F32F1F5F2E5B0010BF04;
remoteInfo = "privatedata-tvOS";
};
13174BF1200BB50A0092B6A8 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 75BE9067987349D092A1F545 /* RNInstabug.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 24DF11ED1DA3A2B90056F77C;
remoteInfo = RNInstabug;
};
139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */;
@ -302,10 +365,10 @@
2D02E47B1E0B4A5D006451C7 /* InstabugSample-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "InstabugSample-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
2D02E4901E0B4A5D006451C7 /* InstabugSample-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "InstabugSample-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
2D16E6891FA4F8E400B85C8A /* libReact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libReact.a; sourceTree = BUILT_PRODUCTS_DIR; };
53D615D08C9B45B58B5FB092 /* libRNInstabug.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = archive.ar; name = libRNInstabug.a; path = libRNInstabug.a; sourceTree = "<group>"; };
53D615D08C9B45B58B5FB092 /* libRNInstabug.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNInstabug.a; sourceTree = "<group>"; };
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
75289D1E3DA40C1D5273D5AC /* Instabug.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Instabug.framework; path = "../node_modules/instabug-reactnative/ios/Instabug.framework"; sourceTree = "<group>"; };
75BE9067987349D092A1F545 /* RNInstabug.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNInstabug.xcodeproj; path = "../node_modules/instabug-reactnative/ios/RNInstabug.xcodeproj"; sourceTree = "<group>"; };
75BE9067987349D092A1F545 /* RNInstabug.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNInstabug.xcodeproj; path = "../node_modules/instabug-reactnative/ios/RNInstabug.xcodeproj"; sourceTree = "<group>"; };
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
A449A983A79E024260E2FE0D /* InstabugCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = InstabugCore.framework; path = "../node_modules/instabug-reactnative/ios/InstabugCore.framework"; sourceTree = "<group>"; };
@ -428,6 +491,22 @@
name = "Supporting Files";
sourceTree = "<group>";
};
13174BB8200BB5050092B6A8 /* Recovered References */ = {
isa = PBXGroup;
children = (
53D615D08C9B45B58B5FB092 /* libRNInstabug.a */,
);
name = "Recovered References";
sourceTree = "<group>";
};
13174BEE200BB5090092B6A8 /* Products */ = {
isa = PBXGroup;
children = (
13174BF2200BB50A0092B6A8 /* libRNInstabug.a */,
);
name = Products;
sourceTree = "<group>";
};
139105B71AF99BAD00B5F7CC /* Products */ = {
isa = PBXGroup;
children = (
@ -466,13 +545,21 @@
isa = PBXGroup;
children = (
146834041AC3E56700842450 /* libReact.a */,
3DAD3EA31DF850E9000B6D8A /* libReact.a */,
3DAD3EA51DF850E9000B6D8A /* libyoga.a */,
3DAD3EA71DF850E9000B6D8A /* libyoga.a */,
3DAD3EA91DF850E9000B6D8A /* libcxxreact.a */,
3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */,
3DAD3EAD1DF850E9000B6D8A /* libjschelpers.a */,
3DAD3EAF1DF850E9000B6D8A /* libjschelpers.a */,
3DAD3EA31DF850E9000B6D8A /* libReact-tvOS.a */,
13174BDF200BB5090092B6A8 /* libjsinspector.a */,
13174BE1200BB5090092B6A8 /* libjsinspector-tvOS.a */,
13174BE3200BB5090092B6A8 /* libthird-party.a */,
13174BE5200BB5090092B6A8 /* libthird-party.a */,
13174BE7200BB5090092B6A8 /* libdouble-conversion.a */,
13174BE9200BB5090092B6A8 /* libdouble-conversion.a */,
13174BEB200BB5090092B6A8 /* libprivatedata.a */,
13174BED200BB5090092B6A8 /* libprivatedata-tvOS.a */,
);
name = Products;
sourceTree = "<group>";
@ -542,6 +629,7 @@
00E356EF1AD99517003FC87E /* InstabugSampleTests */,
83CBBA001A601CBA00E9B192 /* Products */,
2D16E6871FA4F8E400B85C8A /* Frameworks */,
13174BB8200BB5050092B6A8 /* Recovered References */,
);
indentWidth = 2;
sourceTree = "<group>";
@ -729,6 +817,10 @@
ProductGroup = 146834001AC3E56700842450 /* Products */;
ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
},
{
ProductGroup = 13174BEE200BB5090092B6A8 /* Products */;
ProjectRef = 75BE9067987349D092A1F545 /* RNInstabug.xcodeproj */;
},
);
projectRoot = "";
targets = (
@ -776,6 +868,69 @@
remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
13174BDF200BB5090092B6A8 /* libjsinspector.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libjsinspector.a;
remoteRef = 13174BDE200BB5090092B6A8 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
13174BE1200BB5090092B6A8 /* libjsinspector-tvOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libjsinspector-tvOS.a";
remoteRef = 13174BE0200BB5090092B6A8 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
13174BE3200BB5090092B6A8 /* libthird-party.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libthird-party.a";
remoteRef = 13174BE2200BB5090092B6A8 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
13174BE5200BB5090092B6A8 /* libthird-party.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libthird-party.a";
remoteRef = 13174BE4200BB5090092B6A8 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
13174BE7200BB5090092B6A8 /* libdouble-conversion.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libdouble-conversion.a";
remoteRef = 13174BE6200BB5090092B6A8 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
13174BE9200BB5090092B6A8 /* libdouble-conversion.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libdouble-conversion.a";
remoteRef = 13174BE8200BB5090092B6A8 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
13174BEB200BB5090092B6A8 /* libprivatedata.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libprivatedata.a;
remoteRef = 13174BEA200BB5090092B6A8 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
13174BED200BB5090092B6A8 /* libprivatedata-tvOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libprivatedata-tvOS.a";
remoteRef = 13174BEC200BB5090092B6A8 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
13174BF2200BB50A0092B6A8 /* libRNInstabug.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRNInstabug.a;
remoteRef = 13174BF1200BB50A0092B6A8 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
@ -860,10 +1015,10 @@
remoteRef = 3DAD3E981DF850E9000B6D8A /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
3DAD3EA31DF850E9000B6D8A /* libReact-tvOS.a */ = {
3DAD3EA31DF850E9000B6D8A /* libReact.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libReact-tvOS.a";
path = libReact.a;
remoteRef = 3DAD3EA21DF850E9000B6D8A /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
@ -1008,7 +1163,6 @@
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "bash \"${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/InstabugCore.framework/strip-frameworks.sh\"\n";
showEnvVarsInLog = 1;
};
2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = {
isa = PBXShellScriptBuildPhase;

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:InstabugSample.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>

View File

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}