@stream-io/video-react-native-sdk 1.34.0 → 1.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/dist/commonjs/components/Call/RingingCallContent/IncomingCall.js +9 -2
- package/dist/commonjs/components/Call/RingingCallContent/IncomingCall.js.map +1 -1
- package/dist/commonjs/components/Call/RingingCallContent/OutgoingCall.js +9 -2
- package/dist/commonjs/components/Call/RingingCallContent/OutgoingCall.js.map +1 -1
- package/dist/commonjs/components/Call/RingingCallContent/RingingCallContent.js +11 -12
- package/dist/commonjs/components/Call/RingingCallContent/RingingCallContent.js.map +1 -1
- package/dist/commonjs/components/Call/RingingCallContent/TextBasedIndicator.js +7 -2
- package/dist/commonjs/components/Call/RingingCallContent/TextBasedIndicator.js.map +1 -1
- package/dist/commonjs/components/Livestream/ViewerLivestream/ViewerLivestream.js +7 -3
- package/dist/commonjs/components/Livestream/ViewerLivestream/ViewerLivestream.js.map +1 -1
- package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.js +1 -1
- package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.js.map +1 -1
- package/dist/commonjs/hooks/push/index.js +0 -4
- package/dist/commonjs/hooks/push/index.js.map +1 -1
- package/dist/commonjs/modules/call-manager/CallManager.js +6 -0
- package/dist/commonjs/modules/call-manager/CallManager.js.map +1 -1
- package/dist/commonjs/utils/StreamVideoRN/index.js +0 -17
- package/dist/commonjs/utils/StreamVideoRN/index.js.map +1 -1
- package/dist/commonjs/utils/internal/callingx/callingx.js +55 -32
- package/dist/commonjs/utils/internal/callingx/callingx.js.map +1 -1
- package/dist/commonjs/utils/internal/registerSDKGlobals.js +2 -0
- package/dist/commonjs/utils/internal/registerSDKGlobals.js.map +1 -1
- package/dist/commonjs/utils/push/android.js +10 -93
- package/dist/commonjs/utils/push/android.js.map +1 -1
- package/dist/commonjs/utils/push/index.js +0 -11
- package/dist/commonjs/utils/push/index.js.map +1 -1
- package/dist/commonjs/utils/push/internal/utils.js +2 -31
- package/dist/commonjs/utils/push/internal/utils.js.map +1 -1
- package/dist/commonjs/utils/push/libs/callingx.js +9 -0
- package/dist/commonjs/utils/push/libs/callingx.js.map +1 -1
- package/dist/commonjs/utils/push/libs/index.js +0 -33
- package/dist/commonjs/utils/push/libs/index.js.map +1 -1
- package/dist/commonjs/utils/push/utils.js +0 -28
- package/dist/commonjs/utils/push/utils.js.map +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/module/components/Call/RingingCallContent/IncomingCall.js +9 -2
- package/dist/module/components/Call/RingingCallContent/IncomingCall.js.map +1 -1
- package/dist/module/components/Call/RingingCallContent/OutgoingCall.js +9 -2
- package/dist/module/components/Call/RingingCallContent/OutgoingCall.js.map +1 -1
- package/dist/module/components/Call/RingingCallContent/RingingCallContent.js +11 -12
- package/dist/module/components/Call/RingingCallContent/RingingCallContent.js.map +1 -1
- package/dist/module/components/Call/RingingCallContent/TextBasedIndicator.js +7 -2
- package/dist/module/components/Call/RingingCallContent/TextBasedIndicator.js.map +1 -1
- package/dist/module/components/Livestream/ViewerLivestream/ViewerLivestream.js +7 -3
- package/dist/module/components/Livestream/ViewerLivestream/ViewerLivestream.js.map +1 -1
- package/dist/module/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.js +1 -1
- package/dist/module/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.js.map +1 -1
- package/dist/module/hooks/push/index.js +0 -4
- package/dist/module/hooks/push/index.js.map +1 -1
- package/dist/module/modules/call-manager/CallManager.js +6 -0
- package/dist/module/modules/call-manager/CallManager.js.map +1 -1
- package/dist/module/utils/StreamVideoRN/index.js +0 -17
- package/dist/module/utils/StreamVideoRN/index.js.map +1 -1
- package/dist/module/utils/internal/callingx/callingx.js +56 -33
- package/dist/module/utils/internal/callingx/callingx.js.map +1 -1
- package/dist/module/utils/internal/registerSDKGlobals.js +2 -0
- package/dist/module/utils/internal/registerSDKGlobals.js.map +1 -1
- package/dist/module/utils/push/android.js +11 -92
- package/dist/module/utils/push/android.js.map +1 -1
- package/dist/module/utils/push/index.js +0 -1
- package/dist/module/utils/push/index.js.map +1 -1
- package/dist/module/utils/push/internal/utils.js +0 -28
- package/dist/module/utils/push/internal/utils.js.map +1 -1
- package/dist/module/utils/push/libs/callingx.js +9 -0
- package/dist/module/utils/push/libs/callingx.js.map +1 -1
- package/dist/module/utils/push/libs/index.js +0 -3
- package/dist/module/utils/push/libs/index.js.map +1 -1
- package/dist/module/utils/push/utils.js +0 -25
- package/dist/module/utils/push/utils.js.map +1 -1
- package/dist/module/version.js +1 -1
- package/dist/typescript/components/Call/RingingCallContent/IncomingCall.d.ts.map +1 -1
- package/dist/typescript/components/Call/RingingCallContent/OutgoingCall.d.ts.map +1 -1
- package/dist/typescript/components/Call/RingingCallContent/RingingCallContent.d.ts.map +1 -1
- package/dist/typescript/components/Call/RingingCallContent/TextBasedIndicator.d.ts.map +1 -1
- package/dist/typescript/components/Livestream/ViewerLivestream/ViewerLivestream.d.ts.map +1 -1
- package/dist/typescript/hooks/push/index.d.ts.map +1 -1
- package/dist/typescript/modules/call-manager/CallManager.d.ts.map +1 -1
- package/dist/typescript/utils/StreamVideoRN/index.d.ts +0 -7
- package/dist/typescript/utils/StreamVideoRN/index.d.ts.map +1 -1
- package/dist/typescript/utils/StreamVideoRN/types.d.ts +19 -40
- package/dist/typescript/utils/StreamVideoRN/types.d.ts.map +1 -1
- package/dist/typescript/utils/internal/callingx/callingx.d.ts.map +1 -1
- package/dist/typescript/utils/internal/registerSDKGlobals.d.ts.map +1 -1
- package/dist/typescript/utils/push/android.d.ts +1 -6
- package/dist/typescript/utils/push/android.d.ts.map +1 -1
- package/dist/typescript/utils/push/index.d.ts +0 -1
- package/dist/typescript/utils/push/index.d.ts.map +1 -1
- package/dist/typescript/utils/push/internal/utils.d.ts +2 -10
- package/dist/typescript/utils/push/internal/utils.d.ts.map +1 -1
- package/dist/typescript/utils/push/libs/callingx.d.ts.map +1 -1
- package/dist/typescript/utils/push/libs/firebaseMessaging/index.d.ts +16 -2
- package/dist/typescript/utils/push/libs/firebaseMessaging/index.d.ts.map +1 -1
- package/dist/typescript/utils/push/libs/index.d.ts +0 -3
- package/dist/typescript/utils/push/libs/index.d.ts.map +1 -1
- package/dist/typescript/utils/push/utils.d.ts +0 -6
- package/dist/typescript/utils/push/utils.d.ts.map +1 -1
- package/dist/typescript/version.d.ts +1 -1
- package/expo-config-plugin/dist/withAppDelegate.js +56 -0
- package/ios/StreamVideoReactNative.h +14 -0
- package/ios/StreamVideoReactNative.m +129 -7
- package/package.json +4 -14
- package/src/components/Call/RingingCallContent/IncomingCall.tsx +14 -2
- package/src/components/Call/RingingCallContent/OutgoingCall.tsx +14 -2
- package/src/components/Call/RingingCallContent/RingingCallContent.tsx +7 -12
- package/src/components/Call/RingingCallContent/TextBasedIndicator.tsx +13 -2
- package/src/components/Livestream/ViewerLivestream/ViewerLivestream.tsx +10 -2
- package/src/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.tsx +1 -1
- package/src/hooks/push/index.ts +0 -4
- package/src/modules/call-manager/CallManager.ts +6 -0
- package/src/utils/StreamVideoRN/index.ts +0 -22
- package/src/utils/StreamVideoRN/types.ts +19 -46
- package/src/utils/internal/callingx/callingx.ts +60 -29
- package/src/utils/internal/registerSDKGlobals.ts +2 -0
- package/src/utils/push/android.ts +11 -117
- package/src/utils/push/index.ts +0 -1
- package/src/utils/push/internal/utils.ts +1 -41
- package/src/utils/push/libs/callingx.ts +12 -0
- package/src/utils/push/libs/index.ts +0 -3
- package/src/utils/push/utils.ts +0 -37
- package/src/version.ts +1 -1
- package/dist/commonjs/hooks/push/useIosInitRemoteNotifications.js +0 -33
- package/dist/commonjs/hooks/push/useIosInitRemoteNotifications.js.map +0 -1
- package/dist/commonjs/hooks/push/useProcessPushNonRingingCallEffect.js +0 -49
- package/dist/commonjs/hooks/push/useProcessPushNonRingingCallEffect.js.map +0 -1
- package/dist/commonjs/utils/internal/newNotificationCallbacks.js +0 -17
- package/dist/commonjs/utils/internal/newNotificationCallbacks.js.map +0 -1
- package/dist/commonjs/utils/push/internal/rxSubjects.js +0 -13
- package/dist/commonjs/utils/push/internal/rxSubjects.js.map +0 -1
- package/dist/commonjs/utils/push/ios.js +0 -158
- package/dist/commonjs/utils/push/ios.js.map +0 -1
- package/dist/commonjs/utils/push/libs/expoNotifications.js +0 -25
- package/dist/commonjs/utils/push/libs/expoNotifications.js.map +0 -1
- package/dist/commonjs/utils/push/libs/iosPushNotification.js +0 -17
- package/dist/commonjs/utils/push/libs/iosPushNotification.js.map +0 -1
- package/dist/commonjs/utils/push/libs/notifee/index.js +0 -38
- package/dist/commonjs/utils/push/libs/notifee/index.js.map +0 -1
- package/dist/commonjs/utils/push/libs/notifee/lib.js +0 -16
- package/dist/commonjs/utils/push/libs/notifee/lib.js.map +0 -1
- package/dist/module/hooks/push/useIosInitRemoteNotifications.js +0 -27
- package/dist/module/hooks/push/useIosInitRemoteNotifications.js.map +0 -1
- package/dist/module/hooks/push/useProcessPushNonRingingCallEffect.js +0 -43
- package/dist/module/hooks/push/useProcessPushNonRingingCallEffect.js.map +0 -1
- package/dist/module/utils/internal/newNotificationCallbacks.js +0 -10
- package/dist/module/utils/internal/newNotificationCallbacks.js.map +0 -1
- package/dist/module/utils/push/internal/rxSubjects.js +0 -7
- package/dist/module/utils/push/internal/rxSubjects.js.map +0 -1
- package/dist/module/utils/push/ios.js +0 -148
- package/dist/module/utils/push/ios.js.map +0 -1
- package/dist/module/utils/push/libs/expoNotifications.js +0 -18
- package/dist/module/utils/push/libs/expoNotifications.js.map +0 -1
- package/dist/module/utils/push/libs/iosPushNotification.js +0 -11
- package/dist/module/utils/push/libs/iosPushNotification.js.map +0 -1
- package/dist/module/utils/push/libs/notifee/index.js +0 -31
- package/dist/module/utils/push/libs/notifee/index.js.map +0 -1
- package/dist/module/utils/push/libs/notifee/lib.js +0 -11
- package/dist/module/utils/push/libs/notifee/lib.js.map +0 -1
- package/dist/typescript/hooks/push/useIosInitRemoteNotifications.d.ts +0 -5
- package/dist/typescript/hooks/push/useIosInitRemoteNotifications.d.ts.map +0 -1
- package/dist/typescript/hooks/push/useProcessPushNonRingingCallEffect.d.ts +0 -7
- package/dist/typescript/hooks/push/useProcessPushNonRingingCallEffect.d.ts.map +0 -1
- package/dist/typescript/utils/internal/newNotificationCallbacks.d.ts +0 -10
- package/dist/typescript/utils/internal/newNotificationCallbacks.d.ts.map +0 -1
- package/dist/typescript/utils/push/internal/rxSubjects.d.ts +0 -11
- package/dist/typescript/utils/push/internal/rxSubjects.d.ts.map +0 -1
- package/dist/typescript/utils/push/ios.d.ts +0 -14
- package/dist/typescript/utils/push/ios.d.ts.map +0 -1
- package/dist/typescript/utils/push/libs/expoNotifications.d.ts +0 -6
- package/dist/typescript/utils/push/libs/expoNotifications.d.ts.map +0 -1
- package/dist/typescript/utils/push/libs/iosPushNotification.d.ts +0 -5
- package/dist/typescript/utils/push/libs/iosPushNotification.d.ts.map +0 -1
- package/dist/typescript/utils/push/libs/notifee/index.d.ts +0 -23
- package/dist/typescript/utils/push/libs/notifee/index.d.ts.map +0 -1
- package/dist/typescript/utils/push/libs/notifee/lib.d.ts +0 -4
- package/dist/typescript/utils/push/libs/notifee/lib.d.ts.map +0 -1
- package/src/hooks/push/useIosInitRemoteNotifications.ts +0 -29
- package/src/hooks/push/useProcessPushNonRingingCallEffect.ts +0 -50
- package/src/utils/internal/newNotificationCallbacks.ts +0 -29
- package/src/utils/push/internal/rxSubjects.ts +0 -10
- package/src/utils/push/ios.ts +0 -207
- package/src/utils/push/libs/expoNotifications.ts +0 -32
- package/src/utils/push/libs/iosPushNotification.ts +0 -22
- package/src/utils/push/libs/notifee/index.ts +0 -41
- package/src/utils/push/libs/notifee/lib.ts +0 -14
package/src/utils/push/ios.ts
DELETED
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import { Platform } from 'react-native';
|
|
2
|
-
import type { StreamVideoConfig } from '../StreamVideoRN/types';
|
|
3
|
-
import { pushNonRingingCallData$ } from './internal/rxSubjects';
|
|
4
|
-
import {
|
|
5
|
-
type ExpoNotification,
|
|
6
|
-
getExpoNotificationsLib,
|
|
7
|
-
getNotifeeLibThrowIfNotInstalledForPush,
|
|
8
|
-
getPushNotificationIosLib,
|
|
9
|
-
type PushNotificationiOSType,
|
|
10
|
-
} from './libs';
|
|
11
|
-
import { StreamVideoClient, videoLoggerSystem } from '@stream-io/video-client';
|
|
12
|
-
import { setPushLogoutCallback } from '../internal/pushLogoutCallback';
|
|
13
|
-
import type { Event } from '@notifee/react-native';
|
|
14
|
-
import { StreamVideoRN } from '../StreamVideoRN';
|
|
15
|
-
import type { StreamPushPayload } from './utils';
|
|
16
|
-
|
|
17
|
-
type PushConfig = NonNullable<StreamVideoConfig['push']>;
|
|
18
|
-
|
|
19
|
-
let lastApnToken = { token: '', userId: '' };
|
|
20
|
-
|
|
21
|
-
function processNonRingingNotificationStreamPayload(
|
|
22
|
-
streamPayload: StreamPushPayload,
|
|
23
|
-
) {
|
|
24
|
-
if (
|
|
25
|
-
streamPayload?.sender === 'stream.video' &&
|
|
26
|
-
streamPayload?.type !== 'call.ring'
|
|
27
|
-
) {
|
|
28
|
-
const cid = streamPayload.call_cid;
|
|
29
|
-
const type = streamPayload.type;
|
|
30
|
-
const logger = videoLoggerSystem.getLogger(
|
|
31
|
-
'processNonRingingNotificationStreamPayload',
|
|
32
|
-
);
|
|
33
|
-
logger.trace(`cid, type - ${cid}, ${type}`);
|
|
34
|
-
pushNonRingingCallData$.next({ cid, type });
|
|
35
|
-
return { cid, type };
|
|
36
|
-
}
|
|
37
|
-
return undefined;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export const oniOSExpoNotificationEvent = (event: ExpoNotification) => {
|
|
41
|
-
const pushConfig = StreamVideoRN.getConfig().push;
|
|
42
|
-
if (pushConfig) {
|
|
43
|
-
const trigger = event.request.trigger;
|
|
44
|
-
if (
|
|
45
|
-
trigger &&
|
|
46
|
-
typeof trigger === 'object' &&
|
|
47
|
-
'type' in trigger &&
|
|
48
|
-
trigger.type === 'push' &&
|
|
49
|
-
trigger.payload?.stream
|
|
50
|
-
) {
|
|
51
|
-
const streamPayload = trigger.payload.stream as StreamPushPayload;
|
|
52
|
-
const logger = videoLoggerSystem.getLogger(
|
|
53
|
-
'processNonRingingNotificationStreamPayload',
|
|
54
|
-
);
|
|
55
|
-
logger.trace(
|
|
56
|
-
`processNonRingingNotificationStreamPayload - ${JSON.stringify(
|
|
57
|
-
streamPayload,
|
|
58
|
-
)}`,
|
|
59
|
-
);
|
|
60
|
-
processNonRingingNotificationStreamPayload(streamPayload);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export const oniOSNotifeeEvent = ({ event }: { event: Event }) => {
|
|
66
|
-
if (Platform.OS !== 'ios') return;
|
|
67
|
-
const pushConfig = StreamVideoRN.getConfig().push;
|
|
68
|
-
const { type, detail } = event;
|
|
69
|
-
const notifeeLib = getNotifeeLibThrowIfNotInstalledForPush();
|
|
70
|
-
if (pushConfig && type === notifeeLib.EventType.PRESS) {
|
|
71
|
-
const streamPayload = detail.notification?.data?.stream as
|
|
72
|
-
| StreamPushPayload
|
|
73
|
-
| undefined;
|
|
74
|
-
const result = processNonRingingNotificationStreamPayload(streamPayload);
|
|
75
|
-
if (result) {
|
|
76
|
-
const logger = videoLoggerSystem.getLogger('oniOSNotifeeEvent');
|
|
77
|
-
logger.debug(
|
|
78
|
-
`onTapNonRingingCallNotification?.(${result.cid}, ${result.type})`,
|
|
79
|
-
);
|
|
80
|
-
pushConfig.onTapNonRingingCallNotification?.(result.cid, result.type);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export function onPushNotificationiOSStreamVideoEvent(
|
|
86
|
-
notification: PushNotificationiOSType,
|
|
87
|
-
) {
|
|
88
|
-
const pushNotificationIosLib = getPushNotificationIosLib();
|
|
89
|
-
const data = notification.getData();
|
|
90
|
-
const streamPayload = data?.stream as StreamPushPayload;
|
|
91
|
-
const logger = videoLoggerSystem.getLogger(
|
|
92
|
-
'onPushNotificationiOSStreamVideoEvent',
|
|
93
|
-
);
|
|
94
|
-
if (!streamPayload) {
|
|
95
|
-
logger.trace(
|
|
96
|
-
`skipping process: no stream payload found in notification data - ${JSON.stringify(
|
|
97
|
-
data,
|
|
98
|
-
)}`,
|
|
99
|
-
);
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
const isClicked = data.userInteraction === 1;
|
|
103
|
-
const pushConfig = StreamVideoRN.getConfig().push;
|
|
104
|
-
if (!isClicked || !pushConfig) {
|
|
105
|
-
logger.debug(
|
|
106
|
-
`notification.finish called and returning - isClicked: ${isClicked}, pushConfig: ${!!pushConfig}`,
|
|
107
|
-
);
|
|
108
|
-
notification.finish(pushNotificationIosLib.FetchResult.NoData);
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
// listen to foreground notifications
|
|
112
|
-
const result = processNonRingingNotificationStreamPayload(streamPayload);
|
|
113
|
-
if (result) {
|
|
114
|
-
logger.debug(
|
|
115
|
-
`onTapNonRingingCallNotification?.(${result.cid}, ${result.type})`,
|
|
116
|
-
);
|
|
117
|
-
pushConfig.onTapNonRingingCallNotification?.(result.cid, result.type);
|
|
118
|
-
}
|
|
119
|
-
notification.finish(pushNotificationIosLib.FetchResult.NoData);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/** Send token to stream */
|
|
123
|
-
export async function initIosNonVoipToken(
|
|
124
|
-
client: StreamVideoClient,
|
|
125
|
-
pushConfig: PushConfig,
|
|
126
|
-
setUnsubscribeListener: (unsubscribe: () => void) => void,
|
|
127
|
-
) {
|
|
128
|
-
if (
|
|
129
|
-
Platform.OS !== 'ios' ||
|
|
130
|
-
!pushConfig.ios?.pushProviderName ||
|
|
131
|
-
!pushConfig.onTapNonRingingCallNotification
|
|
132
|
-
) {
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const logger = videoLoggerSystem.getLogger('initIosNonVoipToken');
|
|
137
|
-
const setDeviceToken = async (token: string) => {
|
|
138
|
-
const userId = client.streamClient._user?.id ?? '';
|
|
139
|
-
if (lastApnToken.token === token && lastApnToken.userId === userId) {
|
|
140
|
-
logger.debug(
|
|
141
|
-
'Skipped sending device token to stream as it was already sent',
|
|
142
|
-
token,
|
|
143
|
-
);
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
setPushLogoutCallback(async () => {
|
|
147
|
-
lastApnToken = { token: '', userId: '' };
|
|
148
|
-
try {
|
|
149
|
-
logger.debug('Remove device token - setPushLogoutCallback', token);
|
|
150
|
-
await client.removeDevice(token);
|
|
151
|
-
} catch (err) {
|
|
152
|
-
logger.warn(
|
|
153
|
-
'setPushLogoutCallback - Failed to remove apn token from stream',
|
|
154
|
-
err,
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
const push_provider_name = pushConfig.ios?.pushProviderName;
|
|
159
|
-
logger.debug('Add device token to stream', token);
|
|
160
|
-
await client
|
|
161
|
-
.addDevice(token, 'apn', push_provider_name)
|
|
162
|
-
.then(() => {
|
|
163
|
-
lastApnToken = { token, userId };
|
|
164
|
-
})
|
|
165
|
-
.catch((err) => {
|
|
166
|
-
logger.warn('Failed to add apn token to stream', err);
|
|
167
|
-
});
|
|
168
|
-
};
|
|
169
|
-
if (pushConfig.isExpo) {
|
|
170
|
-
const expoNotificationsLib = getExpoNotificationsLib();
|
|
171
|
-
if (expoNotificationsLib) {
|
|
172
|
-
expoNotificationsLib.getDevicePushTokenAsync().then((devicePushToken) => {
|
|
173
|
-
logger.debug(
|
|
174
|
-
'Got device token - expoNotificationsLib.getDevicePushTokenAsync',
|
|
175
|
-
devicePushToken.data,
|
|
176
|
-
);
|
|
177
|
-
setDeviceToken(devicePushToken.data);
|
|
178
|
-
});
|
|
179
|
-
const subscription = expoNotificationsLib.addPushTokenListener(
|
|
180
|
-
(devicePushToken) => {
|
|
181
|
-
logger.debug(
|
|
182
|
-
'Got device token - expoNotificationsLib.addPushTokenListener',
|
|
183
|
-
devicePushToken.data,
|
|
184
|
-
);
|
|
185
|
-
setDeviceToken(devicePushToken.data);
|
|
186
|
-
},
|
|
187
|
-
);
|
|
188
|
-
setUnsubscribeListener(() => {
|
|
189
|
-
logger.debug(`removed expo addPushTokenListener`);
|
|
190
|
-
subscription.remove();
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
} else {
|
|
194
|
-
const pushNotificationIosLib = getPushNotificationIosLib();
|
|
195
|
-
pushNotificationIosLib.addEventListener('register', (token) => {
|
|
196
|
-
logger.debug(
|
|
197
|
-
`Got device token - pushNotificationIosLib.addEventListener('register')`,
|
|
198
|
-
token,
|
|
199
|
-
);
|
|
200
|
-
setDeviceToken(token);
|
|
201
|
-
});
|
|
202
|
-
setUnsubscribeListener(() => {
|
|
203
|
-
logger.debug(`pushNotificationIosLib.removeEventListener('register')`);
|
|
204
|
-
pushNotificationIosLib.removeEventListener('register');
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { Notification } from 'expo-notifications';
|
|
2
|
-
import { videoLoggerSystem } from '@stream-io/video-client';
|
|
3
|
-
|
|
4
|
-
export type ExpoNotificationsLib = typeof import('expo-notifications');
|
|
5
|
-
|
|
6
|
-
export type ExpoNotification = Notification;
|
|
7
|
-
|
|
8
|
-
let expoNotificationsLib: ExpoNotificationsLib | undefined;
|
|
9
|
-
|
|
10
|
-
try {
|
|
11
|
-
expoNotificationsLib = require('expo-notifications');
|
|
12
|
-
} catch {}
|
|
13
|
-
|
|
14
|
-
export function getExpoNotificationsLib() {
|
|
15
|
-
if (!expoNotificationsLib) {
|
|
16
|
-
throw Error(
|
|
17
|
-
'expo-notifications library is not installed. Please see https://docs.expo.dev/versions/latest/sdk/notifications/ for installation instructions. It is required for non ringing push notifications.',
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
return expoNotificationsLib;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function getExpoNotificationsLibNoThrow() {
|
|
24
|
-
if (!expoNotificationsLib) {
|
|
25
|
-
videoLoggerSystem
|
|
26
|
-
.getLogger('getExpoNotificationsLibNoThrow')
|
|
27
|
-
.debug(
|
|
28
|
-
'expo-notifications library is not installed. It is required for non ringing push notifications and not for ringing',
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
return expoNotificationsLib;
|
|
32
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { PushNotification } from '@react-native-community/push-notification-ios';
|
|
2
|
-
|
|
3
|
-
export type PushNotificationIosLib =
|
|
4
|
-
typeof import('@react-native-community/push-notification-ios').default;
|
|
5
|
-
|
|
6
|
-
let pushNotificationIosLib: PushNotificationIosLib | undefined;
|
|
7
|
-
|
|
8
|
-
export type PushNotificationiOSType = PushNotification;
|
|
9
|
-
|
|
10
|
-
try {
|
|
11
|
-
pushNotificationIosLib =
|
|
12
|
-
require('@react-native-community/push-notification-ios').default;
|
|
13
|
-
} catch {}
|
|
14
|
-
|
|
15
|
-
export function getPushNotificationIosLib() {
|
|
16
|
-
if (!pushNotificationIosLib) {
|
|
17
|
-
throw Error(
|
|
18
|
-
'@react-native-community/push-notification-ios library is not installed. Please install it using "yarn add @react-native-community/push-notification-ios" or "npm i @react-native-community/push-notification-ios --save"',
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
return pushNotificationIosLib;
|
|
22
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { lib, type Type } from './lib';
|
|
2
|
-
|
|
3
|
-
export type NotifeeLib = Type;
|
|
4
|
-
|
|
5
|
-
enum AndroidForegroundServiceType {
|
|
6
|
-
FOREGROUND_SERVICE_TYPE_CAMERA = 64,
|
|
7
|
-
FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE = 16,
|
|
8
|
-
FOREGROUND_SERVICE_TYPE_DATA_SYNC = 1,
|
|
9
|
-
FOREGROUND_SERVICE_TYPE_HEALTH = 256,
|
|
10
|
-
FOREGROUND_SERVICE_TYPE_LOCATION = 8,
|
|
11
|
-
FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK = 2,
|
|
12
|
-
FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION = 32,
|
|
13
|
-
FOREGROUND_SERVICE_TYPE_MEDIA_PROCESSING = 8192,
|
|
14
|
-
FOREGROUND_SERVICE_TYPE_MICROPHONE = 128,
|
|
15
|
-
FOREGROUND_SERVICE_TYPE_PHONE_CALL = 4,
|
|
16
|
-
FOREGROUND_SERVICE_TYPE_REMOTE_MESSAGING = 512,
|
|
17
|
-
FOREGROUND_SERVICE_TYPE_SHORT_SERVICE = 2048,
|
|
18
|
-
FOREGROUND_SERVICE_TYPE_SPECIAL_USE = 1073741824,
|
|
19
|
-
FOREGROUND_SERVICE_TYPE_SYSTEM_EXEMPTED = 1024,
|
|
20
|
-
FOREGROUND_SERVICE_TYPE_MANIFEST = -1,
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const INSTALLATION_INSTRUCTION =
|
|
24
|
-
'Please see https://notifee.app/react-native/docs/installation for installation instructions';
|
|
25
|
-
|
|
26
|
-
export function getNotifeeLibThrowIfNotInstalledForPush() {
|
|
27
|
-
if (!lib) {
|
|
28
|
-
throw Error(
|
|
29
|
-
'@notifee/react-native is not installed. It is required for implementing push notifications. ' +
|
|
30
|
-
INSTALLATION_INSTRUCTION,
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
return lib;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function getIncomingCallForegroundServiceTypes() {
|
|
37
|
-
const types: AndroidForegroundServiceType[] = [
|
|
38
|
-
AndroidForegroundServiceType.FOREGROUND_SERVICE_TYPE_SHORT_SERVICE,
|
|
39
|
-
];
|
|
40
|
-
return types;
|
|
41
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export type Type = typeof import('@notifee/react-native');
|
|
2
|
-
|
|
3
|
-
let lib: Type | undefined;
|
|
4
|
-
|
|
5
|
-
try {
|
|
6
|
-
lib = require('@notifee/react-native');
|
|
7
|
-
} catch {}
|
|
8
|
-
|
|
9
|
-
export { lib };
|
|
10
|
-
|
|
11
|
-
/*
|
|
12
|
-
IMPORTANT: must keep a failing import in a different file
|
|
13
|
-
Else on commonjs, metro doesnt resolve any other modules properly in a file, if one of the module is not installed
|
|
14
|
-
*/
|