@stream-io/react-native-callingx 0.1.0-beta.4 → 0.1.0-beta.5
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/README.md +0 -1
- package/android/src/main/java/io/getstream/rn/callingx/CallService.kt +60 -21
- package/android/src/main/java/io/getstream/rn/callingx/CallingxModule.kt +146 -57
- package/android/src/main/java/io/getstream/rn/callingx/repo/TelecomCallRepository.kt +3 -0
- package/dist/module/CallingxModule.js +2 -2
- package/dist/module/CallingxModule.js.map +1 -1
- package/dist/typescript/src/CallingxModule.d.ts +1 -1
- package/dist/typescript/src/CallingxModule.d.ts.map +1 -1
- package/dist/typescript/src/spec/NativeCallingx.d.ts +1 -1
- package/dist/typescript/src/spec/NativeCallingx.d.ts.map +1 -1
- package/dist/typescript/src/types.d.ts +2 -2
- package/dist/typescript/src/types.d.ts.map +1 -1
- package/ios/Callingx.mm +20 -10
- package/ios/CallingxCall.swift +105 -0
- package/ios/CallingxImpl.swift +136 -70
- package/ios/CallingxPublic.h +2 -5
- package/ios/UUIDStorage.swift +71 -26
- package/package.json +3 -3
- package/src/CallingxModule.ts +2 -2
- package/src/spec/NativeCallingx.ts +1 -1
- package/src/types.ts +2 -2
package/ios/UUIDStorage.swift
CHANGED
|
@@ -1,34 +1,78 @@
|
|
|
1
1
|
import Foundation
|
|
2
2
|
|
|
3
3
|
@objcMembers public class UUIDStorage: NSObject {
|
|
4
|
-
|
|
5
|
-
private var
|
|
4
|
+
/// Primary storage: cid -> CallingxCall
|
|
5
|
+
private var callsByCid: [String: CallingxCall] = [:]
|
|
6
|
+
/// Reverse lookup: lowercased UUID string -> CallingxCall
|
|
7
|
+
private var callsByUUID: [String: CallingxCall] = [:]
|
|
6
8
|
private let queue = DispatchQueue(label: "com.stream.uuidstorage", attributes: [])
|
|
7
9
|
|
|
8
10
|
public override init() {
|
|
9
11
|
super.init()
|
|
10
12
|
}
|
|
11
13
|
|
|
14
|
+
// MARK: - CallingxCall-based API (new)
|
|
15
|
+
|
|
16
|
+
/// Returns the existing call for the given cid, or creates a new one.
|
|
17
|
+
public func getOrCreateCall(forCid cid: String, isOutgoing: Bool = false) -> CallingxCall {
|
|
18
|
+
return queue.sync {
|
|
19
|
+
if let existing = callsByCid[cid] {
|
|
20
|
+
#if DEBUG
|
|
21
|
+
print("[UUIDStorage] getOrCreateCall: found existing \(existing)")
|
|
22
|
+
#endif
|
|
23
|
+
return existing
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let uuid = UUID()
|
|
27
|
+
let call = CallingxCall(uuid: uuid, cid: cid, isOutgoing: isOutgoing)
|
|
28
|
+
let uuidString = uuid.uuidString.lowercased()
|
|
29
|
+
callsByCid[cid] = call
|
|
30
|
+
callsByUUID[uuidString] = call
|
|
31
|
+
#if DEBUG
|
|
32
|
+
print("[UUIDStorage] getOrCreateCall: created \(call)")
|
|
33
|
+
#endif
|
|
34
|
+
return call
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/// Returns the call for the given cid, or nil if not found.
|
|
39
|
+
public func getCall(forCid cid: String) -> CallingxCall? {
|
|
40
|
+
return queue.sync {
|
|
41
|
+
return callsByCid[cid]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/// Returns the call for the given UUID, or nil if not found.
|
|
46
|
+
public func getCallByUUID(_ uuid: UUID) -> CallingxCall? {
|
|
47
|
+
return queue.sync {
|
|
48
|
+
let uuidString = uuid.uuidString.lowercased()
|
|
49
|
+
return callsByUUID[uuidString]
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// MARK: - Legacy API (preserved for backward compatibility)
|
|
54
|
+
|
|
12
55
|
public func allUUIDs() -> [UUID] {
|
|
13
56
|
return queue.sync {
|
|
14
|
-
return
|
|
57
|
+
return callsByCid.values.map { $0.uuid }
|
|
15
58
|
}
|
|
16
59
|
}
|
|
17
60
|
|
|
61
|
+
/// Returns the existing UUID for the given cid, or creates a new CallingxCall and returns its UUID.
|
|
18
62
|
public func getOrCreateUUID(forCid cid: String) -> UUID {
|
|
19
63
|
return queue.sync {
|
|
20
|
-
|
|
21
|
-
if let existingUUID = uuidDict[cid] {
|
|
64
|
+
if let existing = callsByCid[cid] {
|
|
22
65
|
#if DEBUG
|
|
23
|
-
print("[UUIDStorage] getUUIDForCid: found existing UUID \(
|
|
66
|
+
print("[UUIDStorage] getUUIDForCid: found existing UUID \(existing.uuid.uuidString.lowercased()) for cid \(cid)")
|
|
24
67
|
#endif
|
|
25
|
-
return
|
|
68
|
+
return existing.uuid
|
|
26
69
|
}
|
|
27
70
|
|
|
28
71
|
let uuid = UUID()
|
|
72
|
+
let call = CallingxCall(uuid: uuid, cid: cid, isOutgoing: false)
|
|
29
73
|
let uuidString = uuid.uuidString.lowercased()
|
|
30
|
-
|
|
31
|
-
|
|
74
|
+
callsByCid[cid] = call
|
|
75
|
+
callsByUUID[uuidString] = call
|
|
32
76
|
#if DEBUG
|
|
33
77
|
print("[UUIDStorage] getUUIDForCid: created new UUID \(uuidString) for cid \(cid)")
|
|
34
78
|
#endif
|
|
@@ -38,15 +82,14 @@ import Foundation
|
|
|
38
82
|
|
|
39
83
|
public func getUUID(forCid cid: String) -> UUID? {
|
|
40
84
|
return queue.sync {
|
|
41
|
-
|
|
42
|
-
return UUID(uuidString: uuidString)
|
|
85
|
+
return callsByCid[cid]?.uuid
|
|
43
86
|
}
|
|
44
87
|
}
|
|
45
88
|
|
|
46
89
|
public func getCid(forUUID uuid: UUID) -> String? {
|
|
47
90
|
return queue.sync {
|
|
48
91
|
let uuidString = uuid.uuidString.lowercased()
|
|
49
|
-
let cid =
|
|
92
|
+
let cid = callsByUUID[uuidString]?.cid
|
|
50
93
|
#if DEBUG
|
|
51
94
|
print("[UUIDStorage] getCidForUUID: UUID \(uuidString) -> cid \(cid ?? "(not found)")")
|
|
52
95
|
#endif
|
|
@@ -57,11 +100,11 @@ import Foundation
|
|
|
57
100
|
public func removeCid(forUUID uuid: UUID) {
|
|
58
101
|
queue.sync {
|
|
59
102
|
let uuidString = uuid.uuidString.lowercased()
|
|
60
|
-
if let
|
|
61
|
-
|
|
62
|
-
|
|
103
|
+
if let call = callsByUUID[uuidString] {
|
|
104
|
+
callsByCid.removeValue(forKey: call.cid)
|
|
105
|
+
callsByUUID.removeValue(forKey: uuidString)
|
|
63
106
|
#if DEBUG
|
|
64
|
-
print("[UUIDStorage] removeCidForUUID: removed cid \(cid) for UUID \(uuidString)")
|
|
107
|
+
print("[UUIDStorage] removeCidForUUID: removed cid \(call.cid) for UUID \(uuidString)")
|
|
65
108
|
#endif
|
|
66
109
|
} else {
|
|
67
110
|
#if DEBUG
|
|
@@ -73,9 +116,10 @@ import Foundation
|
|
|
73
116
|
|
|
74
117
|
public func removeCid(_ cid: String) {
|
|
75
118
|
queue.sync {
|
|
76
|
-
if let
|
|
77
|
-
|
|
78
|
-
|
|
119
|
+
if let call = callsByCid[cid] {
|
|
120
|
+
let uuidString = call.uuid.uuidString.lowercased()
|
|
121
|
+
callsByUUID.removeValue(forKey: uuidString)
|
|
122
|
+
callsByCid.removeValue(forKey: cid)
|
|
79
123
|
#if DEBUG
|
|
80
124
|
print("[UUIDStorage] removeCid: removed cid \(cid) with UUID \(uuidString)")
|
|
81
125
|
#endif
|
|
@@ -89,9 +133,9 @@ import Foundation
|
|
|
89
133
|
|
|
90
134
|
public func removeAllObjects() {
|
|
91
135
|
queue.sync {
|
|
92
|
-
let count =
|
|
93
|
-
|
|
94
|
-
|
|
136
|
+
let count = callsByCid.count
|
|
137
|
+
callsByCid.removeAll()
|
|
138
|
+
callsByUUID.removeAll()
|
|
95
139
|
#if DEBUG
|
|
96
140
|
print("[UUIDStorage] removeAllObjects: cleared \(count) entries")
|
|
97
141
|
#endif
|
|
@@ -100,25 +144,26 @@ import Foundation
|
|
|
100
144
|
|
|
101
145
|
public func count() -> Int {
|
|
102
146
|
return queue.sync {
|
|
103
|
-
return
|
|
147
|
+
return callsByCid.count
|
|
104
148
|
}
|
|
105
149
|
}
|
|
106
150
|
|
|
107
151
|
public func containsCid(_ cid: String) -> Bool {
|
|
108
152
|
return queue.sync {
|
|
109
|
-
return
|
|
153
|
+
return callsByCid[cid] != nil
|
|
110
154
|
}
|
|
111
155
|
}
|
|
112
156
|
|
|
113
157
|
public func containsUUID(_ uuid: UUID) -> Bool {
|
|
114
158
|
return queue.sync {
|
|
115
|
-
return
|
|
159
|
+
return callsByUUID[uuid.uuidString.lowercased()] != nil
|
|
116
160
|
}
|
|
117
161
|
}
|
|
118
162
|
|
|
119
163
|
public override var description: String {
|
|
120
164
|
return queue.sync {
|
|
121
|
-
|
|
165
|
+
let entries = callsByCid.map { "\($0.key): \($0.value)" }.joined(separator: ", ")
|
|
166
|
+
return "UUIDStorage: [\(entries)]"
|
|
122
167
|
}
|
|
123
168
|
}
|
|
124
169
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stream-io/react-native-callingx",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.5",
|
|
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",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@react-native-community/cli": "20.0.1",
|
|
63
63
|
"@react-native/babel-preset": "^0.81.5",
|
|
64
|
-
"@stream-io/react-native-webrtc": "137.1.2
|
|
64
|
+
"@stream-io/react-native-webrtc": "137.1.2",
|
|
65
65
|
"@types/react": "^19.1.0",
|
|
66
66
|
"del-cli": "^6.0.0",
|
|
67
67
|
"react": "19.1.0",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"typescript": "^5.9.2"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
|
-
"@stream-io/react-native-webrtc": ">=137.1.
|
|
73
|
+
"@stream-io/react-native-webrtc": ">=137.1.2",
|
|
74
74
|
"react": "*",
|
|
75
75
|
"react-native": "*"
|
|
76
76
|
},
|
package/src/CallingxModule.ts
CHANGED
|
@@ -196,8 +196,8 @@ class CallingxModule implements ICallingxModule {
|
|
|
196
196
|
return NativeCallingModule.endCallWithReason(callId, reasons[reason]);
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
|
|
200
|
-
return NativeCallingModule.
|
|
199
|
+
isCallTracked(callId: string): boolean {
|
|
200
|
+
return NativeCallingModule.isCallTracked(callId);
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
hasRegisteredCall(): boolean {
|
package/src/types.ts
CHANGED
|
@@ -76,11 +76,11 @@ export interface ICallingxModule {
|
|
|
76
76
|
): Promise<void>;
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
|
-
* Check if the call is
|
|
79
|
+
* Check if the call is tracked in the native calling module.
|
|
80
80
|
* @param callId - The call id.
|
|
81
81
|
* @returns The boolean value.
|
|
82
82
|
*/
|
|
83
|
-
|
|
83
|
+
isCallTracked(callId: string): boolean;
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
86
|
* Check if there is a registered call.
|