@stream-io/video-react-native-sdk 0.1.2 → 0.1.4
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 +22 -0
- package/dist/commonjs/components/Call/CallControls/HangupCallButton.js +4 -6
- package/dist/commonjs/components/Call/CallControls/HangupCallButton.js.map +1 -1
- package/dist/commonjs/hooks/push/index.js +4 -0
- package/dist/commonjs/hooks/push/index.js.map +1 -1
- package/dist/commonjs/hooks/push/useInitAndroidTokenAndRest.js +8 -2
- package/dist/commonjs/hooks/push/useInitAndroidTokenAndRest.js.map +1 -1
- package/dist/commonjs/hooks/push/useIosInitRemoteNotifications.js +34 -0
- package/dist/commonjs/hooks/push/useIosInitRemoteNotifications.js.map +1 -0
- package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js +50 -4
- package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
- package/dist/commonjs/hooks/push/useProcessPushNonRingingCallEffect.js +50 -0
- package/dist/commonjs/hooks/push/useProcessPushNonRingingCallEffect.js.map +1 -0
- package/dist/commonjs/utils/StreamVideoRN/index.js +33 -0
- package/dist/commonjs/utils/StreamVideoRN/index.js.map +1 -1
- package/dist/commonjs/utils/internal/newNotificationCallbacks.js +18 -0
- package/dist/commonjs/utils/internal/newNotificationCallbacks.js.map +1 -0
- package/dist/commonjs/utils/internal/pushLogoutCallback.js +18 -0
- package/dist/commonjs/utils/internal/pushLogoutCallback.js.map +1 -0
- package/dist/commonjs/utils/push/android.js +182 -68
- package/dist/commonjs/utils/push/android.js.map +1 -1
- package/dist/commonjs/utils/push/ios.js +107 -1
- package/dist/commonjs/utils/push/ios.js.map +1 -1
- package/dist/commonjs/utils/push/libs.js +34 -1
- package/dist/commonjs/utils/push/libs.js.map +1 -1
- package/dist/commonjs/utils/push/rxSubjects.js +8 -1
- package/dist/commonjs/utils/push/rxSubjects.js.map +1 -1
- package/dist/commonjs/utils/push/utils.js +29 -1
- package/dist/commonjs/utils/push/utils.js.map +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/module/components/Call/CallControls/HangupCallButton.js +3 -4
- package/dist/module/components/Call/CallControls/HangupCallButton.js.map +1 -1
- package/dist/module/hooks/push/index.js +4 -0
- package/dist/module/hooks/push/index.js.map +1 -1
- package/dist/module/hooks/push/useInitAndroidTokenAndRest.js +8 -2
- package/dist/module/hooks/push/useInitAndroidTokenAndRest.js.map +1 -1
- package/dist/module/hooks/push/useIosInitRemoteNotifications.js +28 -0
- package/dist/module/hooks/push/useIosInitRemoteNotifications.js.map +1 -0
- package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js +49 -4
- package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
- package/dist/module/hooks/push/useProcessPushNonRingingCallEffect.js +44 -0
- package/dist/module/hooks/push/useProcessPushNonRingingCallEffect.js.map +1 -0
- package/dist/module/utils/StreamVideoRN/index.js +32 -0
- package/dist/module/utils/StreamVideoRN/index.js.map +1 -1
- package/dist/module/utils/internal/newNotificationCallbacks.js +10 -0
- package/dist/module/utils/internal/newNotificationCallbacks.js.map +1 -0
- package/dist/module/utils/internal/pushLogoutCallback.js +10 -0
- package/dist/module/utils/internal/pushLogoutCallback.js.map +1 -0
- package/dist/module/utils/push/android.js +184 -70
- package/dist/module/utils/push/android.js.map +1 -1
- package/dist/module/utils/push/ios.js +103 -1
- package/dist/module/utils/push/ios.js.map +1 -1
- package/dist/module/utils/push/libs.js +31 -1
- package/dist/module/utils/push/libs.js.map +1 -1
- package/dist/module/utils/push/rxSubjects.js +5 -0
- package/dist/module/utils/push/rxSubjects.js.map +1 -1
- package/dist/module/utils/push/utils.js +27 -0
- package/dist/module/utils/push/utils.js.map +1 -1
- package/dist/module/version.js +1 -1
- package/dist/typescript/hooks/push/index.d.ts.map +1 -1
- package/dist/typescript/hooks/push/useInitAndroidTokenAndRest.d.ts +1 -1
- package/dist/typescript/hooks/push/useInitAndroidTokenAndRest.d.ts.map +1 -1
- package/dist/typescript/hooks/push/useIosInitRemoteNotifications.d.ts +5 -0
- package/dist/typescript/hooks/push/useIosInitRemoteNotifications.d.ts.map +1 -0
- package/dist/typescript/hooks/push/useIosVoipPushEventsSetupEffect.d.ts.map +1 -1
- package/dist/typescript/hooks/push/useProcessPushNonRingingCallEffect.d.ts +7 -0
- package/dist/typescript/hooks/push/useProcessPushNonRingingCallEffect.d.ts.map +1 -0
- package/dist/typescript/utils/StreamVideoRN/index.d.ts +12 -0
- package/dist/typescript/utils/StreamVideoRN/index.d.ts.map +1 -1
- package/dist/typescript/utils/StreamVideoRN/types.d.ts +40 -6
- package/dist/typescript/utils/StreamVideoRN/types.d.ts.map +1 -1
- package/dist/typescript/utils/internal/newNotificationCallbacks.d.ts +10 -0
- package/dist/typescript/utils/internal/newNotificationCallbacks.d.ts.map +1 -0
- package/dist/typescript/utils/internal/pushLogoutCallback.d.ts +8 -0
- package/dist/typescript/utils/internal/pushLogoutCallback.d.ts.map +1 -0
- package/dist/typescript/utils/push/android.d.ts +1 -1
- package/dist/typescript/utils/push/android.d.ts.map +1 -1
- package/dist/typescript/utils/push/ios.d.ts +4 -0
- package/dist/typescript/utils/push/ios.d.ts.map +1 -1
- package/dist/typescript/utils/push/libs.d.ts +6 -0
- package/dist/typescript/utils/push/libs.d.ts.map +1 -1
- package/dist/typescript/utils/push/rxSubjects.d.ts +9 -0
- package/dist/typescript/utils/push/rxSubjects.d.ts.map +1 -1
- package/dist/typescript/utils/push/utils.d.ts +9 -1
- package/dist/typescript/utils/push/utils.d.ts.map +1 -1
- package/dist/typescript/version.d.ts +1 -1
- package/expo-config-plugin/dist/index.d.ts +3 -2
- package/expo-config-plugin/dist/index.js +9 -5
- package/expo-config-plugin/dist/withPushAppDelegate.d.ts +4 -0
- package/expo-config-plugin/dist/withPushAppDelegate.js +119 -0
- package/expo-config-plugin/dist/withiOSInfoPlist.d.ts +2 -1
- package/expo-config-plugin/dist/withiOSInfoPlist.js +6 -1
- package/package.json +19 -3
- package/src/components/Call/CallControls/HangupCallButton.tsx +4 -4
- package/src/hooks/push/index.ts +4 -0
- package/src/hooks/push/useInitAndroidTokenAndRest.ts +8 -2
- package/src/hooks/push/useIosInitRemoteNotifications.ts +29 -0
- package/src/hooks/push/useIosVoipPushEventsSetupEffect.ts +50 -3
- package/src/hooks/push/useProcessPushNonRingingCallEffect.ts +44 -0
- package/src/utils/StreamVideoRN/index.ts +36 -0
- package/src/utils/StreamVideoRN/types.ts +47 -6
- package/src/utils/internal/newNotificationCallbacks.ts +29 -0
- package/src/utils/internal/pushLogoutCallback.ts +17 -0
- package/src/utils/push/android.ts +203 -74
- package/src/utils/push/ios.ts +120 -1
- package/src/utils/push/libs.ts +48 -2
- package/src/utils/push/rxSubjects.ts +9 -0
- package/src/utils/push/utils.ts +35 -1
- package/src/version.ts +1 -1
- /package/expo-config-plugin/dist/{withAppDelegate.d.ts → withStreamVideoReactNativeSDKAppDelegate.d.ts} +0 -0
- /package/expo-config-plugin/dist/{withAppDelegate.js → withStreamVideoReactNativeSDKAppDelegate.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInitAndroidTokenAndRest.d.ts","sourceRoot":"","sources":["../../../../src/hooks/push/useInitAndroidTokenAndRest.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,eAAO,MAAM,0BAA0B,
|
|
1
|
+
{"version":3,"file":"useInitAndroidTokenAndRest.d.ts","sourceRoot":"","sources":["../../../../src/hooks/push/useInitAndroidTokenAndRest.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,eAAO,MAAM,0BAA0B,YAiBtC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIosInitRemoteNotifications.d.ts","sourceRoot":"","sources":["../../../../src/hooks/push/useIosInitRemoteNotifications.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,eAAO,MAAM,6BAA6B,YAiBzC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIosVoipPushEventsSetupEffect.d.ts","sourceRoot":"","sources":["../../../../src/hooks/push/useIosVoipPushEventsSetupEffect.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useIosVoipPushEventsSetupEffect.d.ts","sourceRoot":"","sources":["../../../../src/hooks/push/useIosVoipPushEventsSetupEffect.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,eAAO,MAAM,+BAA+B,YA4E3C,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This hook is used to process the non ringing call data via push notifications using the relevant rxjs subject
|
|
3
|
+
* Note: this effect cannot work when push notifications are received when the app is in quit state or in other words when the client is not connected with a websocket.
|
|
4
|
+
* So we essentially run this effect only when the client is connected with a websocket.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useProcessPushNonRingingCallEffect: () => void;
|
|
7
|
+
//# sourceMappingURL=useProcessPushNonRingingCallEffect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useProcessPushNonRingingCallEffect.d.ts","sourceRoot":"","sources":["../../../../src/hooks/push/useProcessPushNonRingingCallEffect.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,eAAO,MAAM,kCAAkC,YAqB9C,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StreamVideoConfig } from './types';
|
|
2
|
+
import { NewCallNotificationCallback } from '../internal/newNotificationCallbacks';
|
|
2
3
|
export declare class StreamVideoRN {
|
|
3
4
|
private static config;
|
|
4
5
|
/**
|
|
@@ -24,5 +25,16 @@ export declare class StreamVideoRN {
|
|
|
24
25
|
*/
|
|
25
26
|
static setPushConfig(pushConfig: NonNullable<StreamVideoConfig['push']>): void;
|
|
26
27
|
static getConfig(): StreamVideoConfig;
|
|
28
|
+
/**
|
|
29
|
+
* This is the function to be called when the push token must be removed.
|
|
30
|
+
* Typically used on user logout.
|
|
31
|
+
*/
|
|
32
|
+
static onPushLogout(): void;
|
|
33
|
+
/**
|
|
34
|
+
* This function is used to add a callback to be called when a new call notification is received.
|
|
35
|
+
* @param callback
|
|
36
|
+
* @returns Unsubscribe function
|
|
37
|
+
*/
|
|
38
|
+
static addOnNewCallNotificationListener(callback: NewCallNotificationCallback): () => void;
|
|
27
39
|
}
|
|
28
40
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/StreamVideoRN/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/StreamVideoRN/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAiC,EAC/B,2BAA2B,EAC5B,MAAM,sCAAsC,CAAC;AAoB9C,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAC,MAAM,CAA+B;IAEpD;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;IAO1E;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,aAAa,CAAC,UAAU,EAAE,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAYvE,MAAM,CAAC,SAAS;IAIhB;;;OAGG;IACH,MAAM,CAAC,YAAY;IAMnB;;;;OAIG;IACH,MAAM,CAAC,gCAAgC,CACrC,QAAQ,EAAE,2BAA2B;CAYxC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { StreamVideoClient } from '@stream-io/video-client';
|
|
2
2
|
import { AndroidChannel } from '@notifee/react-native';
|
|
3
|
+
export type NonRingingPushEvent = 'call.live_started' | 'call.notification';
|
|
3
4
|
export type StreamVideoConfig = {
|
|
4
5
|
/**
|
|
5
6
|
* The configuration to be used for push notifications.
|
|
@@ -7,14 +8,32 @@ export type StreamVideoConfig = {
|
|
|
7
8
|
* @default undefined
|
|
8
9
|
*/
|
|
9
10
|
push?: {
|
|
11
|
+
isExpo?: boolean;
|
|
10
12
|
ios: {
|
|
11
13
|
/**
|
|
12
14
|
* The name for the alias of push provider used for iOS
|
|
15
|
+
* Pass undefined if you will not be using stream's push notifications but still want to use the functionality of the SDK
|
|
13
16
|
* @example "production-apn-video" or "staging-apn-video" based on the environment
|
|
14
17
|
*/
|
|
15
|
-
pushProviderName
|
|
18
|
+
pushProviderName?: string;
|
|
16
19
|
};
|
|
17
20
|
android: {
|
|
21
|
+
/**
|
|
22
|
+
* The name for the alias of push provider used for Android
|
|
23
|
+
* Pass undefined if you will not be using stream's push notifications but still want to use the functionality of the SDK
|
|
24
|
+
* @example "production-fcm-video" or "staging-fcm-video" based on the environment
|
|
25
|
+
*/
|
|
26
|
+
pushProviderName?: string;
|
|
27
|
+
/**
|
|
28
|
+
* The notification channel to be used for non ringing calls for Android.
|
|
29
|
+
* @example
|
|
30
|
+
* {
|
|
31
|
+
* id: 'stream_call_notifications',
|
|
32
|
+
* name: 'Call notifications',
|
|
33
|
+
* importance: AndroidImportance.HIGH
|
|
34
|
+
* }
|
|
35
|
+
*/
|
|
36
|
+
callChannel?: AndroidChannel;
|
|
18
37
|
/**
|
|
19
38
|
* The notification channel to be used for incoming calls for Android.
|
|
20
39
|
* @example
|
|
@@ -24,7 +43,7 @@ export type StreamVideoConfig = {
|
|
|
24
43
|
* importance: AndroidImportance.HIGH
|
|
25
44
|
* }
|
|
26
45
|
*/
|
|
27
|
-
incomingCallChannel
|
|
46
|
+
incomingCallChannel?: AndroidChannel;
|
|
28
47
|
/**
|
|
29
48
|
* Functions to create the texts shown in the notification for incoming calls in Android.
|
|
30
49
|
* @example
|
|
@@ -33,15 +52,28 @@ export type StreamVideoConfig = {
|
|
|
33
52
|
* body: (createdUserName: string) => `Tap to answer the call`
|
|
34
53
|
* }
|
|
35
54
|
*/
|
|
36
|
-
incomingCallNotificationTextGetters
|
|
55
|
+
incomingCallNotificationTextGetters?: {
|
|
37
56
|
getTitle: (createdUserName: string) => string;
|
|
38
57
|
getBody: (createdUserName: string) => string;
|
|
39
58
|
};
|
|
40
59
|
/**
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
60
|
+
* Functions to create the texts shown in the notification for non ringing calls in Android.
|
|
61
|
+
* @example
|
|
62
|
+
* getTitle(type, createdUserName) {
|
|
63
|
+
if (type === 'call.live_started') {
|
|
64
|
+
return `Call went live, it was started by ${createdUserName}`;
|
|
65
|
+
} else {
|
|
66
|
+
return `${createdUserName} is notifying you about a call`;
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
getBody(_type, createdUserName) {
|
|
70
|
+
return 'Tap to open the call';
|
|
71
|
+
},
|
|
43
72
|
*/
|
|
44
|
-
|
|
73
|
+
callNotificationTextGetters?: {
|
|
74
|
+
getTitle: (type: NonRingingPushEvent, createdUserName: string) => string;
|
|
75
|
+
getBody: (type: NonRingingPushEvent, createdUserName: string) => string;
|
|
76
|
+
};
|
|
45
77
|
};
|
|
46
78
|
/**
|
|
47
79
|
* This function is used to create a custom video client.
|
|
@@ -65,6 +97,8 @@ export type StreamVideoConfig = {
|
|
|
65
97
|
navigateAcceptCall: () => void;
|
|
66
98
|
/** The callback that is called when a push notification is tapped but user did not press accept or decline, used for navigation */
|
|
67
99
|
navigateToIncomingCall: () => void;
|
|
100
|
+
/** Callback that is called when a non ringing push notification was tapped */
|
|
101
|
+
onTapNonRingingCallNotification?: (call_cid: string, type: NonRingingPushEvent) => void;
|
|
68
102
|
};
|
|
69
103
|
foregroundService: {
|
|
70
104
|
android: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/utils/StreamVideoRN/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;OAIG;IACH,IAAI,CAAC,EAAE;QACL,GAAG,EAAE;YACH
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/utils/StreamVideoRN/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,MAAM,mBAAmB,GAAG,mBAAmB,GAAG,mBAAmB,CAAC;AAE5E,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;OAIG;IACH,IAAI,CAAC,EAAE;QACL,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,GAAG,EAAE;YACH;;;;eAIG;YACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;SAC3B,CAAC;QACF,OAAO,EAAE;YACP;;;;eAIG;YACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;YAC1B;;;;;;;;eAQG;YACH,WAAW,CAAC,EAAE,cAAc,CAAC;YAC7B;;;;;;;;eAQG;YACH,mBAAmB,CAAC,EAAE,cAAc,CAAC;YACrC;;;;;;;eAOG;YACH,mCAAmC,CAAC,EAAE;gBACpC,QAAQ,EAAE,CAAC,eAAe,EAAE,MAAM,KAAK,MAAM,CAAC;gBAC9C,OAAO,EAAE,CAAC,eAAe,EAAE,MAAM,KAAK,MAAM,CAAC;aAC9C,CAAC;YACF;;;;;;;;;;;;;eAaG;YACH,2BAA2B,CAAC,EAAE;gBAC5B,QAAQ,EAAE,CACR,IAAI,EAAE,mBAAmB,EACzB,eAAe,EAAE,MAAM,KACpB,MAAM,CAAC;gBACZ,OAAO,EAAE,CAAC,IAAI,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,KAAK,MAAM,CAAC;aACzE,CAAC;SACH,CAAC;QACF;;;;;;;;;;;;;;;;WAgBG;QACH,uBAAuB,EAAE,MAAM,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAAC;QACtE,+EAA+E;QAC/E,kBAAkB,EAAE,MAAM,IAAI,CAAC;QAC/B,mIAAmI;QACnI,sBAAsB,EAAE,MAAM,IAAI,CAAC;QACnC,8EAA8E;QAC9E,+BAA+B,CAAC,EAAE,CAChC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,mBAAmB,KACtB,IAAI,CAAC;KACX,CAAC;IACF,iBAAiB,EAAE;QACjB,OAAO,EAAE;YACP;;eAEG;YACH,OAAO,EAAE,cAAc,CAAC;YACxB;;eAEG;YACH,iBAAiB,EAAE;gBACjB,KAAK,EAAE,MAAM,CAAC;gBACd,IAAI,EAAE,MAAM,CAAC;aACd,CAAC;SACH,CAAC;KACH,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Call } from '@stream-io/video-client';
|
|
2
|
+
import { NonRingingPushEvent } from '../StreamVideoRN/types';
|
|
3
|
+
export type NewCallNotificationCallback = (call: Call, notificationType: NonRingingPushEvent) => void;
|
|
4
|
+
type NewNotificationCallbacks = {
|
|
5
|
+
current?: NewCallNotificationCallback[];
|
|
6
|
+
};
|
|
7
|
+
declare const newNotificationCallbacks: NewNotificationCallbacks;
|
|
8
|
+
export declare const onNewCallNotification: NewCallNotificationCallback;
|
|
9
|
+
export default newNotificationCallbacks;
|
|
10
|
+
//# sourceMappingURL=newNotificationCallbacks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"newNotificationCallbacks.d.ts","sourceRoot":"","sources":["../../../../src/utils/internal/newNotificationCallbacks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,MAAM,MAAM,2BAA2B,GAAG,CACxC,IAAI,EAAE,IAAI,EACV,gBAAgB,EAAE,mBAAmB,KAClC,IAAI,CAAC;AAEV,KAAK,wBAAwB,GAAG;IAC9B,OAAO,CAAC,EAAE,2BAA2B,EAAE,CAAC;CACzC,CAAC;AAIF,QAAA,MAAM,wBAAwB,EAAE,wBAA6B,CAAC;AAE9D,eAAO,MAAM,qBAAqB,EAAE,2BAUnC,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type Callback = () => void;
|
|
2
|
+
type PushLogoutCallbacks = {
|
|
3
|
+
current?: Callback[];
|
|
4
|
+
};
|
|
5
|
+
declare let pushLogoutCallbacks: PushLogoutCallbacks;
|
|
6
|
+
export declare const setPushLogoutCallback: (callback: () => void) => void;
|
|
7
|
+
export default pushLogoutCallbacks;
|
|
8
|
+
//# sourceMappingURL=pushLogoutCallback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pushLogoutCallback.d.ts","sourceRoot":"","sources":["../../../../src/utils/internal/pushLogoutCallback.ts"],"names":[],"mappings":"AAAA,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAC;AAE3B,KAAK,mBAAmB,GAAG;IACzB,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;CACtB,CAAC;AAEF,QAAA,IAAI,mBAAmB,EAAE,mBAAwB,CAAC;AAElD,eAAO,MAAM,qBAAqB,aAAc,MAAM,IAAI,SAMzD,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -4,6 +4,6 @@ type PushConfig = NonNullable<StreamVideoConfig['push']>;
|
|
|
4
4
|
/** Setup Firebase push message handler **/
|
|
5
5
|
export declare function setupFirebaseHandlerAndroid(pushConfig: PushConfig): void;
|
|
6
6
|
/** Send token to stream, create notification channel, */
|
|
7
|
-
export declare function initAndroidPushToken(client: StreamVideoClient, pushConfig: PushConfig): Promise<void>;
|
|
7
|
+
export declare function initAndroidPushToken(client: StreamVideoClient, pushConfig: PushConfig, setUnsubscribeListener: (unsubscribe: () => void) => void): Promise<void>;
|
|
8
8
|
export {};
|
|
9
9
|
//# sourceMappingURL=android.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"android.d.ts","sourceRoot":"","sources":["../../../../src/utils/push/android.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"android.d.ts","sourceRoot":"","sources":["../../../../src/utils/push/android.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAkBhC,KAAK,UAAU,GAAG,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;AAEzD,2CAA2C;AAC3C,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,UAAU,QA2DjE;AAED,0DAA0D;AAC1D,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,iBAAiB,EACzB,UAAU,EAAE,UAAU,EACtB,sBAAsB,EAAE,CAAC,WAAW,EAAE,MAAM,IAAI,KAAK,IAAI,iBAmC1D"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { StreamVideoConfig } from '../StreamVideoRN/types';
|
|
2
|
+
import { StreamVideoClient } from '@stream-io/video-client';
|
|
2
3
|
type PushConfig = NonNullable<StreamVideoConfig['push']>;
|
|
3
4
|
export declare const iosCallkeepAcceptCall: (call_cid: string | undefined, callUUIDFromCallkeep: string) => void;
|
|
4
5
|
export declare const iosCallkeepRejectCall: (call_cid: string | undefined, callUUIDFromCallkeep: string, pushConfig: PushConfig) => Promise<void>;
|
|
6
|
+
export declare const setupRemoteNotificationsHandleriOS: (pushConfig: PushConfig) => void;
|
|
7
|
+
/** Send token to stream */
|
|
8
|
+
export declare function initIosNonVoipToken(client: StreamVideoClient, pushConfig: PushConfig, setUnsubscribeListener: (unsubscribe: () => void) => void): Promise<void>;
|
|
5
9
|
export {};
|
|
6
10
|
//# sourceMappingURL=ios.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ios.d.ts","sourceRoot":"","sources":["../../../../src/utils/push/ios.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ios.d.ts","sourceRoot":"","sources":["../../../../src/utils/push/ios.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAUhC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAI5D,KAAK,UAAU,GAAG,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;AAwBzD,eAAO,MAAM,qBAAqB,aACtB,MAAM,GAAG,SAAS,wBACN,MAAM,SAc7B,CAAC;AAEF,eAAO,MAAM,qBAAqB,aACtB,MAAM,GAAG,SAAS,wBACN,MAAM,cAChB,UAAU,kBAUvB,CAAC;AAgBF,eAAO,MAAM,kCAAkC,eAAgB,UAAU,SA6BxE,CAAC;AAEF,2BAA2B;AAC3B,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,iBAAiB,EACzB,UAAU,EAAE,UAAU,EACtB,sBAAsB,EAAE,CAAC,WAAW,EAAE,MAAM,IAAI,KAAK,IAAI,iBAmD1D"}
|
|
@@ -4,6 +4,12 @@ export type { FirebaseMessagingTypes } from '@react-native-firebase/messaging';
|
|
|
4
4
|
export type RNCallKeepType = typeof import('react-native-callkeep').default;
|
|
5
5
|
export type FirebaseMessagingType = typeof import('@react-native-firebase/messaging').default;
|
|
6
6
|
export type VoipPushNotificationType = typeof import('react-native-voip-push-notification').default;
|
|
7
|
+
export type ExpoNotificationsLib = typeof import('expo-notifications');
|
|
8
|
+
export type ExpoTaskManagerLib = typeof import('expo-task-manager');
|
|
9
|
+
export type PushNotificationIosLib = typeof import('@react-native-community/push-notification-ios').default;
|
|
10
|
+
export declare function getExpoNotificationsLib(): typeof import("expo-notifications");
|
|
11
|
+
export declare function getExpoTaskManagerLib(): typeof import("expo-task-manager");
|
|
12
|
+
export declare function getPushNotificationIosLib(): import("@react-native-community/push-notification-ios").PushNotificationIOSStatic;
|
|
7
13
|
export declare function getCallKeepLib(): typeof import("react-native-callkeep").default;
|
|
8
14
|
export declare function getFirebaseMessagingLib(): import("@react-native-firebase/app").ReactNativeFirebase.FirebaseModuleWithStatics<import("@react-native-firebase/messaging").FirebaseMessagingTypes.Module, import("@react-native-firebase/messaging").FirebaseMessagingTypes.Statics>;
|
|
9
15
|
export declare function getVoipPushNotificationLib(): typeof import("react-native-voip-push-notification").default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libs.d.ts","sourceRoot":"","sources":["../../../../src/utils/push/libs.ts"],"names":[],"mappings":";;AAAA,YAAY,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"libs.d.ts","sourceRoot":"","sources":["../../../../src/utils/push/libs.ts"],"names":[],"mappings":";;AAAA,YAAY,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC/E,MAAM,MAAM,cAAc,GAAG,cAAc,uBAAuB,EAAE,OAAO,CAAC;AAC5E,MAAM,MAAM,qBAAqB,GAC/B,cAAc,kCAAkC,EAAE,OAAO,CAAC;AAC5D,MAAM,MAAM,wBAAwB,GAClC,cAAc,qCAAqC,EAAE,OAAO,CAAC;AAC/D,MAAM,MAAM,oBAAoB,GAAG,cAAc,oBAAoB,CAAC,CAAC;AACvE,MAAM,MAAM,kBAAkB,GAAG,cAAc,mBAAmB,CAAC,CAAC;AACpE,MAAM,MAAM,sBAAsB,GAChC,cAAc,+CAA+C,EAAE,OAAO,CAAC;AAkCzE,wBAAgB,uBAAuB,wCAOtC;AAED,wBAAgB,qBAAqB,uCAOpC;AAED,wBAAgB,yBAAyB,sFAOxC;AAED,wBAAgB,cAAc,mDAO7B;AAED,wBAAgB,uBAAuB,4OAOtC;AAED,wBAAgB,0BAA0B,iEAOzC"}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { BehaviorSubject } from 'rxjs';
|
|
2
|
+
import { NonRingingPushEvent } from '../StreamVideoRN/types';
|
|
3
|
+
/**
|
|
4
|
+
* This rxjs subject is used to store the call cid of the accepted incoming call from push notification
|
|
5
|
+
* Note: it is should be subscribed only when a user has connected to the websocket of Stream
|
|
6
|
+
*/
|
|
7
|
+
export declare const pushNonRingingCallData$: BehaviorSubject<{
|
|
8
|
+
cid: string;
|
|
9
|
+
type: NonRingingPushEvent;
|
|
10
|
+
} | undefined>;
|
|
2
11
|
/**
|
|
3
12
|
* This rxjs subject is used to store the call cid of the accepted incoming call from push notification
|
|
4
13
|
* Note: it is should be subscribed only when a user has connected to the websocket of Stream
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rxSubjects.d.ts","sourceRoot":"","sources":["../../../../src/utils/push/rxSubjects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"rxSubjects.d.ts","sourceRoot":"","sources":["../../../../src/utils/push/rxSubjects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D;;;GAGG;AACH,eAAO,MAAM,uBAAuB;SAC3B,MAAM;UAAQ,mBAAmB;cAC9B,CAAC;AAEb;;;GAGG;AACH,eAAO,MAAM,4BAA4B,qCAE7B,CAAC;AAEb;;;GAGG;AACH,eAAO,MAAM,0BAA0B,qCAE3B,CAAC;AAEb;;;GAGG;AACH,eAAO,MAAM,4BAA4B,qCAE7B,CAAC;AAEb;;GAEG;AACH,eAAO,MAAM,4BAA4B,qCAE7B,CAAC;AAEb,sFAAsF;AACtF,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAOF,eAAO,MAAM,gCAAgC,0CAEjC,CAAC;AAKb,eAAO,MAAM,0CAA0C,0CAE3C,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StreamVideoClient } from '@stream-io/video-client';
|
|
2
|
-
import type { StreamVideoConfig } from '../StreamVideoRN/types';
|
|
2
|
+
import type { NonRingingPushEvent, StreamVideoConfig } from '../StreamVideoRN/types';
|
|
3
3
|
type PushConfig = NonNullable<StreamVideoConfig['push']>;
|
|
4
4
|
export declare const processCallFromPushInBackground: (pushConfig: PushConfig, call_cid: string, action: Parameters<typeof processCallFromPush>[2]) => Promise<void>;
|
|
5
5
|
/**
|
|
@@ -10,5 +10,13 @@ export declare const processCallFromPushInBackground: (pushConfig: PushConfig, c
|
|
|
10
10
|
* 3. Join or leave the call based on the user's action.
|
|
11
11
|
*/
|
|
12
12
|
export declare const processCallFromPush: (client: StreamVideoClient, call_cid: string, action: 'accept' | 'decline' | 'pressed') => Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* This function is used process the call from push notifications due to non ringing calls
|
|
15
|
+
* It does the following steps:
|
|
16
|
+
* 1. Get the call from the client if present or create a new call
|
|
17
|
+
* 2. Fetch the latest state of the call from the server if its not already in ringing state
|
|
18
|
+
* 3. Call all the callbacks to inform the app about the call
|
|
19
|
+
*/
|
|
20
|
+
export declare const processNonIncomingCallFromPush: (client: StreamVideoClient, call_cid: string, nonRingingNotificationType: NonRingingPushEvent) => Promise<void>;
|
|
13
21
|
export {};
|
|
14
22
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/utils/push/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/utils/push/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAGhC,KAAK,UAAU,GAAG,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;AAMzD,eAAO,MAAM,+BAA+B,eAC9B,UAAU,YACZ,MAAM,UACR,WAAW,0BAA0B,CAAC,CAAC,CAAC,CAAC,kBAclD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,WACtB,iBAAiB,YACf,MAAM,UACR,QAAQ,GAAG,SAAS,GAAG,SAAS,kBAmBzC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,WACjC,iBAAiB,YACf,MAAM,8BACY,mBAAmB,kBAkBhD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "0.1.
|
|
1
|
+
export declare const version = "0.1.4";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { ConfigProps } from './common/types';
|
|
3
|
+
declare const _default: ConfigPlugin<ConfigProps>;
|
|
4
|
+
export default _default;
|
|
@@ -4,18 +4,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const config_plugins_1 = require("@expo/config-plugins");
|
|
7
|
-
const
|
|
7
|
+
const withStreamVideoReactNativeSDKAppDelegate_1 = __importDefault(require("./withStreamVideoReactNativeSDKAppDelegate"));
|
|
8
|
+
const withPushAppDelegate_1 = __importDefault(require("./withPushAppDelegate"));
|
|
8
9
|
const withMainApplication_1 = __importDefault(require("./withMainApplication"));
|
|
9
10
|
const withAndroidPermissions_1 = __importDefault(require("./withAndroidPermissions"));
|
|
10
11
|
const withAndroidManifest_1 = __importDefault(require("./withAndroidManifest"));
|
|
11
12
|
const withiOSInfoPlist_1 = __importDefault(require("./withiOSInfoPlist"));
|
|
12
|
-
|
|
13
|
+
// path should be relative to dist
|
|
14
|
+
const pkg = require('../../package.json');
|
|
15
|
+
const withStreamVideoReactNativeSDK = (config, props) => {
|
|
13
16
|
return (0, config_plugins_1.withPlugins)(config, [
|
|
14
|
-
|
|
17
|
+
() => (0, withPushAppDelegate_1.default)(config, props),
|
|
18
|
+
withStreamVideoReactNativeSDKAppDelegate_1.default,
|
|
15
19
|
withMainApplication_1.default,
|
|
16
20
|
withAndroidPermissions_1.default,
|
|
17
21
|
withAndroidManifest_1.default,
|
|
18
|
-
withiOSInfoPlist_1.default,
|
|
22
|
+
() => (0, withiOSInfoPlist_1.default)(config, props),
|
|
19
23
|
]);
|
|
20
24
|
};
|
|
21
|
-
exports.default = withStreamVideoReactNativeSDK;
|
|
25
|
+
exports.default = (0, config_plugins_1.createRunOncePlugin)(withStreamVideoReactNativeSDK, pkg.name, pkg.version);
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
7
|
+
const codeMod_1 = require("@expo/config-plugins/build/ios/codeMod");
|
|
8
|
+
const addNewLinesToAppDelegate_1 = __importDefault(require("./common/addNewLinesToAppDelegate"));
|
|
9
|
+
const DID_FINISH_LAUNCHING_WITH_OPTIONS = 'application:didFinishLaunchingWithOptions:';
|
|
10
|
+
const DID_UPDATE_PUSH_CREDENTIALS = 'pushRegistry:didUpdatePushCredentials:forType:';
|
|
11
|
+
const DID_RECEIVE_INCOMING_PUSH = 'pushRegistry:didReceiveIncomingPushWithPayload:forType:withCompletionHandler:';
|
|
12
|
+
const withPushAppDelegate = (configuration, props) => {
|
|
13
|
+
return (0, config_plugins_1.withAppDelegate)(configuration, (config) => {
|
|
14
|
+
if (!props.ringingPushNotifications) {
|
|
15
|
+
// user doesnt want to use ringing push notifications, so quit early
|
|
16
|
+
return config;
|
|
17
|
+
}
|
|
18
|
+
if (['objc', 'objcpp'].includes(config.modResults.language)) {
|
|
19
|
+
try {
|
|
20
|
+
// all the imports that are needed
|
|
21
|
+
config.modResults.contents = (0, codeMod_1.addObjcImports)(config.modResults.contents, [
|
|
22
|
+
'"RNCallKeep.h"',
|
|
23
|
+
'<PushKit/PushKit.h>',
|
|
24
|
+
'"RNVoipPushNotificationManager.h"',
|
|
25
|
+
]);
|
|
26
|
+
config.modResults.contents = addDidFinishLaunchingWithOptions(config.modResults.contents, props.ringingPushNotifications);
|
|
27
|
+
config.modResults.contents = addDidUpdatePushCredentials(config.modResults.contents);
|
|
28
|
+
config.modResults.contents = addDidReceiveIncomingPushCallback(config.modResults.contents);
|
|
29
|
+
return config;
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
throw new Error('Cannot setup StreamVideoReactNativeSDK because the AppDelegate is malformed');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
throw new Error('Cannot setup StreamVideoReactNativeSDK because the language is not supported');
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
function addDidFinishLaunchingWithOptions(contents, ringingPushNotifications) {
|
|
41
|
+
// call the setup RNCallKeep
|
|
42
|
+
const supportsVideoString = ringingPushNotifications.disableVideoIos
|
|
43
|
+
? '@NO'
|
|
44
|
+
: '@YES';
|
|
45
|
+
const includesCallsInRecents = ringingPushNotifications.includesCallsInRecentsIos ? '@YES' : '@NO';
|
|
46
|
+
const setupCallKeep = `NSString *localizedAppName = [[[NSBundle mainBundle] localizedInfoDictionary] objectForKey:@"CFBundleDisplayName"];
|
|
47
|
+
NSString *appName = [[[NSBundle mainBundle] infoDictionary]objectForKey :@"CFBundleDisplayName"];
|
|
48
|
+
[RNCallKeep setup:@{
|
|
49
|
+
@"appName": localizedAppName != nil ? localizedAppName : appName,
|
|
50
|
+
@"supportsVideo": ${supportsVideoString},
|
|
51
|
+
@"includesCallsInRecents": ${includesCallsInRecents},
|
|
52
|
+
}];`;
|
|
53
|
+
if (!contents.includes('[RNCallKeep setup:@')) {
|
|
54
|
+
contents = (0, codeMod_1.insertContentsInsideObjcFunctionBlock)(contents, DID_FINISH_LAUNCHING_WITH_OPTIONS, setupCallKeep, { position: 'head' });
|
|
55
|
+
}
|
|
56
|
+
// call the setup of voip push notification
|
|
57
|
+
const voipSetupMethod = '[RNVoipPushNotificationManager voipRegistration];';
|
|
58
|
+
if (!contents.includes(voipSetupMethod)) {
|
|
59
|
+
contents = (0, codeMod_1.insertContentsInsideObjcFunctionBlock)(contents, DID_FINISH_LAUNCHING_WITH_OPTIONS, voipSetupMethod, { position: 'head' });
|
|
60
|
+
}
|
|
61
|
+
return contents;
|
|
62
|
+
}
|
|
63
|
+
function addDidUpdatePushCredentials(contents) {
|
|
64
|
+
const updatedPushCredentialsMethod = '[RNVoipPushNotificationManager didUpdatePushCredentials:credentials forType:(NSString *)type];';
|
|
65
|
+
if (!contents.includes(updatedPushCredentialsMethod)) {
|
|
66
|
+
const codeblock = (0, codeMod_1.findObjcFunctionCodeBlock)(contents, DID_UPDATE_PUSH_CREDENTIALS);
|
|
67
|
+
if (!codeblock) {
|
|
68
|
+
return (0, addNewLinesToAppDelegate_1.default)(contents, [
|
|
69
|
+
'- (void)pushRegistry:(PKPushRegistry *)registry didUpdatePushCredentials:(PKPushCredentials *)credentials forType:(PKPushType)type {',
|
|
70
|
+
' ' /* indentation */ + updatedPushCredentialsMethod,
|
|
71
|
+
'}',
|
|
72
|
+
]);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
return (0, codeMod_1.insertContentsInsideObjcFunctionBlock)(contents, DID_UPDATE_PUSH_CREDENTIALS, updatedPushCredentialsMethod, { position: 'tail' });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return contents;
|
|
79
|
+
}
|
|
80
|
+
function addDidReceiveIncomingPushCallback(contents) {
|
|
81
|
+
const onIncomingPush = `
|
|
82
|
+
// send event to JS
|
|
83
|
+
[RNVoipPushNotificationManager didReceiveIncomingPushWithPayload:payload forType:(NSString *)type];
|
|
84
|
+
|
|
85
|
+
// process the payload
|
|
86
|
+
NSDictionary *stream = payload.dictionaryPayload[@"stream"];
|
|
87
|
+
NSString *uuid = [[NSUUID UUID] UUIDString];
|
|
88
|
+
NSString *createdCallerName = stream[@"created_by_display_name"];
|
|
89
|
+
|
|
90
|
+
// display the incoming call notification
|
|
91
|
+
[RNCallKeep reportNewIncomingCall: uuid
|
|
92
|
+
handle: createdCallerName
|
|
93
|
+
handleType: @"generic"
|
|
94
|
+
hasVideo: YES
|
|
95
|
+
localizedCallerName: createdCallerName
|
|
96
|
+
supportsHolding: YES
|
|
97
|
+
supportsDTMF: YES
|
|
98
|
+
supportsGrouping: YES
|
|
99
|
+
supportsUngrouping: YES
|
|
100
|
+
fromPushKit: YES
|
|
101
|
+
payload: stream
|
|
102
|
+
withCompletionHandler: completion];
|
|
103
|
+
`;
|
|
104
|
+
if (!contents.includes('[RNVoipPushNotificationManager didReceiveIncomingPushWithPayload')) {
|
|
105
|
+
const codeblock = (0, codeMod_1.findObjcFunctionCodeBlock)(contents, DID_RECEIVE_INCOMING_PUSH);
|
|
106
|
+
if (!codeblock) {
|
|
107
|
+
return (0, addNewLinesToAppDelegate_1.default)(contents, [
|
|
108
|
+
'- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void (^)(void))completion {',
|
|
109
|
+
...onIncomingPush.trim().split('\n'),
|
|
110
|
+
'}',
|
|
111
|
+
]);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
return (0, codeMod_1.insertContentsInsideObjcFunctionBlock)(contents, DID_RECEIVE_INCOMING_PUSH, onIncomingPush, { position: 'tail' });
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return contents;
|
|
118
|
+
}
|
|
119
|
+
exports.default = withPushAppDelegate;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
-
|
|
2
|
+
import { ConfigProps } from './common/types';
|
|
3
|
+
declare const withStreamVideoReactNativeSDKiOSInfoPList: ConfigPlugin<ConfigProps>;
|
|
3
4
|
export default withStreamVideoReactNativeSDKiOSInfoPList;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const config_plugins_1 = require("@expo/config-plugins");
|
|
4
|
-
const withStreamVideoReactNativeSDKiOSInfoPList = (configuration) => {
|
|
4
|
+
const withStreamVideoReactNativeSDKiOSInfoPList = (configuration, props) => {
|
|
5
5
|
return (0, config_plugins_1.withInfoPlist)(configuration, (config) => {
|
|
6
6
|
if (!Array.isArray(config.modResults.UIBackgroundModes)) {
|
|
7
7
|
config.modResults.UIBackgroundModes = [];
|
|
@@ -9,6 +9,11 @@ const withStreamVideoReactNativeSDKiOSInfoPList = (configuration) => {
|
|
|
9
9
|
if (!config.modResults.UIBackgroundModes.includes('audio')) {
|
|
10
10
|
config.modResults.UIBackgroundModes.push('audio');
|
|
11
11
|
}
|
|
12
|
+
if (props.enableNonRingingPushNotifications) {
|
|
13
|
+
if (!config.modResults.UIBackgroundModes.includes('remote-notification')) {
|
|
14
|
+
config.modResults.UIBackgroundModes.push('remote-notification');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
12
17
|
return config;
|
|
13
18
|
});
|
|
14
19
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stream-io/video-react-native-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"packageManager": "yarn@3.2.4",
|
|
5
5
|
"main": "dist/commonjs/index.js",
|
|
6
6
|
"module": "dist/module/index.js",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@stream-io/i18n": "^0.1.2",
|
|
49
|
-
"@stream-io/video-client": "^0.3.
|
|
50
|
-
"@stream-io/video-react-bindings": "^0.2.
|
|
49
|
+
"@stream-io/video-client": "^0.3.31",
|
|
50
|
+
"@stream-io/video-react-bindings": "^0.2.32",
|
|
51
51
|
"intl-pluralrules": "2.0.1",
|
|
52
52
|
"lodash.merge": "^4.6.2",
|
|
53
53
|
"react-native-url-polyfill": "1.3.0",
|
|
@@ -56,9 +56,12 @@
|
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"@notifee/react-native": ">=7.8.0",
|
|
58
58
|
"@react-native-community/netinfo": ">=9.0.0",
|
|
59
|
+
"@react-native-community/push-notification-ios": ">=1.11.0",
|
|
59
60
|
"@react-native-firebase/app": ">=17.5.0",
|
|
60
61
|
"@react-native-firebase/messaging": ">=17.5.0",
|
|
61
62
|
"@stream-io/react-native-webrtc": ">=104.0.1",
|
|
63
|
+
"expo-notifications": "*",
|
|
64
|
+
"expo-task-manager": "*",
|
|
62
65
|
"react": ">=17.0.0",
|
|
63
66
|
"react-native": ">=0.67.0",
|
|
64
67
|
"react-native-callkeep": ">=4.3.11",
|
|
@@ -69,12 +72,21 @@
|
|
|
69
72
|
"react-native-voip-push-notification": ">=3.3.1"
|
|
70
73
|
},
|
|
71
74
|
"peerDependenciesMeta": {
|
|
75
|
+
"@react-native-community/push-notification-ios": {
|
|
76
|
+
"optional": true
|
|
77
|
+
},
|
|
72
78
|
"@react-native-firebase/app": {
|
|
73
79
|
"optional": true
|
|
74
80
|
},
|
|
75
81
|
"@react-native-firebase/messaging": {
|
|
76
82
|
"optional": true
|
|
77
83
|
},
|
|
84
|
+
"expo-notifications": {
|
|
85
|
+
"optional": true
|
|
86
|
+
},
|
|
87
|
+
"expo-task-manager": {
|
|
88
|
+
"optional": true
|
|
89
|
+
},
|
|
78
90
|
"react-native-callkeep": {
|
|
79
91
|
"optional": true
|
|
80
92
|
},
|
|
@@ -94,6 +106,7 @@
|
|
|
94
106
|
"@notifee/react-native": "7.8.0",
|
|
95
107
|
"@react-native-community/eslint-config": "^3.2.0",
|
|
96
108
|
"@react-native-community/netinfo": "9.3.9",
|
|
109
|
+
"@react-native-community/push-notification-ios": "1.11.0",
|
|
97
110
|
"@react-native-firebase/app": "17.5.0",
|
|
98
111
|
"@react-native-firebase/messaging": "17.5.0",
|
|
99
112
|
"@stream-io/react-native-webrtc": "104.0.1",
|
|
@@ -106,6 +119,9 @@
|
|
|
106
119
|
"@types/react-native": "^0.70.4",
|
|
107
120
|
"@types/react-native-incall-manager": "^3.2.1",
|
|
108
121
|
"@types/react-test-renderer": "^18",
|
|
122
|
+
"expo-modules-core": "1.5.11",
|
|
123
|
+
"expo-notifications": "0.20.1",
|
|
124
|
+
"expo-task-manager": "11.3.0",
|
|
109
125
|
"jest": "^29.5.0",
|
|
110
126
|
"react-native": "0.71.8",
|
|
111
127
|
"react-native-builder-bob": "^0.21.3",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { CallControlsButton } from './CallControlsButton';
|
|
3
3
|
import { PhoneDown } from '../../../icons';
|
|
4
4
|
import { ButtonTestIds } from '../../../constants/TestIds';
|
|
@@ -38,7 +38,8 @@ export const HangUpCallButton = ({
|
|
|
38
38
|
const {
|
|
39
39
|
theme: { colors, hangupCallButton },
|
|
40
40
|
} = useTheme();
|
|
41
|
-
|
|
41
|
+
|
|
42
|
+
const onPress = async () => {
|
|
42
43
|
if (onPressHandler) {
|
|
43
44
|
onPressHandler();
|
|
44
45
|
return;
|
|
@@ -54,8 +55,7 @@ export const HangUpCallButton = ({
|
|
|
54
55
|
} catch (error) {
|
|
55
56
|
console.error('Error leaving call:', error);
|
|
56
57
|
}
|
|
57
|
-
|
|
58
|
-
}, [call]);
|
|
58
|
+
};
|
|
59
59
|
|
|
60
60
|
return (
|
|
61
61
|
<CallControlsButton
|
package/src/hooks/push/index.ts
CHANGED
|
@@ -2,14 +2,18 @@ import { useIosCallKeepEventsSetupEffect } from './useIosCallKeepEventsSetupEffe
|
|
|
2
2
|
import { useIosVoipPushEventsSetupEffect } from './useIosVoipPushEventsSetupEffect';
|
|
3
3
|
import { useProcessPushCallEffect } from './useProcessPushCallEffect';
|
|
4
4
|
import { useInitAndroidTokenAndRest } from './useInitAndroidTokenAndRest';
|
|
5
|
+
import { useIosInitRemoteNotifications } from './useIosInitRemoteNotifications';
|
|
6
|
+
import { useProcessPushNonRingingCallEffect } from './useProcessPushNonRingingCallEffect';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* This hook is used to do the initial setup for push notifications.
|
|
8
10
|
* It must be used in a component which is a child of StreamVideo from bindings
|
|
9
11
|
*/
|
|
10
12
|
export const usePushRegisterEffect = () => {
|
|
13
|
+
useIosInitRemoteNotifications();
|
|
11
14
|
useIosCallKeepEventsSetupEffect();
|
|
12
15
|
useIosVoipPushEventsSetupEffect();
|
|
16
|
+
useProcessPushNonRingingCallEffect();
|
|
13
17
|
useProcessPushCallEffect();
|
|
14
18
|
useInitAndroidTokenAndRest();
|
|
15
19
|
};
|