@stream-io/video-react-native-sdk 0.0.1-alpha.197 → 0.0.1-alpha.199
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 +13 -0
- package/dist/src/hooks/push/index.js +4 -4
- package/dist/src/hooks/push/index.js.map +1 -1
- package/dist/src/hooks/push/useInitAndroidTokenAndRest.js +2 -2
- package/dist/src/hooks/push/useInitAndroidTokenAndRest.js.map +1 -1
- package/dist/src/hooks/push/{useIosCallKeepEffect.d.ts → useIosCallKeepEventsSetupEffect.d.ts} +1 -1
- package/dist/src/hooks/push/useIosCallKeepEventsSetupEffect.js +36 -0
- package/dist/src/hooks/push/useIosCallKeepEventsSetupEffect.js.map +1 -0
- package/dist/src/hooks/push/{useIosPushEffect.d.ts → useIosVoipPushEventsSetupEffect.d.ts} +1 -1
- package/dist/src/hooks/push/{useIosPushEffect.js → useIosVoipPushEventsSetupEffect.js} +36 -20
- package/dist/src/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -0
- package/dist/src/hooks/push/useProcessPushCallEffect.d.ts +2 -1
- package/dist/src/hooks/push/useProcessPushCallEffect.js +2 -1
- package/dist/src/hooks/push/useProcessPushCallEffect.js.map +1 -1
- package/dist/src/hooks/useAndroidKeepCallAliveEffect.js +9 -0
- package/dist/src/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
- package/dist/src/hooks/useIosCallkeepEndEffect.d.ts +4 -0
- package/dist/src/hooks/useIosCallkeepEndEffect.js +52 -0
- package/dist/src/hooks/useIosCallkeepEndEffect.js.map +1 -0
- package/dist/src/providers/StreamCall.js +12 -2
- package/dist/src/providers/StreamCall.js.map +1 -1
- package/dist/src/utils/StreamVideoRN/index.js +3 -4
- package/dist/src/utils/StreamVideoRN/index.js.map +1 -1
- package/dist/src/utils/StreamVideoRN/types.d.ts +0 -11
- package/dist/src/utils/push/android.d.ts +8 -0
- package/dist/src/utils/push/android.js +155 -0
- package/dist/src/utils/push/android.js.map +1 -0
- package/dist/src/utils/push/ios.d.ts +5 -0
- package/dist/src/utils/push/ios.js +40 -0
- package/dist/src/utils/push/ios.js.map +1 -0
- package/dist/src/utils/push/rxSubjects.d.ts +12 -0
- package/dist/src/utils/push/rxSubjects.js +13 -1
- package/dist/src/utils/push/rxSubjects.js.map +1 -1
- package/dist/src/utils/push/utils.d.ts +1 -5
- package/dist/src/utils/push/utils.js +16 -208
- package/dist/src/utils/push/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/hooks/push/index.ts +4 -4
- package/src/hooks/push/useInitAndroidTokenAndRest.ts +1 -1
- package/src/hooks/push/useIosCallKeepEventsSetupEffect.ts +37 -0
- package/src/hooks/push/{useIosPushEffect.ts → useIosVoipPushEventsSetupEffect.ts} +36 -20
- package/src/hooks/push/useProcessPushCallEffect.ts +2 -1
- package/src/hooks/useAndroidKeepCallAliveEffect.ts +10 -0
- package/src/hooks/useIosCallkeepEndEffect.ts +53 -0
- package/src/providers/StreamCall.tsx +13 -2
- package/src/utils/StreamVideoRN/index.ts +2 -3
- package/src/utils/StreamVideoRN/types.ts +0 -11
- package/src/utils/push/android.ts +154 -0
- package/src/utils/push/ios.ts +55 -0
- package/src/utils/push/rxSubjects.ts +15 -0
- package/src/utils/push/utils.ts +15 -208
- package/dist/src/hooks/push/useIosCallKeepEffect.js +0 -80
- package/dist/src/hooks/push/useIosCallKeepEffect.js.map +0 -1
- package/dist/src/hooks/push/useIosPushEffect.js.map +0 -1
- package/src/hooks/push/useIosCallKeepEffect.ts +0 -103
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.0.1-alpha.199](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-0.0.1-alpha.198...@stream-io/video-react-native-sdk-0.0.1-alpha.199) (2023-06-22)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## [0.0.1-alpha.198](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-0.0.1-alpha.197...@stream-io/video-react-native-sdk-0.0.1-alpha.198) (2023-06-22)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* **react-native:** push support for iOS ([#693](https://github.com/GetStream/stream-video-js/issues/693)) ([137832e](https://github.com/GetStream/stream-video-js/commit/137832e5519fb5d9be099a60a65cdbb41252b4c7))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
5
18
|
## [0.0.1-alpha.197](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-0.0.1-alpha.196...@stream-io/video-react-native-sdk-0.0.1-alpha.197) (2023-06-22)
|
|
6
19
|
|
|
7
20
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.usePushRegisterEffect = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const useIosCallKeepEventsSetupEffect_1 = require("./useIosCallKeepEventsSetupEffect");
|
|
5
|
+
const useIosVoipPushEventsSetupEffect_1 = require("./useIosVoipPushEventsSetupEffect");
|
|
6
6
|
const useProcessPushCallEffect_1 = require("./useProcessPushCallEffect");
|
|
7
7
|
const useInitAndroidTokenAndRest_1 = require("./useInitAndroidTokenAndRest");
|
|
8
8
|
/**
|
|
@@ -10,8 +10,8 @@ const useInitAndroidTokenAndRest_1 = require("./useInitAndroidTokenAndRest");
|
|
|
10
10
|
* It must be used in a component which is a child of StreamVideo from bindings
|
|
11
11
|
*/
|
|
12
12
|
const usePushRegisterEffect = () => {
|
|
13
|
-
(0,
|
|
14
|
-
(0,
|
|
13
|
+
(0, useIosCallKeepEventsSetupEffect_1.useIosCallKeepEventsSetupEffect)();
|
|
14
|
+
(0, useIosVoipPushEventsSetupEffect_1.useIosVoipPushEventsSetupEffect)();
|
|
15
15
|
(0, useProcessPushCallEffect_1.useProcessPushCallEffect)();
|
|
16
16
|
(0, useInitAndroidTokenAndRest_1.useInitAndroidTokenAndRest)();
|
|
17
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/hooks/push/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/hooks/push/index.ts"],"names":[],"mappings":";;;AAAA,uFAAoF;AACpF,uFAAoF;AACpF,yEAAsE;AACtE,6EAA0E;AAE1E;;;GAGG;AACI,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,IAAA,iEAA+B,GAAE,CAAC;IAClC,IAAA,iEAA+B,GAAE,CAAC;IAClC,IAAA,mDAAwB,GAAE,CAAC;IAC3B,IAAA,uDAA0B,GAAE,CAAC;AAC/B,CAAC,CAAC;AALW,QAAA,qBAAqB,yBAKhC"}
|
|
@@ -4,7 +4,7 @@ exports.useInitAndroidTokenAndRest = void 0;
|
|
|
4
4
|
const video_react_bindings_1 = require("@stream-io/video-react-bindings");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const utils_1 = require("../../utils");
|
|
7
|
-
const
|
|
7
|
+
const android_1 = require("../../utils/push/android");
|
|
8
8
|
/**
|
|
9
9
|
* This hook is used to initialize the push token for Android and ask notification permissions.
|
|
10
10
|
*/
|
|
@@ -17,7 +17,7 @@ const useInitAndroidTokenAndRest = () => {
|
|
|
17
17
|
if (!client || !connectedUserId || !pushConfig) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
(0,
|
|
20
|
+
(0, android_1.initAndroidPushToken)(client, pushConfig);
|
|
21
21
|
}, [client, connectedUserId]);
|
|
22
22
|
};
|
|
23
23
|
exports.useInitAndroidTokenAndRest = useInitAndroidTokenAndRest;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInitAndroidTokenAndRest.js","sourceRoot":"","sources":["../../../../src/hooks/push/useInitAndroidTokenAndRest.ts"],"names":[],"mappings":";;;AAAA,0EAGyC;AACzC,iCAAkC;AAClC,uCAA4C;AAC5C,
|
|
1
|
+
{"version":3,"file":"useInitAndroidTokenAndRest.js","sourceRoot":"","sources":["../../../../src/hooks/push/useInitAndroidTokenAndRest.ts"],"names":[],"mappings":";;;AAAA,0EAGyC;AACzC,iCAAkC;AAClC,uCAA4C;AAC5C,sDAAgE;AAEhE;;GAEG;AACI,MAAM,0BAA0B,GAAG,GAAG,EAAE;IAC7C,MAAM,MAAM,GAAG,IAAA,2CAAoB,GAAE,CAAC;IACtC,MAAM,eAAe,GAAG,IAAA,uCAAgB,GAAE,EAAE,EAAE,CAAC;IAC/C,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,UAAU,GAAG,qBAAa,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC;QAClD,mFAAmF;QACnF,IAAI,CAAC,MAAM,IAAI,CAAC,eAAe,IAAI,CAAC,UAAU,EAAE;YAC9C,OAAO;SACR;QACD,IAAA,8BAAoB,EAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC3C,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;AAChC,CAAC,CAAC;AAXW,QAAA,0BAA0B,8BAWrC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useIosCallKeepEventsSetupEffect = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const rxSubjects_1 = require("../../utils/push/rxSubjects");
|
|
6
|
+
const video_client_1 = require("@stream-io/video-client");
|
|
7
|
+
const ios_1 = require("../../utils/push/ios");
|
|
8
|
+
const libs_1 = require("../../utils/push/libs");
|
|
9
|
+
const utils_1 = require("../../utils");
|
|
10
|
+
const react_native_1 = require("react-native");
|
|
11
|
+
/**
|
|
12
|
+
* This hook is used to listen to callkeep events and do the necessary actions
|
|
13
|
+
*/
|
|
14
|
+
const useIosCallKeepEventsSetupEffect = () => {
|
|
15
|
+
(0, react_1.useEffect)(() => {
|
|
16
|
+
const pushConfig = utils_1.StreamVideoRN.getConfig().push;
|
|
17
|
+
if (react_native_1.Platform.OS !== 'ios' || !pushConfig) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const callkeep = (0, libs_1.getCallKeepLib)();
|
|
21
|
+
callkeep.addEventListener('answerCall', ({ callUUID }) => {
|
|
22
|
+
const call_cid = video_client_1.RxUtils.getCurrentValue(rxSubjects_1.voipPushNotificationCallCId$);
|
|
23
|
+
(0, ios_1.iosCallkeepAcceptCall)(call_cid, callUUID, pushConfig);
|
|
24
|
+
});
|
|
25
|
+
callkeep.addEventListener('endCall', ({ callUUID }) => {
|
|
26
|
+
const call_cid = video_client_1.RxUtils.getCurrentValue(rxSubjects_1.voipPushNotificationCallCId$);
|
|
27
|
+
(0, ios_1.iosCallkeepRejectCall)(call_cid, callUUID, pushConfig);
|
|
28
|
+
});
|
|
29
|
+
return () => {
|
|
30
|
+
callkeep.removeEventListener('answerCall');
|
|
31
|
+
callkeep.removeEventListener('endCall');
|
|
32
|
+
};
|
|
33
|
+
}, []);
|
|
34
|
+
};
|
|
35
|
+
exports.useIosCallKeepEventsSetupEffect = useIosCallKeepEventsSetupEffect;
|
|
36
|
+
//# sourceMappingURL=useIosCallKeepEventsSetupEffect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIosCallKeepEventsSetupEffect.js","sourceRoot":"","sources":["../../../../src/hooks/push/useIosCallKeepEventsSetupEffect.ts"],"names":[],"mappings":";;;AAAA,iCAAkC;AAClC,4DAA2E;AAC3E,0DAAkD;AAClD,8CAG8B;AAC9B,gDAAuD;AACvD,uCAA4C;AAC5C,+CAAwC;AAExC;;GAEG;AACI,MAAM,+BAA+B,GAAG,GAAG,EAAE;IAClD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,UAAU,GAAG,qBAAa,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC;QAClD,IAAI,uBAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC,UAAU,EAAE;YACxC,OAAO;SACR;QACD,MAAM,QAAQ,GAAG,IAAA,qBAAc,GAAE,CAAC;QAElC,QAAQ,CAAC,gBAAgB,CAAC,YAAY,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;YACvD,MAAM,QAAQ,GAAG,sBAAO,CAAC,eAAe,CAAC,yCAA4B,CAAC,CAAC;YACvE,IAAA,2BAAqB,EAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;QACH,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;YACpD,MAAM,QAAQ,GAAG,sBAAO,CAAC,eAAe,CAAC,yCAA4B,CAAC,CAAC;YACvE,IAAA,2BAAqB,EAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;YAC3C,QAAQ,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;QAC1C,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC;AAtBW,QAAA,+BAA+B,mCAsB1C"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.useIosVoipPushEventsSetupEffect = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const libs_1 = require("../../utils/push/libs");
|
|
6
6
|
const react_native_1 = require("react-native");
|
|
7
7
|
const utils_1 = require("../../utils");
|
|
8
8
|
const video_react_bindings_1 = require("@stream-io/video-react-bindings");
|
|
9
|
+
const rxSubjects_1 = require("../../utils/push/rxSubjects");
|
|
9
10
|
/**
|
|
10
11
|
* This hook is used to do the initial setup of listeners
|
|
11
12
|
* for ios voip push notifications.
|
|
12
13
|
*/
|
|
13
|
-
const
|
|
14
|
+
const useIosVoipPushEventsSetupEffect = () => {
|
|
14
15
|
const client = (0, video_react_bindings_1.useStreamVideoClient)();
|
|
15
16
|
(0, react_1.useEffect)(() => {
|
|
16
17
|
const pushConfig = utils_1.StreamVideoRN.getConfig().push;
|
|
@@ -22,45 +23,60 @@ const useIosPushEffect = () => {
|
|
|
22
23
|
// send token to stream
|
|
23
24
|
const push_provider_name = pushConfig.ios.pushProviderName;
|
|
24
25
|
client.addVoipDevice(token, 'apn', push_provider_name).catch((err) => {
|
|
25
|
-
console.warn('Failed to send voip token to
|
|
26
|
+
console.warn('Failed to send voip token to stream', err);
|
|
26
27
|
});
|
|
27
28
|
};
|
|
29
|
+
// fired when PushKit give us the latest token
|
|
28
30
|
voipPushNotification.addEventListener('register', (token) => {
|
|
29
31
|
onTokenReceived(token);
|
|
30
32
|
});
|
|
31
|
-
//
|
|
32
|
-
// --- this.onvoipPushNotificationReceived
|
|
33
|
-
voipPushNotification.addEventListener('notification', (notification) => {
|
|
34
|
-
// --- when receive remote voip push, register your VoIP client, show local notification ... etc
|
|
35
|
-
console.log({ notification });
|
|
36
|
-
// --- optionally, if you `addCompletionHandler` from the native side, once you have done the js jobs to initiate a call, call `completion()`
|
|
37
|
-
// voipPushNotification.onVoipNotificationCompleted(notification.uuid);
|
|
38
|
-
});
|
|
39
|
-
// ===== Step 3: subscribe `didLoadWithEvents` event =====
|
|
33
|
+
// this will fire when there are events occured before js bridge initialized
|
|
40
34
|
voipPushNotification.addEventListener('didLoadWithEvents', (events) => {
|
|
41
|
-
// --- this will fire when there are events occured before js bridge initialized
|
|
42
|
-
// --- use this event to execute your event handler manually by event type
|
|
43
35
|
if (!events || !Array.isArray(events) || events.length < 1) {
|
|
44
36
|
return;
|
|
45
37
|
}
|
|
46
38
|
for (let voipPushEvent of events) {
|
|
47
39
|
let { name, data } = voipPushEvent;
|
|
48
|
-
console.log({ voipPushEvent });
|
|
49
40
|
if (name === 'RNVoipPushRemoteNotificationsRegisteredEvent') {
|
|
50
41
|
onTokenReceived(data);
|
|
51
42
|
}
|
|
52
43
|
else if (name === 'RNVoipPushRemoteNotificationReceivedEvent') {
|
|
53
|
-
|
|
54
|
-
// voipPushNotification.onVoipNotificationCompleted(data.uuid);
|
|
44
|
+
onNotificationReceived(data);
|
|
55
45
|
}
|
|
56
46
|
}
|
|
57
47
|
});
|
|
58
48
|
return () => {
|
|
59
49
|
voipPushNotification.removeEventListener('didLoadWithEvents');
|
|
60
50
|
voipPushNotification.removeEventListener('register');
|
|
61
|
-
voipPushNotification.removeEventListener('notification');
|
|
62
51
|
};
|
|
63
52
|
}, [client]);
|
|
53
|
+
(0, react_1.useEffect)(() => {
|
|
54
|
+
const pushConfig = utils_1.StreamVideoRN.getConfig().push;
|
|
55
|
+
if (react_native_1.Platform.OS !== 'ios' || !pushConfig) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const voipPushNotification = (0, libs_1.getVoipPushNotificationLib)();
|
|
59
|
+
// fired when we received a voip push notification
|
|
60
|
+
voipPushNotification.addEventListener('notification', (notification) => {
|
|
61
|
+
onNotificationReceived(notification);
|
|
62
|
+
});
|
|
63
|
+
return () => {
|
|
64
|
+
voipPushNotification.removeEventListener('notification');
|
|
65
|
+
};
|
|
66
|
+
}, []);
|
|
67
|
+
};
|
|
68
|
+
exports.useIosVoipPushEventsSetupEffect = useIosVoipPushEventsSetupEffect;
|
|
69
|
+
const onNotificationReceived = (notification) => {
|
|
70
|
+
const sender = notification?.stream?.sender;
|
|
71
|
+
// do not process any other notifications other than stream.video
|
|
72
|
+
if (sender !== 'stream.video') {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const call_cid = notification?.stream?.call_cid;
|
|
76
|
+
if (call_cid) {
|
|
77
|
+
// send the info to this subject, it is listened by callkeep events
|
|
78
|
+
// callkeep events will then accept/reject the call
|
|
79
|
+
rxSubjects_1.voipPushNotificationCallCId$.next(call_cid);
|
|
80
|
+
}
|
|
64
81
|
};
|
|
65
|
-
|
|
66
|
-
//# sourceMappingURL=useIosPushEffect.js.map
|
|
82
|
+
//# sourceMappingURL=useIosVoipPushEventsSetupEffect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIosVoipPushEventsSetupEffect.js","sourceRoot":"","sources":["../../../../src/hooks/push/useIosVoipPushEventsSetupEffect.ts"],"names":[],"mappings":";;;AAAA,iCAAkC;AAClC,gDAAmE;AAEnE,+CAAwC;AACxC,uCAA4C;AAC5C,0EAAuE;AACvE,4DAA2E;AAE3E;;;GAGG;AACI,MAAM,+BAA+B,GAAG,GAAG,EAAE;IAClD,MAAM,MAAM,GAAG,IAAA,2CAAoB,GAAE,CAAC;IACtC,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,UAAU,GAAG,qBAAa,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC;QAClD,IAAI,uBAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC,UAAU,IAAI,CAAC,MAAM,EAAE;YACnD,OAAO;SACR;QACD,MAAM,oBAAoB,GAAG,IAAA,iCAA0B,GAAE,CAAC;QAE1D,MAAM,eAAe,GAAG,CAAC,KAAa,EAAE,EAAE;YACxC,uBAAuB;YACvB,MAAM,kBAAkB,GAAG,UAAU,CAAC,GAAG,CAAC,gBAAgB,CAAC;YAC3D,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBACnE,OAAO,CAAC,IAAI,CAAC,qCAAqC,EAAE,GAAG,CAAC,CAAC;YAC3D,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QACF,8CAA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,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,EAAE;YACV,oBAAoB,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC;QAC3D,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC;AAvDW,QAAA,+BAA+B,mCAuD1C;AAEF,MAAM,sBAAsB,GAAG,CAAC,YAAiB,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC;IAC5C,iEAAiE;IACjE,IAAI,MAAM,KAAK,cAAc,EAAE;QAC7B,OAAO;KACR;IACD,MAAM,QAAQ,GAAG,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC;IAChD,IAAI,QAAQ,EAAE;QACZ,mEAAmE;QACnE,mDAAmD;QACnD,yCAA4B,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;KAC7C;AACH,CAAC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This hook is used to process the incoming call data via push notifications using the relevant rxjs subjects
|
|
3
3
|
* It either joins or leaves the call based on the user's action.
|
|
4
|
-
* Note: this effect cannot work when push notifications are received when the app is in quit state
|
|
4
|
+
* 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.
|
|
5
|
+
* So we essentially run this effect only when the client is connected with a websocket.
|
|
5
6
|
*/
|
|
6
7
|
export declare const useProcessPushCallEffect: () => void;
|
|
@@ -10,7 +10,8 @@ const utils_2 = require("../../utils/push/utils");
|
|
|
10
10
|
/**
|
|
11
11
|
* This hook is used to process the incoming call data via push notifications using the relevant rxjs subjects
|
|
12
12
|
* It either joins or leaves the call based on the user's action.
|
|
13
|
-
* Note: this effect cannot work when push notifications are received when the app is in quit state
|
|
13
|
+
* 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.
|
|
14
|
+
* So we essentially run this effect only when the client is connected with a websocket.
|
|
14
15
|
*/
|
|
15
16
|
const useProcessPushCallEffect = () => {
|
|
16
17
|
const client = (0, video_react_bindings_1.useStreamVideoClient)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProcessPushCallEffect.js","sourceRoot":"","sources":["../../../../src/hooks/push/useProcessPushCallEffect.ts"],"names":[],"mappings":";;;AAAA,4DAGqC;AACrC,iCAAkC;AAClC,uCAA4C;AAC5C,0EAGyC;AACzC,8CAAwC;AACxC,kDAA6D;AAE7D
|
|
1
|
+
{"version":3,"file":"useProcessPushCallEffect.js","sourceRoot":"","sources":["../../../../src/hooks/push/useProcessPushCallEffect.ts"],"names":[],"mappings":";;;AAAA,4DAGqC;AACrC,iCAAkC;AAClC,uCAA4C;AAC5C,0EAGyC;AACzC,8CAAwC;AACxC,kDAA6D;AAE7D;;;;;GAKG;AACI,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC3C,MAAM,MAAM,GAAG,IAAA,2CAAoB,GAAE,CAAC;IACtC,MAAM,eAAe,GAAG,IAAA,uCAAgB,GAAE,EAAE,EAAE,CAAC;IAC/C,oHAAoH;IACpH,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,UAAU,GAAG,qBAAa,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC;QAClD,IAAI,CAAC,UAAU,IAAI,CAAC,MAAM,IAAI,CAAC,eAAe,EAAE;YAC9C,OAAO;SACR;QAED,uEAAuE;QACvE,MAAM,wBAAwB,GAAG,yCAA4B;aAC1D,IAAI,CAAC,IAAA,kBAAM,EAAC,iBAAiB,CAAC,CAAC;aAC/B,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YAC3B,MAAM,IAAA,2BAAmB,EAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;YACrD,yCAA4B,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,uDAAuD;QACvG,CAAC,CAAC,CAAC;QACL,wEAAwE;QACxE,MAAM,wBAAwB,GAAG,yCAA4B;aAC1D,IAAI,CAAC,IAAA,kBAAM,EAAC,iBAAiB,CAAC,CAAC;aAC/B,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YAC3B,MAAM,IAAA,2BAAmB,EAAC,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;YACtD,yCAA4B,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,uDAAuD;QACvG,CAAC,CAAC,CAAC;QACL,OAAO,GAAG,EAAE;YACV,wBAAwB,CAAC,WAAW,EAAE,CAAC;YACvC,wBAAwB,CAAC,WAAW,EAAE,CAAC;QACzC,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;AAChC,CAAC,CAAC;AA7BW,QAAA,wBAAwB,4BA6BnC;AAEF;;GAEG;AACH,SAAS,iBAAiB,CAAC,GAAuB;IAChD,OAAO,GAAG,KAAK,SAAS,CAAC;AAC3B,CAAC"}
|
|
@@ -114,6 +114,15 @@ const useAndroidKeepCallAliveEffect = () => {
|
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
116
|
}, [callingState]);
|
|
117
|
+
(0, react_1.useEffect)(() => {
|
|
118
|
+
return () => {
|
|
119
|
+
// stop foreground service when this effect is unmounted
|
|
120
|
+
if (foregroundServiceStartedRef.current) {
|
|
121
|
+
stopForegroundService();
|
|
122
|
+
foregroundServiceStartedRef.current = false;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}, []);
|
|
117
126
|
};
|
|
118
127
|
exports.useAndroidKeepCallAliveEffect = useAndroidKeepCallAliveEffect;
|
|
119
128
|
//# sourceMappingURL=useAndroidKeepCallAliveEffect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAndroidKeepCallAliveEffect.js","sourceRoot":"","sources":["../../../src/hooks/useAndroidKeepCallAliveEffect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0EAAsE;AACtE,iCAA0C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AC9C,CAAC,CAAC;SACH;IACH,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,OAAO,GAAG,EAAE;YACV,wDAAwD;YACxD,IAAI,2BAA2B,CAAC,OAAO,EAAE;gBACvC,qBAAqB,EAAE,CAAC;gBACxB,2BAA2B,CAAC,OAAO,GAAG,KAAK,CAAC;aAC7C;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC;AA7CW,QAAA,6BAA6B,iCA6CxC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useIosCallkeepEndEffect = void 0;
|
|
4
|
+
const video_client_1 = require("@stream-io/video-client");
|
|
5
|
+
const video_react_bindings_1 = require("@stream-io/video-react-bindings");
|
|
6
|
+
const react_native_1 = require("react-native");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const utils_1 = require("../utils");
|
|
9
|
+
const libs_1 = require("../utils/push/libs");
|
|
10
|
+
const isNonActiveCallingState = (callingState) => {
|
|
11
|
+
return (callingState === video_client_1.CallingState.IDLE ||
|
|
12
|
+
callingState === video_client_1.CallingState.UNKNOWN ||
|
|
13
|
+
callingState === video_client_1.CallingState.LEFT);
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* This hook is used to inform the callkeep library that the call has ended.
|
|
17
|
+
*/
|
|
18
|
+
const useIosCallkeepEndEffect = () => {
|
|
19
|
+
const activeCall = (0, video_react_bindings_1.useCall)();
|
|
20
|
+
const callingState = (0, video_react_bindings_1.useCallCallingState)();
|
|
21
|
+
const currentActiveCallIdRef = (0, react_1.useRef)();
|
|
22
|
+
(0, react_1.useEffect)(() => {
|
|
23
|
+
const pushConfig = utils_1.StreamVideoRN.getConfig().push;
|
|
24
|
+
if (react_native_1.Platform.OS !== 'ios' || !pushConfig) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const callkeep = (0, libs_1.getCallKeepLib)();
|
|
28
|
+
return () => {
|
|
29
|
+
// if the component is unmounted and the callID was not reported to callkeep, then report it now
|
|
30
|
+
if (currentActiveCallIdRef.current) {
|
|
31
|
+
callkeep.endCall(currentActiveCallIdRef.current);
|
|
32
|
+
currentActiveCallIdRef.current = undefined;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}, []);
|
|
36
|
+
const pushConfig = utils_1.StreamVideoRN.getConfig().push;
|
|
37
|
+
if (react_native_1.Platform.OS !== 'ios' || !pushConfig) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (!isNonActiveCallingState(callingState)) {
|
|
41
|
+
currentActiveCallIdRef.current = activeCall?.id;
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
// the current call has ended, so report it to callkeep asap
|
|
45
|
+
if (activeCall?.id && activeCall?.id === currentActiveCallIdRef.current) {
|
|
46
|
+
const callkeep = (0, libs_1.getCallKeepLib)();
|
|
47
|
+
callkeep.endCall(activeCall?.id);
|
|
48
|
+
currentActiveCallIdRef.current = undefined;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
exports.useIosCallkeepEndEffect = useIosCallkeepEndEffect;
|
|
52
|
+
//# sourceMappingURL=useIosCallkeepEndEffect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIosCallkeepEndEffect.js","sourceRoot":"","sources":["../../../src/hooks/useIosCallkeepEndEffect.ts"],"names":[],"mappings":";;;AAAA,0DAAuD;AACvD,0EAA+E;AAC/E,+CAAwC;AACxC,iCAA0C;AAC1C,oCAAyC;AACzC,6CAAoD;AAEpD,MAAM,uBAAuB,GAAG,CAAC,YAA0B,EAAE,EAAE;IAC7D,OAAO,CACL,YAAY,KAAK,2BAAY,CAAC,IAAI;QAClC,YAAY,KAAK,2BAAY,CAAC,OAAO;QACrC,YAAY,KAAK,2BA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sBAAsB,CAAC,OAAO,GAAG,SAAS,CAAC;KAC5C;AACH,CAAC,CAAC;AAlCW,QAAA,uBAAuB,2BAkClC"}
|
|
@@ -28,6 +28,7 @@ const video_react_bindings_1 = require("@stream-io/video-react-bindings");
|
|
|
28
28
|
const react_1 = __importStar(require("react"));
|
|
29
29
|
const video_client_1 = require("@stream-io/video-client");
|
|
30
30
|
const hooks_1 = require("../hooks");
|
|
31
|
+
const useIosCallkeepEndEffect_1 = require("../hooks/useIosCallkeepEndEffect");
|
|
31
32
|
/**
|
|
32
33
|
* StreamCall is a wrapper component that orchestrates the call life cycle logic and
|
|
33
34
|
* provides the call object to the children components.
|
|
@@ -64,7 +65,8 @@ const StreamCall = ({ callId, callType = 'default', call, callCycleHandlers = {}
|
|
|
64
65
|
};
|
|
65
66
|
}, [activeCall, callId, callType, videoClient]);
|
|
66
67
|
return (<video_react_bindings_1.StreamCallProvider call={activeCall}>
|
|
67
|
-
<
|
|
68
|
+
<AndroidKeepCallAlive />
|
|
69
|
+
<IosInformCallkeepCallEnd />
|
|
68
70
|
<exports.CallCycleLogicsWrapper callCycleHandlers={callCycleHandlers}>
|
|
69
71
|
{children}
|
|
70
72
|
</exports.CallCycleLogicsWrapper>
|
|
@@ -80,8 +82,16 @@ exports.CallCycleLogicsWrapper = CallCycleLogicsWrapper;
|
|
|
80
82
|
* This is a renderless component is used to keep the call alive on Android device using useAndroidKeepCallAliveEffect.
|
|
81
83
|
* useAndroidKeepCallAliveEffect needs to called inside a child of StreamCallProvider.
|
|
82
84
|
*/
|
|
83
|
-
const
|
|
85
|
+
const AndroidKeepCallAlive = () => {
|
|
84
86
|
(0, hooks_1.useAndroidKeepCallAliveEffect)();
|
|
85
87
|
return null;
|
|
86
88
|
};
|
|
89
|
+
/**
|
|
90
|
+
* This is a renderless component to end the call in callkeep for ios.
|
|
91
|
+
* useAndroidKeepCallAliveEffect needs to called inside a child of StreamCallProvider.
|
|
92
|
+
*/
|
|
93
|
+
const IosInformCallkeepCallEnd = () => {
|
|
94
|
+
(0, useIosCallkeepEndEffect_1.useIosCallkeepEndEffect)();
|
|
95
|
+
return null;
|
|
96
|
+
};
|
|
87
97
|
//# sourceMappingURL=StreamCall.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StreamCall.js","sourceRoot":"","sources":["../../../src/providers/StreamCall.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0EAGyC;AACzC,+CAAsE;AACtE,0DAA6D;AAC7D,oCAA6E;
|
|
1
|
+
{"version":3,"file":"StreamCall.js","sourceRoot":"","sources":["../../../src/providers/StreamCall.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0EAGyC;AACzC,+CAAsE;AACtE,0DAA6D;AAC7D,oCAA6E;AAC7E,8EAA2E;AAqC3E;;;;;;GAMG;AACI,MAAM,UAAU,GAAG,CAAC,EACzB,MAAM,EACN,QAAQ,GAAG,SAAS,EACpB,IAAI,EACJ,iBAAiB,GAAG,EAAE,EACtB,QAAQ,GAC2B,EAAE,EAAE;IACvC,MAAM,WAAW,GAAG,IAAA,2CAAoB,GAAE,CAAC;IAC3C,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,IAAA,gBAAQ,EAAmB,GAAG,EAAE;QAClE,IAAI,IAAI,EAAE;YACR,OAAO,IAAI,CAAC;SACb;QACD,IAAI,CAAC,WAAW,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE;YACxC,OAAO;SACR;QACD,OAAO,WAAW,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,wFAAwF;IACxF,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO;SACR;QAED,IAAI,MAAM,IAAI,QAAQ,IAAI,CAAC,UAAU,EAAE;YACrC,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,CA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,GAAE,CAAC;IAC1B,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.StreamVideoRN = void 0;
|
|
4
4
|
const react_native_1 = require("@notifee/react-native");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
|
-
const
|
|
6
|
+
const android_1 = require("../push/android");
|
|
7
7
|
const permissions_1 = require("./permissions");
|
|
8
8
|
const DEFAULT_STREAM_VIDEO_CONFIG = {
|
|
9
9
|
supportedReactions: constants_1.defaultEmojiReactions,
|
|
@@ -54,9 +54,8 @@ class StreamVideoRN {
|
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
56
|
this.config.push = pushConfig;
|
|
57
|
-
// After getting the config we should setup callkeep
|
|
58
|
-
(0,
|
|
59
|
-
(0, utils_1.setupFirebaseHandlerAndroid)(pushConfig);
|
|
57
|
+
// After getting the config we should setup callkeep events, firebase handler asap to handle incoming calls from a dead state
|
|
58
|
+
(0, android_1.setupFirebaseHandlerAndroid)(pushConfig);
|
|
60
59
|
}
|
|
61
60
|
/**
|
|
62
61
|
* Set native permissions config for StreamVideoRN.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utils/StreamVideoRN/index.ts"],"names":[],"mappings":";;;AAAA,wDAA0D;AAC1D,+CAAwD;AACxD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utils/StreamVideoRN/index.ts"],"names":[],"mappings":";;;AAAA,wDAA0D;AAC1D,+CAAwD;AACxD,6CAA8D;AAE9D,+CAGuB;AAEvB,MAAM,2BAA2B,GAAsB;IACrD,kBAAkB,EAAE,iCAAqB;IACzC,iBAAiB,EAAE;QACjB,OAAO,EAAE;YACP,OAAO,EAAE;gBACP,EAAE,EAAE,gCAAgC;gBACpC,IAAI,EAAE,yCAAyC;gBAC/C,MAAM,EAAE,KAAK;gBACb,SAAS,EAAE,KAAK;gBAChB,UAAU,EAAE,gCAAiB,CAAC,OAAO;aACtC;YACD,iBAAiB,EAAE;gBACjB,KAAK,EAAE,kBAAkB;gBACzB,IAAI,EAAE,2BAA2B;aAClC;SACF;KACF;CACF,CAAC;AAEF,MAAa,aAAa;IAChB,MAAM,CAAC,MAAM,GAAG,2BAA2B,CAAC;IACpD;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CAAC,YAAsD;QACxE,IAAI,CAAC,MAAM,GAAG;YACZ,GAAG,IAAI,CAAC,MAAM;YACd,GAAG,YAAY;SAChB,CAAC;IACJ,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CAAC,aAAa,CAAC,UAAkD;QACrE,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;YACpB,OAAO,CAAC,GAAG,CACT,oEAAoE,CACrE,CAAC;YACF,OAAO;SACR;QACD,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,UAAU,CAAC;QAC9B,6HAA6H;QAC7H,IAAA,qCAA2B,EAAC,UAAU,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,EACpB,yBAAyB,EACzB,sBAAsB,GAIvB;QACC,wCAA0B,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;QAC3D,qCAAuB,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IACvD,CAAC;IAED,MAAM,CAAC,SAAS;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;;AAzDH,sCA0DC"}
|
|
@@ -17,8 +17,6 @@ export type StreamVideoConfig = {
|
|
|
17
17
|
*/
|
|
18
18
|
push?: {
|
|
19
19
|
ios: {
|
|
20
|
-
/** The name of the app */
|
|
21
|
-
appName: string;
|
|
22
20
|
/**
|
|
23
21
|
* The name for the alias of push provider used for iOS
|
|
24
22
|
* @example "production-apn-video" or "staging-apn-video" based on the environment
|
|
@@ -26,15 +24,6 @@ export type StreamVideoConfig = {
|
|
|
26
24
|
pushProviderName: string;
|
|
27
25
|
};
|
|
28
26
|
android: {
|
|
29
|
-
/**
|
|
30
|
-
* The texts shown in the notification to keep call alive in the background for Android using a foreground service.
|
|
31
|
-
*/
|
|
32
|
-
phoneCallingAccountPermissionTexts: {
|
|
33
|
-
alertTitle: string;
|
|
34
|
-
alertDescription: string;
|
|
35
|
-
cancelButton: string;
|
|
36
|
-
okButton: string;
|
|
37
|
-
};
|
|
38
27
|
/**
|
|
39
28
|
* The notification channel to be used for incoming calls for Android.
|
|
40
29
|
* @example
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { StreamVideoClient } from '@stream-io/video-client';
|
|
2
|
+
import type { StreamVideoConfig } from '../StreamVideoRN/types';
|
|
3
|
+
type PushConfig = NonNullable<StreamVideoConfig['push']>;
|
|
4
|
+
/** Setup Firebase push message handler **/
|
|
5
|
+
export declare function setupFirebaseHandlerAndroid(pushConfig: PushConfig): void;
|
|
6
|
+
/** Send token to stream, create notification channel, */
|
|
7
|
+
export declare function initAndroidPushToken(client: StreamVideoClient, pushConfig: PushConfig): Promise<void>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.initAndroidPushToken = exports.setupFirebaseHandlerAndroid = void 0;
|
|
27
|
+
const react_native_1 = __importStar(require("@notifee/react-native"));
|
|
28
|
+
const react_native_2 = require("react-native");
|
|
29
|
+
const libs_1 = require("./libs");
|
|
30
|
+
const rxSubjects_1 = require("./rxSubjects");
|
|
31
|
+
const utils_1 = require("./utils");
|
|
32
|
+
const ACCEPT_CALL_ACTION_ID = 'accept';
|
|
33
|
+
const DECLINE_CALL_ACTION_ID = 'decline';
|
|
34
|
+
/** Setup Firebase push message handler **/
|
|
35
|
+
function setupFirebaseHandlerAndroid(pushConfig) {
|
|
36
|
+
if (react_native_2.Platform.OS !== 'android') {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const messaging = (0, libs_1.getFirebaseMessagingLib)();
|
|
40
|
+
messaging().setBackgroundMessageHandler(async (msg) => await firebaseMessagingOnMessageHandler(msg, pushConfig));
|
|
41
|
+
// messaging().onMessage(firebaseMessagingOnMessageHandler); // this is to listen to foreground messages, which we dont need for now
|
|
42
|
+
react_native_1.default.onBackgroundEvent(async (event) => {
|
|
43
|
+
// NOTE: When app was opened from a quit state, we will never hit this when on accept event as app will open and the click event will go to foreground
|
|
44
|
+
await onNotifeeEvent(event, pushConfig);
|
|
45
|
+
});
|
|
46
|
+
react_native_1.default.onForegroundEvent((event) => {
|
|
47
|
+
// NOTE: When app was opened from a quit state, we will never hit this when on accept event as app will open and go to foreground immediately
|
|
48
|
+
onNotifeeEvent(event, pushConfig);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
exports.setupFirebaseHandlerAndroid = setupFirebaseHandlerAndroid;
|
|
52
|
+
/** Send token to stream, create notification channel, */
|
|
53
|
+
async function initAndroidPushToken(client, pushConfig) {
|
|
54
|
+
if (react_native_2.Platform.OS !== 'android') {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const messaging = (0, libs_1.getFirebaseMessagingLib)();
|
|
58
|
+
const token = await messaging().getToken();
|
|
59
|
+
const push_provider_name = pushConfig.android.pushProviderName;
|
|
60
|
+
await client.addDevice(token, 'firebase', push_provider_name);
|
|
61
|
+
}
|
|
62
|
+
exports.initAndroidPushToken = initAndroidPushToken;
|
|
63
|
+
const firebaseMessagingOnMessageHandler = async (message, pushConfig) => {
|
|
64
|
+
if (react_native_2.Platform.OS !== 'android') {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
/* Example data from firebase
|
|
68
|
+
"message": {
|
|
69
|
+
"data": {
|
|
70
|
+
call_cid: 'audio_room:dcc1638c-e90d-4dcb-bf3b-8fa7767bfbb0',
|
|
71
|
+
call_display_name: '',
|
|
72
|
+
created_by_display_name: 'tommaso',
|
|
73
|
+
created_by_id: 'tommaso-03dcddb7-e9e2-42ec-b2f3-5043aac666ee',
|
|
74
|
+
receiver_id: 'martin-21824f17-319b-401b-a61b-fcab646f0d3f',
|
|
75
|
+
sender: 'stream.video',
|
|
76
|
+
type: 'call.live_started',
|
|
77
|
+
version: 'v2'
|
|
78
|
+
},
|
|
79
|
+
// other stuff
|
|
80
|
+
}
|
|
81
|
+
*/
|
|
82
|
+
const data = message.data;
|
|
83
|
+
if (!data || data.sender !== 'stream.video') {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
await react_native_1.default.createChannel(pushConfig.android.incomingCallChannel);
|
|
87
|
+
const { getTitle, getBody } = pushConfig.android.incomingCallNotificationTextGetters;
|
|
88
|
+
const channelId = pushConfig.android.incomingCallChannel.id;
|
|
89
|
+
const createdUserName = data.created_by_display_name;
|
|
90
|
+
await react_native_1.default.displayNotification({
|
|
91
|
+
title: getTitle(createdUserName),
|
|
92
|
+
body: getBody(createdUserName),
|
|
93
|
+
data,
|
|
94
|
+
android: {
|
|
95
|
+
channelId,
|
|
96
|
+
pressAction: {
|
|
97
|
+
id: 'default',
|
|
98
|
+
launchActivity: 'default', // open the app when the notification is pressed
|
|
99
|
+
},
|
|
100
|
+
actions: [
|
|
101
|
+
{
|
|
102
|
+
title: 'Decline',
|
|
103
|
+
pressAction: {
|
|
104
|
+
id: DECLINE_CALL_ACTION_ID,
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
title: 'Accept',
|
|
109
|
+
pressAction: {
|
|
110
|
+
id: ACCEPT_CALL_ACTION_ID,
|
|
111
|
+
launchActivity: 'default', // open the app when the notification is pressed
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
timeoutAfter: 60000, // 60 seconds, after which the notification will be dismissed automatically
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
const onNotifeeEvent = async (event, pushConfig) => {
|
|
120
|
+
const { type, detail } = event;
|
|
121
|
+
const { notification, pressAction } = detail;
|
|
122
|
+
const notificationId = notification?.id;
|
|
123
|
+
const data = notification?.data;
|
|
124
|
+
if (!data ||
|
|
125
|
+
!pressAction ||
|
|
126
|
+
!notificationId ||
|
|
127
|
+
data.sender !== 'stream.video') {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
// we can safely cast to string because the data is from "stream.video"
|
|
131
|
+
const call_cid = data.call_cid;
|
|
132
|
+
// Check if we need to decline the call
|
|
133
|
+
const didPressDecline = type === react_native_1.EventType.ACTION_PRESS &&
|
|
134
|
+
pressAction.id === DECLINE_CALL_ACTION_ID;
|
|
135
|
+
const didDismiss = type === react_native_1.EventType.DISMISSED;
|
|
136
|
+
const mustDecline = didPressDecline || didDismiss;
|
|
137
|
+
// Check if we need to accept the call
|
|
138
|
+
const mustAccept = type === react_native_1.EventType.ACTION_PRESS && pressAction.id === ACCEPT_CALL_ACTION_ID;
|
|
139
|
+
if (mustAccept) {
|
|
140
|
+
rxSubjects_1.pushAcceptedIncomingCallCId$.next(call_cid);
|
|
141
|
+
pushConfig.navigateAcceptCall();
|
|
142
|
+
// NOTE: accept will be handled by the app with rxjs observers as the app will go to foreground always
|
|
143
|
+
}
|
|
144
|
+
else if (mustDecline) {
|
|
145
|
+
rxSubjects_1.pushRejectedIncomingCallCId$.next(call_cid);
|
|
146
|
+
const hasObservers = rxSubjects_1.pushAcceptedIncomingCallCId$.observed &&
|
|
147
|
+
rxSubjects_1.pushRejectedIncomingCallCId$.observed;
|
|
148
|
+
if (hasObservers) {
|
|
149
|
+
// if we had observers we can return here as the observers will handle the call as the app is in the foreground state
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
await (0, utils_1.declineCallFromPushInBackground)(pushConfig, call_cid);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
//# sourceMappingURL=android.js.map
|