Skip to content

Update the React Native SDK guide to unify the public entry point #206

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

Closed
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
23 changes: 11 additions & 12 deletions fern/docs/pages/plug-sdk/react-native.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ npm install @devrev/sdk-react-native

## Set up the DevRev SDK

In DevRev, go to **Settings** > **PLuG Chat** copy the value under **Your unique App ID**. After obtaining the credentials, you can configure the DevRev SDK in your app.
In DevRev, go to **Settings** > **PLuG Chat** copy the value under **Your unique App ID**. After obtaining the credentials, you can configure the DevRev SDK in your app.

<Callout intent="note">
The DevRev SDK must be configured before you can use any of its features.
Expand Down Expand Up @@ -107,7 +107,7 @@ This functionality is for Android only.
For scenarios where custom handling is needed, links from the support chat can be captured with the following method:

```typescript
DevRevSDK.setInAppLinkHandler((url) => {
DevRev.setInAppLinkHandler((url) => {
// Perform an action here.
});
```
Expand Down Expand Up @@ -169,7 +169,7 @@ You can add custom properties to the session recording to help you understand th
DevRev.addSessionProperties(properties: Map<string, string>)
```

To clear the session properties in scenarios such as user logout or when the session ends, use the following method:
To clear the session properties in scenarios such as user logout or when the session ends, use the following method:

```typescript
DevRev.clearSessionProperties()
Expand Down Expand Up @@ -236,19 +236,19 @@ Push notifications require SDK configuration and user identification, whether un
The DevRev SDK offers a method to register your device for receiving push notifications. You can register for push notifications using the following method:

```typescript
DevRevSDK.registerDeviceToken(deviceToken: string, deviceID: string)
DevRev.registerDeviceToken(deviceToken: string, deviceID: string)
```

On Android devices, the `deviceToken` should be the Firebase Cloud Messaging (FCM) token value, while on iOS devices, it should be the Apple Push Notification Service (APNS) token.

### Unregister from push notifications

If your app no longer needs to receive push notifications, you can unregister the device.
If your app no longer needs to receive push notifications, you can unregister the device.

Use the following method to unregister the device:

```typescript
DevRevSDK.unregisterDevice(deviceID: string)
DevRev.unregisterDevice(deviceID: string)
```

The method requires the device identifier, which should be the same as the one used when registering the device.
Expand All @@ -263,7 +263,7 @@ On Android, notifications are implemented as data messages to offer flexibility.
To process the notification, use the following method:

```typescript
DevRevSDK.processPushNotification(payload: string)
DevRev.processPushNotification(payload: string)
```

Here, the `message` object from the notification payload should be passed to this function.
Expand All @@ -278,23 +278,22 @@ const notificationPayload = {
}
};
const messageJson = notificationPayload["message"];
DevRevSDK.processPushNotification(JSON.stringify(messageJson));
DevRev.processPushNotification(JSON.stringify(messageJson));
```
#### iOS

On iOS devices, you must pass the received push notification payload to the DevRev SDK for processing. The SDK will then handle the notification and execute the necessary actions.
On iOS devices, you must pass the received push notification payload to the DevRev SDK for processing. The SDK will then handle the notification and execute the necessary actions.

```typescript
DevRevSDK.processPushNotification(payload: string)
DevRev.processPushNotification(payload: string)
```

For example:

```typescript
DevRevSDK.processPushNotification(JSON.stringify(payload));
DevRev.processPushNotification(JSON.stringify(payload));
```

## License

Apache 2.0

Loading