Skip to content

Refactor / Simplify Codes, support didLoadWithEvents #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
js: export native event name constant
  • Loading branch information
zxcpoiu committed Nov 17, 2020
commit c8037622f5bd3dfc3b1e96b22836772f66d51da0
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ class MyComponent extends React.Component {
}
for (let voipPushEvent of events) {
let { name, data } = voipPushEvent;
if (name === 'RNVoipPushRemoteNotificationsRegisteredEvent') {
if (name === VoipPushNotification.RNVoipPushRemoteNotificationsRegisteredEvent) {
this.onVoipPushNotificationRegistered(data);
} else if (name === 'RNVoipPushRemoteNotificationReceivedEvent') {
} else if (name === VoipPushNotification.RNVoipPushRemoteNotificationReceivedEvent) {
this.onVoipPushNotificationiReceived(data);
}
}
Expand Down
12 changes: 12 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ const RNVoipPushDidLoadWithEvents = "RNVoipPushDidLoadWithEvents"; // --- 'didLo

export default class RNVoipPushNotification {

static get RNVoipPushRemoteNotificationsRegisteredEvent() {
return RNVoipPushRemoteNotificationsRegisteredEvent;
}

static get RNVoipPushRemoteNotificationReceivedEvent() {
return RNVoipPushRemoteNotificationReceivedEvent;
}

static get RNVoipPushDidLoadWithEvents() {
return RNVoipPushDidLoadWithEvents;
}

/**
* Attaches a listener to remote notification events while the app is running
* in the foreground or the background.
Expand Down