Skip to content

Commit adc97c3

Browse files
committed
Rename registerRemoteNotificationReceived to registerNotificationReceived
1 parent b54ba78 commit adc97c3

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

lib/src/adapters/NativeEventsReceiver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class NativeEventsReceiver {
2020
return this.emitter.addListener('pushKitRegistered', callback);
2121
}
2222

23-
public registerRemoteNotificationReceived(callback: (notification: Notification) => void): EmitterSubscription {
23+
public registerNotificationReceived(callback: (notification: Notification) => void): EmitterSubscription {
2424
return this.emitter.addListener('notificationReceived', (payload) => {
2525
callback(this.notificationFactory.fromPayload(payload));
2626
});

lib/src/events/EventsRegistry.test.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ describe('EventsRegistry', () => {
2525
it('delegates to nativeEventsReceiver', () => {
2626
const cb = jest.fn();
2727

28-
uut.registerRemoteNotificationReceivedForeground(cb);
28+
uut.registerNotificationReceivedForeground(cb);
2929

30-
expect(mockNativeEventsReceiver.registerRemoteNotificationReceived).toHaveBeenCalledTimes(1);
31-
expect(mockNativeEventsReceiver.registerRemoteNotificationReceived).toHaveBeenCalledWith(expect.any(Function));
30+
expect(mockNativeEventsReceiver.registerNotificationReceived).toHaveBeenCalledTimes(1);
31+
expect(mockNativeEventsReceiver.registerNotificationReceived).toHaveBeenCalledWith(expect.any(Function));
3232
});
3333

3434
it('should wrap callback with completion block', () => {
3535
const wrappedCallback = jest.fn();
3636
const notification: Notification = new Notification({identifier: 'identifier'});
3737

38-
uut.registerRemoteNotificationReceivedForeground(wrappedCallback);
39-
const call = mockNativeEventsReceiver.registerRemoteNotificationReceived.mock.calls[0][0];
38+
uut.registerNotificationReceivedForeground(wrappedCallback);
39+
const call = mockNativeEventsReceiver.registerNotificationReceived.mock.calls[0][0];
4040
call(notification);
4141

4242
expect(wrappedCallback).toBeCalledWith(notification, expect.any(Function));
@@ -46,23 +46,23 @@ describe('EventsRegistry', () => {
4646
it('should wrap callback with completion block', () => {
4747
const expectedNotification: Notification = new Notification({identifier: 'identifier'});
4848

49-
uut.registerRemoteNotificationReceivedForeground((notification) => {
49+
uut.registerNotificationReceivedForeground((notification) => {
5050
expect(notification).toEqual(expectedNotification);
5151
});
52-
const call = mockNativeEventsReceiver.registerRemoteNotificationReceived.mock.calls[0][0];
52+
const call = mockNativeEventsReceiver.registerNotificationReceived.mock.calls[0][0];
5353
call(expectedNotification);
5454
});
5555

5656
it('should invoke finishPresentingNotification', () => {
5757
const notification: Notification = new Notification({identifier: 'notificationId'});
5858
const response: NotificationCompletion = {alert: true}
5959

60-
uut.registerRemoteNotificationReceivedForeground((notification, completion) => {
60+
uut.registerNotificationReceivedForeground((notification, completion) => {
6161
completion(response);
6262

6363
expect(mockNativeCommandsSender.finishPresentingNotification).toBeCalledWith(notification.identifier, response);
6464
});
65-
const call = mockNativeEventsReceiver.registerRemoteNotificationReceived.mock.calls[0][0];
65+
const call = mockNativeEventsReceiver.registerNotificationReceived.mock.calls[0][0];
6666
call(notification);
6767
});
6868

@@ -71,12 +71,12 @@ describe('EventsRegistry', () => {
7171
const expectedNotification: Notification = new Notification({identifier: 'notificationId'});
7272
const response: NotificationCompletion = {alert: true}
7373

74-
uut.registerRemoteNotificationReceivedForeground((notification, completion) => {
74+
uut.registerNotificationReceivedForeground((notification, completion) => {
7575
completion(response);
7676
expect(expectedNotification).toEqual(notification);
7777
expect(mockNativeCommandsSender.finishPresentingNotification).toBeCalledTimes(0);
7878
});
79-
const call = mockNativeEventsReceiver.registerRemoteNotificationReceived.mock.calls[0][0];
79+
const call = mockNativeEventsReceiver.registerNotificationReceived.mock.calls[0][0];
8080
call(expectedNotification);
8181
});
8282
});
@@ -89,18 +89,18 @@ describe('EventsRegistry', () => {
8989
it('delegates to nativeEventsReceiver', () => {
9090
const cb = jest.fn();
9191

92-
uut.registerRemoteNotificationReceivedBackground(cb);
92+
uut.registerNotificationReceivedBackground(cb);
9393

94-
expect(mockNativeEventsReceiver.registerRemoteNotificationReceived).toHaveBeenCalledTimes(1);
95-
expect(mockNativeEventsReceiver.registerRemoteNotificationReceived).toHaveBeenCalledWith(expect.any(Function));
94+
expect(mockNativeEventsReceiver.registerNotificationReceived).toHaveBeenCalledTimes(1);
95+
expect(mockNativeEventsReceiver.registerNotificationReceived).toHaveBeenCalledWith(expect.any(Function));
9696
});
9797

9898
it('should wrap callback with completion block', () => {
9999
const wrappedCallback = jest.fn();
100100
const notification: Notification = new Notification({identifier: 'identifier'});
101101

102-
uut.registerRemoteNotificationReceivedBackground(wrappedCallback);
103-
const call = mockNativeEventsReceiver.registerRemoteNotificationReceived.mock.calls[0][0];
102+
uut.registerNotificationReceivedBackground(wrappedCallback);
103+
const call = mockNativeEventsReceiver.registerNotificationReceived.mock.calls[0][0];
104104
call(notification);
105105

106106
expect(wrappedCallback).toBeCalledWith(notification, expect.any(Function));
@@ -110,23 +110,23 @@ describe('EventsRegistry', () => {
110110
it('should wrap callback with completion block', () => {
111111
const expectedNotification: Notification = new Notification({identifier: 'identifier'});
112112

113-
uut.registerRemoteNotificationReceivedBackground((notification) => {
113+
uut.registerNotificationReceivedBackground((notification) => {
114114
expect(notification).toEqual(expectedNotification);
115115
});
116-
const call = mockNativeEventsReceiver.registerRemoteNotificationReceived.mock.calls[0][0];
116+
const call = mockNativeEventsReceiver.registerNotificationReceived.mock.calls[0][0];
117117
call(expectedNotification);
118118
});
119119

120120
it('should invoke finishPresentingNotification', () => {
121121
const notification: Notification = new Notification({identifier: 'notificationId'});
122122
const response: NotificationCompletion = {alert: true}
123123

124-
uut.registerRemoteNotificationReceivedBackground((notification, completion) => {
124+
uut.registerNotificationReceivedBackground((notification, completion) => {
125125
completion(response);
126126

127127
expect(mockNativeCommandsSender.finishPresentingNotification).toBeCalledWith(notification.identifier, response);
128128
});
129-
const call = mockNativeEventsReceiver.registerRemoteNotificationReceived.mock.calls[0][0];
129+
const call = mockNativeEventsReceiver.registerNotificationReceived.mock.calls[0][0];
130130
call(notification);
131131
});
132132

@@ -135,12 +135,12 @@ describe('EventsRegistry', () => {
135135
const expectedNotification: Notification = new Notification({identifier: 'notificationId'});
136136
const response: NotificationCompletion = {alert: true}
137137

138-
uut.registerRemoteNotificationReceivedBackground((notification, completion) => {
138+
uut.registerNotificationReceivedBackground((notification, completion) => {
139139
completion(response);
140140
expect(expectedNotification).toEqual(notification);
141141
expect(mockNativeCommandsSender.finishPresentingNotification).toBeCalledTimes(0);
142142
});
143-
const call = mockNativeEventsReceiver.registerRemoteNotificationReceived.mock.calls[0][0];
143+
const call = mockNativeEventsReceiver.registerNotificationReceived.mock.calls[0][0];
144144
call(expectedNotification);
145145
});
146146
});

lib/src/events/EventsRegistry.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ export class EventsRegistry {
1919
return this.nativeEventsReceiver.registerRemoteNotificationsRegistered(callback);
2020
}
2121

22-
public registerRemoteNotificationReceivedForeground(callback: (notification: Notification, completion: (response: NotificationCompletion) => void) => void): EmitterSubscription {
23-
return this.nativeEventsReceiver.registerRemoteNotificationReceived(this.completionCallbackWrapper.wrapReceivedForegroundCallback(callback));
22+
public registerNotificationReceivedForeground(callback: (notification: Notification, completion: (response: NotificationCompletion) => void) => void): EmitterSubscription {
23+
return this.nativeEventsReceiver.registerNotificationReceived(this.completionCallbackWrapper.wrapReceivedForegroundCallback(callback));
2424
}
2525

26-
public registerRemoteNotificationReceivedBackground(callback: (notification: Notification, completion: (response: NotificationCompletion) => void) => void): EmitterSubscription {
27-
return this.nativeEventsReceiver.registerRemoteNotificationReceived(this.completionCallbackWrapper.wrapReceivedBackgroundCallback(callback));
26+
public registerNotificationReceivedBackground(callback: (notification: Notification, completion: (response: NotificationCompletion) => void) => void): EmitterSubscription {
27+
return this.nativeEventsReceiver.registerNotificationReceived(this.completionCallbackWrapper.wrapReceivedBackgroundCallback(callback));
2828
}
2929

3030
public registerNotificationOpened(callback: (response: NotificationResponse, completion: () => void) => void): EmitterSubscription {

0 commit comments

Comments
 (0)