Skip to content

Commit 5e8a08b

Browse files
committed
Update index.d.ts
Updated index.d.ts in order to resolve bunch of `An implementation cannot be declared in ambient contexts.` typescript-errors
1 parent 1a4e31a commit 5e8a08b

File tree

1 file changed

+112
-164
lines changed

1 file changed

+112
-164
lines changed

index.d.ts

Lines changed: 112 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -1,191 +1,139 @@
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+
/**
9981
* @description reportConnectedOutgoingCallWithUUID method is available only on iOS.
100-
*/
101-
static reportConnectedOutgoingCallWithUUID(uuid: string) {
102-
103-
}
82+
*/
83+
static reportConnectedOutgoingCallWithUUID(uuid: string): void
10484

105-
/**
85+
/**
10686
* @description reportConnectedOutgoingCallWithUUID method is available only on iOS.
107-
*/
108-
static reportConnectingOutgoingCallWithUUID(uuid: string): void {
87+
*/
88+
static reportConnectingOutgoingCallWithUUID(uuid: string): void
10989

110-
}
111-
static reportEndCallWithUUID(uuid: string, reason: number): void {
90+
static reportEndCallWithUUID(uuid: string, reason: number): void
11291

113-
}
92+
static rejectCall(uuid: string): void
11493

115-
static rejectCall(uuid: string) {
116-
117-
}
94+
static endCall(uuid: string): void
11895

119-
static endCall(uuid: string) {
96+
static endAllCalls(): void
12097

121-
}
122-
123-
static endAllCalls() {
124-
125-
}
98+
static setReachable(): void
12699

127-
static setReachable() {
100+
static isCallActive(uuid: string): Promise<boolean>
128101

129-
}
130-
static isCallActive(uuid: string): Promise<boolean> {
131-
132-
}
133-
/**
102+
/**
134103
* @description supportConnectionService method is available only on Android.
135-
*/
136-
static supportConnectionService(): boolean {
137-
138-
}
104+
*/
105+
static supportConnectionService(): boolean
139106

140-
/**
107+
/**
141108
* @description hasPhoneAccount method is available only on Android.
142-
*/
143-
static async hasPhoneAccount(): Promise<boolean> {
144-
145-
}
109+
*/
110+
static hasPhoneAccount(): Promise<boolean>
146111

147-
static async hasOutgoingCall(): Promise<boolean> {
112+
static hasOutgoingCall(): Promise<boolean>
148113

149-
}
150-
151-
/**
114+
/**
152115
* @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
159118

160-
}
119+
static setOnHold(uuid: string, held: boolean): void
161120

162-
/**
121+
/**
163122
* @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
170125

171-
}
172-
173-
static checkSpeaker(): Promise<boolean> {
126+
static checkIfBusy(): Promise<boolean>
174127

175-
}
128+
static checkSpeaker(): Promise<boolean>
176129

177-
/**
130+
/**
178131
* @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
187134

188-
static backToForeground() {
135+
static setCurrentCallActive(callUUID: string): void
189136

137+
static backToForeground(): void
190138
}
191139
}

0 commit comments

Comments
 (0)