Repository: getsentry/sentry-capacitor (ts)

Issue:
TypeScript/hybrid layer not implementing new enableWatchdogTerminationTracking setting
### Environment

Upgrading from version 0.11.4 to version 0.12.2 of Sentry Capacitor

### Steps to Reproduce

1. Prior to upgrading to v0.12.2, our app implemented a [setting](https://docs.sentry.io/platforms/javascript/guides/capacitor/configuration/options/#enableOutOfMemoryTracking) called `enableOutOfMemoryTracking`
2. This setting is used to disable events sent to Sentry by the native layer if the OS kills the native app on iOS.
3. We are setting it to `false` to disable [out of memory](https://docs.sentry.io/platforms/apple/guides/ios/configuration/out-of-memory/) tracking on iOS.

### Expected Result

We expected setting `enableOutOfMemoryTracking: false` to disable out of memory tracking on iOS.

### Actual Result

Out of memory tracking still occurs on iOS.

It seems this setting was [renamed](https://docs.sentry.io/platforms/apple/guides/ios/configuration/watchdog-terminations/) to `enableWatchdogTerminationTracking` with version 8.0.0 of Sentry Apple SDK. This might be why configuring the setting `enableOutOfMemoryTracking: false` no longer seems to disable it.


Pull request description:
Fix: enableWatchdogTerminationTracking (replaces enableOutOfMemoryTracking) is now properly set on iOS.
New implementation of Sentry Cocoa uses `enableWatchdogTerminationTracking` instead of  `enableOutOfMemoryTracking `
This PR fixes the correct value to be sent to the Native SDK, allowing both methods to be used, and also deprecates enableOutOfMemoryTracking to warn users that this feature will be removed on a major version.


Fixes #445

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b59955c..243b6e4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@
 ### Fixes
 
 - (iOS) UI API called on a background thread ([#448](https://github.com/getsentry/sentry-capacitor/pull/448))
+- enableWatchdogTerminationTracking (replaces enableOutOfMemoryTracking) is now properly set on iOS. ([#454](https://github.com/getsentry/sentry-capacitor/pull/454))
 
 ## 0.12.3
 
diff --git a/src/nativeOptions.ts b/src/nativeOptions.ts
index 473b11b..7429d1d 100644
--- a/src/nativeOptions.ts
+++ b/src/nativeOptions.ts
@@ -16,7 +16,8 @@ export function FilterNativeOptions(options: CapacitorOptions): CapacitorOptions
     dsn: options.dsn,
     enabled: options.enabled,
     enableNdkScopeSync: options.enableNdkScopeSync,
-    enableOutOfMemoryTracking: options.enableOutOfMemoryTracking,
+    // eslint-disable-next-line deprecation/deprecation
+    enableWatchdogTerminationTracking: options.enableOutOfMemoryTracking ?? options.enableWatchdogTerminationTracking,
     enableTracing: options.enableTracing,
     environment: options.environment,
     // ignoreErrors: Only available on the JavaScript Layer.
diff --git a/src/options.ts b/src/options.ts
index c59fed0..39d7415 100644
--- a/src/options.ts
+++ b/src/options.ts
@@ -43,6 +43,15 @@ export interface CapacitorOptions
   *
   * @default true
   * */
-  enableOutOfMemoryTracking?: boolean;
+  enableWatchdogTerminationTracking?: boolean;
 
+  /**
+  * Enables Out of Memory Tracking for iOS and macCatalyst.
+  * See the following link for more information and possible restrictions:
+  * https://docs.sentry.io/platforms/apple/guides/ios/configuration/out-of-memory/
+  *
+  * @default true
+  * @deprecated The method will be removed on a major update, instead, use enableWatchdogTerminationTracking for the same result.
+  * */
+  enableOutOfMemoryTracking?: boolean;
 }
diff --git a/src/sdk.ts b/src/sdk.ts
index c03664f..ae8894f 100644
--- a/src/sdk.ts
+++ b/src/sdk.ts
@@ -24,7 +24,7 @@ export function init<O>(
 ): void {
   const finalOptions = {
     enableAutoSessionTracking: true,
-    enableOutOfMemoryTracking: true,
+    enableWatchdogTerminationTracking: true,
     ...passedOptions,
   };
   if (finalOptions.enabled === false ||


Test patch:
diff --git a/test/nativeOptions.test.ts b/test/nativeOptions.test.ts
index cd855f3..e03d357 100644
--- a/test/nativeOptions.test.ts
+++ b/test/nativeOptions.test.ts
@@ -3,6 +3,31 @@ import type { Instrumenter, StackParser } from '@sentry/types';
 import { FilterNativeOptions } from '../src/nativeOptions';
 
 describe('nativeOptions', () => {
+
+  test('Use value of enableOutOfMemoryTracking on enableWatchdogTerminationTracking when set true', async () => {
+    const nativeOptions = FilterNativeOptions(
+      {
+        enableOutOfMemoryTracking: true
+      });
+    expect(nativeOptions.enableWatchdogTerminationTracking).toBeTruthy();
+  });
+
+  test('Use value of enableOutOfMemoryTracking on enableWatchdogTerminationTracking when set false', async () => {
+    const nativeOptions = FilterNativeOptions(
+      {
+        enableOutOfMemoryTracking: false
+      });
+    expect(nativeOptions.enableWatchdogTerminationTracking).toBeFalsy();
+  });
+
+  test('enableWatchdogTerminationTracking is set when defined', async () => {
+    const nativeOptions = FilterNativeOptions(
+      {
+        enableWatchdogTerminationTracking: true
+      });
+    expect(nativeOptions.enableWatchdogTerminationTracking).toBeTruthy();
+  });
+
   test('invalid types not included', async () => {
     const nativeOptions = FilterNativeOptions(
       {