Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add enableCrashlyticsCollection to Crashlytics #1718

Merged
merged 19 commits into from
Dec 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,34 @@ aliases:
# -------------------------
- &restore-yarn-cache
keys:
- yarn-cache-{{ arch }}-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}-{{ checksum "tests/package.json" }}-{{ checksum "tests/yarn.lock" }}
- yarn-cache-{{ arch }}
- v1-yarn-cache-{{ arch }}-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}-{{ checksum "tests/package.json" }}-{{ checksum "tests/yarn.lock" }}
- v1-yarn-cache-{{ arch }}

- &save-yarn-cache
paths:
- ~/.cache/yarn
- ~/Library/Detox/ios
key: yarn-cache-{{ arch }}-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}-{{ checksum "tests/package.json" }}-{{ checksum "tests/yarn.lock" }}
key: v1-yarn-cache-{{ arch }}-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}-{{ checksum "tests/package.json" }}-{{ checksum "tests/yarn.lock" }}

- &save-pods-cache
paths:
- ~/react-native-firebase/tests/ios/Pods
key: v2-pods-cache-{{ arch }}-{{ checksum "ios/RNFirebase.podspec" }}-{{ checksum "tests/ios/Podfile" }}-{{ checksum "tests/ios/Podfile.lock" }}
key: v3-pods-cache-{{ arch }}-{{ checksum "ios/RNFirebase.podspec" }}-{{ checksum "tests/ios/Podfile" }}-{{ checksum "tests/ios/Podfile.lock" }}

- &restore-pods-cache
keys:
- v2-pods-cache-{{ arch }}-{{ checksum "ios/RNFirebase.podspec" }}-{{ checksum "tests/ios/Podfile" }}-{{ checksum "tests/ios/Podfile.lock" }}
- v2-pods-cache-{{ arch }}
- v3-pods-cache-{{ arch }}-{{ checksum "ios/RNFirebase.podspec" }}-{{ checksum "tests/ios/Podfile" }}-{{ checksum "tests/ios/Podfile.lock" }}
- v3-pods-cache-{{ arch }}

- &save-ios-build-cache
paths:
- ~/react-native-firebase/tests/ios/build/Build
key: v2-ios-build-cache-{{ arch }}-{{ checksum "ios/RNFirebase.podspec" }}-{{ checksum "tests/ios/Podfile" }}-{{ checksum "tests/ios/Podfile.lock" }}
key: v3-ios-build-cache-{{ arch }}-{{ checksum "ios/RNFirebase.podspec" }}-{{ checksum "tests/ios/Podfile" }}-{{ checksum "tests/ios/Podfile.lock" }}

- &restore-ios-build-cache
keys:
- v2-ios-build-cache-{{ arch }}-{{ checksum "ios/RNFirebase.podspec" }}-{{ checksum "tests/ios/Podfile" }}-{{ checksum "tests/ios/Podfile.lock" }}
- v2-ios-build-cache-{{ arch }}
- v3-ios-build-cache-{{ arch }}-{{ checksum "ios/RNFirebase.podspec" }}-{{ checksum "tests/ios/Podfile" }}-{{ checksum "tests/ios/Podfile.lock" }}
- v3-ios-build-cache-{{ arch }}

- &save-brew-cache
paths:
Expand Down Expand Up @@ -182,13 +182,17 @@ jobs:
- save-cache: *save-yarn-cache

# Pods
- restore-cache: *restore-pods-cache
# - restore-cache: *restore-pods-cache
- run:
name: Install CocoaPods + Pod Install
command: |
cd tests/ios
curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf
pod install
cd tests
yarn
cd ios
rm -rf Pods/
rm Podfile.lock
pod install --repo-update
- save-cache: *save-pods-cache

# must always be after environment config job but before ios build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;

import io.fabric.sdk.android.Fabric;

public class RNFirebaseCrashlytics extends ReactContextBaseJavaModule {

Expand Down Expand Up @@ -63,4 +64,10 @@ public void setStringValue(final String key, final String stringValue) {
public void setUserIdentifier(String userId) {
Crashlytics.setUserIdentifier(userId);
}

@ReactMethod
public void enableCrashlyticsCollection() {
Fabric.with(this, new Crashlytics());
}

}
10 changes: 10 additions & 0 deletions ios/RNFirebase/fabric/crashlytics/RNFirebaseCrashlytics.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
#endif
#endif

#if __has_include(<Fabric/Fabric.h>)
#import <Fabric/Fabric.h>
#endif

#ifdef HAS_CRASHLYTICS
@implementation RNFirebaseCrashlytics
RCT_EXPORT_MODULE();
Expand Down Expand Up @@ -47,6 +51,12 @@
[CrashlyticsKit setUserIdentifier:userId];
}

RCT_EXPORT_METHOD(enableCrashlyticsCollection) {
#if __has_include(<Fabric/Fabric.h>)
[Fabric with:@[[Crashlytics class]]];
#endif
}

@end
#else
@implementation RNFirebaseCrashlytics
Expand Down
5 changes: 5 additions & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2010,6 +2010,11 @@ declare module 'react-native-firebase' {
* Set the user ID to show alongside any subsequent crash reports.
*/
setUserIdentifier(userId: string): void;

/**
* Enable Crashlytics reporting. Only avaliable when disabled automatic initialization
*/
enableCrashlyticsCollection(): void;
}
}

Expand Down
7 changes: 7 additions & 0 deletions src/modules/crashlytics/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ export default class Crashlytics extends ModuleBase {
setUserIdentifier(userId: string): void {
getNativeModule(this).setUserIdentifier(userId);
}

/**
* Enable Crashlytics reporting. Only avaliable when disabled automatic initialization
*/
enableCrashlyticsCollection(): void {
getNativeModule(this).enableCrashlyticsCollection();
}
}

export const statics = {};
6 changes: 6 additions & 0 deletions tests/e2e/crashlytics/crashlytics.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,10 @@ describe('crashlytics()', () => {
await firebase.crashlytics().setUserIdentifier(123456);
});
});

describe('enableCrashlyticsCollection()', () => {
it('should not throw', async () => {
await firebase.crashlytics().enableCrashlyticsCollection();
});
});
});
9 changes: 3 additions & 6 deletions tests/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ install! 'cocoapods', :deterministic_uuids => false
# platform :ios, '8.0'

target 'testing' do
platform :ios, '9.0'
platform :ios, '10.0'
# Uncomment this line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!

Expand All @@ -15,12 +15,12 @@ target 'testing' do
pod "yoga", :path => "#{react_native_path}/ReactCommon/yoga"

# Pods for ReactNativeFirebaseDemo
pod 'React', :path => '../node_modules/react-native', :subspecs => [
pod 'React', :path => "#{react_native_path}/React.podspec", :subspecs => [
'Core',
'RCTText',
'RCTNetwork',
'RCTWebSocket',
]
]

pod 'Firebase/AdMob', '~> 5.11.0'
pod 'Firebase/Auth', '~> 5.11.0'
Expand All @@ -41,9 +41,6 @@ target 'testing' do

post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "React"
target.remove_from_project
end
if target.name == 'yoga'
target.build_configurations.each do |config|
config.build_settings['GCC_TREAT_WARNINGS_AS_ERRORS'] = 'NO'
Expand Down
81 changes: 40 additions & 41 deletions tests/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -141,22 +141,21 @@ PODS:
- FirebaseAuthInterop (~> 1.0)
- FirebaseCore (~> 5.0)
- GTMSessionFetcher/Core (~> 1.1)
- Google-Mobile-Ads-SDK (7.35.1)
- GoogleAPIClientForREST (1.3.6):
- GoogleAPIClientForREST/Core (= 1.3.6)
- Google-Mobile-Ads-SDK (7.36.0)
- GoogleAPIClientForREST (1.3.7):
- GoogleAPIClientForREST/Core (= 1.3.7)
- GTMSessionFetcher (>= 1.1.7)
- GoogleAPIClientForREST/Core (1.3.6):
- GoogleAPIClientForREST/Core (1.3.7):
- GTMSessionFetcher (>= 1.1.7)
- GoogleAppMeasurement (5.3.0):
- GoogleUtilities/AppDelegateSwizzler (~> 5.2)
- GoogleUtilities/MethodSwizzler (~> 5.2)
- GoogleUtilities/Network (~> 5.2)
- "GoogleUtilities/NSData+zlib (~> 5.2)"
- nanopb (~> 0.3)
- GoogleSignIn (4.3.0):
- GoogleSignIn (4.4.0):
- "GoogleToolboxForMac/NSDictionary+URLArguments (~> 2.1)"
- "GoogleToolboxForMac/NSString+URLArguments (~> 2.1)"
- GTMOAuth2 (~> 1.0)
- GTMSessionFetcher/Core (~> 1.1)
- GoogleToolboxForMac/Core (2.1.4):
- GoogleToolboxForMac/Defines (= 2.1.4)
Expand All @@ -179,36 +178,36 @@ PODS:
- GoogleToolboxForMac/Defines (= 2.1.4)
- "GoogleToolboxForMac/NSDictionary+URLArguments (= 2.1.4)"
- "GoogleToolboxForMac/NSString+URLArguments (= 2.1.4)"
- GoogleUtilities/AppDelegateSwizzler (5.3.4):
- GoogleUtilities/AppDelegateSwizzler (5.3.6):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
- GoogleUtilities/Network
- GoogleUtilities/Environment (5.3.4)
- GoogleUtilities/ISASwizzler (5.3.4)
- GoogleUtilities/Logger (5.3.4):
- GoogleUtilities/Environment (5.3.6)
- GoogleUtilities/ISASwizzler (5.3.6)
- GoogleUtilities/Logger (5.3.6):
- GoogleUtilities/Environment
- GoogleUtilities/MethodSwizzler (5.3.4):
- GoogleUtilities/MethodSwizzler (5.3.6):
- GoogleUtilities/Logger
- GoogleUtilities/Network (5.3.4):
- GoogleUtilities/Network (5.3.6):
- GoogleUtilities/Logger
- "GoogleUtilities/NSData+zlib"
- GoogleUtilities/Reachability
- "GoogleUtilities/NSData+zlib (5.3.4)"
- GoogleUtilities/Reachability (5.3.4):
- "GoogleUtilities/NSData+zlib (5.3.6)"
- GoogleUtilities/Reachability (5.3.6):
- GoogleUtilities/Logger
- GoogleUtilities/UserDefaults (5.3.4):
- GoogleUtilities/UserDefaults (5.3.6):
- GoogleUtilities/Logger
- gRPC (1.14.0):
- gRPC-RxLibrary (= 1.14.0)
- gRPC/Main (= 1.14.0)
- "gRPC-C++ (0.0.3)":
- "gRPC-C++/Implementation (= 0.0.3)"
- "gRPC-C++/Interface (= 0.0.3)"
- "gRPC-C++/Implementation (0.0.3)":
- "gRPC-C++/Interface (= 0.0.3)"
- "gRPC-C++ (0.0.5)":
- "gRPC-C++/Implementation (= 0.0.5)"
- "gRPC-C++/Interface (= 0.0.5)"
- "gRPC-C++/Implementation (0.0.5)":
- "gRPC-C++/Interface (= 0.0.5)"
- gRPC-Core (= 1.14.0)
- nanopb (~> 0.3)
- "gRPC-C++/Interface (0.0.3)"
- "gRPC-C++/Interface (0.0.5)"
- gRPC-Core (1.14.0):
- gRPC-Core/Implementation (= 1.14.0)
- gRPC-Core/Interface (= 1.14.0)
Expand All @@ -229,11 +228,11 @@ PODS:
- gRPC-RxLibrary (= 1.14.0)
- GTMOAuth2 (1.1.6):
- GTMSessionFetcher (~> 1.1)
- GTMSessionFetcher (1.2.0):
- GTMSessionFetcher/Full (= 1.2.0)
- GTMSessionFetcher/Core (1.2.0)
- GTMSessionFetcher/Full (1.2.0):
- GTMSessionFetcher/Core (= 1.2.0)
- GTMSessionFetcher (1.2.1):
- GTMSessionFetcher/Full (= 1.2.1)
- GTMSessionFetcher/Core (1.2.1)
- GTMSessionFetcher/Full (1.2.1):
- GTMSessionFetcher/Core (= 1.2.1)
- leveldb-library (1.20)
- nanopb (0.3.901):
- nanopb/decode (= 0.3.901)
Expand All @@ -256,7 +255,7 @@ PODS:
- React/Core
- React/fishhook
- React/RCTBlob
- RNFirebase (5.1.0-rc2):
- RNFirebase (5.1.1):
- Firebase/Core
- React
- yoga (0.57.1.React)
Expand All @@ -276,10 +275,10 @@ DEPENDENCIES:
- Firebase/Performance (~> 5.11.0)
- Firebase/RemoteConfig (~> 5.11.0)
- Firebase/Storage (~> 5.11.0)
- React/Core (from `../node_modules/react-native`)
- React/RCTNetwork (from `../node_modules/react-native`)
- React/RCTText (from `../node_modules/react-native`)
- React/RCTWebSocket (from `../node_modules/react-native`)
- React/Core (from `../node_modules/react-native/React.podspec`)
- React/RCTNetwork (from `../node_modules/react-native/React.podspec`)
- React/RCTText (from `../node_modules/react-native/React.podspec`)
- React/RCTWebSocket (from `../node_modules/react-native/React.podspec`)
- RNFirebase (from `../../ios/RNFirebase.podspec`)
- yoga (from `../node_modules/react-native/ReactCommon/yoga`)

Expand Down Expand Up @@ -324,10 +323,10 @@ SPEC REPOS:

EXTERNAL SOURCES:
React:
:path: "../node_modules/react-native"
:path: "../node_modules/react-native/React.podspec"
RNFirebase:
:path: "../../ios/RNFirebase.podspec"
:version: "~> 5.1.0-rc2"
:version: "~> 5.1.1"
yoga:
:path: "../node_modules/react-native/ReactCommon/yoga"

Expand All @@ -352,26 +351,26 @@ SPEC CHECKSUMS:
FirebasePerformance: 4adfe91a2c696bc43429822ad0e4aa8753b283b4
FirebaseRemoteConfig: 7e11c65f0769c09bff6947997c209515058c5318
FirebaseStorage: fd82e5e5c474897e19972b34b22ac0f589dce04e
Google-Mobile-Ads-SDK: 151d5e87b4a0ae6d7d07e2cd8d55d1b41ea2e61e
GoogleAPIClientForREST: 5b95b38a0fa912e8ac7bdcf9e124578ef1a61bf2
Google-Mobile-Ads-SDK: 5bb4d2cea811842e104a24780caef63b4808e1bd
GoogleAPIClientForREST: 825503f12cb5824601cf526cf06d81a1cea4afd9
GoogleAppMeasurement: 5029d78f2b438bd30ffb44e6c558b57c21622727
GoogleSignIn: 11183592dc63e105475c7305a325045ff95e02b7
GoogleSignIn: 7ff245e1a7b26d379099d3243a562f5747e23d39
GoogleToolboxForMac: 91c824d21e85b31c2aae9bb011c5027c9b4e738f
GoogleUtilities: abb092d2c12e817fa3e0e7b274987dd72fb86ec3
GoogleUtilities: 95996bea7c7d9b8fb811b7507669a4a8762f80c7
gRPC: 9d4c549f37c7cef22478634bac7a0405b6e3dbfb
"gRPC-C++": ee0b01db3122f0b6c2be28b5b11039f62fa15fe6
"gRPC-C++": 19eec1ffd34de29453f5fab5b4697ad0f240ad51
gRPC-Core: f4836515817c0eb479aeeb9cc27c91c4ba62a9f6
gRPC-ProtoRPC: 76f6053639a842e1fb45fa82aa598bf3f4d9f66f
gRPC-RxLibrary: 3c305f32155024b116b780f389323c73a28197e6
GTMOAuth2: c77fe325e4acd453837e72d91e3b5f13116857b2
GTMSessionFetcher: 0c4baf0a73acd0041bf9f71ea018deedab5ea84e
GTMOAuth2: e8b6512c896235149df975c41d9a36c868ab7fba
GTMSessionFetcher: 32aeca0aa144acea523e1c8e053089dec2cb98ca
leveldb-library: 08cba283675b7ed2d99629a4bc5fd052cd2bb6a5
nanopb: 2901f78ea1b7b4015c860c2fdd1ea2fee1a18d48
Protobuf: 1eb9700044745f00181c136ef21b8ff3ad5a0fd5
React: 1fe0eb13d90b625d94c3b117c274dcfd2e760e11
RNFirebase: 2b25fd2e60269f26bb0a76c71dcc942b35a77df0
yoga: b1ce48b6cf950b98deae82838f5173ea7cf89e85

PODFILE CHECKSUM: d219a67a398d8e5ad35cbde6834206b0401163ba
PODFILE CHECKSUM: 4a17cd31bba5415cba9b8f969b6ad5d489f5a07d

COCOAPODS: 1.5.3
Loading