@stream-io/react-native-callingx 0.1.0-beta.7 → 0.1.1-beta.1
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/android/build.gradle +7 -1
- package/android/src/main/AndroidManifest.xml +31 -1
- package/android/src/main/java/io/getstream/rn/callingx/CallEventBroadcastReceiver.kt +17 -0
- package/android/src/main/java/io/getstream/rn/callingx/CallRegistrationStore.kt +145 -0
- package/android/src/main/java/io/getstream/rn/callingx/CallService.kt +301 -83
- package/android/src/main/java/io/getstream/rn/callingx/CallingxModuleImpl.kt +148 -390
- package/android/src/main/java/io/getstream/rn/callingx/StreamMessagingService.kt +48 -0
- package/android/src/main/java/io/getstream/rn/callingx/model/Call.kt +1 -0
- package/android/src/main/java/io/getstream/rn/callingx/notifications/CallNotificationManager.kt +188 -48
- package/android/src/main/java/io/getstream/rn/callingx/notifications/NotificationIntentFactory.kt +14 -8
- package/android/src/main/java/io/getstream/rn/callingx/notifications/NotificationReceiverActivity.kt +12 -1
- package/android/src/main/java/io/getstream/rn/callingx/notifications/NotificationReceiverService.kt +7 -0
- package/android/src/main/java/io/getstream/rn/callingx/repo/CallRepository.kt +38 -19
- package/android/src/main/java/io/getstream/rn/callingx/repo/LegacyCallRepository.kt +64 -55
- package/android/src/main/java/io/getstream/rn/callingx/repo/TelecomCallRepository.kt +241 -195
- package/android/src/main/java/io/getstream/rn/callingx/utils/CallEventBus.kt +61 -0
- package/android/src/main/java/io/getstream/rn/callingx/utils/SettingsStore.kt +51 -0
- package/android/src/newarch/java/io/getstream/rn/callingx/CallingxModule.kt +12 -3
- package/android/src/oldarch/java/io/getstream/rn/callingx/CallingxModule.kt +13 -3
- package/dist/module/CallingxModule.js +20 -24
- package/dist/module/CallingxModule.js.map +1 -1
- package/dist/module/spec/NativeCallingx.js.map +1 -1
- package/dist/module/utils/constants.js +24 -14
- package/dist/module/utils/constants.js.map +1 -1
- package/dist/typescript/src/CallingxModule.d.ts +4 -2
- package/dist/typescript/src/CallingxModule.d.ts.map +1 -1
- package/dist/typescript/src/spec/NativeCallingx.d.ts +7 -4
- package/dist/typescript/src/spec/NativeCallingx.d.ts.map +1 -1
- package/dist/typescript/src/types.d.ts +33 -5
- package/dist/typescript/src/types.d.ts.map +1 -1
- package/dist/typescript/src/utils/constants.d.ts +2 -3
- package/dist/typescript/src/utils/constants.d.ts.map +1 -1
- package/ios/AudioSessionManager.swift +2 -2
- package/ios/Callingx.mm +41 -17
- package/ios/CallingxImpl.swift +213 -83
- package/ios/Settings.swift +2 -2
- package/ios/UUIDStorage.swift +10 -10
- package/ios/VoipNotificationsManager.swift +8 -8
- package/package.json +4 -2
- package/src/CallingxModule.ts +20 -21
- package/src/spec/NativeCallingx.ts +10 -6
- package/src/types.ts +36 -4
- package/src/utils/constants.ts +23 -12
- /package/android/src/main/java/io/getstream/rn/callingx/{ResourceUtils.kt → utils/ResourceUtils.kt} +0 -0
- /package/android/src/main/java/io/getstream/rn/callingx/{Utils.kt → utils/Utils.kt} +0 -0
package/ios/UUIDStorage.swift
CHANGED
|
@@ -18,7 +18,7 @@ import Foundation
|
|
|
18
18
|
return queue.sync {
|
|
19
19
|
if let existing = callsByCid[cid] {
|
|
20
20
|
#if DEBUG
|
|
21
|
-
|
|
21
|
+
NSLog("%@","[UUIDStorage] getOrCreateCall: found existing \(existing)")
|
|
22
22
|
#endif
|
|
23
23
|
return existing
|
|
24
24
|
}
|
|
@@ -29,7 +29,7 @@ import Foundation
|
|
|
29
29
|
callsByCid[cid] = call
|
|
30
30
|
callsByUUID[uuidString] = call
|
|
31
31
|
#if DEBUG
|
|
32
|
-
|
|
32
|
+
NSLog("%@","[UUIDStorage] getOrCreateCall: created \(call)")
|
|
33
33
|
#endif
|
|
34
34
|
return call
|
|
35
35
|
}
|
|
@@ -63,7 +63,7 @@ import Foundation
|
|
|
63
63
|
return queue.sync {
|
|
64
64
|
if let existing = callsByCid[cid] {
|
|
65
65
|
#if DEBUG
|
|
66
|
-
|
|
66
|
+
NSLog("%@","[UUIDStorage] getUUIDForCid: found existing UUID \(existing.uuid.uuidString.lowercased()) for cid \(cid)")
|
|
67
67
|
#endif
|
|
68
68
|
return existing.uuid
|
|
69
69
|
}
|
|
@@ -74,7 +74,7 @@ import Foundation
|
|
|
74
74
|
callsByCid[cid] = call
|
|
75
75
|
callsByUUID[uuidString] = call
|
|
76
76
|
#if DEBUG
|
|
77
|
-
|
|
77
|
+
NSLog("%@","[UUIDStorage] getUUIDForCid: created new UUID \(uuidString) for cid \(cid)")
|
|
78
78
|
#endif
|
|
79
79
|
return uuid
|
|
80
80
|
}
|
|
@@ -91,7 +91,7 @@ import Foundation
|
|
|
91
91
|
let uuidString = uuid.uuidString.lowercased()
|
|
92
92
|
let cid = callsByUUID[uuidString]?.cid
|
|
93
93
|
#if DEBUG
|
|
94
|
-
|
|
94
|
+
NSLog("%@","[UUIDStorage] getCidForUUID: UUID \(uuidString) -> cid \(cid ?? "(not found)")")
|
|
95
95
|
#endif
|
|
96
96
|
return cid
|
|
97
97
|
}
|
|
@@ -104,11 +104,11 @@ import Foundation
|
|
|
104
104
|
callsByCid.removeValue(forKey: call.cid)
|
|
105
105
|
callsByUUID.removeValue(forKey: uuidString)
|
|
106
106
|
#if DEBUG
|
|
107
|
-
|
|
107
|
+
NSLog("%@","[UUIDStorage] removeCidForUUID: removed cid \(call.cid) for UUID \(uuidString)")
|
|
108
108
|
#endif
|
|
109
109
|
} else {
|
|
110
110
|
#if DEBUG
|
|
111
|
-
|
|
111
|
+
NSLog("%@","[UUIDStorage] removeCidForUUID: no cid found for UUID \(uuidString)")
|
|
112
112
|
#endif
|
|
113
113
|
}
|
|
114
114
|
}
|
|
@@ -121,11 +121,11 @@ import Foundation
|
|
|
121
121
|
callsByUUID.removeValue(forKey: uuidString)
|
|
122
122
|
callsByCid.removeValue(forKey: cid)
|
|
123
123
|
#if DEBUG
|
|
124
|
-
|
|
124
|
+
NSLog("%@","[UUIDStorage] removeCid: removed cid \(cid) with UUID \(uuidString)")
|
|
125
125
|
#endif
|
|
126
126
|
} else {
|
|
127
127
|
#if DEBUG
|
|
128
|
-
|
|
128
|
+
NSLog("%@","[UUIDStorage] removeCid: no UUID found for cid \(cid)")
|
|
129
129
|
#endif
|
|
130
130
|
}
|
|
131
131
|
}
|
|
@@ -137,7 +137,7 @@ import Foundation
|
|
|
137
137
|
callsByCid.removeAll()
|
|
138
138
|
callsByUUID.removeAll()
|
|
139
139
|
#if DEBUG
|
|
140
|
-
|
|
140
|
+
NSLog("%@","[UUIDStorage] removeAllObjects: cleared \(count) entries")
|
|
141
141
|
#endif
|
|
142
142
|
}
|
|
143
143
|
}
|
|
@@ -56,13 +56,13 @@ typealias RNVoipPushNotificationCompletion = () -> Void
|
|
|
56
56
|
@objc public static func voipRegistration() {
|
|
57
57
|
if isVoipRegistered {
|
|
58
58
|
#if DEBUG
|
|
59
|
-
|
|
59
|
+
NSLog("%@","[VoipNotificationsManager] voipRegistration is already registered. return _lastVoipToken = \(lastVoipToken)")
|
|
60
60
|
#endif
|
|
61
61
|
let voipPushManager = VoipNotificationsManager.shared()
|
|
62
62
|
voipPushManager.sendEventWithNameWrapper(name: VoipNotificationsEvents.registered, body: ["token": lastVoipToken])
|
|
63
63
|
} else {
|
|
64
64
|
#if DEBUG
|
|
65
|
-
|
|
65
|
+
NSLog("%@","[VoipNotificationsManager] voipRegistration enter")
|
|
66
66
|
#endif
|
|
67
67
|
DispatchQueue.main.async {
|
|
68
68
|
let voipRegistry = PKPushRegistry(queue: DispatchQueue.main)
|
|
@@ -78,7 +78,7 @@ typealias RNVoipPushNotificationCompletion = () -> Void
|
|
|
78
78
|
isVoipRegistered = true
|
|
79
79
|
} else {
|
|
80
80
|
#if DEBUG
|
|
81
|
-
|
|
81
|
+
NSLog("%@","[VoipNotificationsManager] voipRegistration appDelegate not found. return")
|
|
82
82
|
#endif
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -87,7 +87,7 @@ typealias RNVoipPushNotificationCompletion = () -> Void
|
|
|
87
87
|
|
|
88
88
|
@objc public static func didUpdatePushCredentials(_ credentials: PKPushCredentials, forType type: String) {
|
|
89
89
|
#if DEBUG
|
|
90
|
-
|
|
90
|
+
NSLog("%@","[VoipNotificationsManager] didUpdatePushCredentials credentials.token = \(credentials.token), type = \(type)")
|
|
91
91
|
#endif
|
|
92
92
|
|
|
93
93
|
let voipTokenLength = credentials.token.count
|
|
@@ -103,7 +103,7 @@ typealias RNVoipPushNotificationCompletion = () -> Void
|
|
|
103
103
|
|
|
104
104
|
@objc public static func didReceiveIncomingPushWithPayload(_ payload: PKPushPayload, forType type: String) {
|
|
105
105
|
#if DEBUG
|
|
106
|
-
|
|
106
|
+
NSLog("%@","[VoipNotificationsManager] didReceiveIncomingPushWithPayload payload.dictionaryPayload = \(payload.dictionaryPayload), type = \(type)")
|
|
107
107
|
#endif
|
|
108
108
|
|
|
109
109
|
let dictionaryPayload: [String: Any] = Dictionary(uniqueKeysWithValues: payload.dictionaryPayload.map { (key, value) in
|
|
@@ -119,7 +119,7 @@ typealias RNVoipPushNotificationCompletion = () -> Void
|
|
|
119
119
|
var events: [[String: Any]] = []
|
|
120
120
|
let action = {
|
|
121
121
|
#if DEBUG
|
|
122
|
-
|
|
122
|
+
NSLog("%@","[VoipNotificationsManager][getInitialEvents] delayedEvents = \(self.delayedEvents)")
|
|
123
123
|
#endif
|
|
124
124
|
|
|
125
125
|
events = self.delayedEvents
|
|
@@ -148,7 +148,7 @@ typealias RNVoipPushNotificationCompletion = () -> Void
|
|
|
148
148
|
|
|
149
149
|
private func sendEventWithNameWrapper(name: String, body: [String: Any]?) {
|
|
150
150
|
#if DEBUG
|
|
151
|
-
|
|
151
|
+
NSLog("%@","[VoipNotificationsManager] sendEventWithNameWrapper: \(name)")
|
|
152
152
|
#endif
|
|
153
153
|
|
|
154
154
|
let sendEventAction = {
|
|
@@ -162,7 +162,7 @@ typealias RNVoipPushNotificationCompletion = () -> Void
|
|
|
162
162
|
} else {
|
|
163
163
|
self.delayedEvents.append(dictionary)
|
|
164
164
|
#if DEBUG
|
|
165
|
-
|
|
165
|
+
NSLog("%@","[VoipNotificationsManager] delayedEvents: \(self.delayedEvents)")
|
|
166
166
|
#endif
|
|
167
167
|
}
|
|
168
168
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stream-io/react-native-callingx",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1-beta.1",
|
|
4
4
|
"description": "CallKit and Telecom API capabilities for React Native",
|
|
5
5
|
"main": "./dist/module/index.js",
|
|
6
6
|
"module": "./dist/module/index.js",
|
|
@@ -70,6 +70,8 @@
|
|
|
70
70
|
"typescript": "^5.9.2"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
|
+
"@react-native-firebase/app": ">=23.0.0",
|
|
74
|
+
"@react-native-firebase/messaging": ">=23.0.0",
|
|
73
75
|
"@stream-io/react-native-webrtc": ">=137.1.2",
|
|
74
76
|
"react": "*",
|
|
75
77
|
"react-native": "*"
|
|
@@ -109,4 +111,4 @@
|
|
|
109
111
|
"tools": [],
|
|
110
112
|
"version": "0.55.0"
|
|
111
113
|
}
|
|
112
|
-
}
|
|
114
|
+
}
|
package/src/CallingxModule.ts
CHANGED
|
@@ -11,7 +11,6 @@ import type { EventListener } from './EventManager';
|
|
|
11
11
|
import {
|
|
12
12
|
type ICallingxModule,
|
|
13
13
|
type InfoDisplayOptions,
|
|
14
|
-
type TextTransformer,
|
|
15
14
|
type EndCallReason,
|
|
16
15
|
type EventData,
|
|
17
16
|
type EventName,
|
|
@@ -25,7 +24,6 @@ import {
|
|
|
25
24
|
androidEndCallReasonMap,
|
|
26
25
|
defaultAndroidOptions,
|
|
27
26
|
defaultiOSOptions,
|
|
28
|
-
defaultTextTransformer,
|
|
29
27
|
iosEndCallReasonMap,
|
|
30
28
|
} from './utils/constants';
|
|
31
29
|
import { isVoipEvent } from './utils/utils';
|
|
@@ -35,8 +33,8 @@ class CallingxModule implements ICallingxModule {
|
|
|
35
33
|
private _isOngoingCallsEnabled = false;
|
|
36
34
|
private _isHeadlessTaskRegistered = false;
|
|
37
35
|
|
|
38
|
-
private titleTransformer:
|
|
39
|
-
|
|
36
|
+
private titleTransformer: (memberName: string, incoming: boolean) => string =
|
|
37
|
+
(memberName: string) => memberName;
|
|
40
38
|
|
|
41
39
|
private eventManager: EventManager<EventName, EventParams> =
|
|
42
40
|
new EventManager();
|
|
@@ -74,13 +72,13 @@ class CallingxModule implements ICallingxModule {
|
|
|
74
72
|
if (Platform.OS === 'android') {
|
|
75
73
|
const {
|
|
76
74
|
titleTransformer,
|
|
77
|
-
subtitleTransformer,
|
|
78
75
|
incomingChannel,
|
|
79
76
|
ongoingChannel,
|
|
77
|
+
notificationTexts,
|
|
80
78
|
} = options.android ?? {};
|
|
81
79
|
|
|
82
|
-
this.titleTransformer =
|
|
83
|
-
|
|
80
|
+
this.titleTransformer =
|
|
81
|
+
titleTransformer ?? ((memberName: string) => memberName);
|
|
84
82
|
|
|
85
83
|
const notificationsConfig = {
|
|
86
84
|
incomingChannel: {
|
|
@@ -91,6 +89,7 @@ class CallingxModule implements ICallingxModule {
|
|
|
91
89
|
...defaultAndroidOptions.ongoingChannel,
|
|
92
90
|
...(ongoingChannel ?? {}),
|
|
93
91
|
},
|
|
92
|
+
notificationTexts,
|
|
94
93
|
};
|
|
95
94
|
|
|
96
95
|
if (
|
|
@@ -133,7 +132,6 @@ class CallingxModule implements ICallingxModule {
|
|
|
133
132
|
): Promise<void> {
|
|
134
133
|
const displayOptions: InfoDisplayOptions = {
|
|
135
134
|
displayTitle: this.titleTransformer(callerName, true),
|
|
136
|
-
displaySubtitle: this.subtitleTransformer?.(phoneNumber, true),
|
|
137
135
|
};
|
|
138
136
|
return NativeCallingModule.displayIncomingCall(
|
|
139
137
|
callId,
|
|
@@ -157,7 +155,6 @@ class CallingxModule implements ICallingxModule {
|
|
|
157
155
|
): Promise<void> {
|
|
158
156
|
const displayOptions: InfoDisplayOptions = {
|
|
159
157
|
displayTitle: this.titleTransformer(callerName, false),
|
|
160
|
-
displaySubtitle: this.subtitleTransformer?.(phoneNumber, false),
|
|
161
158
|
};
|
|
162
159
|
return NativeCallingModule.startCall(
|
|
163
160
|
callId,
|
|
@@ -172,10 +169,10 @@ class CallingxModule implements ICallingxModule {
|
|
|
172
169
|
callId: string,
|
|
173
170
|
phoneNumber: string,
|
|
174
171
|
callerName: string,
|
|
172
|
+
incoming: boolean,
|
|
175
173
|
): Promise<void> {
|
|
176
174
|
const displayOptions: InfoDisplayOptions = {
|
|
177
|
-
displayTitle: this.titleTransformer(callerName,
|
|
178
|
-
displaySubtitle: this.subtitleTransformer?.(phoneNumber, false), //adjust incoming or outgoing call
|
|
175
|
+
displayTitle: this.titleTransformer(callerName, incoming),
|
|
179
176
|
};
|
|
180
177
|
return NativeCallingModule.updateDisplay(
|
|
181
178
|
callId,
|
|
@@ -237,16 +234,6 @@ class CallingxModule implements ICallingxModule {
|
|
|
237
234
|
);
|
|
238
235
|
}
|
|
239
236
|
|
|
240
|
-
// Check if service is started (Android only)
|
|
241
|
-
if (Platform.OS === 'android') {
|
|
242
|
-
const isServiceStarted = await NativeCallingModule.isServiceStarted();
|
|
243
|
-
if (!isServiceStarted) {
|
|
244
|
-
throw new Error(
|
|
245
|
-
'Service is not started. Call displayIncomingCall or startCall first.',
|
|
246
|
-
);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
237
|
return NativeCallingModule.startBackgroundTask(HEADLESS_TASK_NAME, 0);
|
|
251
238
|
}
|
|
252
239
|
|
|
@@ -255,10 +242,22 @@ class CallingxModule implements ICallingxModule {
|
|
|
255
242
|
return NativeCallingModule.stopBackgroundTask(HEADLESS_TASK_NAME);
|
|
256
243
|
}
|
|
257
244
|
|
|
245
|
+
fulfillAnswerCallAction(callId: string, didFail: boolean): void {
|
|
246
|
+
NativeCallingModule.fulfillAnswerCallAction(callId, didFail);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
fulfillEndCallAction(callId: string, didFail: boolean): void {
|
|
250
|
+
NativeCallingModule.fulfillEndCallAction(callId, didFail);
|
|
251
|
+
}
|
|
252
|
+
|
|
258
253
|
registerVoipToken(): void {
|
|
259
254
|
NativeCallingModule.registerVoipToken();
|
|
260
255
|
}
|
|
261
256
|
|
|
257
|
+
stopService(): Promise<void> {
|
|
258
|
+
return NativeCallingModule.stopService();
|
|
259
|
+
}
|
|
260
|
+
|
|
262
261
|
addEventListener<T extends EventName | VoipEventName>(
|
|
263
262
|
eventName: T,
|
|
264
263
|
callback: EventListener<
|
|
@@ -31,6 +31,10 @@ export interface Spec extends TurboModule {
|
|
|
31
31
|
id: string;
|
|
32
32
|
name: string;
|
|
33
33
|
};
|
|
34
|
+
notificationTexts?: {
|
|
35
|
+
accepting?: string;
|
|
36
|
+
rejecting?: string;
|
|
37
|
+
};
|
|
34
38
|
}): void;
|
|
35
39
|
|
|
36
40
|
setShouldRejectCallWhenBusy(shouldReject: boolean): void;
|
|
@@ -86,7 +90,6 @@ export interface Spec extends TurboModule {
|
|
|
86
90
|
hasVideo: boolean,
|
|
87
91
|
displayOptions?: {
|
|
88
92
|
displayTitle?: string;
|
|
89
|
-
displaySubtitle?: string;
|
|
90
93
|
},
|
|
91
94
|
): Promise<void>;
|
|
92
95
|
|
|
@@ -100,7 +103,6 @@ export interface Spec extends TurboModule {
|
|
|
100
103
|
hasVideo: boolean,
|
|
101
104
|
displayOptions?: {
|
|
102
105
|
displayTitle?: string;
|
|
103
|
-
displaySubtitle?: string;
|
|
104
106
|
},
|
|
105
107
|
): Promise<void>;
|
|
106
108
|
|
|
@@ -110,7 +112,6 @@ export interface Spec extends TurboModule {
|
|
|
110
112
|
callerName: string,
|
|
111
113
|
displayOptions?: {
|
|
112
114
|
displayTitle?: string;
|
|
113
|
-
displaySubtitle?: string;
|
|
114
115
|
},
|
|
115
116
|
): Promise<void>;
|
|
116
117
|
|
|
@@ -127,15 +128,18 @@ export interface Spec extends TurboModule {
|
|
|
127
128
|
setOnHoldCall(callId: string, isOnHold: boolean): Promise<void>;
|
|
128
129
|
|
|
129
130
|
registerBackgroundTaskAvailable(): void;
|
|
130
|
-
|
|
131
|
-
isServiceStarted(): Promise<boolean>;
|
|
132
|
-
|
|
133
131
|
startBackgroundTask(taskName: string, timeout: number): Promise<void>;
|
|
134
132
|
|
|
135
133
|
stopBackgroundTask(taskName: string): Promise<void>;
|
|
136
134
|
|
|
135
|
+
fulfillAnswerCallAction(callId: string, didFail: boolean): void;
|
|
136
|
+
|
|
137
|
+
fulfillEndCallAction(callId: string, didFail: boolean): void;
|
|
138
|
+
|
|
137
139
|
registerVoipToken(): void;
|
|
138
140
|
|
|
141
|
+
stopService(): Promise<void>;
|
|
142
|
+
|
|
139
143
|
readonly onNewEvent: EventEmitter<{
|
|
140
144
|
eventName: string;
|
|
141
145
|
params: {
|
package/src/types.ts
CHANGED
|
@@ -73,6 +73,7 @@ export interface ICallingxModule {
|
|
|
73
73
|
callId: string,
|
|
74
74
|
phoneNumber: string,
|
|
75
75
|
callerName: string,
|
|
76
|
+
incoming: boolean,
|
|
76
77
|
): Promise<void>;
|
|
77
78
|
|
|
78
79
|
/**
|
|
@@ -121,8 +122,26 @@ export interface ICallingxModule {
|
|
|
121
122
|
|
|
122
123
|
stopBackgroundTask(taskName: string): Promise<void>;
|
|
123
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Fulfill or fail a pending CXAnswerCallAction on iOS.
|
|
127
|
+
* Must be called after starting the JS-side joining process (e.g: without awaiting for call.join() to complete)
|
|
128
|
+
* @param callId - The call id.
|
|
129
|
+
* @param didFail - If true, calls action.fail(); otherwise calls action.fulfill().
|
|
130
|
+
*/
|
|
131
|
+
fulfillAnswerCallAction(callId: string, didFail: boolean): void;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Fulfill or fail a pending CXEndCallAction on iOS.
|
|
135
|
+
* Must be called after completetion of the JS-side processing (e.g: after call.leave() is done).
|
|
136
|
+
* @param callId - The call id.
|
|
137
|
+
* @param didFail - If true, calls action.fail(); otherwise calls action.fulfill().
|
|
138
|
+
*/
|
|
139
|
+
fulfillEndCallAction(callId: string, didFail: boolean): void;
|
|
140
|
+
|
|
124
141
|
registerVoipToken(): void;
|
|
125
142
|
|
|
143
|
+
stopService(): Promise<void>;
|
|
144
|
+
|
|
126
145
|
/**
|
|
127
146
|
* Single entry point for adding event listeners.
|
|
128
147
|
* Automatically routes to the appropriate manager based on event type.
|
|
@@ -195,13 +214,27 @@ export type InternalAndroidOptions = {
|
|
|
195
214
|
id?: string;
|
|
196
215
|
name?: string;
|
|
197
216
|
};
|
|
217
|
+
/**
|
|
218
|
+
* Texts used for call state notifications while the system is connecting or declining the call.
|
|
219
|
+
* If not provided, platform defaults will be used.
|
|
220
|
+
*/
|
|
221
|
+
notificationTexts?: {
|
|
222
|
+
/**
|
|
223
|
+
* Text shown while optimistically accepting a call.
|
|
224
|
+
* @default "Connecting..."
|
|
225
|
+
*/
|
|
226
|
+
accepting?: string;
|
|
227
|
+
/**
|
|
228
|
+
* Text shown while optimistically rejecting a call.
|
|
229
|
+
* @default "Declining..."
|
|
230
|
+
*/
|
|
231
|
+
rejecting?: string;
|
|
232
|
+
};
|
|
198
233
|
};
|
|
199
234
|
type AndroidOptions = InternalAndroidOptions & NotificationTransformers;
|
|
200
235
|
|
|
201
|
-
export type TextTransformer = (text: string, incoming: boolean) => string;
|
|
202
236
|
export type NotificationTransformers = {
|
|
203
|
-
titleTransformer?:
|
|
204
|
-
subtitleTransformer?: TextTransformer;
|
|
237
|
+
titleTransformer?: (memberName: string, incoming: boolean) => string;
|
|
205
238
|
};
|
|
206
239
|
|
|
207
240
|
export type CallingExpOptions = {
|
|
@@ -221,7 +254,6 @@ export type CallingExpOptions = {
|
|
|
221
254
|
|
|
222
255
|
export type InfoDisplayOptions = {
|
|
223
256
|
displayTitle?: string;
|
|
224
|
-
displaySubtitle?: string;
|
|
225
257
|
};
|
|
226
258
|
|
|
227
259
|
export type EventData = {
|
package/src/utils/constants.ts
CHANGED
|
@@ -2,12 +2,9 @@ import type {
|
|
|
2
2
|
InternalAndroidOptions,
|
|
3
3
|
InternalIOSOptions,
|
|
4
4
|
EndCallReason,
|
|
5
|
-
TextTransformer,
|
|
6
5
|
} from '../types';
|
|
7
6
|
import type { DeepRequired } from './types';
|
|
8
7
|
|
|
9
|
-
export const defaultTextTransformer: TextTransformer = (text: string) => text;
|
|
10
|
-
|
|
11
8
|
export const defaultiOSOptions: Required<InternalIOSOptions> = {
|
|
12
9
|
supportsVideo: true,
|
|
13
10
|
maximumCallsPerCallGroup: 1,
|
|
@@ -19,7 +16,10 @@ export const defaultiOSOptions: Required<InternalIOSOptions> = {
|
|
|
19
16
|
displayCallTimeout: 60000, // 1 minute
|
|
20
17
|
};
|
|
21
18
|
|
|
22
|
-
export const defaultAndroidOptions:
|
|
19
|
+
export const defaultAndroidOptions: Omit<
|
|
20
|
+
DeepRequired<InternalAndroidOptions>,
|
|
21
|
+
'notificationTexts'
|
|
22
|
+
> = {
|
|
23
23
|
incomingChannel: {
|
|
24
24
|
id: 'stream_incoming_calls_channel',
|
|
25
25
|
name: 'Incoming calls',
|
|
@@ -48,17 +48,28 @@ export const iosEndCallReasonMap: Record<EndCallReason, number> = {
|
|
|
48
48
|
unknown: 1, // .failed (no iOS equivalent)
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
// Android: maps to android.telecom.DisconnectCause constants
|
|
52
|
-
//
|
|
51
|
+
// Android: maps to a limited subset of android.telecom.DisconnectCause constants
|
|
52
|
+
// that are allowed when using the CallControl / core-telecom APIs.
|
|
53
|
+
//
|
|
54
|
+
// Per platform docs, only the following codes are valid when disconnecting a call:
|
|
55
|
+
// - DisconnectCause.LOCAL
|
|
56
|
+
// - DisconnectCause.REMOTE
|
|
57
|
+
// - DisconnectCause.REJECTED
|
|
58
|
+
// - DisconnectCause.MISSED
|
|
59
|
+
//
|
|
60
|
+
// Numeric values (from android.telecom.DisconnectCause):
|
|
61
|
+
// LOCAL = 2, REMOTE = 3, REJECTED = 6, MISSED = 5
|
|
62
|
+
//
|
|
63
|
+
// We therefore collapse all high-level EndCallReason variants to this allowed set.
|
|
53
64
|
export const androidEndCallReasonMap: Record<EndCallReason, number> = {
|
|
54
65
|
local: 2, // LOCAL
|
|
55
66
|
remote: 3, // REMOTE
|
|
56
67
|
rejected: 6, // REJECTED
|
|
57
|
-
busy:
|
|
58
|
-
answeredElsewhere:
|
|
68
|
+
busy: 6, // map busy -> REJECTED
|
|
69
|
+
answeredElsewhere: 3, // map answeredElsewhere -> REMOTE
|
|
59
70
|
missed: 5, // MISSED
|
|
60
|
-
error:
|
|
61
|
-
canceled:
|
|
62
|
-
restricted:
|
|
63
|
-
unknown:
|
|
71
|
+
error: 2, // map error -> LOCAL
|
|
72
|
+
canceled: 2, // map canceled -> LOCAL
|
|
73
|
+
restricted: 6, // map restricted -> REJECTED
|
|
74
|
+
unknown: 2, // map unknown -> LOCAL
|
|
64
75
|
};
|
/package/android/src/main/java/io/getstream/rn/callingx/{ResourceUtils.kt → utils/ResourceUtils.kt}
RENAMED
|
File without changes
|
|
File without changes
|