Skip to content
Merged

V3 #437

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
a972d1e
Add typescript support
yogevbd Jul 30, 2019
8099dbf
Add unit tests
yogevbd Jul 31, 2019
6c99242
Splits requestPermissionsWithCategories to two functions
yogevbd Jul 31, 2019
f666b85
Done converting the js part to typescript
yogevbd Jul 31, 2019
c0e921c
typescript WIP
yogevbd Jul 31, 2019
1c606aa
Fix unit
yogevbd Jul 31, 2019
4520e23
Fix e2e
yogevbd Aug 3, 2019
d0fefcb
Identical API for Android and iOS
yogevbd Aug 3, 2019
6836b9a
Fix bundle
yogevbd Aug 3, 2019
bbf6a09
build typescript before test-e2e-ios
yogevbd Aug 3, 2019
6a3da31
build typescript before test-e2e-ios
yogevbd Aug 3, 2019
a11de27
Add docousaurus documentation
yogevbd Aug 4, 2019
d3ad6d0
Fix rebase from master
yogevbd Aug 13, 2019
ae51849
Move android and ios folders into lib folder
yogevbd Aug 13, 2019
36a833f
Merge remote-tracking branch 'origin' into v3
yogevbd Aug 13, 2019
4e66145
Split Notification.ts, Fix android example module
yogevbd Sep 9, 2019
ceaeb80
Add test coverage for Notification.ts, clean old js files
yogevbd Sep 9, 2019
5cd92c2
Updated docs
yogevbd Sep 9, 2019
e6281eb
Move ios and android commands to designated classes
yogevbd Sep 9, 2019
c4fa09d
Remove package.json unused packages
yogevbd Sep 9, 2019
9780387
Fix e2e
yogevbd Sep 12, 2019
9e86bf6
Fix docs, remove circleci config file
yogevbd Sep 12, 2019
f56e53f
3.0.0-alpha.0
yogevbd Sep 12, 2019
2b91243
Update README.md
yogevbd Sep 12, 2019
7be8021
Fix js tests
yogevbd Sep 14, 2019
16d0acd
Merge remote-tracking branch 'origin' into v3
yogevbd Sep 14, 2019
657214d
Add missing flavors
yogevbd Sep 14, 2019
15f13c8
Update release script
yogevbd Sep 15, 2019
d5a2735
Add pretest scripts
yogevbd Sep 15, 2019
c0fb186
Update release script
yogevbd Sep 15, 2019
74cbb10
Revert manual version change
yogevbd Sep 15, 2019
57d3cc0
Fix release build
yogevbd Sep 15, 2019
1081242
Merge remote-tracking branch 'origin' into v3
yogevbd Sep 15, 2019
35432ac
Gradle resolve react-native version flavor
yogevbd Sep 15, 2019
2903f89
Fix documentation website
yogevbd Sep 16, 2019
5503586
Merge remote-tracking branch 'origin' into v3
yogevbd Sep 22, 2019
b37ed53
Add identical registerRemoteNotifications api for iOS and Android
yogevbd Oct 2, 2019
c6c4d0f
Finish API documentation
yogevbd Oct 2, 2019
e1d0c80
Merge from master branch
yogevbd Oct 2, 2019
6adee3e
Fix build
yogevbd Oct 2, 2019
3432816
Remove NOTIFICATION_RECEIVED_FOREGROUND_EVENT_NAME
yogevbd Oct 2, 2019
6a64314
Fix iOS example project
yogevbd Oct 2, 2019
27da4aa
Split specific iOS events, Update docs
yogevbd Oct 2, 2019
ff096c8
Add subscription documentation guide
yogevbd Oct 2, 2019
6d3ebcc
Add Local Notifications documentation guide
yogevbd Oct 2, 2019
d94ebbb
Fix handling actions, Add event handling documentation guide
yogevbd Oct 2, 2019
f12b10e
Fix platforms logo
yogevbd Oct 2, 2019
8cf658f
Fix iOS unit tests
yogevbd Oct 2, 2019
2b40b3b
Update package.json version to 3.0.0-beta.0 and generate CHANGELOG.gr…
mobile1-internal Oct 2, 2019
9ef5e6f
Fix documentation
yogevbd Oct 7, 2019
2ad92d6
Add prerelease script
yogevbd Oct 7, 2019
6fe705f
Update package.json version to 3.0.0-beta.1 and generate CHANGELOG.gr…
mobile1-internal Oct 7, 2019
75c6776
Merge remote-tracking branch 'origin' into v3
yogevbd Jan 12, 2020
394371c
Add npm run docusaurus
yogevbd Jan 12, 2020
6eeafe0
Add removeAllDeliveredNotifications support for both iOS and Android
yogevbd Jan 12, 2020
a67dd3a
Add CI tag support
yogevbd Jan 12, 2020
062fd3a
Fix podspec
yogevbd Jan 12, 2020
884c825
Update iOS installation
yogevbd Jan 12, 2020
5341d8b
Fix android installation
yogevbd Jan 12, 2020
504a73b
fix build.gradle rn package.json path
artald Jan 12, 2020
cbc84ff
Fix iOS
yogevbd Jan 12, 2020
62769db
Add NotificationFactory
yogevbd Jan 13, 2020
f5ae779
Fix tests
yogevbd Jan 13, 2020
67e072c
Fix resolving gradle react native version
yogevbd Jan 13, 2020
8f807b0
find rn package.json by checking if the file exists instead of an exc…
artald Jan 13, 2020
bc4a8dc
Fix e2e
yogevbd Jan 13, 2020
1509072
Merge branch 'v3' of github.com:wix/react-native-notifications into v3
yogevbd Jan 13, 2020
adae079
Update package.json version to 3.0.0-beta.2 and generate CHANGELOG.gr…
mobile1-internal Jan 13, 2020
b634cb3
Rename setBadgesCount to setBadgeCount
yogevbd Jan 13, 2020
fe981cd
Merge branch 'v3' of github.com:wix/react-native-notifications into v3
yogevbd Jan 13, 2020
64a1ce6
add ios and android Notifications object getters
artald Jan 13, 2020
dfa5b30
Update package.json version to 3.0.0-beta.3 and generate CHANGELOG.gr…
mobile1-internal Jan 13, 2020
d665da3
Fix android token registration
yogevbd Jan 14, 2020
c737a54
Update package.json version to 3.0.0-beta.4 and generate CHANGELOG.gr…
mobile1-internal Jan 14, 2020
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
40 changes: 0 additions & 40 deletions .circleci/config.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*/node_modules
*.log
14 changes: 9 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ npm-debug.log
#####
# Android

android/local.properties
android/*.iml
lib/android/local.properties
lib/android/*.iml
lib/android/.idea
lib/android/build
lib/android/.gradle
*.gradle

#####
# OS X temporary files that should never be committed
Expand Down Expand Up @@ -187,6 +191,6 @@ coverage/
package-lock.json

.history
android/.idea
android/build
android/.gradle

# Typescript build
lib/dist/
9 changes: 7 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
example/
test/
RNNotifications/DerivedData
node_modules/
website/
docs/
docs_old/
scripts/
e2e/

.eslintrc
*.yml
Expand All @@ -10,4 +14,5 @@ coverage/
android/.idea
android/build/
.idea
.history/
.history/
.github/
15 changes: 15 additions & 0 deletions CHANGELOG.gren.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 3.0.0-beta.4 (14/01/2020)
*No changelog for this release.*

---

## 3.0.0-beta.3 (13/01/2020)
*No changelog for this release.*

---

## 3.0.0-beta.2 (13/01/2020)
*No changelog for this release.*

---

## 2.1.7 (14/12/2019)
*No changelog for this release.*

Expand Down
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:8.11.4

WORKDIR /app/website

EXPOSE 3000 35729
COPY ./docs /app/docs
COPY ./website /app/website
RUN yarn install

CMD ["yarn", "start"]
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# React Native Notifications [![CircleCI](https://circleci.com/gh/wix/react-native-notifications/tree/master.svg?style=svg)](https://circleci.com/gh/wix/react-native-notifications/tree/master)
# React Native Notifications
![npm](https://img.shields.io/npm/dw/react-native-notifications.svg)
[![Build Status](https://img.shields.io/jenkins/s/http/jenkins-oss.wixpress.com:8080/job/multi-react-native-notifications-master.svg)](https://jenkins-oss.wixpress.com/job/multi-react-native-notifications-master/)
[![npm (tag)](https://img.shields.io/npm/v/react-native-notifications/snapshot.svg)](https://github.com/wix/react-native-navigation/tree/master)

Handle all the aspects of push notifications for your app, including remote and local notifications, interactive notifications, silent notifications, and more.

Expand Down Expand Up @@ -27,14 +30,8 @@ _For information regarding proper integration with [react-native-navigation](htt
_Upcoming: local notifications, background-state Rx queue (iOS equivalent)_


# Table of Content

- [Installation and setup](./docs/installation.md) - Setting up the library in your app
- [Subscription](./docs/subscription.md) - Signing in to push notifications vendors (e.g. GCM)
- [Notification Events (notfications core)](./docs/notificationsEvents.md) - Handling push notification arrival, notification opening by users
- [Local notifications](./docs/localNotifications.md) - Manually triggering notifications (i.e. not via push)
- [Advanced iOS topics](./docs/advancedIos.md) - e.g. managed notifications, PushKit API, Notifications actions
- [Notifications layout control - Android (wiki page)](https://github.com/wix/react-native-notifications/wiki/Android:-Layout-Customization) - Learn how to fully customize your notifications layout on Android!
# Quick Links
- [Documentation](https://wix.github.io/react-native-notifications/)

# License
The MIT License.
Expand Down
15 changes: 0 additions & 15 deletions RNNotifications/RNEventEmitter.h

This file was deleted.

18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: "3"

services:
docusaurus:
build: .
ports:
- 3000:3000
- 35729:35729
volumes:
- ./docs:/app/docs
- ./website/blog:/app/website/blog
- ./website/core:/app/website/core
- ./website/i18n:/app/website/i18n
- ./website/pages:/app/website/pages
- ./website/static:/app/website/static
- ./website/sidebars.json:/app/website/sidebars.json
- ./website/siteConfig.js:/app/website/siteConfig.js
working_dir: /app/website
165 changes: 165 additions & 0 deletions docs/advanced-ios.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
---
id: advanced-ios
title: iOS Advanced API
sidebar_label: iOS
---

## PushKit API

The PushKit framework provides the classes for your iOS apps to receive background pushes from remote servers. it has better support for background notifications compared to regular push notifications with `content-available: 1`. More info in [iOS PushKit documentation](https://developer.apple.com/library/ios/documentation/NetworkingInternet/Reference/PushKit_Framework/).

### Register to PushKit
[Prepare your app to receive VoIP push notifications](https://developer.apple.com/library/ios/documentation/Performance/Conceptual/EnergyGuide-iOS/OptimizeVoIP.html)

### Listen to PushKit notifications
On receiving PushKit notification, a `pushKitNotificationReceived` event will be fired with the notification payload.

```js
Notifications.ios.events().registerPushKitNotificationReceived((payload: object) => {
console.log(JSON.stringify(payload));
});
```

In your ReactNative code, add event handler for `pushKitRegistered` event and call to `registerPushKit()`:

```javascript
constructor() {
Notifications.ios.events().registerPushKitRegistered((event: RegisteredPushKit) => {
console.log("PushKit Token Received: " + event.pushKitToken);
});

Notifications.ios.events().registerPushKitNotificationReceived((payload: object) => {
console.log('PushKit notification Received: ' + JSON.stringify(payload));
});

Notifications.ios.registerPushKit();
}
```

> 1. Notice that PushKit device token and regular notifications device token are different, so you must handle two different tokens in the server side in order to support this feature.
> 2. PushKit will not request permissions from the user for push notifications.


---

## Interactive / Actionable Notifications

> This section provides description for iOS. For notifications customization on Android, refer to [our wiki](https://github.com/wix/react-native-notifications/wiki/Android-Customizations#customizing-notifications-layout).

Interactive notifications allow you to reply to a message right from the notification banner or take action right from the lock screen.

On the Lock screen and within Notification Center, you swipe from right to left
to reveal actions. Destructive actions, like trashing an email, are color-coded red. Relatively neutral actions, like dismissing an alert or declining an invitation, are color-coded gray.

For banners, you pull down to reveal actions as buttons. For popups, the actions are immediately visible — the buttons are right there.

You can find more info about interactive notifications [here](http://www.imore.com/interactive-notifications-ios-8-explained).

![Interactive Notifications](http://i.imgur.com/XrVzy9w.gif)


Notification **actions** allow the user to interact with a given notification.

Notification **categories** allow you to group multiple actions together, and to connect the actions with the push notification itself.

Follow the basic workflow of adding interactive notifications to your app:

1. Config the actions.
2. Group actions together into categories.
3. Register to push notifications with the configured categories.
4. Push a notification (or trigger a [local](#triggering-local-notifications) one) with the configured category name.

### Example
#### Config the Actions
We will config two actions: upvote and reply.

```javascript
import { Notifications, NotificationAction, NotificationCategory } from 'react-native-notifications';

let upvoteAction = new NotificationAction({
activationMode: "background",
title: String.fromCodePoint(0x1F44D),
identifier: "UPVOTE_ACTION",
textInput: {
buttonTitle: 'title',
placeholder: 'placeholder text'
}
});

let replyAction = new NotificationAction({
activationMode: "background",
title: "Reply",
authenticationRequired: true,
identifier: "REPLY_ACTION"
});

```

#### Config the Category
We will group `upvote` action and `reply` action into a single category: `EXAMPLE_CATEGORY `. If the notification contains `EXAMPLE_CATEGORY ` under `category` field, those actions will appear.

```javascript
let exampleCategory = new NotificationCategory({
identifier: "EXAMPLE_CATEGORY",
actions: [upvoteAction, replyAction]
});
```

#### Register to Push Notifications
Instead of basic registration like we've done before, we will register the device to push notifications with the category we've just created.

```javascript
Notifications.setCategories([exampleCategory]);
```

#### Push an Interactive Notification
Notification payload should look like this:

```javascript
{
aps: {
// ... (alert, sound, badge, etc)
category: "EXAMPLE_CATEGORY"
}
}
```

The [example app](https://github.com/wix/react-native-notifications/tree/master/example) contains this interactive notification example, you can follow there.

### `NotificationAction` Payload

- `title` - Action button title.
- `identifier` - Action identifier (must be unique).
- `activationMode` - Indicating whether the app should activate to the foreground or background.
- `foreground` (default) - Activate the app and put it in the foreground.
- `background` - Activate the app and put it in the background. If the app is already in the foreground, it remains in the foreground.
- `textInput` - `TextInput` payload, when supplied, the system will present text input in this action.
- `destructive` - A Boolean value indicating whether the action is destructive. When the value of this property is `true`, the system displays the corresponding button differently to indicate that the action is destructive.
- `authenticationRequired` - A Boolean value indicating whether the user must unlock the device before the action is performed.

### `NotificationCategory` Payload

- `identifier` - The name of the action group (must be unique).
- `actions` - An array of `NotificationAction` objects, which related to this category.

### `TextInput` Payload

- `buttonTitle` - Title of the `send` button.
- `placeholder` - Placeholder for the `textInput`.


#### Get and set application icon badges count (iOS only)

Get the current number:
```javascript
Notifications.ios.getBadgeCount((count) => console.log(count));
```

Set to specific number:
```javascript
Notifications.ios.setBadgeCount(2);
```
Clear badges icon:
```javascript
Notifications.ios.setBadgeCount(0);
```
12 changes: 12 additions & 0 deletions docs/android-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
id: android-api
title: Android Specific Commands
sidebar_label: Android specific
---

## refreshToken()
Request a new token for sending push notifications.

```js
Notifications.android.refreshToken();
```
Loading