@stream-io/video-react-native-sdk 1.40.2 → 1.42.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 +48 -0
- package/android/src/main/java/com/streamvideo/reactnative/audio/AudioDeviceManager.kt +79 -54
- package/android/src/main/java/com/streamvideo/reactnative/audio/utils/AudioManagerUtil.kt +6 -2
- package/android/src/main/java/com/streamvideo/reactnative/callmanager/StreamInCallManagerModule.kt +3 -3
- package/dist/commonjs/components/Call/CallLayout/CallParticipantsSpotlight.js +2 -0
- package/dist/commonjs/components/Call/CallLayout/CallParticipantsSpotlight.js.map +1 -1
- package/dist/commonjs/components/Call/CallParticipantsList/CallParticipantsList.js +22 -31
- package/dist/commonjs/components/Call/CallParticipantsList/CallParticipantsList.js.map +1 -1
- package/dist/commonjs/components/Call/RingingCallContent/IncomingCall.js +8 -5
- package/dist/commonjs/components/Call/RingingCallContent/IncomingCall.js.map +1 -1
- package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer/index.js +2 -1
- package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer/index.js.map +1 -1
- package/dist/commonjs/hooks/index.js +11 -0
- package/dist/commonjs/hooks/index.js.map +1 -1
- package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js +73 -0
- package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js.map +1 -1
- package/dist/commonjs/hooks/useAudioDeviceStatus.js +76 -0
- package/dist/commonjs/hooks/useAudioDeviceStatus.js.map +1 -0
- package/dist/commonjs/modules/call-manager/CallManager.js +94 -47
- package/dist/commonjs/modules/call-manager/CallManager.js.map +1 -1
- package/dist/commonjs/utils/internal/callingx/callingx.js +0 -7
- package/dist/commonjs/utils/internal/callingx/callingx.js.map +1 -1
- package/dist/commonjs/utils/push/setupCallingExpEvents.js +31 -2
- package/dist/commonjs/utils/push/setupCallingExpEvents.js.map +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/module/components/Call/CallLayout/CallParticipantsSpotlight.js +3 -1
- package/dist/module/components/Call/CallLayout/CallParticipantsSpotlight.js.map +1 -1
- package/dist/module/components/Call/CallParticipantsList/CallParticipantsList.js +23 -32
- package/dist/module/components/Call/CallParticipantsList/CallParticipantsList.js.map +1 -1
- package/dist/module/components/Call/RingingCallContent/IncomingCall.js +9 -6
- package/dist/module/components/Call/RingingCallContent/IncomingCall.js.map +1 -1
- package/dist/module/components/Participant/ParticipantView/VideoRenderer/index.js +2 -1
- package/dist/module/components/Participant/ParticipantView/VideoRenderer/index.js.map +1 -1
- package/dist/module/hooks/index.js +1 -0
- package/dist/module/hooks/index.js.map +1 -1
- package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js +73 -0
- package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js.map +1 -1
- package/dist/module/hooks/useAudioDeviceStatus.js +71 -0
- package/dist/module/hooks/useAudioDeviceStatus.js.map +1 -0
- package/dist/module/modules/call-manager/CallManager.js +94 -47
- package/dist/module/modules/call-manager/CallManager.js.map +1 -1
- package/dist/module/utils/internal/callingx/callingx.js +0 -7
- package/dist/module/utils/internal/callingx/callingx.js.map +1 -1
- package/dist/module/utils/push/setupCallingExpEvents.js +32 -3
- package/dist/module/utils/push/setupCallingExpEvents.js.map +1 -1
- package/dist/module/version.js +1 -1
- package/dist/typescript/components/Call/CallLayout/CallParticipantsSpotlight.d.ts.map +1 -1
- package/dist/typescript/components/Call/CallParticipantsList/CallParticipantsList.d.ts.map +1 -1
- package/dist/typescript/components/Call/RingingCallContent/IncomingCall.d.ts.map +1 -1
- package/dist/typescript/components/Participant/ParticipantView/VideoRenderer/index.d.ts.map +1 -1
- package/dist/typescript/hooks/index.d.ts +1 -0
- package/dist/typescript/hooks/index.d.ts.map +1 -1
- package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts.map +1 -1
- package/dist/typescript/hooks/useAudioDeviceStatus.d.ts +21 -0
- package/dist/typescript/hooks/useAudioDeviceStatus.d.ts.map +1 -0
- package/dist/typescript/modules/call-manager/CallManager.d.ts +25 -11
- package/dist/typescript/modules/call-manager/CallManager.d.ts.map +1 -1
- package/dist/typescript/modules/call-manager/types.d.ts +29 -3
- package/dist/typescript/modules/call-manager/types.d.ts.map +1 -1
- package/dist/typescript/utils/internal/callingx/callingx.d.ts.map +1 -1
- package/dist/typescript/utils/push/setupCallingExpEvents.d.ts.map +1 -1
- package/dist/typescript/version.d.ts +1 -1
- package/expo-config-plugin/dist/index.js +2 -0
- package/expo-config-plugin/dist/withAndroidMessagingService.js +287 -0
- package/ios/StreamInCallManager.m +7 -0
- package/ios/StreamInCallManager.swift +257 -14
- package/package.json +8 -8
- package/src/components/Call/CallLayout/CallParticipantsSpotlight.tsx +6 -1
- package/src/components/Call/CallParticipantsList/CallParticipantsList.tsx +63 -62
- package/src/components/Call/RingingCallContent/IncomingCall.tsx +10 -12
- package/src/components/Participant/ParticipantView/VideoRenderer/index.tsx +4 -1
- package/src/hooks/index.ts +1 -0
- package/src/hooks/push/useCallingExpWithCallingStateEffect.ts +95 -0
- package/src/hooks/useAudioDeviceStatus.ts +90 -0
- package/src/modules/call-manager/CallManager.ts +122 -64
- package/src/modules/call-manager/native-module.d.ts +14 -7
- package/src/modules/call-manager/types.ts +30 -3
- package/src/utils/internal/callingx/callingx.ts +0 -8
- package/src/utils/push/setupCallingExpEvents.ts +41 -3
- package/src/version.ts +1 -1
- package/dist/commonjs/utils/internal/callingx/audioSessionPromise.js +0 -68
- package/dist/commonjs/utils/internal/callingx/audioSessionPromise.js.map +0 -1
- package/dist/module/utils/internal/callingx/audioSessionPromise.js +0 -63
- package/dist/module/utils/internal/callingx/audioSessionPromise.js.map +0 -1
- package/dist/typescript/utils/internal/callingx/audioSessionPromise.d.ts +0 -16
- package/dist/typescript/utils/internal/callingx/audioSessionPromise.d.ts.map +0 -1
- package/src/utils/internal/callingx/audioSessionPromise.ts +0 -65
|
@@ -1,21 +1,35 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { AudioDevicesState, IOSAudioInterruptionEvent, StreamInCallManagerConfig } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Cross-platform audio output device picker.
|
|
4
|
+
*/
|
|
5
|
+
declare class AudioDevicesManager {
|
|
3
6
|
private eventEmitter?;
|
|
7
|
+
private interruptionReassertSetup;
|
|
4
8
|
/**
|
|
5
|
-
*
|
|
9
|
+
* iOS + CallKit only: re-assert the user's output pick after an interruption ends.
|
|
10
|
+
*
|
|
11
|
+
* On interruption-end iOS clears the ephemeral route override (`setPreferredInput` /
|
|
12
|
+
* `overrideOutputAudioPort`) and doesn't restore it, and callingx re-applies its config
|
|
13
|
+
* only on engine-enable — not the engine-restart of interruption recovery.
|
|
14
|
+
*/
|
|
15
|
+
private ensureInterruptionReassert;
|
|
16
|
+
/**
|
|
17
|
+
* Get the current audio device state (available devices + the selected one).
|
|
18
|
+
* Read directly from the audio session, so it works on every path.
|
|
6
19
|
*/
|
|
7
|
-
|
|
20
|
+
getStatus: () => Promise<AudioDevicesState>;
|
|
8
21
|
/**
|
|
9
|
-
*
|
|
22
|
+
* Switch the audio output to the device with the given id.
|
|
10
23
|
*
|
|
11
|
-
* @param
|
|
24
|
+
* @param deviceId the stable {@link AudioDevice.id} (not the display name).
|
|
12
25
|
*/
|
|
13
|
-
|
|
26
|
+
select: (deviceId: string) => void;
|
|
14
27
|
/**
|
|
15
|
-
* Register a listener for audio device changes.
|
|
16
|
-
*
|
|
28
|
+
* Register a listener for audio device changes. Returns an unsubscribe fn.
|
|
29
|
+
*
|
|
30
|
+
* @param onChange called with the latest {@link AudioDevicesState} on change.
|
|
17
31
|
*/
|
|
18
|
-
|
|
32
|
+
addChangeListener: (onChange: (state: AudioDevicesState) => void) => (() => void);
|
|
19
33
|
}
|
|
20
34
|
declare class IOSCallManager {
|
|
21
35
|
private eventEmitter?;
|
|
@@ -41,7 +55,7 @@ declare class SpeakerManager {
|
|
|
41
55
|
setForceSpeakerphoneOn: (force: boolean) => void;
|
|
42
56
|
}
|
|
43
57
|
export declare class CallManager {
|
|
44
|
-
|
|
58
|
+
audioDevices: AudioDevicesManager;
|
|
45
59
|
ios: IOSCallManager;
|
|
46
60
|
speaker: SpeakerManager;
|
|
47
61
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CallManager.d.ts","sourceRoot":"","sources":["../../../../src/modules/call-manager/CallManager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"CallManager.d.ts","sourceRoot":"","sources":["../../../../src/modules/call-manager/CallManager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,iBAAiB,EACjB,yBAAyB,EACzB,yBAAyB,EAC1B,MAAM,SAAS,CAAC;AAgGjB;;GAEG;AACH,cAAM,mBAAmB;IACvB,OAAO,CAAC,YAAY,CAAC,CAAqB;IAC1C,OAAO,CAAC,yBAAyB,CAAS;IAE1C;;;;;;OAMG;IACH,OAAO,CAAC,0BAA0B,CAWhC;IAEF;;;OAGG;IACH,SAAS,QAAa,OAAO,CAAC,iBAAiB,CAAC,CAQ9C;IAEF;;;;OAIG;IACH,MAAM,GAAI,UAAU,MAAM,KAAG,IAAI,CAoB/B;IAEF;;;;OAIG;IACH,iBAAiB,GACf,UAAU,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,KAC3C,CAAC,MAAM,IAAI,CAAC,CAsCb;CACH;AAED,cAAM,cAAc;IAClB,OAAO,CAAC,YAAY,CAAC,CAAqB;IAE1C;;OAEG;IACH,kBAAkB,QAAO,IAAI,CAG3B;IAEF;;;;OAIG;IACH,4BAA4B,GAC1B,gBAAgB,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,KACzD,CAAC,MAAM,IAAI,CAAC,CAQb;CACH;AAED,cAAM,cAAc;IAClB;;OAEG;IACH,OAAO,GAAI,MAAM,OAAO,KAAG,IAAI,CAM7B;IAEF;;OAEG;IACH,sBAAsB,GAAI,OAAO,OAAO,KAAG,IAAI,CAkC7C;CACH;AAeD,qBAAa,WAAW;IACtB,YAAY,sBAA6B;IACzC,GAAG,iBAAwB;IAC3B,OAAO,iBAAwB;IAE/B;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,GAAI,SAAS,yBAAyB,KAAG,IAAI,CA6ChD;IAEF;;OAEG;IACH,IAAI,QAAO,IAAI,CAQb;IAEF;;;OAGG;IACH,aAAa,QAAO,IAAI,CAAkC;IAE1D;;;OAGG;IACH,gBAAgB,QAAO,MAAM,CAAqC;CACnE"}
|
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
export type AudioDeviceEndpointType = 'Bluetooth Device' | 'Earpiece' | 'Speaker' | 'Wired Headset' | 'Unknown' | (string & {});
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* A selectable audio output device.
|
|
4
|
+
*
|
|
5
|
+
* Devices are identified by a stable {@link AudioDevice.id} — never by name —
|
|
6
|
+
* so two devices that share a display name (e.g. two "AirPods Pro") never
|
|
7
|
+
* collide. On iOS the id is the `AVAudioSessionPortDescription.uid`
|
|
8
|
+
* (or the synthetic `'speaker'` / `'earpiece'` for the built-in outputs).
|
|
9
|
+
* On Android it is the `AudioDeviceInfo.id` for SDK-managed routing, or the
|
|
10
|
+
* Telecom endpoint id (a `CallEndpointCompat` identifier) when the call is
|
|
11
|
+
* Telecom-managed via callingx — stable for the lifetime of that call.
|
|
12
|
+
*/
|
|
13
|
+
export type AudioDevice = {
|
|
14
|
+
/** Stable, unique device identifier. Pass this to `callManager.audioDevices.select()`. */
|
|
15
|
+
id: string;
|
|
16
|
+
/** Human-readable label for display (e.g. "AirPods Pro", "Speaker"). Not stable — do not use as a key. */
|
|
17
|
+
name: string;
|
|
18
|
+
/** The kind of endpoint, useful for picking an icon. */
|
|
19
|
+
type: AudioDeviceEndpointType;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* The current audio-output device state. Returned by
|
|
23
|
+
* `callManager.audioDevices.getStatus()` and the `useAudioDeviceStatus()` hook.
|
|
24
|
+
*/
|
|
25
|
+
export type AudioDevicesState = {
|
|
26
|
+
/** All currently available output devices. */
|
|
27
|
+
devices: AudioDevice[];
|
|
28
|
+
/** The id of the active device, matching one of `devices[].id` (when known). */
|
|
29
|
+
selectedDeviceId?: string;
|
|
30
|
+
/** The endpoint type of the active device. */
|
|
4
31
|
currentEndpointType: AudioDeviceEndpointType;
|
|
5
|
-
selectedDevice: string;
|
|
6
32
|
};
|
|
7
33
|
export type AudioRole = 'communicator' | 'listener';
|
|
8
34
|
export type DeviceEndpointType = 'speaker' | 'earpiece';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/modules/call-manager/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,uBAAuB,GAC/B,kBAAkB,GAClB,UAAU,GACV,SAAS,GACT,eAAe,GACf,SAAS,GACT,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/modules/call-manager/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,uBAAuB,GAC/B,kBAAkB,GAClB,UAAU,GACV,SAAS,GACT,eAAe,GACf,SAAS,GACT,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB;;;;;;;;;;GAUG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,0FAA0F;IAC1F,EAAE,EAAE,MAAM,CAAC;IACX,0GAA0G;IAC1G,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,IAAI,EAAE,uBAAuB,CAAC;CAC/B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,8CAA8C;IAC9C,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,gFAAgF;IAChF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,8CAA8C;IAC9C,mBAAmB,EAAE,uBAAuB,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,cAAc,GAAG,UAAU,CAAC;AACpD,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,UAAU,CAAC;AAExD,MAAM,MAAM,yBAAyB,GAAG;IACtC,MAAM,EAAE,aAAa,GAAG,UAAU,CAAC;IACnC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC;IACzB,MAAM,CAAC,EAAE,SAAS,GAAG,iBAAiB,GAAG,mBAAmB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAC7E,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GACjC;IACE,SAAS,EAAE,cAAc,CAAC;IAC1B,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC,GACD;IACE,SAAS,EAAE,UAAU,CAAC;IACtB,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callingx.d.ts","sourceRoot":"","sources":["../../../../../src/utils/internal/callingx/callingx.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"callingx.d.ts","sourceRoot":"","sources":["../../../../../src/utils/internal/callingx/callingx.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEtE,OAAO,KAAK,EACV,IAAI,EACJ,cAAc,EACd,sBAAsB,EACvB,MAAM,yBAAyB,CAAC;AA6CjC;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,cAAc,EAAE,GAAG,SAAS,EACzC,YAAY,EAAE,sBAAsB,EAAE,GAAG,SAAS,EAClD,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,MAAM,CAgCR;AAaD,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,IAAI,iBAgCpD;AAED;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,iBA4ErE;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,aAAa,iBAmBvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupCallingExpEvents.d.ts","sourceRoot":"","sources":["../../../../src/utils/push/setupCallingExpEvents.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setupCallingExpEvents.d.ts","sourceRoot":"","sources":["../../../../src/utils/push/setupCallingExpEvents.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAYhE,KAAK,UAAU,GAAG,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;AAIzD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,WAAW,CAAC,UAAU,CAAC,QAsDxE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "1.
|
|
1
|
+
export declare const version = "1.42.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -13,6 +13,7 @@ const withMainApplication_1 = __importDefault(require("./withMainApplication"));
|
|
|
13
13
|
const withAppBuildGradle_1 = __importDefault(require("./withAppBuildGradle"));
|
|
14
14
|
const withIosScreenCapture_1 = __importDefault(require("./withIosScreenCapture"));
|
|
15
15
|
const withCallResources_1 = __importDefault(require("./withCallResources"));
|
|
16
|
+
const withAndroidMessagingService_1 = __importDefault(require("./withAndroidMessagingService"));
|
|
16
17
|
// path should be relative to dist
|
|
17
18
|
const pkg = require('../../package.json');
|
|
18
19
|
const withStreamVideoReactNativeSDK = (config, props) => {
|
|
@@ -28,6 +29,7 @@ const withStreamVideoReactNativeSDK = (config, props) => {
|
|
|
28
29
|
() => (0, withMainActivity_1.default)(config, props),
|
|
29
30
|
() => (0, withMainApplication_1.default)(config, props),
|
|
30
31
|
() => (0, withCallResources_1.default)(config, props),
|
|
32
|
+
() => (0, withAndroidMessagingService_1.default)(config, props),
|
|
31
33
|
]);
|
|
32
34
|
};
|
|
33
35
|
exports.default = (0, config_plugins_1.createRunOncePlugin)(withStreamVideoReactNativeSDK, pkg.name, pkg.version);
|
|
@@ -0,0 +1,287 @@
|
|
|
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 () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.FIREBASE_DEP_MARKER = exports.FIREBASE_BOM_FALLBACK_VERSION = exports.FIREBASE_MESSAGING_ARTIFACT = exports.STREAM_DEFAULT_SERVICE = exports.GENERATED_SERVICE_CLASS_NAME = exports.EXPO_NOTIFICATIONS_SERVICE = void 0;
|
|
37
|
+
exports.updateManifest = updateManifest;
|
|
38
|
+
exports.buildServiceSource = buildServiceSource;
|
|
39
|
+
exports.validateBaseClass = validateBaseClass;
|
|
40
|
+
exports.resolveBaseClass = resolveBaseClass;
|
|
41
|
+
exports.isExpoNotificationsInstalled = isExpoNotificationsInstalled;
|
|
42
|
+
exports.getGeneratedServiceFqcn = getGeneratedServiceFqcn;
|
|
43
|
+
exports.addFirebaseMessagingDependency = addFirebaseMessagingDependency;
|
|
44
|
+
exports.resolveFirebaseBomVersion = resolveFirebaseBomVersion;
|
|
45
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
46
|
+
const fs = __importStar(require("fs"));
|
|
47
|
+
const path = __importStar(require("path"));
|
|
48
|
+
const GENERATED_SERVICE_CLASS_NAME = 'StreamVideoMessagingService';
|
|
49
|
+
exports.GENERATED_SERVICE_CLASS_NAME = GENERATED_SERVICE_CLASS_NAME;
|
|
50
|
+
const STREAM_DEFAULT_SERVICE = 'io.getstream.rn.callingx.StreamMessagingService';
|
|
51
|
+
exports.STREAM_DEFAULT_SERVICE = STREAM_DEFAULT_SERVICE;
|
|
52
|
+
/** React Native Firebase's own FCM service. */
|
|
53
|
+
const RN_FIREBASE_SERVICE = 'io.invertase.firebase.messaging.ReactNativeFirebaseMessagingService';
|
|
54
|
+
/** expo-notifications' FCM service — the default base auto-detected when installed. */
|
|
55
|
+
const EXPO_NOTIFICATIONS_SERVICE = 'expo.modules.notifications.service.ExpoFirebaseMessagingService';
|
|
56
|
+
exports.EXPO_NOTIFICATIONS_SERVICE = EXPO_NOTIFICATIONS_SERVICE;
|
|
57
|
+
const MESSAGING_EVENT_ACTION = 'com.google.firebase.MESSAGING_EVENT';
|
|
58
|
+
/**
|
|
59
|
+
* The generated service lives in the `:app` module, which only has
|
|
60
|
+
* firebase-messaging on its *runtime* classpath (via callingx / RNFB /
|
|
61
|
+
* expo-notifications `implementation` deps). We add it as `compileOnly` so the
|
|
62
|
+
* app can compile a `FirebaseMessagingService` subclass. The runtime artifact is
|
|
63
|
+
* still supplied by those modules, so this avoids a version conflict.
|
|
64
|
+
*/
|
|
65
|
+
const FIREBASE_MESSAGING_ARTIFACT = 'com.google.firebase:firebase-messaging';
|
|
66
|
+
exports.FIREBASE_MESSAGING_ARTIFACT = FIREBASE_MESSAGING_ARTIFACT;
|
|
67
|
+
/**
|
|
68
|
+
* Fallback Firebase BOM version, used only when the live BOM cannot be resolved
|
|
69
|
+
* from @react-native-firebase/app. This is the BOM shipped by the minimum RNFB
|
|
70
|
+
* version we support: @stream-io/react-native-callingx declares a
|
|
71
|
+
* `@react-native-firebase/* >= 23.0.0` peer dependency, and RNFB `23.0.0` pins
|
|
72
|
+
* firebase-bom `34.0.0`. Keep in sync with that peer floor.
|
|
73
|
+
*/
|
|
74
|
+
const FIREBASE_BOM_FALLBACK_VERSION = '34.0.0';
|
|
75
|
+
exports.FIREBASE_BOM_FALLBACK_VERSION = FIREBASE_BOM_FALLBACK_VERSION;
|
|
76
|
+
/** Stable comment used to detect (and avoid duplicating) our gradle injection. */
|
|
77
|
+
const FIREBASE_DEP_MARKER = '// Added by @stream-io/video-react-native-sdk for the generated FCM messaging service';
|
|
78
|
+
exports.FIREBASE_DEP_MARKER = FIREBASE_DEP_MARKER;
|
|
79
|
+
function getAndroidPackage(config) {
|
|
80
|
+
const modResults = config.modResults;
|
|
81
|
+
const pkg = config.android?.package ?? modResults?.manifest?.$?.package;
|
|
82
|
+
if (!pkg) {
|
|
83
|
+
throw new Error('[StreamVideo] Unable to resolve the Android package name required to generate ' +
|
|
84
|
+
'the FCM messaging service. Set "android.package" in your app config.');
|
|
85
|
+
}
|
|
86
|
+
return pkg;
|
|
87
|
+
}
|
|
88
|
+
function getGeneratedServiceFqcn(androidPackage) {
|
|
89
|
+
return `${androidPackage}.${GENERATED_SERVICE_CLASS_NAME}`;
|
|
90
|
+
}
|
|
91
|
+
function validateBaseClass(baseClass) {
|
|
92
|
+
if (typeof baseClass !== 'string' || baseClass.trim().length === 0) {
|
|
93
|
+
throw new Error('[StreamVideo] "androidMessagingServiceBaseClass" must be a non-empty string.');
|
|
94
|
+
}
|
|
95
|
+
if (!baseClass.includes('.')) {
|
|
96
|
+
throw new Error(`[StreamVideo] "androidMessagingServiceBaseClass" must be a fully-qualified class name ` +
|
|
97
|
+
`including its package (e.g. "expo.modules.notifications.service.ExpoFirebaseMessagingService"), ` +
|
|
98
|
+
`received "${baseClass}".`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function isExpoNotificationsInstalled(projectRoot) {
|
|
102
|
+
try {
|
|
103
|
+
require.resolve('expo-notifications/package.json', projectRoot ? { paths: [projectRoot] } : undefined);
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function resolveBaseClass(value, projectRoot) {
|
|
111
|
+
if (value === null) {
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
if (typeof value === 'string') {
|
|
115
|
+
validateBaseClass(value);
|
|
116
|
+
return value;
|
|
117
|
+
}
|
|
118
|
+
return isExpoNotificationsInstalled(projectRoot)
|
|
119
|
+
? EXPO_NOTIFICATIONS_SERVICE
|
|
120
|
+
: undefined;
|
|
121
|
+
}
|
|
122
|
+
/** Kotlin source for the generated messaging service. */
|
|
123
|
+
function buildServiceSource(androidPackage, baseClassFqcn) {
|
|
124
|
+
const simpleName = baseClassFqcn.split('.').pop();
|
|
125
|
+
const shouldForwardNewToken = baseClassFqcn !== RN_FIREBASE_SERVICE;
|
|
126
|
+
const onNewToken = shouldForwardNewToken
|
|
127
|
+
? `
|
|
128
|
+
override fun onNewToken(token: String) {
|
|
129
|
+
super.onNewToken(token)
|
|
130
|
+
// Keep Stream's device registration working under a non-RNFirebase base.
|
|
131
|
+
StreamMessagingHelper.forwardNewToken(token)
|
|
132
|
+
}
|
|
133
|
+
`
|
|
134
|
+
: '';
|
|
135
|
+
return `package ${androidPackage}
|
|
136
|
+
|
|
137
|
+
import android.annotation.SuppressLint
|
|
138
|
+
import com.google.firebase.messaging.RemoteMessage
|
|
139
|
+
import io.getstream.rn.callingx.StreamMessagingHelper
|
|
140
|
+
import ${baseClassFqcn}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* AUTO-GENERATED by the @stream-io/video-react-native-sdk Expo config plugin.
|
|
144
|
+
* Do not edit — this file is regenerated on every \`expo prebuild\`.
|
|
145
|
+
*
|
|
146
|
+
* Extends the app-declared FCM service (${baseClassFqcn}) and injects Stream
|
|
147
|
+
* Video incoming-call (\`call.ring\`) handling. Stream's default
|
|
148
|
+
* ${STREAM_DEFAULT_SERVICE} is removed from the merged manifest so this class is
|
|
149
|
+
* the single FirebaseMessagingService for the app.
|
|
150
|
+
*/
|
|
151
|
+
@SuppressLint("MissingFirebaseInstanceTokenRefresh")
|
|
152
|
+
class ${GENERATED_SERVICE_CLASS_NAME} : ${simpleName}() {
|
|
153
|
+
override fun onMessageReceived(remoteMessage: RemoteMessage) {
|
|
154
|
+
if (StreamMessagingHelper.isStreamCallRing(remoteMessage)) {
|
|
155
|
+
StreamMessagingHelper.handleMessage(applicationContext, remoteMessage)
|
|
156
|
+
return
|
|
157
|
+
}
|
|
158
|
+
super.onMessageReceived(remoteMessage)
|
|
159
|
+
}
|
|
160
|
+
${onNewToken}}
|
|
161
|
+
`;
|
|
162
|
+
}
|
|
163
|
+
function updateManifest(androidManifest, generatedFqcn, baseClassFqcn) {
|
|
164
|
+
const manifest = androidManifest.manifest;
|
|
165
|
+
if (!manifest ||
|
|
166
|
+
!Array.isArray(manifest.application) ||
|
|
167
|
+
!manifest.application[0]) {
|
|
168
|
+
throw new Error('[StreamVideo] Malformed AndroidManifest.xml: missing <application> element.');
|
|
169
|
+
}
|
|
170
|
+
manifest.$ = manifest.$ ?? {};
|
|
171
|
+
manifest.$['xmlns:tools'] =
|
|
172
|
+
manifest.$['xmlns:tools'] ?? 'http://schemas.android.com/tools';
|
|
173
|
+
// Services whose registration we strip so the generated service is the only
|
|
174
|
+
// MESSAGING_EVENT handler: Stream's default (from react-native-callingx) and
|
|
175
|
+
// the base class (its logic still runs — the generated service subclasses it).
|
|
176
|
+
const servicesToRemove = [
|
|
177
|
+
...new Set([STREAM_DEFAULT_SERVICE, baseClassFqcn]),
|
|
178
|
+
];
|
|
179
|
+
const application = manifest.application[0];
|
|
180
|
+
const existing = application.service ?? [];
|
|
181
|
+
// Drop our own previously-added entries so re-runs don't duplicate them.
|
|
182
|
+
const services = existing.filter((service) => {
|
|
183
|
+
const name = service?.$?.['android:name'];
|
|
184
|
+
return name !== generatedFqcn && !servicesToRemove.includes(name ?? '');
|
|
185
|
+
});
|
|
186
|
+
// The generated service becomes the single com.google.firebase.MESSAGING_EVENT handler.
|
|
187
|
+
services.push({
|
|
188
|
+
$: {
|
|
189
|
+
'android:name': generatedFqcn,
|
|
190
|
+
'android:exported': 'false',
|
|
191
|
+
},
|
|
192
|
+
'intent-filter': [
|
|
193
|
+
{
|
|
194
|
+
action: [{ $: { 'android:name': MESSAGING_EVENT_ACTION } }],
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
});
|
|
198
|
+
// Remove the competing services so they don't win FCM delivery. `tools:node`
|
|
199
|
+
// is not part of the strict typing but is valid manifest merger syntax.
|
|
200
|
+
for (const name of servicesToRemove) {
|
|
201
|
+
services.push({
|
|
202
|
+
$: {
|
|
203
|
+
'android:name': name,
|
|
204
|
+
'tools:node': 'remove',
|
|
205
|
+
},
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
application.service = services;
|
|
209
|
+
return androidManifest;
|
|
210
|
+
}
|
|
211
|
+
const withGeneratedMessagingServiceFile = (config, value) => {
|
|
212
|
+
return (0, config_plugins_1.withDangerousMod)(config, [
|
|
213
|
+
'android',
|
|
214
|
+
(dangerousConfig) => {
|
|
215
|
+
const baseClassFqcn = resolveBaseClass(value, dangerousConfig.modRequest.projectRoot);
|
|
216
|
+
if (!baseClassFqcn) {
|
|
217
|
+
return dangerousConfig;
|
|
218
|
+
}
|
|
219
|
+
const androidPackage = getAndroidPackage(dangerousConfig);
|
|
220
|
+
const packagePath = androidPackage.replace(/\./g, path.sep);
|
|
221
|
+
const javaDir = path.join(dangerousConfig.modRequest.platformProjectRoot, 'app', 'src', 'main', 'java', packagePath);
|
|
222
|
+
fs.mkdirSync(javaDir, { recursive: true });
|
|
223
|
+
const destPath = path.join(javaDir, `${GENERATED_SERVICE_CLASS_NAME}.kt`);
|
|
224
|
+
fs.writeFileSync(destPath, buildServiceSource(androidPackage, baseClassFqcn), 'utf8');
|
|
225
|
+
return dangerousConfig;
|
|
226
|
+
},
|
|
227
|
+
]);
|
|
228
|
+
};
|
|
229
|
+
const withMessagingServiceManifest = (config, value) => {
|
|
230
|
+
return (0, config_plugins_1.withAndroidManifest)(config, (androidConfig) => {
|
|
231
|
+
const baseClassFqcn = resolveBaseClass(value, androidConfig.modRequest.projectRoot);
|
|
232
|
+
if (!baseClassFqcn) {
|
|
233
|
+
return androidConfig;
|
|
234
|
+
}
|
|
235
|
+
const androidPackage = getAndroidPackage(androidConfig);
|
|
236
|
+
androidConfig.modResults = updateManifest(androidConfig.modResults, getGeneratedServiceFqcn(androidPackage), baseClassFqcn);
|
|
237
|
+
return androidConfig;
|
|
238
|
+
});
|
|
239
|
+
};
|
|
240
|
+
function resolveFirebaseBomVersion(projectRoot) {
|
|
241
|
+
try {
|
|
242
|
+
const pkgPath = require.resolve('@react-native-firebase/app/package.json', projectRoot ? { paths: [projectRoot] } : undefined);
|
|
243
|
+
const pkg = require(pkgPath);
|
|
244
|
+
const bom = pkg?.sdkVersions?.android?.firebase;
|
|
245
|
+
return typeof bom === 'string' && bom.length > 0 ? bom : undefined;
|
|
246
|
+
}
|
|
247
|
+
catch {
|
|
248
|
+
return undefined;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
const DEPENDENCIES_BLOCK = /dependencies\s*\{/;
|
|
252
|
+
function addFirebaseMessagingDependency(contents, bomVersion) {
|
|
253
|
+
if (contents.includes(FIREBASE_DEP_MARKER)) {
|
|
254
|
+
return contents;
|
|
255
|
+
}
|
|
256
|
+
if (!DEPENDENCIES_BLOCK.test(contents)) {
|
|
257
|
+
throw new Error('[StreamVideo] Could not find a "dependencies { }" block in the app build.gradle ' +
|
|
258
|
+
'to add the firebase-messaging compile dependency for the generated FCM service.');
|
|
259
|
+
}
|
|
260
|
+
const lines = ` ${FIREBASE_DEP_MARKER}\n` +
|
|
261
|
+
` compileOnly(platform("com.google.firebase:firebase-bom:${bomVersion ?? FIREBASE_BOM_FALLBACK_VERSION}"))\n` +
|
|
262
|
+
` compileOnly("${FIREBASE_MESSAGING_ARTIFACT}")`;
|
|
263
|
+
return contents.replace(DEPENDENCIES_BLOCK, (match) => `${match}\n${lines}`);
|
|
264
|
+
}
|
|
265
|
+
const withMessagingServiceGradle = (config, value) => {
|
|
266
|
+
return (0, config_plugins_1.withAppBuildGradle)(config, (gradleConfig) => {
|
|
267
|
+
const baseClassFqcn = resolveBaseClass(value, gradleConfig.modRequest.projectRoot);
|
|
268
|
+
if (!baseClassFqcn) {
|
|
269
|
+
return gradleConfig;
|
|
270
|
+
}
|
|
271
|
+
const bomVersion = resolveFirebaseBomVersion(gradleConfig.modRequest.projectRoot);
|
|
272
|
+
gradleConfig.modResults.contents = addFirebaseMessagingDependency(gradleConfig.modResults.contents, bomVersion);
|
|
273
|
+
return gradleConfig;
|
|
274
|
+
});
|
|
275
|
+
};
|
|
276
|
+
const withAndroidMessagingService = (config, props) => {
|
|
277
|
+
// The messaging-service override only matters for the ringing flow, skip it otherwise.
|
|
278
|
+
if (!props?.ringing) {
|
|
279
|
+
return config;
|
|
280
|
+
}
|
|
281
|
+
const value = props?.androidMessagingServiceBaseClass;
|
|
282
|
+
let updated = withGeneratedMessagingServiceFile(config, value);
|
|
283
|
+
updated = withMessagingServiceManifest(updated, value);
|
|
284
|
+
updated = withMessagingServiceGradle(updated, value);
|
|
285
|
+
return updated;
|
|
286
|
+
};
|
|
287
|
+
exports.default = withAndroidMessagingService;
|
|
@@ -17,6 +17,13 @@ RCT_EXTERN_METHOD(stop)
|
|
|
17
17
|
|
|
18
18
|
RCT_EXTERN_METHOD(showAudioRoutePicker)
|
|
19
19
|
|
|
20
|
+
RCT_EXTERN_METHOD(getAudioDeviceStatus:(RCTPromiseResolveBlock)resolve
|
|
21
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
22
|
+
|
|
23
|
+
RCT_EXTERN_METHOD(chooseAudioDeviceEndpoint:(NSString *)id)
|
|
24
|
+
|
|
25
|
+
RCT_EXTERN_METHOD(reapplyAudioRoute)
|
|
26
|
+
|
|
20
27
|
RCT_EXTERN_METHOD(setForceSpeakerphoneOn:(BOOL)enable)
|
|
21
28
|
|
|
22
29
|
RCT_EXTERN_METHOD(setMicrophoneMute:(BOOL)enable)
|