History log of /expo/packages/expo-notifications/build/BadgeModule.js (Results 1 – 2 of 2)
Revision Date Author Comments
# 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 ...


# b286d3e7 05-Mar-2020 Stanisław Chmiela <[email protected]>

[expo-notifications] Badge count module (#6869)

# Why

We want to let people set badge counter on demand.

# How

- on Android we use `ShortcutBadger`
- on iOS we use `applicationIconBadgeNum

[expo-notifications] Badge count module (#6869)

# Why

We want to let people set badge counter on demand.

# How

- on Android we use `ShortcutBadger`
- on iOS we use `applicationIconBadgeNumber`
- on web we use `badgin`

### API

```ts
getBadgeCountAsync(): Promise<number>;
```

```ts
setBadgeCountAsync(badgeCount: number, undefined | {
web?: badgin.Options
}): Promise<boolean>;
```

# Test Plan

Tested the module on iOS 13 (worked ✅), Android 7.1 (Samsung, default launcher, ��), Android 7.1 (Samsung, ADW Launcher, ✅), Android 9 (Nokia, default launcher, ��), web (worked ✅). In order to be able to work around unsupported launchers I added a simple infrastructure inside `NewNotifications.js` test suite to skip tests on unsupported devices.

show more ...