|
1 | 1 | # react-native-notifications-utils |
2 | | -notifications utils |
| 2 | + |
| 3 | +A simple package for notifications utils. |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +## Features |
| 8 | +- [X] Opening App Notifications Settings for Android and iOS |
| 9 | +- [X] Typescript |
| 10 | + |
| 11 | + |
3 | 12 | ## Installation |
| 13 | +--- |
| 14 | +```sh |
| 15 | +yarn add react-native-notifications-utils |
| 16 | +``` |
| 17 | + |
| 18 | +### iOS |
4 | 19 |
|
5 | 20 | ```sh |
6 | | -npm install react-native-notifications-utils |
| 21 | +cd ios && pod install |
7 | 22 | ``` |
8 | 23 |
|
| 24 | + |
9 | 25 | ## Usage |
| 26 | +--- |
10 | 27 |
|
11 | | -```js |
12 | | -import { multiply } from "react-native-notifications-utils"; |
| 28 | +```typescript |
| 29 | +import NotificationsUtils from "react-native-notifications-utils"; |
13 | 30 |
|
14 | 31 | // ... |
15 | 32 |
|
16 | | -const result = await multiply(3, 7); |
| 33 | +NotificationsUtils.openSettings(); |
17 | 34 | ``` |
18 | 35 |
|
| 36 | +## API |
| 37 | +--- |
| 38 | + |
| 39 | +### `openSettings(channelId?: string)` |
| 40 | + API used to open the Platform specific System settings for the application. |
| 41 | + |
| 42 | +| Parameter | Type | Description | Android | iOS | |
| 43 | +| --------- | -------- | ------------------------------------------------------------------------------------------- | ------- | --- | |
| 44 | +| channelId | `string` | The channel id to open the settings for. If not provided, the default channel will be used. | ✅ | ❌ | |
| 45 | + |
| 46 | +- On Android: |
| 47 | + - API version is >= 26 with `channelId` will open the channel settings. if `channelI` is not provided, the app's notification settings will be opened. |
| 48 | + - API version is < 26, the application settings screen is opened |
| 49 | + |
| 50 | +- On iOS: |
| 51 | + - If the version of iOS is >= 15.4, the app's notification settings screen is displayed. |
| 52 | + - If the version of iOS is < 15.4, the app's settings screen is displayed. |
| 53 | + - for further details, see: |
| 54 | + - [Apple's iOS 16 documentation for `openNotificationSettingsURLString`]( https://developer.apple.com/documentation/uikit/uiapplication/4013180-opennotificationsettingsurlstrin) |
| 55 | + - [Apple's iOS 15.4 documentation for `UIApplicationOpenNotificationSettingsURLString`](https://developer.apple.com/documentation/uikit/uiapplicationopennotificationsettingsurlstring) |
| 56 | + - [Apple's documentation for `openSettingsURLString`](https://developer.apple.com/documentation/uikit/uiapplication/1623042-opensettingsurlstring). |
19 | 57 | ## Contributing |
20 | 58 |
|
21 | 59 | See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow. |
22 | 60 |
|
| 61 | +## Author |
| 62 | +___ |
| 63 | + - [**@stringsaeed**](https://www.github.com/stringsaeed) |
| 64 | + |
| 65 | + |
23 | 66 | ## License |
| 67 | +--- |
24 | 68 |
|
25 | 69 | MIT |
26 | 70 |
|
| 71 | + |
| 72 | + |
| 73 | +### TODO: |
| 74 | +--- |
| 75 | +- [ ] Add tests |
| 76 | +- [ ] Add support for request permissions |
| 77 | +- [ ] Keeps updated with new native features |
| 78 | + |
27 | 79 | --- |
28 | 80 |
|
29 | 81 | Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob) |
0 commit comments