From 90d0553c5b25a895f96aefbf6c1ac67cb4f77c44 Mon Sep 17 00:00:00 2001 From: Salakar Date: Tue, 5 Feb 2019 04:33:29 +0000 Subject: [PATCH] [crashlytics] create package --- packages/crashlytics/.npmignore | 65 ++++ packages/crashlytics/LICENSE | 32 ++ packages/crashlytics/README.md | 47 +++ packages/crashlytics/android/build.gradle | 66 ++++ .../gradle/wrapper/gradle-wrapper.properties | 6 + packages/crashlytics/android/gradlew | 160 ++++++++ packages/crashlytics/android/gradlew.bat | 90 +++++ packages/crashlytics/android/lint.xml | 5 + packages/crashlytics/android/settings.gradle | 1 + .../android/src/main/AndroidManifest.xml | 8 + .../ReactNativeFirebaseCrashlyticsModule.java | 40 ++ ...ReactNativeFirebaseCrashlyticsPackage.java | 42 +++ packages/crashlytics/e2e/crashlytics.e2e.js | 27 ++ .../crashlytics/ios/RNFBCrashlytics.podspec | 20 + .../RNFBCrashlytics.xcodeproj/project.pbxproj | 349 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../xcshareddata/WorkspaceSettings.xcsettings | 5 + .../xcshareddata/IDETemplateMacros.plist | 24 ++ .../RNFBCrashlytics/RNFBCrashlyticsModule.h | 24 ++ .../RNFBCrashlytics/RNFBCrashlyticsModule.m | 38 ++ packages/crashlytics/lib/index.d.ts | 90 +++++ packages/crashlytics/lib/index.js | 55 +++ packages/crashlytics/lib/index.js.flow | 70 ++++ packages/crashlytics/package.json | 42 +++ tests/package.json | 1 + 26 files changed, 1322 insertions(+) create mode 100644 packages/crashlytics/.npmignore create mode 100644 packages/crashlytics/LICENSE create mode 100644 packages/crashlytics/README.md create mode 100644 packages/crashlytics/android/build.gradle create mode 100644 packages/crashlytics/android/gradle/wrapper/gradle-wrapper.properties create mode 100644 packages/crashlytics/android/gradlew create mode 100644 packages/crashlytics/android/gradlew.bat create mode 100644 packages/crashlytics/android/lint.xml create mode 100644 packages/crashlytics/android/settings.gradle create mode 100644 packages/crashlytics/android/src/main/AndroidManifest.xml create mode 100644 packages/crashlytics/android/src/main/java/io/invertase/firebase/crashlytics/ReactNativeFirebaseCrashlyticsModule.java create mode 100644 packages/crashlytics/android/src/main/java/io/invertase/firebase/crashlytics/ReactNativeFirebaseCrashlyticsPackage.java create mode 100644 packages/crashlytics/e2e/crashlytics.e2e.js create mode 100644 packages/crashlytics/ios/RNFBCrashlytics.podspec create mode 100644 packages/crashlytics/ios/RNFBCrashlytics.xcodeproj/project.pbxproj create mode 100644 packages/crashlytics/ios/RNFBCrashlytics.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 packages/crashlytics/ios/RNFBCrashlytics.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 packages/crashlytics/ios/RNFBCrashlytics.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings create mode 100644 packages/crashlytics/ios/RNFBCrashlytics.xcodeproj/xcshareddata/IDETemplateMacros.plist create mode 100644 packages/crashlytics/ios/RNFBCrashlytics/RNFBCrashlyticsModule.h create mode 100644 packages/crashlytics/ios/RNFBCrashlytics/RNFBCrashlyticsModule.m create mode 100644 packages/crashlytics/lib/index.d.ts create mode 100644 packages/crashlytics/lib/index.js create mode 100644 packages/crashlytics/lib/index.js.flow create mode 100644 packages/crashlytics/package.json diff --git a/packages/crashlytics/.npmignore b/packages/crashlytics/.npmignore new file mode 100644 index 00000000..d9fa30e5 --- /dev/null +++ b/packages/crashlytics/.npmignore @@ -0,0 +1,65 @@ +# Built application files +android/*/build/ + +# Crashlytics configuations +android/com_crashlytics_export_strings.xml + +# Local configuration file (sdk path, etc) +android/local.properties + +# Gradle generated files +android/.gradle/ + +# Signing files +android/.signing/ + +# User-specific configurations +android/.idea/gradle.xml +android/.idea/libraries/ +android/.idea/workspace.xml +android/.idea/tasks.xml +android/.idea/.name +android/.idea/compiler.xml +android/.idea/copyright/profiles_settings.xml +android/.idea/encodings.xml +android/.idea/misc.xml +android/.idea/modules.xml +android/.idea/scopes/scope_settings.xml +android/.idea/vcs.xml +android/*.iml + +# Xcode +*.pbxuser +*.mode1v3 +*.mode2v3 +*.perspectivev3 +*.xcuserstate +ios/Pods +ios/build +*project.xcworkspace* +*xcuserdata* + +# OS-specific files +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.dbandroid/gradle +android/gradlew +android/build +android/gradlew.bat +android/gradle/ + +.idea +coverage +yarn.lock +e2e/ +.github +.vscode +.nyc_output +android/.settings +*.coverage.json +.circleci +.eslintignore diff --git a/packages/crashlytics/LICENSE b/packages/crashlytics/LICENSE new file mode 100644 index 00000000..ef3ed44f --- /dev/null +++ b/packages/crashlytics/LICENSE @@ -0,0 +1,32 @@ +Apache-2.0 License +------------------ + +Copyright (c) 2016-present Invertase Limited & Contributors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this library except in compliance with the License. + +You may obtain a copy of the Apache-2.0 License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + + +Creative Commons Attribution 3.0 License +---------------------------------------- + +Copyright (c) 2016-present Invertase Limited & Contributors + +Documentation and other instructional materials provided for this project +(including on a separate documentation repository or it's documentation website) are +licensed under the Creative Commons Attribution 3.0 License. Code samples/blocks +contained therein are licensed under the Apache License, Version 2.0 (the "License"), as above. + +You may obtain a copy of the Creative Commons Attribution 3.0 License at + + https://creativecommons.org/licenses/by/3.0/ diff --git a/packages/crashlytics/README.md b/packages/crashlytics/README.md new file mode 100644 index 00000000..446573e3 --- /dev/null +++ b/packages/crashlytics/README.md @@ -0,0 +1,47 @@ +

+ +
+
+

React Native Firebase - Crashlytics

+

+ +

+ NPM downloads + NPM version + License + Backers on Open Collective + Sponsors on Open Collective + Chat + Follow on Twitter +

+ +---- + +Crashlytics description. + +[> Learn More](https://firebase.google.com/products/crashlytics/) + +## Installation + +```bash +yarn add @react-native-firebase/crashlytics +react-native link @react-native-firebase/crashlytics +``` + +## Documentation + + - [Guides](#TODO) + - [Installation](#TODO) + - [Reference](#TODO) + +## License + +- See [LICENSE](/LICENSE) + +---- + +Built and maintained with 💛 by [Invertase](https://invertase.io). + +- [💼 Hire Us](https://invertase.io/hire-us) +- [☕️ Sponsor Us](https://opencollective.com/react-native-firebase) +- [👩‍💻 Work With Us](https://invertase.io/jobs) diff --git a/packages/crashlytics/android/build.gradle b/packages/crashlytics/android/build.gradle new file mode 100644 index 00000000..9dee65ac --- /dev/null +++ b/packages/crashlytics/android/build.gradle @@ -0,0 +1,66 @@ +buildscript { + repositories { + google() + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:3.3.0' + } +} + +plugins { + id "io.invertase.gradle.build" version "1.3" +} + +project.ext { + set('react-native', [ + versions: [ + android : [ + minSdk : 16, + targetSdk : 28, + compileSdk: 28, + // optional as gradle.buildTools comes with one by default + // overriding here though to match the version RN uses + buildTools: "28.0.3" + ], + + googlePlayServices: [ + base: "16.0.1", + ], + + firebase : [ + crashlytics: "16.0.6" + ], + ], + ]) +} + +android { + defaultConfig { + multiDexEnabled true + } + lintOptions { + disable 'GradleCompatible' + abortOnError false + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +repositories { + google() + jcenter() +} + +dependencies { + api project(':@react-native-firebase/app') + implementation "com.google.firebase:firebase-crashlytics:${ReactNative.ext.getVersion("firebase", "crashlytics")}" + implementation "com.google.android.gms:play-services-base:${ReactNative.ext.getVersion("googlePlayServices", "base")}" +} + +ReactNative.shared.applyPackageVersion() +ReactNative.shared.applyDefaultExcludes() +ReactNative.module.applyAndroidVersions() +ReactNative.module.applyReactNativeDependency("api") diff --git a/packages/crashlytics/android/gradle/wrapper/gradle-wrapper.properties b/packages/crashlytics/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..5c8a6d6f --- /dev/null +++ b/packages/crashlytics/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Tue Oct 09 01:55:27 BST 2018 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip diff --git a/packages/crashlytics/android/gradlew b/packages/crashlytics/android/gradlew new file mode 100644 index 00000000..9d82f789 --- /dev/null +++ b/packages/crashlytics/android/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/packages/crashlytics/android/gradlew.bat b/packages/crashlytics/android/gradlew.bat new file mode 100644 index 00000000..8a0b282a --- /dev/null +++ b/packages/crashlytics/android/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/packages/crashlytics/android/lint.xml b/packages/crashlytics/android/lint.xml new file mode 100644 index 00000000..c3dd72ac --- /dev/null +++ b/packages/crashlytics/android/lint.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/crashlytics/android/settings.gradle b/packages/crashlytics/android/settings.gradle new file mode 100644 index 00000000..b34fa0e3 --- /dev/null +++ b/packages/crashlytics/android/settings.gradle @@ -0,0 +1 @@ +rootProject.name = '@react-native-firebase/crashlytics' diff --git a/packages/crashlytics/android/src/main/AndroidManifest.xml b/packages/crashlytics/android/src/main/AndroidManifest.xml new file mode 100644 index 00000000..e64cfda2 --- /dev/null +++ b/packages/crashlytics/android/src/main/AndroidManifest.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/packages/crashlytics/android/src/main/java/io/invertase/firebase/crashlytics/ReactNativeFirebaseCrashlyticsModule.java b/packages/crashlytics/android/src/main/java/io/invertase/firebase/crashlytics/ReactNativeFirebaseCrashlyticsModule.java new file mode 100644 index 00000000..b36856a2 --- /dev/null +++ b/packages/crashlytics/android/src/main/java/io/invertase/firebase/crashlytics/ReactNativeFirebaseCrashlyticsModule.java @@ -0,0 +1,40 @@ +package io.invertase.firebase.crashlytics; + +/* + * Copyright (c) 2016-present Invertase Limited & Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this library except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +import android.app.Activity; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.Promise; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.ReadableMap; +import com.facebook.react.bridge.ReadableMapKeySetIterator; + +import javax.annotation.Nullable; + +import io.invertase.firebase.common.ReactNativeFirebaseModule; + +public class ReactNativeFirebaseCrashlyticsModule extends ReactNativeFirebaseModule { + private static final String TAG = "Crashlytics"; + + ReactNativeFirebaseCrashlyticsModule(ReactApplicationContext reactContext) { + super(reactContext, TAG); + } + +} diff --git a/packages/crashlytics/android/src/main/java/io/invertase/firebase/crashlytics/ReactNativeFirebaseCrashlyticsPackage.java b/packages/crashlytics/android/src/main/java/io/invertase/firebase/crashlytics/ReactNativeFirebaseCrashlyticsPackage.java new file mode 100644 index 00000000..e63cc060 --- /dev/null +++ b/packages/crashlytics/android/src/main/java/io/invertase/firebase/crashlytics/ReactNativeFirebaseCrashlyticsPackage.java @@ -0,0 +1,42 @@ +package io.invertase.firebase.crashlytics; + +/* + * Copyright (c) 2016-present Invertase Limited & Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this library except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +import com.facebook.react.ReactPackage; +import com.facebook.react.bridge.NativeModule; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.uimanager.ViewManager; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +@SuppressWarnings("unused") +public class ReactNativeFirebaseCrashlyticsPackage implements ReactPackage { + @Override + public List createNativeModules(ReactApplicationContext reactContext) { + List modules = new ArrayList<>(); + modules.add(new ReactNativeFirebaseCrashlyticsModule(reactContext)); + return modules; + } + + @Override + public List createViewManagers(ReactApplicationContext reactContext) { + return Collections.emptyList(); + } +} diff --git a/packages/crashlytics/e2e/crashlytics.e2e.js b/packages/crashlytics/e2e/crashlytics.e2e.js new file mode 100644 index 00000000..30a7a0fc --- /dev/null +++ b/packages/crashlytics/e2e/crashlytics.e2e.js @@ -0,0 +1,27 @@ +describe('crashlytics()', () => { + describe('namespace', () => { + it('accessible from firebase.app()', () => { + const app = firebase.app(); + should.exist(app.crashlytics); + app.crashlytics().app.should.equal(app); + }); + + // removing as pending if module.options.hasMultiAppSupport = true + xit('supports multiple apps', async () => { + firebase.crashlytics().app.name.should.equal('[DEFAULT]'); + + firebase + .crashlytics(firebase.app('secondaryFromNative')) + .app.name.should.equal('secondaryFromNative'); + + firebase + .app('secondaryFromNative') + .crashlytics() + .app.name.should.equal('secondaryFromNative'); + }); + }); + + describe('aMethod()', () => { + // TODO + }); +}); diff --git a/packages/crashlytics/ios/RNFBCrashlytics.podspec b/packages/crashlytics/ios/RNFBCrashlytics.podspec new file mode 100644 index 00000000..3179db5d --- /dev/null +++ b/packages/crashlytics/ios/RNFBCrashlytics.podspec @@ -0,0 +1,20 @@ +require 'json' +package = JSON.parse(File.read('../package.json')) + +Pod::Spec.new do |s| + s.name = "RNFBCrashlytics" + s.version = package["version"] + s.description = package["description"] + s.summary = <<-DESC + A well tested feature rich Firebase implementation for React Native, supporting iOS & Android. + DESC + s.homepage = "http://invertase.io/oss/react-native-firebase" + s.license = package['license'] + s.authors = "Invertase Limited" + s.source = { :git => "https://github.com/invertase/react-native-firebase.git", :tag => "v#{s.version}" } + s.social_media_url = 'http://twitter.com/invertaseio' + s.platform = :ios, "10.0" + s.source_files = 'RNFBCrashlytics/**/*.{h,m}' + s.dependency 'React' + s.dependency 'Firebase/Core', '~> 5.15.0' +end diff --git a/packages/crashlytics/ios/RNFBCrashlytics.xcodeproj/project.pbxproj b/packages/crashlytics/ios/RNFBCrashlytics.xcodeproj/project.pbxproj new file mode 100644 index 00000000..83c5c1e6 --- /dev/null +++ b/packages/crashlytics/ios/RNFBCrashlytics.xcodeproj/project.pbxproj @@ -0,0 +1,349 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 48; + objects = { + +/* Begin PBXBuildFile section */ + 2744B98621F45429004F8E3F /* RNFBCrashlyticsModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 2744B98521F45429004F8E3F /* RNFBCrashlyticsModule.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 2744B98021F45429004F8E3F /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 2744B98221F45429004F8E3F /* libRNFBCrashlytics.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNFBCrashlytics.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 2744B98421F45429004F8E3F /* RNFBCrashlyticsModule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RNFBCrashlyticsModule.h; path = RNFBCrashlytics/RNFBCrashlyticsModule.h; sourceTree = SOURCE_ROOT; }; + 2744B98521F45429004F8E3F /* RNFBCrashlyticsModule.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = RNFBCrashlyticsModule.m; path = RNFBCrashlytics/RNFBCrashlyticsModule.m; sourceTree = SOURCE_ROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 2744B97F21F45429004F8E3F /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 2744B97521F452B8004F8E3F /* Products */ = { + isa = PBXGroup; + children = ( + 2744B98221F45429004F8E3F /* libRNFBCrashlytics.a */, + ); + name = Products; + sourceTree = ""; + }; + 2744B98321F45429004F8E3F /* RNFBCrashlytics */ = { + isa = PBXGroup; + children = ( + 2744B9A121F48736004F8E3F /* converters */, + 2744B98C21F45C64004F8E3F /* common */, + 2744B98421F45429004F8E3F /* RNFBCrashlyticsModule.h */, + 2744B98521F45429004F8E3F /* RNFBCrashlyticsModule.m */, + ); + path = RNFBCrashlytics; + sourceTree = ""; + }; + 3323F52AAFE26B7384BE4DE3 = { + isa = PBXGroup; + children = ( + 2744B98321F45429004F8E3F /* RNFBCrashlytics */, + 2744B97521F452B8004F8E3F /* Products */, + ); + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 2744B98121F45429004F8E3F /* RNFBCrashlytics */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2744B98821F45429004F8E3F /* Build configuration list for PBXNativeTarget "RNFBCrashlytics" */; + buildPhases = ( + 2744B97E21F45429004F8E3F /* Sources */, + 2744B97F21F45429004F8E3F /* Frameworks */, + 2744B98021F45429004F8E3F /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = RNFBCrashlytics; + productName = RNFBCrashlytics; + productReference = 2744B98221F45429004F8E3F /* libRNFBCrashlytics.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 3323F95273A95DB34F55C6D7 /* Project object */ = { + isa = PBXProject; + attributes = { + CLASSPREFIX = RNFBCrashlytics; + LastUpgradeCheck = 1010; + ORGANIZATIONNAME = Invertase; + TargetAttributes = { + 2744B98121F45429004F8E3F = { + CreatedOnToolsVersion = 10.1; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 3323F1C5716BA966BBBB95A4 /* Build configuration list for PBXProject "RNFBCrashlytics" */; + compatibilityVersion = "Xcode 8.0"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 3323F52AAFE26B7384BE4DE3; + productRefGroup = 2744B97521F452B8004F8E3F /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 2744B98121F45429004F8E3F /* RNFBCrashlytics */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 2744B97E21F45429004F8E3F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2744B98621F45429004F8E3F /* RNFBCrashlyticsModule.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 2744B98921F45429004F8E3F /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 2744B98A21F45429004F8E3F /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 3323F77D701E1896E6D239CF /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "${BUILT_PRODUCTS_DIR}/**", + "${SRCROOT}/../../../ios/Firebase/**", + "$(FIREBASE_SEARCH_PATH)/Firebase/**", + "$(SRCROOT)/../../../ios/Pods/FirebaseCrashlytics/Frameworks", + "$(SRCROOT)/../../../tests/ios/Pods/FirebaseCrashlytics/Frameworks", + ); + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(REACT_SEARCH_PATH)/React/**", + "$(SRCROOT)/../../react-native/React/**", + "$(SRCROOT)/../../react-native-firebase/ios/**", + "$(FIREBASE_SEARCH_PATH)/Firebase/**", + "${SRCROOT}/../../../ios/Firebase/**", + "${SRCROOT}/../../../ios/Pods/Headers/Public/**", + "${SRCROOT}/../../../tests/ios/Pods/Headers/Public/**", + "$(SRCROOT)/../../../node_modules/react-native/React/**", + "$(SRCROOT)/../../../node_modules/react-native-firebase/ios/**", + "$(SRCROOT)/../../../packages/app/ios/**", + ); + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LIBRARY_SEARCH_PATHS = "$(inherited)"; + MACH_O_TYPE = staticlib; + OTHER_LDFLAGS = "$(inherited)"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Release; + }; + 3323F7E33E1559A2B9826720 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "${BUILT_PRODUCTS_DIR}/**", + "${SRCROOT}/../../../ios/Firebase/**", + "$(FIREBASE_SEARCH_PATH)/Firebase/**", + "$(SRCROOT)/../../../ios/Pods/FirebaseCrashlytics/Frameworks", + ); + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(REACT_SEARCH_PATH)/React/**", + "$(SRCROOT)/../../react-native/React/**", + "$(SRCROOT)/../../react-native-firebase/ios/**", + "$(FIREBASE_SEARCH_PATH)/Firebase/**", + "${SRCROOT}/../../../ios/Firebase/**", + "${SRCROOT}/../../../ios/Pods/Headers/Public/**", + "${SRCROOT}/../../../tests/ios/Pods/Headers/Public/**", + "$(SRCROOT)/../../../node_modules/react-native/React/**", + "$(SRCROOT)/../../../node_modules/react-native-firebase/ios/**", + "$(SRCROOT)/../../../packages/app/ios/**", + ); + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LIBRARY_SEARCH_PATHS = "$(inherited)"; + MACH_O_TYPE = staticlib; + ONLY_ACTIVE_ARCH = YES; + OTHER_LDFLAGS = "$(inherited)"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Debug; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 2744B98821F45429004F8E3F /* Build configuration list for PBXNativeTarget "RNFBCrashlytics" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2744B98921F45429004F8E3F /* Debug */, + 2744B98A21F45429004F8E3F /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 3323F1C5716BA966BBBB95A4 /* Build configuration list for PBXProject "RNFBCrashlytics" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3323F7E33E1559A2B9826720 /* Debug */, + 3323F77D701E1896E6D239CF /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 3323F95273A95DB34F55C6D7 /* Project object */; +} diff --git a/packages/crashlytics/ios/RNFBCrashlytics.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/packages/crashlytics/ios/RNFBCrashlytics.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..919434a6 --- /dev/null +++ b/packages/crashlytics/ios/RNFBCrashlytics.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/packages/crashlytics/ios/RNFBCrashlytics.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/packages/crashlytics/ios/RNFBCrashlytics.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/packages/crashlytics/ios/RNFBCrashlytics.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/packages/crashlytics/ios/RNFBCrashlytics.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/packages/crashlytics/ios/RNFBCrashlytics.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 00000000..0c67376e --- /dev/null +++ b/packages/crashlytics/ios/RNFBCrashlytics.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/crashlytics/ios/RNFBCrashlytics.xcodeproj/xcshareddata/IDETemplateMacros.plist b/packages/crashlytics/ios/RNFBCrashlytics.xcodeproj/xcshareddata/IDETemplateMacros.plist new file mode 100644 index 00000000..63f0a6e5 --- /dev/null +++ b/packages/crashlytics/ios/RNFBCrashlytics.xcodeproj/xcshareddata/IDETemplateMacros.plist @@ -0,0 +1,24 @@ + + + + + FILEHEADER + +/** + * Copyright (c) 2016-present Invertase Limited & Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this library except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + + diff --git a/packages/crashlytics/ios/RNFBCrashlytics/RNFBCrashlyticsModule.h b/packages/crashlytics/ios/RNFBCrashlytics/RNFBCrashlyticsModule.h new file mode 100644 index 00000000..c7b17392 --- /dev/null +++ b/packages/crashlytics/ios/RNFBCrashlytics/RNFBCrashlyticsModule.h @@ -0,0 +1,24 @@ +/** + * Copyright (c) 2016-present Invertase Limited & Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this library except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import + +#import + +@interface RNFBCrashlyticsModule : NSObject + +@end diff --git a/packages/crashlytics/ios/RNFBCrashlytics/RNFBCrashlyticsModule.m b/packages/crashlytics/ios/RNFBCrashlytics/RNFBCrashlyticsModule.m new file mode 100644 index 00000000..f861fad3 --- /dev/null +++ b/packages/crashlytics/ios/RNFBCrashlytics/RNFBCrashlyticsModule.m @@ -0,0 +1,38 @@ +/** + * Copyright (c) 2016-present Invertase Limited & Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this library except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import +#import + +#import "RNFBCrashlyticsModule.h" +#import "RNFBApp/RNFBSharedUtils.h" + + +@implementation RNFBCrashlyticsModule +#pragma mark - +#pragma mark Module Setup + + RCT_EXPORT_MODULE(); + + - (dispatch_queue_t)methodQueue { + return dispatch_get_main_queue(); + } + +#pragma mark - +#pragma mark Firebase Crashlytics Methods + +@end diff --git a/packages/crashlytics/lib/index.d.ts b/packages/crashlytics/lib/index.d.ts new file mode 100644 index 00000000..8a6b35f7 --- /dev/null +++ b/packages/crashlytics/lib/index.d.ts @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2016-present Invertase Limited & Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this library except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +import { + ReactNativeFirebaseModule, + ReactNativeFirebaseNamespace, + ReactNativeFirebaseModuleAndStatics, +} from '@react-native-firebase/app-types'; + +/** + * Crashlytics + * + * @firebase crashlytics + */ +export namespace Crashlytics { + export interface Statics {} + + export interface Module extends ReactNativeFirebaseModule { + + } +} + +declare module '@react-native-firebase/crashlytics' { + import { ReactNativeFirebaseNamespace } from '@react-native-firebase/app-types'; + + const FirebaseNamespaceExport: {} & ReactNativeFirebaseNamespace; + + /** + * @example + * ```js + * import { firebase } from '@react-native-firebase/crashlytics'; + * firebase.crashlytics().X(...); + * ``` + */ + export const firebase = FirebaseNamespaceExport; + + const CrashlyticsDefaultExport: ReactNativeFirebaseModuleAndStatics< + Crashlytics.Module, + Crashlytics.Statics + >; + /** + * @example + * ```js + * import crashlytics from '@react-native-firebase/crashlytics'; + * crashlytics().X(...); + * ``` + */ + export default CrashlyticsDefaultExport; +} + +/** + * Attach namespace to `firebase.` and `FirebaseApp.`. + */ +declare module '@react-native-firebase/app-types' { + interface ReactNativeFirebaseNamespace { + /** + * Crashlytics integrates across Firebase features and provides + * you with unlimited reporting for up to 500 distinct events + * that you can define using the Firebase SDK. Crashlytics reports + * help you understand clearly how your users behave, which enables + * you to make informed decisions regarding app marketing and + * performance optimizations. + */ + crashlytics: ReactNativeFirebaseModuleAndStatics< + Crashlytics.Module, + Crashlytics.Statics + >; + } + + interface FirebaseApp { + /** + * Crashlytics + */ + crashlytics(): Crashlytics.Module; + } +} diff --git a/packages/crashlytics/lib/index.js b/packages/crashlytics/lib/index.js new file mode 100644 index 00000000..212cc9fc --- /dev/null +++ b/packages/crashlytics/lib/index.js @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2016-present Invertase Limited & Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this library except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +import { + createModuleNamespace, + FirebaseModule, + getFirebaseRoot, +} from '@react-native-firebase/app/lib/internal'; + +import version from './version'; + +const statics = {}; + +const namespace = 'crashlytics'; + +const nativeModuleName = 'RNFBCrashlyticsModule'; + +class FirebaseCrashlyticsModule extends FirebaseModule { + +} + +// import { SDK_VERSION } from '@react-native-firebase/crashlytics'; +export const SDK_VERSION = version; + +// import crashlytics from '@react-native-firebase/crashlytics'; +// crashlytics().X(...); +export default createModuleNamespace({ + statics, + version, + namespace, + nativeModuleName, + nativeEvents: false, + hasMultiAppSupport: false, + hasCustomUrlOrRegionSupport: false, + ModuleClass: FirebaseCrashlyticsModule, +}); + +// import crashlytics, { firebase } from '@react-native-firebase/crashlytics'; +// crashlytics().X(...); +// firebase.crashlytics().X(...); +export const firebase = getFirebaseRoot(); diff --git a/packages/crashlytics/lib/index.js.flow b/packages/crashlytics/lib/index.js.flow new file mode 100644 index 00000000..3659de41 --- /dev/null +++ b/packages/crashlytics/lib/index.js.flow @@ -0,0 +1,70 @@ +/* eslint-disable import/no-duplicates */ +/* + * Copyright (c) 2016-present Invertase Limited & Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this library except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +import type { ReactNativeFirebaseModule } from '@react-native-firebase/app-types/index.js.flow'; + +export interface Statics {} + +export interface Module extends ReactNativeFirebaseModule { + +} + +declare module '@react-native-firebase/crashlytics' { + import type { + ReactNativeFirebaseNamespace, + ReactNativeFirebaseModuleAndStatics, + } from '@react-native-firebase/app-types/index.js.flow'; + /** + * @example + * ```js + * import { firebase } from '@react-native-firebase/crashlytics'; + * firebase.crashlytics().X(...); + * ``` + */ + declare export var firebase: {} & ReactNativeFirebaseNamespace; + + /** + * @example + * ```js + * import crashlytics from '@react-native-firebase/crashlytics'; + * crashlytics().X(...); + * ``` + */ + declare export default ReactNativeFirebaseModuleAndStatics; +} + +/** + * Attach namespace to `firebase.` and `FirebaseApp.`. + */ +declare module '@react-native-firebase/app-types' { + import type { ReactNativeFirebaseModuleAndStatics } from '@react-native-firebase/app-types/index.js.flow'; + + declare interface ReactNativeFirebaseNamespace { + /** + * Crashlytics + */ + crashlytics: ReactNativeFirebaseModuleAndStatics; + } + + declare interface FirebaseApp { + /** + * Crashlytics + */ + crashlytics(): Module; + } +} diff --git a/packages/crashlytics/package.json b/packages/crashlytics/package.json new file mode 100644 index 00000000..fe88c418 --- /dev/null +++ b/packages/crashlytics/package.json @@ -0,0 +1,42 @@ +{ + "name": "@react-native-firebase/crashlytics", + "version": "6.0.0-alpha.2", + "author": "Invertase (http://invertase.io)", + "description": "React Native Firebase - Crashlytics", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "scripts": { + "build": "genversion --semi lib/version.js", + "build:clean": "rimraf android/build && rimraf ios/build", + "prepare": "yarn run build" + }, + "repository": { + "type": "git", + "url": "https://github.com/invertase/react-native-firebase/tree/master/packages/crashlytics" + }, + "license": "Apache-2.0", + "keywords": [ + "react", + "react-native", + "firebase", + "crashlytics" + ], + "peerDependencies": { + "@react-native-firebase/app": "6.0.0-alpha.2" + }, + "dependencies": { + "@react-native-firebase/app-types": "6.0.0-alpha.2", + "@react-native-firebase/common": "6.0.0-alpha.2" + }, + "rnpm": { + "android": { + "buildPatch": "implementation project(':@react-native-firebase_crashlytics')", + "packageImportPath": "import io.invertase.firebase.crashlytics.ReactNativeFirebaseCrashlyticsPackage;", + "packageInstance": "new ReactNativeFirebaseCrashlyticsPackage()" + } + }, + "gitHead": "2787d4413eb70c61a687c4d6913add6a6a01f582", + "publishConfig": { + "access": "public" + } +} diff --git a/tests/package.json b/tests/package.json index 9a4149f8..a075bc3b 100755 --- a/tests/package.json +++ b/tests/package.json @@ -10,6 +10,7 @@ "@react-native-firebase/analytics": "^6.0.0-alpha.2", "@react-native-firebase/app": "^6.0.0-alpha.2", "@react-native-firebase/app-types": "^6.0.0-alpha.2", + "@react-native-firebase/crashlytics": "^6.0.0-alpha.2", "@react-native-firebase/functions": "^6.0.0-alpha.2", "@react-native-firebase/iid": "^6.0.0-alpha.2", "@react-native-firebase/perf": "^6.0.0-alpha.2",