From afd5bf6f73f96fb6a418c2ff1231f7e5e2195aee Mon Sep 17 00:00:00 2001 From: Salma ElTarzi Date: Mon, 15 Jan 2018 14:13:55 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20more=20features=20for=20the?= =?UTF-8?q?=20Sample=20App?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- InstabugSample/App.js | 171 +++++++++++++++--- .../InstabugSample.xcodeproj/project.pbxproj | 166 ++++++++++++++++- .../contents.xcworkspacedata | 10 - .../Images.xcassets/Contents.json | 6 + 4 files changed, 312 insertions(+), 41 deletions(-) delete mode 100644 InstabugSample/ios/InstabugSample.xcworkspace/contents.xcworkspacedata create mode 100644 InstabugSample/ios/InstabugSample/Images.xcassets/Contents.json diff --git a/InstabugSample/App.js b/InstabugSample/App.js index 85ced76..b95d656 100644 --- a/InstabugSample/App.js +++ b/InstabugSample/App.js @@ -10,7 +10,10 @@ import { StyleSheet, Text, View, - TouchableOpacity + TouchableOpacity, + processColor, + Switch, + ScrollView } from 'react-native'; import Instabug from'instabug-reactnative'; @@ -27,39 +30,109 @@ 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 ( - - Hello Instabug 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 - - this.showIntroMessage()}> - SHOW INTRO MESSAGE - - this.invoke()}> - INVOKE - - this.sendBugReport()}> - SEND BUG REPORT - - this.sendFeedback()}> - SEND FEEDBACK - - this.startNewConversation()}> - START A NEW CONVERSATION - - this.showUnreadMessagesCount()}> - GET UNREAD MESSAGES COUNT - + + + 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 + + this.showIntroMessage()}> + SHOW INTRO MESSAGE + + this.invoke()}> + INVOKE + + this.sendBugReport()}> + SEND BUG REPORT + + this.sendFeedback()}> + SEND FEEDBACK + + this.startNewConversation()}> + START A NEW CONVERSATION + + this.showUnreadMessagesCount()}> + GET UNREAD MESSAGES COUNT + + {this.invocationEvent()} + Set primary color + + this.setPrimaryColor('#FF0000')}> + RED + + this.setPrimaryColor('#00FF00')}> + GREEN + + this.setPrimaryColor('#0000FF')}> + BLUE + + this.setPrimaryColor('#FFFF00')}> + YELLOW + + + + Color Theme: {this.state.colorTheme} + + + ); } + invocationEvent() { + if(Platform.OS === 'ios') { + return( + + Change Invocation Event + + this.changeInvocationEvent('Shake')}> + SHAKE + + this.changeInvocationEvent('Button')}> + FLOATING BUTTON + + this.changeInvocationEvent('Screenshot')}> + SCREENSHOT + + this.changeInvocationEvent('None')}> + NONE + + + + ); + } + 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 } }); diff --git a/InstabugSample/ios/InstabugSample.xcodeproj/project.pbxproj b/InstabugSample/ios/InstabugSample.xcodeproj/project.pbxproj index 5ba8f1e..b1ba0e1 100644 --- a/InstabugSample/ios/InstabugSample.xcodeproj/project.pbxproj +++ b/InstabugSample/ios/InstabugSample.xcodeproj/project.pbxproj @@ -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 = ""; }; + 53D615D08C9B45B58B5FB092 /* libRNInstabug.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNInstabug.a; sourceTree = ""; }; 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = ""; }; 75289D1E3DA40C1D5273D5AC /* Instabug.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Instabug.framework; path = "../node_modules/instabug-reactnative/ios/Instabug.framework"; sourceTree = ""; }; - 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 = ""; }; + 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 = ""; }; 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; }; A449A983A79E024260E2FE0D /* InstabugCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = InstabugCore.framework; path = "../node_modules/instabug-reactnative/ios/InstabugCore.framework"; sourceTree = ""; }; @@ -428,6 +491,22 @@ name = "Supporting Files"; sourceTree = ""; }; + 13174BB8200BB5050092B6A8 /* Recovered References */ = { + isa = PBXGroup; + children = ( + 53D615D08C9B45B58B5FB092 /* libRNInstabug.a */, + ); + name = "Recovered References"; + sourceTree = ""; + }; + 13174BEE200BB5090092B6A8 /* Products */ = { + isa = PBXGroup; + children = ( + 13174BF2200BB50A0092B6A8 /* libRNInstabug.a */, + ); + name = Products; + sourceTree = ""; + }; 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 = ""; @@ -542,6 +629,7 @@ 00E356EF1AD99517003FC87E /* InstabugSampleTests */, 83CBBA001A601CBA00E9B192 /* Products */, 2D16E6871FA4F8E400B85C8A /* Frameworks */, + 13174BB8200BB5050092B6A8 /* Recovered References */, ); indentWidth = 2; sourceTree = ""; @@ -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; diff --git a/InstabugSample/ios/InstabugSample.xcworkspace/contents.xcworkspacedata b/InstabugSample/ios/InstabugSample.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 8398a26..0000000 --- a/InstabugSample/ios/InstabugSample.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/InstabugSample/ios/InstabugSample/Images.xcassets/Contents.json b/InstabugSample/ios/InstabugSample/Images.xcassets/Contents.json new file mode 100644 index 0000000..2d92bd5 --- /dev/null +++ b/InstabugSample/ios/InstabugSample/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +}