History log of /expo/packages/expo-notifications/src/NotificationsHandlerModule.ts (Results 1 – 5 of 5)
Revision Date Author Comments
# 8285c032 13-Aug-2021 Tomasz Sapeta <[email protected]>

Rename unimodules imports to expo-modules-core


# db1c4130 19-Jun-2020 Stanisław Chmiela <[email protected]>

[expo-notifications] Add preliminary "support" for Web (#8853)

# Why

Even though we don't support Web in `expo-notifications`, we don't want to be a pain to the users and throw errors just becaus

[expo-notifications] Add preliminary "support" for Web (#8853)

# Why

Even though we don't support Web in `expo-notifications`, we don't want to be a pain to the users and throw errors just because of running the code on Web.

# How

Added simple object fallbacks for missing modules on web so that they are queryable by
```ts
if (!Module.methodAsync) {
throw new Unavailability…
}
```

Swapped `.ts` + `.web.ts` for `.native.ts` + `.ts` (or + `.web.ts` + `.ts` where it made sense, eg. if we would need to use `localStorage` inside the `.ts` file I renamed it to `.web.ts` and added an empty fallback in `.ts`).

# Test Plan

- [x] Ran NCL in `bare-expo` on Web, clicked buttons around, noticed the error is readable and makes sense.
- [x] Ran `expo-notifications` test-suite on both iOS and Web. It seems iOS tests are a little bit flaky, unfortunately (the errors could also happen due to erroring Expo API, HTTP error 504 when fetching push token, but I was able to make all of the tests pass just refreshing).

show more ...


# 7cf8d919 27-Mar-2020 Stanisław Chmiela <[email protected]>

[expo-notifications] Unify types across the API


# 596463bc 13-Feb-2020 Stanisław Chmiela <[email protected]>

[expo-notifications] Add notification building infrastructure (#6843)

# Why

We want to have a way to build notifications based on some requests, eg. from `presentNotificationAsync({…})`, or from

[expo-notifications] Add notification building infrastructure (#6843)

# Why

We want to have a way to build notifications based on some requests, eg. from `presentNotificationAsync({…})`, or from a `data` property of a `RemoteMessage`.

# How

`NotificationBuilderFactory` provides `NotificationBuilders` capable of configuring `NotificationCompat.Builder` instances according to configuration passed in with `setRemoteMessage(RemoteMessage)`.

This is the class we will extend (and eventually refactor if it gets too complicated, eg. into the [Modifiers scheme](https://github.com/expo/expo/pull/6021/files#diff-5d8593d4edad0300f92d6b77d850602aR32)) to support more fields from the notifications object to set `Intent`s, links, number etc.

> **Note:** Builder uses `NotificationChannel.DEFAULT_CHANNEL_ID` at the moment, which results in not showing the notification. This module will be integrated with `NotificationChannelsManager` once [it lands](https://github.com/expo/expo/pull/6842).

![excalidraw-202012311929-8](https://user-images.githubusercontent.com/1151041/73081987-e84d9000-3ec8-11ea-8e4f-fcbed9a70826.png)

More complete architecture diagram (receiving + handling + building)

![excalidraw-202012311929-10](https://user-images.githubusercontent.com/1151041/73084080-9870c800-3ecc-11ea-9d78-dc7328e86750.png)

# Test Plan

I have confirmed these classes work as expected in a more complex PR.

show more ...


# 03846faa 12-Feb-2020 Stanisław Chmiela <[email protected]>

[expo-notifications] Handling notifications (#6796)

# Why

Next `expo-notifications` feature.

# How

- `NotificationsHandlerModule` registers at singleton for new notifications/messages
- fo

[expo-notifications] Handling notifications (#6796)

# Why

Next `expo-notifications` feature.

# How

- `NotificationsHandlerModule` registers at singleton for new notifications/messages
- for each message it _starts up_ a task which emits an event to JS
- in response to the JS event, delegate responds with the appropriate behavior (eg. `shouldShowAlert: true`)
- the behavior is pushed to native side using `NotificationsHandler.handleNotificationAsync` call
- which directs it to the appropriate task
- task handles the behavior (on iOS calls `completionHandler`, on Android it will show the notification once implemented) and finishes
- if for whatever reason delegate didn't respond in 3 seconds, `onTimeout` is called on task, which emits another event to JS (for debugging purposes) and the task finishes

![excalidraw-202012311929-7](https://user-images.githubusercontent.com/1151041/73078318-3ca14180-3ec2-11ea-9220-c7a2f3c1e558.png)

# Test Plan

Tested manually by sending notifications and logging messages that the scheme works both when the delegate responds and when it does not.

show more ...