Skip to content

Commit c1a45af

Browse files
committed
fix: move to latest SDKs
1 parent 1145ec3 commit c1a45af

File tree

20 files changed

+1795
-836
lines changed

20 files changed

+1795
-836
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ Pods
2121
*.xcuserdatad
2222
/plugin/README.md
2323
pnpm-lock.yaml
24+
/plugin/platforms/android/sentry.aar

plugin/platforms/android/include.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ android {
77
}
88
}
99
dependencies {
10-
def sentryVersion = project.hasProperty("sentryVersion") ? project.sentryVersion : "4.2.0"
10+
def sentryVersion = project.hasProperty("sentryVersion") ? project.sentryVersion : "5.2.0"
1111
implementation "io.sentry:sentry-android:$sentryVersion"
1212
}
-11.9 KB
Binary file not shown.

plugin/platforms/ios/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pod 'Sentry', :git => 'https://github.com/getsentry/sentry-cocoa.git', :tag => '6.2.0'
1+
pod 'Sentry', :git => 'https://github.com/getsentry/sentry-cocoa.git', :tag => '7.3.0'
235 Bytes
Binary file not shown.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#import <Sentry/Sentry.h>
2+
3+
4+
@interface NSSentrySDK: SentrySDK
5+
6+
+ (void)captureEnvelope:(SentryEnvelope *)envelope;
7+
8+
+ (void)storeEnvelope:(SentryEnvelope *)envelope;
9+
10+
11+
@end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#import "NSSentry.h"
2+
#import <Sentry/Sentry.h>
3+
4+
@implementation NSSentrySDK
5+
@end
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module NSSentry {
2+
header "NSSentry.h"
3+
export *
4+
}

src/backend.ts

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@ export interface NativescriptOptions extends BrowserOptions {
3535

3636
sessionTrackingIntervalMillis?: number;
3737

38+
/** Enable scope sync from Java to NDK on Android */
39+
enableNdkScopeSync?: boolean;
40+
41+
/** When enabled, all the threads are automatically attached to all logged events on Android */
42+
attachThreads?: boolean;
43+
44+
/**
45+
* When enabled, certain personally identifiable information (PII) is added by active integrations.
46+
*
47+
* @default false
48+
* */
49+
sendDefaultPii?: boolean;
50+
3851
/** Should the native nagger alert be shown or not. */
3952
// enableNativeNagger?: boolean;
4053
/**
@@ -53,6 +66,11 @@ export interface NativescriptOptions extends BrowserOptions {
5366
sentry?: boolean;
5467
xhr?: boolean;
5568
};
69+
70+
/** Enable auto performance tracking by default. */
71+
enableAutoPerformanceTracking?: boolean;
72+
73+
flushSendEvent?: boolean;
5674
}
5775

5876
/** The Sentry Nativescript SDK Backend. */
@@ -65,9 +83,10 @@ export class NativescriptBackend extends BaseBackend<BrowserOptions> {
6583
this._browserBackend = new BrowserBackend(_options);
6684

6785
if (_options.enableNative !== false) {
68-
NSSentry.startWithDsnString(_options.dsn, _options).then(() => {
69-
NSSentry.setLogLevel(_options.debug ? 2 : 1);
70-
});
86+
NSSentry.startWithDsnString(_options.dsn, _options);
87+
// .then(() => {
88+
// // NSSentry.setLogLevel(_options.debug ? 2 : 1);
89+
// });
7190
} else {
7291
// if (__DEV__ && _options.enableNativeNagger) {
7392
// Alert.alert(
@@ -89,7 +108,7 @@ export class NativescriptBackend extends BaseBackend<BrowserOptions> {
89108

90109
const transportOptions = {
91110
...this._options.transportOptions,
92-
dsn: this._options.dsn,
111+
dsn: this._options.dsn
93112
};
94113

95114
if (this._options.transport) {
@@ -136,12 +155,11 @@ export class NativescriptBackend extends BaseBackend<BrowserOptions> {
136155
}
137156
}
138157

139-
140158
/**
141-
* Convert js severity level which has critical and log to more widely supported levels.
142-
* @param level
143-
* @returns More widely supported Severity level strings
144-
*/
159+
* Convert js severity level which has critical and log to more widely supported levels.
160+
* @param level
161+
* @returns More widely supported Severity level strings
162+
*/
145163
export function _processLevel(level: Severity): Severity {
146164
if (level === Severity.Critical) {
147165
return Severity.Fatal;

src/client.ts

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import { BaseClient, Scope } from '@sentry/core';
2-
import { Event, EventHint } from '@sentry/types';
3-
import { SyncPromise } from '@sentry/utils';
42

53
import { NativescriptBackend, NativescriptOptions } from './backend';
6-
import { SDK_NAME, SDK_VERSION } from './version';
4+
import { NSSentry } from './nssentry';
75

86
/**
97
* The Sentry React Native SDK Client.
@@ -21,31 +19,20 @@ export class NativescriptClient extends BaseClient<NativescriptBackend, Nativesc
2119
}
2220

2321
/**
24-
* @inheritDoc
25-
*/
26-
protected _prepareEvent(event: Event, scope?: Scope, hint?: EventHint): SyncPromise<Event | null> {
27-
event.platform = event.platform || 'javascript';
28-
event.sdk = {
29-
...event.sdk,
30-
name: SDK_NAME,
31-
packages: [
32-
...((event.sdk && event.sdk.packages) || []),
33-
{
34-
name: 'npm:@nativescript-community/sentry',
35-
version: SDK_VERSION
36-
}
37-
],
38-
version: SDK_VERSION
39-
};
40-
41-
return super._prepareEvent(event, scope, hint) as any;
42-
}
22+
* If native client is available it will trigger a native crash.
23+
* Use this only for testing purposes.
24+
*/
25+
public nativeCrash(): void {
26+
this._getBackend().nativeCrash();
27+
}
4328

44-
/**
45-
* If native client is available it will trigger a native crash.
46-
* Use this only for testing purposes.
47-
*/
48-
public nativeCrash(): void {
49-
this._getBackend().nativeCrash();
50-
}
51-
}
29+
/**
30+
* @inheritDoc
31+
*/
32+
public close(): PromiseLike<boolean> {
33+
// As super.close() flushes queued events, we wait for that to finish before closing the native SDK.
34+
return super.close().then((result: boolean) => {
35+
return NSSentry.closeNativeSdk().then(() => result) as PromiseLike<boolean>;
36+
});
37+
}
38+
}

0 commit comments

Comments
 (0)