Skip to content

Commit

Permalink
(Capacitor): Add migration guide for new version (#10987)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-zimerman authored Aug 26, 2024
1 parent b2082d3 commit 58ff6df
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 41 deletions.
10 changes: 10 additions & 0 deletions docs/platforms/javascript/guides/capacitor/migration/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Migration Guide
description: "Migrate from an older version of our Sentry Capacitor SDK."
sidebar_order: 8000
---

Here's a list of guides on migrating to a newer version of the Sentry Capacitor SDK.


<PageGrid />
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: Migrate from 0.x to 1.x
sidebar_order: 8920
description: "Learn about migrating from Sentry Capacitor SDK 0.x to 1.x"
---

## How to upgrade to SDK version 1:

When upgrading to SDK version 1, please note the main breaking changes with Sentry Capacitor. More detailed information about breaking changes in the sibling SDKs can be found in the <PlatformLink to="/migration/v0-to-v1/v7-to-v8/">sibling migration guide</PlatformLink>.

- Angular minimum supported version changed to version 14, upgrade to Angular 14 or higher for using the latest SDK.

- When using the package `@sentry/angular-ivy`, you will need to replace it by `@sentry/angular`.

- `enableOutOfMemoryTracking` was removed and replaced by `enableWatchdogTerminationTracking`.

- Capacitor V1 requires Sentry JavaScript SDK on version 8.x. We recommend reading below migration guide docs to find out how to address any breaking changes when upgrading the sibling dependencies to version 8.

<PageGrid/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Migrate from Sibling SDK 7.x to 8.x
sidebar_order: 8910
description: "Learn about migrating from Sentry JavaScript SDK 7.x to 8.x"
---

<Include name="../docs/platforms/javascript/common/migration/v7-to-v8/index" />

<PageGrid />
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Deprecations in 7.x
sidebar_order: 8940
description: "Learn about deprecations in Sentry JavaScript SDK 7.x and how to address them"
---

<Include name="../docs/platforms/javascript/common/migration/v7-to-v8/v7-deprecations" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: New Tracing APIs
sidebar_order: 8920
description: "Learn about new Tracing APIs in Sentry JavaScript SDK 8.x"
---

<Include name="../docs/platforms/javascript/common/migration/v7-to-v8/v8-new-performance-api" />
2 changes: 1 addition & 1 deletion includes/migration/javascript-v8/browser-other-changes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Sentry.init({

The xhr transport via `makeXHRTransport` transport has been removed. Only `makeFetchTransport` is available now. This means that the Sentry SDK requires the `fetch` API to be available in the environment.

<PlatformSection notSupported={['javascript.wasm']}>
<PlatformSection notSupported={['javascript.wasm', 'javascript.capacitor']}>
### Removal of the `Offline` integration

The `Offline` integration has been removed in favor of the <PlatformLink to="/configuration/transports/#makebrowserofflinetransport">offline transport wrapper</PlatformLink>
Expand Down
51 changes: 11 additions & 40 deletions platform-includes/getting-started-install/javascript.capacitor.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,49 +44,20 @@ yarn add @sentry/capacitor @sentry/browser
pnpm add @sentry/capacitor @sentry/browser
```

### Capacitor 2 - Android Specifics
### Angular Version Compatibility

<Note>
In its current beta version, the Sentry Capacitor SDK only supports Angular 14 and newer.

This step is not needed if you are using Capacitor 3
If you're using an older version of Angular, you also need to use an older version of the SDK. See the table below for compatibility guidance:

</Note>
| Angular version | Recommended Sentry SDK |
| --------------- | ------------------------------------------------------------------------------------------------------ |
| 14 and newer | `@sentry/capacitor` `@sentry/angular` |
| 12 or 13 | `@sentry/capacitor^0` `@sentry/angular-ivy@^7` * |
| 10 or 11 | `@sentry/capacitor^0` `@sentry/angular@^7` * |

Add the plugin declaration to your `MainActivity.java` file
\* These versions of the SDK are no longer maintained or tested. Version 0 might still receive bug fixes but we don't guarantee support.

```java {filename:MainActivity.java}
import android.os.Bundle;
import com.getcapacitor.BridgeActivity;
import com.getcapacitor.Plugin;
import io.sentry.capacitor.SentryCapacitor;
import java.util.ArrayList;
### React and Vue Version Compatibility

public class MainActivity extends BridgeActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Initializes the Bridge
this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
add(SentryCapacitor.class);
}});
}
}
```

```kotlin
import android.os.Bundle
import com.getcapacitor.BridgeActivity
import com.getcapacitor.Plugin
import io.sentry.capacitor.SentryCapacitor

class MainActivity : BridgeActivity() {
fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Initializes the Bridge
this.init(
savedInstanceState,
listOf<Class<out Plugin>>(SentryCapacitor::class.java)
)
}
}
```
Both Frameworks are fully compatible with the current and beta versions of Sentry Capacitor.

0 comments on commit 58ff6df

Please sign in to comment.