# Upgrading to v5

What's new in native-notify v5, and how to upgrade — including the one breaking change to the five follow helpers.

native-notify **v5** is a drop-in upgrade for most apps. There is exactly one breaking change — the five follow helpers now return structured result objects (see below).

## What's new in v5

New exports:

| Export                                                           | What it does                                                                                              |
| ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| `NativeNotify.init({ appId, appToken })`                         | Set your credentials once at module scope — every function picks them up.                                 |
| `<NativeNotifyProvider appId appToken>`                          | The same, as a React provider for your app tree.                                                          |
| `useNativeNotify()`                                              | Read the active `{ appId, appToken }` config inside a component.                                          |
| `useNativeNotifyPress<T>()`                                      | Cold-start-safe notification tap handling — see [Push Data & Taps](/docs/setup/push-data).                |
| `registerForPushNotificationsAsync()`                            | The raw token-minting flow, exported — never throws, it reports `{ status, reason, expoPushToken, ... }`. |
| `getNotificationInboxPage()` / `getIndieNotificationInboxPage()` | One page of inbox rows plus the server's total row count — `{ rows, total }`.                             |

Other additions that do **not** break anything:

- `registerNNPushToken(appId, appToken, options)` gains an optional third argument: `{ onRegistered, onError, watchTokenRotation }`.
- `appId` / `appToken` are optional everywhere — they are resolved from `NativeNotify.init()` / `<NativeNotifyProvider>` when omitted.
- The [Notification Inbox](/docs/indie-notification-inbox/components) syncs the unread count to the app icon badge (`syncBadge`, default `true`), and both inboxes support exact pagination via the new page functions.

## Breaking change: the follow helpers

These five helpers now return a structured `NativeNotifyActionResult` instead of a plain string:

- `registerFollowMasterID`
- `registerFollowerID`
- `postFollowingID`
- `unfollowMasterID`
- `updateFollowersList`

```ts
interface NativeNotifyActionResult {
  success: boolean;
  status:
    | 'registered'
    | 'already_registered'
    | 'posted'
    | 'already_posted'
    | 'unfollowed'
    | 'not_following'
    | 'removed'
    | 'not_found'
    | 'error';
  message: string; // the string the previous versions returned
  error?: any; // the underlying failure, when status is 'error'
}
```

**Before v5** (a plain string):

```js
const result = await registerFollowMasterID('master-id', appId, appToken);
if (result === 'already registered') {
  // ...
}
```

**In v5** (an object):

```js
const result = await registerFollowMasterID('master-id', appId, appToken);

if (result.success) {
  // registered, already registered, etc. — branch on result.status for details
}

if (result.status === 'error') {
  console.warn(result.message, result.error);
}
```

`message` still contains the text the previous versions returned, so upgrading is mostly a matter of replacing string checks with `result.status` (or `result.success`). The practical improvement: **network failures now surface as `status: 'error'`** with the underlying `error` attached, instead of being misreported as "already registered".
