From 6009b32971456977e7286ec81a21d73bc64ab911 Mon Sep 17 00:00:00 2001 From: Daniel Griesser Date: Thu, 4 Jul 2019 12:59:03 +0200 Subject: [PATCH 1/2] fix: AndroidX, Autolink, Cocoapods --- RNSentry.podspec | 23 +++++++++++++++++ SentryReactNative.podspec | 25 ------------------- .../main/java/io/sentry/RNSentryModule.java | 2 -- ios/Sentry | 2 +- package.json | 14 ----------- react-native.config.js | 18 +++++++++++++ src/js/backend.ts | 1 + src/js/sdk.ts | 3 ++- 8 files changed, 45 insertions(+), 43 deletions(-) create mode 100644 RNSentry.podspec delete mode 100644 SentryReactNative.podspec create mode 100644 react-native.config.js diff --git a/RNSentry.podspec b/RNSentry.podspec new file mode 100644 index 0000000000..2d30600c2e --- /dev/null +++ b/RNSentry.podspec @@ -0,0 +1,23 @@ +require 'json' +version = JSON.parse(File.read('package.json'))["version"] + +Pod::Spec.new do |s| + s.name = 'RNSentry' + s.version = version + s.license = 'MIT' + s.summary = 'Official Sentry SDK for react-native' + s.author = 'Sentry' + s.homepage = "https://github.com/getsentry/sentry-react-native" + s.source = { :git => 'https://github.com/getsentry/sentry-react-native.git', :tag => "#{s.version}"} + + s.ios.deployment_target = "8.0" + s.tvos.deployment_target = "9.0" + + s.preserve_paths = '*.js' + + s.dependency 'React' + s.dependency 'Sentry', '~> 4.4.0' + + s.source_files = 'ios/RNSentry.{h,m}' + s.public_header_files = 'ios/RNSentry.h' +end diff --git a/SentryReactNative.podspec b/SentryReactNative.podspec deleted file mode 100644 index 1f7866ccd7..0000000000 --- a/SentryReactNative.podspec +++ /dev/null @@ -1,25 +0,0 @@ -require 'json' - -Pod::Spec.new do |s| - # NPM package specification - package = JSON.parse(File.read(File.join(File.dirname(__FILE__), 'package.json'))) - - s.name = 'SentryReactNative' - s.version = package['version'] - s.license = 'MIT' - s.summary = 'Official Sentry SDK for react-native' - s.author = 'Sentry' - s.homepage = "https://github.com/getsentry/react-native-sentry" - s.source = { :git => 'https://github.com/getsentry/react-native-sentry.git', :tag => "#{s.version}"} - - s.ios.deployment_target = "8.0" - s.tvos.deployment_target = "9.0" - - s.preserve_paths = '*.js' - - s.dependency 'React' - s.dependency 'Sentry', '~> 4.3.4' - - s.source_files = 'src/ios/RNSentry*.{h,m}' - s.public_header_files = 'src/ios/RNSentry.h' -end diff --git a/android/src/main/java/io/sentry/RNSentryModule.java b/android/src/main/java/io/sentry/RNSentryModule.java index 2bdbf4720d..dba5265cfa 100644 --- a/android/src/main/java/io/sentry/RNSentryModule.java +++ b/android/src/main/java/io/sentry/RNSentryModule.java @@ -3,7 +3,6 @@ import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; -import android.support.annotation.NonNull; import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.Promise; @@ -249,7 +248,6 @@ public void sendEvent(ReadableMap event, Promise promise) { promise.resolve(true); } - @NonNull private UserBuilder getUserBuilder(ReadableMap user) { UserBuilder userBuilder = new UserBuilder(); if (user.hasKey("email")) { diff --git a/ios/Sentry b/ios/Sentry index 52f057f31c..3c7ff35cc0 160000 --- a/ios/Sentry +++ b/ios/Sentry @@ -1 +1 @@ -Subproject commit 52f057f31cceb326cb68ca1212ea96c2f0ad53db +Subproject commit 3c7ff35cc03bd05ce9d50a87b5c3162a5460a8b5 diff --git a/package.json b/package.json index e36aa65f94..223c1cd765 100644 --- a/package.json +++ b/package.json @@ -37,20 +37,6 @@ "@sentry/utils": "^5.4.2", "@sentry/wizard": "^1.0.0" }, - "rnpm": { - "commands": { - "postlink": "node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android", - "postunlink": "node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android --uninstall" - }, - "android": { - "packageInstance": "new RNSentryPackage()" - }, - "ios": { - "sharedLibraries": [ - "libz" - ] - } - }, "devDependencies": { "@sentry/typescript": "5.*", "@types/react-native": "^0.57.57", diff --git a/react-native.config.js b/react-native.config.js new file mode 100644 index 0000000000..59801ea31a --- /dev/null +++ b/react-native.config.js @@ -0,0 +1,18 @@ +module.exports = { + dependency: { + platforms: { + ios: { + sharedLibraries: ["libz"] + }, + android: { + packageInstance: "new RNSentryPackage()" + } + }, + hooks: { + postlink: + "node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android", + postunlink: + "node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android --uninstall" + } + } +}; diff --git a/src/js/backend.ts b/src/js/backend.ts index fd57b99b32..e295ee027d 100644 --- a/src/js/backend.ts +++ b/src/js/backend.ts @@ -94,6 +94,7 @@ export class ReactNativeBackend extends BaseBackend { private _isNativeTransportAvailable(): boolean { return ( this._options.enableNative && + RNSentry && RNSentry.nativeClientAvailable && RNSentry.nativeTransport ); diff --git a/src/js/sdk.ts b/src/js/sdk.ts index 904740ee54..75d286fef2 100644 --- a/src/js/sdk.ts +++ b/src/js/sdk.ts @@ -39,7 +39,8 @@ export function init( i => !IGNORED_DEFAULT_INTEGRATIONS.includes(i.name) ), new Integrations.Breadcrumbs({ - fetch: false + fetch: false, + console: false // If this in enabled it causes problems to native calls on >= RN 0.60 }), new RewriteFrames({ iteratee: (frame: StackFrame) => { From 42d1cb1426dea24b1c8e266ff2e014f8f74797bf Mon Sep 17 00:00:00 2001 From: Daniel Griesser Date: Thu, 4 Jul 2019 13:10:33 +0200 Subject: [PATCH 2/2] fix: Readd rnpm section in package.json to support older versions --- package.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/package.json b/package.json index 223c1cd765..3bfb04f81e 100644 --- a/package.json +++ b/package.json @@ -44,5 +44,19 @@ "replace-in-file": "^4.0.0", "rimraf": "^2.6.3", "typescript": "^3.4.5" + }, + "rnpm": { + "commands": { + "postlink": "node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android", + "postunlink": "node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android --uninstall" + }, + "android": { + "packageInstance": "new RNSentryPackage()" + }, + "ios": { + "sharedLibraries": [ + "libz" + ] + } } }