diff --git a/InstabugSample/.babelrc b/InstabugSample/.babelrc index 8df53fe..a9ce136 100644 --- a/InstabugSample/.babelrc +++ b/InstabugSample/.babelrc @@ -1,3 +1,3 @@ { -"presets": ["react-native"] -} \ No newline at end of file + "presets": ["react-native"] +} diff --git a/InstabugSample/.flowconfig b/InstabugSample/.flowconfig index b38ea97..7d60895 100644 --- a/InstabugSample/.flowconfig +++ b/InstabugSample/.flowconfig @@ -12,33 +12,45 @@ ; For RN Apps installed via npm, "Libraries" folder is inside ; "node_modules/react-native" but in the source repo it is in the root .*/Libraries/react-native/React.js -.*/Libraries/react-native/ReactNative.js + +; Ignore polyfills +.*/Libraries/polyfills/.* + +; Ignore metro +.*/node_modules/metro/.* [include] [libs] node_modules/react-native/Libraries/react-native/react-native-interface.js -node_modules/react-native/flow -flow/ +node_modules/react-native/flow/ +node_modules/react-native/flow-github/ [options] -module.system=haste +emoji=true -experimental.strict_type_args=true +module.system=haste munge_underscores=true module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' +module.file_ext=.js +module.file_ext=.jsx +module.file_ext=.json +module.file_ext=.native.js + suppress_type=$FlowIssue suppress_type=$FlowFixMe -suppress_type=$FixMe +suppress_type=$FlowFixMeProps +suppress_type=$FlowFixMeState -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-7]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-7]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy +suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError unsafe.enable_getters_and_setters=true [version] -^0.37.0 +^0.61.0 diff --git a/InstabugSample/.gitignore b/InstabugSample/.gitignore index 8fce639..0826423 100644 --- a/InstabugSample/.gitignore +++ b/InstabugSample/.gitignore @@ -39,7 +39,6 @@ yarn-error.log # BUCK buck-out/ \.buckd/ -android/app/libs *.keystore # fastlane @@ -47,8 +46,8 @@ android/app/libs # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the # screenshots whenever they are needed. # For more information about the recommended setup visit: -# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md +# https://docs.fastlane.tools/best-practices/source-control/ -fastlane/report.xml -fastlane/Preview.html -fastlane/screenshots +*/fastlane/report.xml +*/fastlane/Preview.html +*/fastlane/screenshots diff --git a/InstabugSample/App.js b/InstabugSample/App.js new file mode 100644 index 0000000..b95d656 --- /dev/null +++ b/InstabugSample/App.js @@ -0,0 +1,232 @@ +/** + * Sample React Native App + * https://github.com/facebook/react-native + * @flow + */ + +import React, { Component } from 'react'; +import { + Platform, + StyleSheet, + Text, + View, + TouchableOpacity, + processColor, + Switch, + ScrollView +} from 'react-native'; + +import Instabug from'instabug-reactnative'; + + +const instructions = Platform.select({ + ios: 'Press Cmd+R to reload,\n' + + 'Cmd+D or shake for dev menu', + android: 'Double tap R on your keyboard to reload,\n' + + 'Shake or press menu button for dev menu', +}); + +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'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(); + } + + invoke() { + Instabug.invoke(); + } + + sendBugReport() { + Instabug.invokeWithInvocationMode(Instabug.invocationMode.newBug); + } + + sendFeedback() { + 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); + } + + showUnreadMessagesCount() { + Instabug.getUnreadMessagesCount((count) => { + alert("Messages: " + count); + }); + } +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + alignItems: 'center', + backgroundColor: '#F5FCFF', + }, + details: { + textAlign: 'center', + color: '#333333', + margin: 20, + marginTop: Platform.OS === 'ios' ? 40 : 20 + }, + text: { + color: '#FFFFFF', + fontSize: 12, + fontWeight: 'bold' + }, + button: { + marginTop: 10, + backgroundColor: "#1D82DC", + 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/android/app/BUCK b/InstabugSample/android/app/BUCK index 8fdad0a..65538e5 100644 --- a/InstabugSample/android/app/BUCK +++ b/InstabugSample/android/app/BUCK @@ -1,5 +1,3 @@ -import re - # To learn about Buck see [Docs](https://buckbuild.com/). # To run your application with Buck: # - install Buck @@ -11,8 +9,9 @@ import re # lib_deps = [] + for jarfile in glob(['libs/*.jar']): - name = 'jars__' + re.sub(r'^.*/([^/]+)\.jar$', r'\1', jarfile) + name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')] lib_deps.append(':' + name) prebuilt_jar( name = name, @@ -20,7 +19,7 @@ for jarfile in glob(['libs/*.jar']): ) for aarfile in glob(['libs/*.aar']): - name = 'aars__' + re.sub(r'^.*/([^/]+)\.aar$', r'\1', aarfile) + name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')] lib_deps.append(':' + name) android_prebuilt_aar( name = name, @@ -28,39 +27,39 @@ for aarfile in glob(['libs/*.aar']): ) android_library( - name = 'all-libs', - exported_deps = lib_deps + name = "all-libs", + exported_deps = lib_deps, ) android_library( - name = 'app-code', - srcs = glob([ - 'src/main/java/**/*.java', - ]), - deps = [ - ':all-libs', - ':build_config', - ':res', - ], + name = "app-code", + srcs = glob([ + "src/main/java/**/*.java", + ]), + deps = [ + ":all-libs", + ":build_config", + ":res", + ], ) android_build_config( - name = 'build_config', - package = 'com.instabugsample', + name = "build_config", + package = "com.instabugsample", ) android_resource( - name = 'res', - res = 'src/main/res', - package = 'com.instabugsample', + name = "res", + package = "com.instabugsample", + res = "src/main/res", ) android_binary( - name = 'app', - package_type = 'debug', - manifest = 'src/main/AndroidManifest.xml', - keystore = '//android/keystores:debug', - deps = [ - ':app-code', - ], + name = "app", + keystore = "//android/keystores:debug", + manifest = "src/main/AndroidManifest.xml", + package_type = "debug", + deps = [ + ":app-code", + ], ) diff --git a/InstabugSample/android/app/build.gradle b/InstabugSample/android/app/build.gradle index ff055f1..6fe9cf8 100644 --- a/InstabugSample/android/app/build.gradle +++ b/InstabugSample/android/app/build.gradle @@ -33,6 +33,13 @@ import com.android.build.OutputFile * // bundleInPaidRelease: true, * // bundleInBeta: true, * + * // whether to disable dev mode in custom build variants (by default only disabled in release) + * // for example: to disable dev mode in the staging build type (if configured) + * devDisabledInStaging: true, + * // The configuration property can be in the following formats + * // 'devDisabledIn${productFlavor}${buildType}' + * // 'devDisabledIn${buildType}' + * * // the root of your project, i.e. where "package.json" lives * root: "../../", * @@ -58,13 +65,17 @@ import com.android.build.OutputFile * inputExcludes: ["android/**", "ios/**"], * * // override which node gets called and with what additional arguments - * nodeExecutableAndArgs: ["node"] + * nodeExecutableAndArgs: ["node"], * * // supply additional arguments to the packager * extraPackagerArgs: [] * ] */ +project.ext.react = [ + entryFile: "index.js" +] + apply from: "../../node_modules/react-native/react.gradle" /** @@ -123,9 +134,6 @@ android { } } } - repositories { - maven { url "https://jitpack.io" } - } } dependencies { diff --git a/InstabugSample/android/app/proguard-rules.pro b/InstabugSample/android/app/proguard-rules.pro index 48361a9..6e8516c 100644 --- a/InstabugSample/android/app/proguard-rules.pro +++ b/InstabugSample/android/app/proguard-rules.pro @@ -50,6 +50,10 @@ -dontwarn com.facebook.react.** +# TextLayoutBuilder uses a non-public Android constructor within StaticLayout. +# See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details. +-dontwarn android.text.StaticLayout + # okhttp -keepattributes Signature diff --git a/InstabugSample/android/app/src/main/AndroidManifest.xml b/InstabugSample/android/app/src/main/AndroidManifest.xml index f1a300b..1009f9a 100644 --- a/InstabugSample/android/app/src/main/AndroidManifest.xml +++ b/InstabugSample/android/app/src/main/AndroidManifest.xml @@ -19,7 +19,8 @@ + android:configChanges="keyboard|keyboardHidden|orientation|screenSize" + android:windowSoftInputMode="adjustResize"> diff --git a/InstabugSample/android/app/src/main/java/com/instabugsample/MainApplication.java b/InstabugSample/android/app/src/main/java/com/instabugsample/MainApplication.java index ea0b2f6..beff2b1 100644 --- a/InstabugSample/android/app/src/main/java/com/instabugsample/MainApplication.java +++ b/InstabugSample/android/app/src/main/java/com/instabugsample/MainApplication.java @@ -1,11 +1,9 @@ package com.instabugsample; import android.app.Application; -import android.util.Log; import com.facebook.react.ReactApplication; import com.instabug.reactlibrary.RNInstabugReactnativePackage; -import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; @@ -26,9 +24,19 @@ public class MainApplication extends Application implements ReactApplication { protected List getPackages() { return Arrays.asList( new MainReactPackage(), - new RNInstabugReactnativePackage("YOUR_ANDROID_APPLICATION_TOKEN",MainApplication.this,"shake","#1D82DC") + new RNInstabugReactnativePackage.Builder("YOUR_ANDROID_APPLICATION_TOKEN",MainApplication.this) + .setInvocationEvent("shake") + .setPrimaryColor("#1D82DC") + .setFloatingEdge("left") + .setFloatingButtonOffsetFromTop(250) + .build() ); } + + @Override + protected String getJSMainModuleName() { + return "index"; + } }; @Override diff --git a/InstabugSample/android/build.gradle b/InstabugSample/android/build.gradle index fcba4c5..d9ab00a 100644 --- a/InstabugSample/android/build.gradle +++ b/InstabugSample/android/build.gradle @@ -3,9 +3,13 @@ buildscript { repositories { jcenter() + maven { + url 'https://maven.google.com/' + name 'Google' + } } dependencies { - classpath 'com.android.tools.build:gradle:1.3.1' + classpath 'com.android.tools.build:gradle:2.2.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -20,5 +24,9 @@ allprojects { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url "$rootDir/../node_modules/react-native/android" } + maven { + url 'https://maven.google.com/' + name 'Google' + } } } diff --git a/InstabugSample/android/gradle/wrapper/gradle-wrapper.properties b/InstabugSample/android/gradle/wrapper/gradle-wrapper.properties index b9fbfab..dbdc05d 100644 --- a/InstabugSample/android/gradle/wrapper/gradle-wrapper.properties +++ b/InstabugSample/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip diff --git a/InstabugSample/android/keystores/BUCK b/InstabugSample/android/keystores/BUCK index 15da20e..88e4c31 100644 --- a/InstabugSample/android/keystores/BUCK +++ b/InstabugSample/android/keystores/BUCK @@ -1,8 +1,8 @@ keystore( - name = 'debug', - store = 'debug.keystore', - properties = 'debug.keystore.properties', - visibility = [ - 'PUBLIC', - ], + name = "debug", + properties = "debug.keystore.properties", + store = "debug.keystore", + visibility = [ + "PUBLIC", + ], ) diff --git a/InstabugSample/index.android.js b/InstabugSample/index.android.js deleted file mode 100644 index 9f69882..0000000 --- a/InstabugSample/index.android.js +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Sample React Native App - * https://github.com/facebook/react-native - * @flow - */ -import React, {Component} from "react"; -import { - AppRegistry, - StyleSheet, - Text, - Button, - Alert, - View, - processColor, - Aerlt, - Image, - TouchableHighlight, - RecyclerViewBackedScrollView -} from "react-native"; -import Instabug from "instabug-reactnative"; - -export default class InstabugSample extends Component { - - constructor(props) { - super(props); - - Instabug.setColorTheme(Instabug.colorTheme.light); - Instabug.setPrimaryColor(processColor('#aaff00')); - Instabug.setEmailFieldRequired(false); - - } - - - render() { - return ( - - - Welcome to React Native! - - - To get started, edit index.android.js - - - Double tap R on your keyboard to reload,{'\n'} - Shake or press menu button for dev menu - -