|
1 | | -export type Events = |
2 | | - 'didReceiveStartCallAction' | |
3 | | - 'answerCall' | |
4 | | - 'endCall' | |
5 | | - 'didActivateAudioSession' | |
6 | | - 'didDeactivateAudioSession' | |
7 | | - 'didDisplayIncomingCall' | |
8 | | - 'didToggleHoldCallAction' | |
9 | | - 'didPerformDTMFAction' | |
10 | | - 'didResetProvider' | |
11 | | - 'checkReachability' | |
12 | | - 'didPerformSetMutedCallAction' | |
13 | | - 'didLoadWithEvents'; |
14 | | - |
15 | | -type HandleType = 'generic' | 'number' | 'email'; |
16 | | - |
17 | | -interface IOptions { |
18 | | - ios: { |
19 | | - appName: string, |
20 | | - imageName?: string, |
21 | | - supportsVideo?: boolean, |
22 | | - maximumCallGroups?: string, |
23 | | - maximumCallsPerCallGroup?: string, |
24 | | - ringtoneSound?: string, |
25 | | - }, |
26 | | - android: { |
27 | | - alertTitle: string, |
28 | | - alertDescription: string, |
29 | | - cancelButton: string, |
30 | | - okButton: string, |
31 | | - imageName?: string, |
32 | | - additionalPermissions: string[], |
33 | | - }, |
34 | | -} |
35 | | - |
36 | | -export type DidReceiveStartCallActionPayload = { handle: string }; |
37 | | -export type AnswerCallPayload = { callUUID: string }; |
38 | | -export type EndCallPayload = AnswerCallPayload; |
39 | | -export type DidDisplayIncomingCallPayload = string | undefined; |
40 | | -export type DidPerformSetMutedCallActionPayload = boolean; |
41 | | - |
42 | | -export default class RNCallKeep { |
43 | | - static addEventListener(type: Events, handler: (args: any) => void) { |
44 | | - |
45 | | - } |
46 | | - |
47 | | - static removeEventListener(type: Events) { |
48 | | - |
49 | | - } |
50 | | - |
51 | | - static async setup(options: IOptions): Promise<void> { |
52 | | - |
53 | | - } |
54 | | - |
55 | | - static hasDefaultPhoneAccount(): boolean { |
56 | | - |
57 | | - } |
58 | | - |
59 | | - static answerIncomingCall(uuid: string) { |
60 | | - |
61 | | - } |
62 | | - |
63 | | - static registerPhoneAccount(): void { |
64 | | - |
65 | | - } |
66 | | - |
67 | | - static registerAndroidEvents(): void { |
68 | | - |
69 | | - } |
70 | | - |
71 | | - static displayIncomingCall( |
72 | | - uuid: string, |
73 | | - handle: string, |
74 | | - localizedCallerName?: string, |
75 | | - handleType?: HandleType, |
76 | | - hasVideo?: boolean, |
77 | | - ) { |
78 | | - |
79 | | - } |
80 | | - |
81 | | - static startCall( |
82 | | - uuid: string, |
83 | | - handle: string, |
84 | | - contactIdentifier?: string, |
85 | | - handleType?: HandleType, |
86 | | - hasVideo?: boolean, |
87 | | - ) { |
88 | | - |
89 | | - } |
90 | | - static updateDisplay( |
91 | | - uuid: string, |
92 | | - displayName: string, |
93 | | - handle: string, |
94 | | - ) { |
95 | | - |
96 | | - } |
97 | | - |
98 | | - /** |
| 1 | +declare module 'react-native-callkeep' { |
| 2 | + export type Events = |
| 3 | + 'didReceiveStartCallAction' | |
| 4 | + 'answerCall' | |
| 5 | + 'endCall' | |
| 6 | + 'didActivateAudioSession' | |
| 7 | + 'didDeactivateAudioSession' | |
| 8 | + 'didDisplayIncomingCall' | |
| 9 | + 'didToggleHoldCallAction' | |
| 10 | + 'didPerformDTMFAction' | |
| 11 | + 'didResetProvider' | |
| 12 | + 'checkReachability' | |
| 13 | + 'didPerformSetMutedCallAction' | |
| 14 | + 'didLoadWithEvents'; |
| 15 | + |
| 16 | + type HandleType = 'generic' | 'number' | 'email'; |
| 17 | + |
| 18 | + interface IOptions { |
| 19 | + ios: { |
| 20 | + appName: string, |
| 21 | + imageName?: string, |
| 22 | + supportsVideo?: boolean, |
| 23 | + maximumCallGroups?: string, |
| 24 | + maximumCallsPerCallGroup?: string, |
| 25 | + ringtoneSound?: string, |
| 26 | + }, |
| 27 | + android: { |
| 28 | + alertTitle: string, |
| 29 | + alertDescription: string, |
| 30 | + cancelButton: string, |
| 31 | + okButton: string, |
| 32 | + imageName?: string, |
| 33 | + additionalPermissions: string[], |
| 34 | + }, |
| 35 | + } |
| 36 | + |
| 37 | + export type DidReceiveStartCallActionPayload = { handle: string }; |
| 38 | + export type AnswerCallPayload = { callUUID: string }; |
| 39 | + export type EndCallPayload = AnswerCallPayload; |
| 40 | + export type DidDisplayIncomingCallPayload = string | undefined; |
| 41 | + export type DidPerformSetMutedCallActionPayload = boolean; |
| 42 | + |
| 43 | + export default class RNCallKeep { |
| 44 | + static addEventListener(type: Events, handler: (args: any) => void): void |
| 45 | + |
| 46 | + static removeEventListener(type: Events): void |
| 47 | + |
| 48 | + static setup(options: IOptions): Promise<void> |
| 49 | + |
| 50 | + static hasDefaultPhoneAccount(): boolean |
| 51 | + |
| 52 | + static answerIncomingCall(uuid: string): void |
| 53 | + |
| 54 | + static registerPhoneAccount(): void |
| 55 | + |
| 56 | + static registerAndroidEvents(): void |
| 57 | + |
| 58 | + static displayIncomingCall( |
| 59 | + uuid: string, |
| 60 | + handle: string, |
| 61 | + localizedCallerName?: string, |
| 62 | + handleType?: HandleType, |
| 63 | + hasVideo?: boolean, |
| 64 | + ): void |
| 65 | + |
| 66 | + static startCall( |
| 67 | + uuid: string, |
| 68 | + handle: string, |
| 69 | + contactIdentifier?: string, |
| 70 | + handleType?: HandleType, |
| 71 | + hasVideo?: boolean, |
| 72 | + ): void |
| 73 | + |
| 74 | + static updateDisplay( |
| 75 | + uuid: string, |
| 76 | + displayName: string, |
| 77 | + handle: string, |
| 78 | + ): void |
| 79 | + |
| 80 | + /** |
99 | 81 | * @description reportConnectedOutgoingCallWithUUID method is available only on iOS. |
100 | | - */ |
101 | | - static reportConnectedOutgoingCallWithUUID(uuid: string) { |
102 | | - |
103 | | - } |
| 82 | + */ |
| 83 | + static reportConnectedOutgoingCallWithUUID(uuid: string): void |
104 | 84 |
|
105 | | - /** |
| 85 | + /** |
106 | 86 | * @description reportConnectedOutgoingCallWithUUID method is available only on iOS. |
107 | | - */ |
108 | | - static reportConnectingOutgoingCallWithUUID(uuid: string): void { |
| 87 | + */ |
| 88 | + static reportConnectingOutgoingCallWithUUID(uuid: string): void |
109 | 89 |
|
110 | | - } |
111 | | - static reportEndCallWithUUID(uuid: string, reason: number): void { |
| 90 | + static reportEndCallWithUUID(uuid: string, reason: number): void |
112 | 91 |
|
113 | | - } |
| 92 | + static rejectCall(uuid: string): void |
114 | 93 |
|
115 | | - static rejectCall(uuid: string) { |
116 | | - |
117 | | - } |
| 94 | + static endCall(uuid: string): void |
118 | 95 |
|
119 | | - static endCall(uuid: string) { |
| 96 | + static endAllCalls(): void |
120 | 97 |
|
121 | | - } |
122 | | - |
123 | | - static endAllCalls() { |
124 | | - |
125 | | - } |
| 98 | + static setReachable(): void |
126 | 99 |
|
127 | | - static setReachable() { |
| 100 | + static isCallActive(uuid: string): Promise<boolean> |
128 | 101 |
|
129 | | - } |
130 | | - static isCallActive(uuid: string): Promise<boolean> { |
131 | | - |
132 | | - } |
133 | | - /** |
| 102 | + /** |
134 | 103 | * @description supportConnectionService method is available only on Android. |
135 | | - */ |
136 | | - static supportConnectionService(): boolean { |
137 | | - |
138 | | - } |
| 104 | + */ |
| 105 | + static supportConnectionService(): boolean |
139 | 106 |
|
140 | | - /** |
| 107 | + /** |
141 | 108 | * @description hasPhoneAccount method is available only on Android. |
142 | | - */ |
143 | | - static async hasPhoneAccount(): Promise<boolean> { |
144 | | - |
145 | | - } |
| 109 | + */ |
| 110 | + static hasPhoneAccount(): Promise<boolean> |
146 | 111 |
|
147 | | - static async hasOutgoingCall(): Promise<boolean> { |
| 112 | + static hasOutgoingCall(): Promise<boolean> |
148 | 113 |
|
149 | | - } |
150 | | - |
151 | | - /** |
| 114 | + /** |
152 | 115 | * @description setMutedCall method is available only on iOS. |
153 | | - */ |
154 | | - static setMutedCall(uuid: string, muted: boolean) { |
155 | | - |
156 | | - } |
157 | | - |
158 | | - static setOnHold(uuid: string, held: boolean) { |
| 116 | + */ |
| 117 | + static setMutedCall(uuid: string, muted: boolean): void |
159 | 118 |
|
160 | | - } |
| 119 | + static setOnHold(uuid: string, held: boolean): void |
161 | 120 |
|
162 | | - /** |
| 121 | + /** |
163 | 122 | * @descriptions sendDTMF is used to send DTMF tones to the PBX. |
164 | | - */ |
165 | | - static sendDTMF(uuid: string, key: string) { |
166 | | - |
167 | | - } |
168 | | - |
169 | | - static checkIfBusy(): Promise<boolean> { |
| 123 | + */ |
| 124 | + static sendDTMF(uuid: string, key: string): void |
170 | 125 |
|
171 | | - } |
172 | | - |
173 | | - static checkSpeaker(): Promise<boolean> { |
| 126 | + static checkIfBusy(): Promise<boolean> |
174 | 127 |
|
175 | | - } |
| 128 | + static checkSpeaker(): Promise<boolean> |
176 | 129 |
|
177 | | - /** |
| 130 | + /** |
178 | 131 | * @description setAvailable method is available only on Android. |
179 | | - */ |
180 | | - static setAvailable(active: boolean) { |
181 | | - |
182 | | - } |
183 | | - |
184 | | - static setCurrentCallActive(callUUID: string) { |
185 | | - |
186 | | - } |
| 132 | + */ |
| 133 | + static setAvailable(active: boolean): void |
187 | 134 |
|
188 | | - static backToForeground() { |
| 135 | + static setCurrentCallActive(callUUID: string): void |
189 | 136 |
|
| 137 | + static backToForeground(): void |
190 | 138 | } |
191 | 139 | } |
0 commit comments