Skip to content

Commit b340006

Browse files
authored
Merge pull request #30 from mediot-inc/master
Fix IllegalArgumentException
2 parents 197c718 + 87783b7 commit b340006

File tree

5 files changed

+159
-2
lines changed

5 files changed

+159
-2
lines changed

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
buildscript {
22
repositories {
3-
jcenter()
43
google()
4+
jcenter()
55
}
66

77
dependencies {

android/src/main/java/io/wazo/callkeep/RNCallKeepModule.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
// @see https://github.com/kbagchiGWC/voice-quickstart-android/blob/9a2aff7fbe0d0a5ae9457b48e9ad408740dfb968/exampleConnectionService/src/main/java/com/twilio/voice/examples/connectionservice/VoiceConnectionServiceActivity.java
5151
public class RNCallKeepModule extends ReactContextBaseJavaModule {
52-
public static final int REQUEST_READ_PHONE_STATE = 394858;
52+
public static final int REQUEST_READ_PHONE_STATE = 1337;
5353
public static final int REQUEST_REGISTER_CALL_PROVIDER = 394859;
5454

5555
public static final String CHECKING_PERMS = "CHECKING_PERMS";
@@ -228,6 +228,18 @@ public static Boolean isConnectionServiceAvailable() {
228228
return Build.VERSION.SDK_INT >= 23;
229229
}
230230

231+
@ReactMethod
232+
public void backToForeground() {
233+
Context context = getAppContext();
234+
String packageName = context.getApplicationContext().getPackageName();
235+
Intent focusIntent = context.getPackageManager().getLaunchIntentForPackage(packageName).cloneFilter();
236+
237+
focusIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
238+
239+
Activity activity = getCurrentActivity();
240+
activity.startActivity(focusIntent);
241+
}
242+
231243
private void registerPhoneAccount(Context appContext) {
232244
if (!isConnectionServiceAvailable()) {
233245
return;

index.d.ts

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
export type Events = 'didReceiveStartCallAction' |
2+
'answerCall' |
3+
'endCall' |
4+
'didActivateAudioSession' |
5+
'didDisplayIncomingCall' |
6+
'didPerformSetMutedCallAction';
7+
8+
type HandleType = 'generic' | 'number' | 'email';
9+
10+
interface IOptions {
11+
ios: {
12+
appName: string,
13+
imageName?: string,
14+
ringtoneSound?: string,
15+
},
16+
android: {
17+
alertTitle: string,
18+
alertDescription: string,
19+
cancelButton: string,
20+
okButton: string,
21+
},
22+
}
23+
24+
export type DidReceiveStartCallActionPayload = { handle: string };
25+
export type AnswerCallPayload = { callUUID: string };
26+
export type EndCallPayload = AnswerCallPayload;
27+
export type DidDisplayIncomingCallPayload = string | undefined;
28+
export type DidPerformSetMutedCallActionPayload = boolean;
29+
30+
export default class RNCallKeep {
31+
static addEventListener(type: Events, handler: (args: any) => void) {
32+
33+
}
34+
35+
static removeEventListener(type: Events, handler: (args: any) => void) {
36+
37+
}
38+
39+
static async setup(options: IOptions): Promise<void> {
40+
41+
}
42+
43+
static displayIncomingCall(
44+
uuid: string,
45+
handle: string,
46+
localizedCallerName?: string,
47+
handleType?: HandleType,
48+
hasVideo?: boolean,
49+
) {
50+
51+
}
52+
53+
/**
54+
* @description startCall method is available only on iOS.
55+
*/
56+
static startCall(
57+
uuid: string,
58+
handle: string,
59+
handleType?: HandleType,
60+
hasVideo: boolean,
61+
contactIdentifier?: string,
62+
) {
63+
64+
}
65+
66+
/**
67+
* @description reportConnectedOutgoingCallWithUUID method is available only on iOS.
68+
*/
69+
static reportConnectedOutgoingCallWithUUID(uuid: string) {
70+
71+
}
72+
73+
static endCall(uuid: string) {
74+
75+
}
76+
77+
static endAllCalls() {
78+
79+
}
80+
81+
/**
82+
* @description supportConnectionService method is available only on Android.
83+
*/
84+
static supportConnectionService(): boolean {
85+
86+
}
87+
88+
/**
89+
* @description hasPhoneAccount method is available only on Android.
90+
*/
91+
static async hasPhoneAccount(): Promise<boolean> {
92+
93+
}
94+
95+
/**
96+
* @description setMutedCall method is available only on iOS.
97+
*/
98+
static setMutedCall(uuid: string, muted: boolean) {
99+
100+
}
101+
102+
/**
103+
* @description setMutedCall method is available only on iOS.
104+
*/
105+
static checkIfBusy(): Promise<boolean> {
106+
107+
}
108+
109+
/**
110+
* @description setMutedCall method is available only on iOS.
111+
*/
112+
static checkSpeaker(): Promise<boolean> {
113+
114+
}
115+
116+
/**
117+
* @description setAvailable method is available only on Android.
118+
*/
119+
static setAvailable(active: boolean) {
120+
121+
}
122+
123+
/**
124+
* @description setAvailable method is available only on Android.
125+
*/
126+
static setCurrentCallActive() {
127+
128+
}
129+
130+
/**
131+
* @description setAvailable method is available only on Android.
132+
*/
133+
static backToForeground() {
134+
135+
}
136+
}

index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,14 @@ class RNCallKeep {
148148
});
149149
};
150150

151+
backToForeground() {
152+
if (isIOS) {
153+
return;
154+
}
155+
156+
NativeModules.RNCallKeep.backToForeground();
157+
}
158+
151159
/*
152160
static holdCall(uuid, onHold) {
153161
RNCallKeepModule.setHeldCall(uuid, onHold);

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"url": "https://github.com/wazo-pbx/react-native-callkeep/issues"
2121
},
2222
"homepage": "https://github.com/wazo-pbx/react-native-callkeep#readme",
23+
"typings": "./index.d.ts",
2324
"peerDependencies": {
2425
"react-native": ">=0.40.0"
2526
},

0 commit comments

Comments
 (0)