Skip to content

Commit

Permalink
Remove Unused Event
Browse files Browse the repository at this point in the history
• Removed the `onRegistered` event, as it seems that it has never been used for anything.
  • Loading branch information
Nightsd01 committed Feb 22, 2018
1 parent 72d6820 commit 8acf1b8
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 32 deletions.
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,14 +335,12 @@ export default class App extends Component {
componentWillMount() {
OneSignal.addEventListener('received', this.onReceived);
OneSignal.addEventListener('opened', this.onOpened);
OneSignal.addEventListener('registered', this.onRegistered);
OneSignal.addEventListener('ids', this.onIds);
}

componentWillUnmount() {
OneSignal.removeEventListener('received', this.onReceived);
OneSignal.removeEventListener('opened', this.onOpened);
OneSignal.removeEventListener('registered', this.onRegistered);
OneSignal.removeEventListener('ids', this.onIds);
}

Expand All @@ -357,10 +355,6 @@ export default class App extends Component {
console.log('openResult: ', openResult);
}

onRegistered(notifData) {
console.log("Device had been registered for push notifications!", notifData);
}

onIds(device) {
console.log('Device info: ', device);
}
Expand Down
11 changes: 0 additions & 11 deletions examples/RNOneSignal/index.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,30 +51,23 @@ export default class RNOneSignal extends Component {


OneSignal.inFocusDisplaying(2)

OneSignal.getPermissionSubscriptionState((response) => {
console.log("Received permission subscription state: ", response);
});
}

componentDidMount() {
this.onReceived = this.onReceived.bind(this);
this.onOpened = this.onOpened.bind(this);
this.onIds = this.onIds.bind(this);
this.onRegistered = this.onRegistered.bind(this);
this.onEmailRegistrationChange = this.onEmailRegistrationChange.bind(this);

OneSignal.addEventListener('received', this.onReceived);
OneSignal.addEventListener('opened', this.onOpened);
OneSignal.addEventListener('registered', this.onRegistered);
OneSignal.addEventListener('ids', this.onIds);
OneSignal.addEventListener('emailSubscription', this.onEmailRegistrationChange);
}

componentWillUnmount() {
OneSignal.removeEventListener('received', this.onReceived);
OneSignal.removeEventListener('opened', this.onOpened);
OneSignal.removeEventListener('registered', this.onRegistered);
OneSignal.removeEventListener('ids', this.onIds);
OneSignal.removeEventListener('emailSubscription', this.onEmailRegistrationChange);
}
Expand All @@ -94,10 +87,6 @@ export default class RNOneSignal extends Component {
console.log('openResult: ', openResult);
}

onRegistered(notifData) {
console.log("Device had been registered for push notifications!", notifData);
}

onIds(device) {
console.log('Device info: ', device);
}
Expand Down
7 changes: 0 additions & 7 deletions examples/RNOneSignal/index.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,17 @@ export default class RNOneSignal extends Component {
this.onReceived = this.onReceived.bind(this);
this.onOpened = this.onOpened.bind(this);
this.onIds = this.onIds.bind(this);
this.onRegistered = this.onRegistered.bind(this);
this.onEmailRegistrationChange = this.onEmailRegistrationChange.bind(this);

OneSignal.addEventListener('received', this.onReceived);
OneSignal.addEventListener('opened', this.onOpened);
OneSignal.addEventListener('registered', this.onRegistered);
OneSignal.addEventListener('ids', this.onIds);
OneSignal.addEventListener('emailSubscription', this.onEmailRegistrationChange);
}

componentWillUnmount() {
OneSignal.removeEventListener('received', this.onReceived);
OneSignal.removeEventListener('opened', this.onOpened);
OneSignal.removeEventListener('registered', this.onRegistered);
OneSignal.removeEventListener('ids', this.onIds);
OneSignal.removeEventListener('emailSubscription', this.onEmailRegistrationChange);
}
Expand All @@ -94,10 +91,6 @@ export default class RNOneSignal extends Component {
console.log('openResult: ', openResult);
}

onRegistered(notifData) {
console.log("Device had been registered for push notifications!", notifData);
}

onIds(device) {
console.log('Device info: ', device);
}
Expand Down
3 changes: 1 addition & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ var oneSignalEventEmitter = new NativeEventEmitter(RNOneSignal);
const eventBroadcastNames = [
'OneSignal-remoteNotificationReceived',
'OneSignal-remoteNotificationOpened',
'OneSignal-remoteNotificationsRegistered',
'OneSignal-idsAvailable',
'OneSignal-emailSubscription'
];

var _eventNames = [ "received", "opened", "registered", "ids", "emailSubscription"];
var _eventNames = [ "received", "opened", "ids", "emailSubscription"];

var _notificationHandler = new Map();
var _notificationCache = new Map();
Expand Down
4 changes: 0 additions & 4 deletions ios/RCTOneSignal/RCTOneSignal.m
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,6 @@ - (NSDictionary *)jsonObjectWithString:(NSString *)jsonString {
return json;
}

- (void)handleRemoteNotificationsRegistered:(NSNotification *)notification {
[self sendEvent:OSEventString(NotificationReceived) withBody:notification.userInfo];
}

- (void)sendEvent:(NSString *)eventName withBody:(NSDictionary *)body {
[RCTOneSignalEventEmitter sendEventWithName:eventName withBody:body];
}
Expand Down
3 changes: 1 addition & 2 deletions ios/RCTOneSignal/RCTOneSignalEventEmitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
typedef NS_ENUM(NSInteger, OSNotificationEventTypes) {
NotificationReceived,
NotificationOpened,
NotificationRegistered,
IdsAvailable,
EmailSubscriptionChanged
};

#define OSNotificationEventTypesArray @[@"OneSignal-remoteNotificationReceived",@"OneSignal-remoteNotificationOpened",@"OneSignal-remoteNotificationsRegistered",@"OneSignal-idsAvailable",@"OneSignal-emailSubscription"]
#define OSNotificationEventTypesArray @[@"OneSignal-remoteNotificationReceived",@"OneSignal-remoteNotificationOpened",@"OneSignal-idsAvailable",@"OneSignal-emailSubscription"]
#define OSEventString(enum) [OSNotificationEventTypesArray objectAtIndex:enum]


Expand Down

0 comments on commit 8acf1b8

Please sign in to comment.