Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 42 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ RNCallKeep.setActive(true);
```

- `active`: boolean
- Tell whenever the app is ready or not
- Tell whenever the app is ready or not

### displayIncomingCall

Expand All @@ -95,11 +95,11 @@ RNCallKeep.displayIncomingCall(uuid, handle);
````

- `uuid`: string
- An `uuid` that should be stored and re-used for `stopCall`.
- An `uuid` that should be stored and re-used for `stopCall`.
- `handle`: string
- Phone number of the caller
- Phone number of the caller
- `localizedCallerName`: string (optional, iOS only)
- Name of the caller to be displayed on the native UI
- Name of the caller to be displayed on the native UI
- `handleType`: string (optional, iOS only)
- `generic`
- `number` (default)
Expand All @@ -119,9 +119,9 @@ RNCallKeep.startCall(uuid, number);
```

- _uuid_: string
- An `uuid` that should be stored and re-used for `stopCall`.
- An `uuid` that should be stored and re-used for `stopCall`.
- `handle`: string
- Phone number of the callee
- Phone number of the callee
- `handleType`: string (optional)
- `generic`
- `number` (default)
Expand All @@ -139,7 +139,7 @@ RNCallKeep.endCall(uuid);
```

- `uuid`: string
- The `uuid` used for `startCall` or `displayIncomingCall`
- The `uuid` used for `startCall` or `displayIncomingCall`


### setMutedCall
Expand All @@ -152,7 +152,7 @@ RNCallKeep.setMutedCall(uuid, true);
```

- `uuid`: string
- uuid of the current call.
- uuid of the current call.
- `muted`: boolean

### checkIfBusy
Expand All @@ -173,6 +173,29 @@ _This feature is available only on iOs._
RNCallKeep.checkSpeaker();
```

### supportConnectionService (async)

Tells if `ConnectionService` is available on the device (returns a boolean).

_This feature is available only on Android._

```js
RNCallKeep.supportConnectionService();
```

### hasPhoneAccount (async)

Checks if the user has enabled the [phone account](https://developer.android.com/reference/android/telecom/PhoneAccount) for your application.
A phone account must be enable to be able to display UI screen on incoming call and make outgoing calls from native Contact application.

Returns a promise of a boolean.

_This feature is available only on Android._

```js
await RNCallKeep.hasPhoneAccount();
```

## Events

### didReceiveStartCallAction
Expand Down Expand Up @@ -250,6 +273,17 @@ A call was muted by the system or the user:
```js
RNCallKeep.addEventListener('didPerformSetMutedCallAction', ({ muted }) => {

});

```
### - didPerformDTMFAction
_This feature is available only on Android for now._

Used type a number on his dialer

```js
RNCallKeep.addEventListener('didPerformDTMFAction', ({ dtmf }) => {

});
```

Expand Down
8 changes: 7 additions & 1 deletion actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,14 @@ const didDisplayIncomingCall = handler =>
const didPerformSetMutedCallAction = handler =>
eventEmitter.addListener(RNCallKeepDidPerformSetMutedCallAction, (data) => { handler(data.muted); });

const didPerformDTMFAction = handler =>
const didPerformDTMFAction = handler => {
// @TODO: handle DTMF on iOS
if (isIOS) {
return;
}

eventEmitter.addListener(RNCallKeepDidPerformDTMFAction, (data) => { handler(data.number); });
};

export const listeners = {
didReceiveStartCallAction,
Expand Down
18 changes: 13 additions & 5 deletions docs/ios-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,17 @@ You'll now have the Library included.

![iOS Other libraries](pictures/ios-other-libraries.png)

### 2. Allow voip background
### 2. Add header search path

2.1. Open `Info.plist` file and add `voip` in `UIBackgroundModes`.
2.1. Click on `Build Settings` tab, then search for `Header Search Paths`.

2.2. Add `$(SRCROOT)/../node_modules/react-native-callkeep/ios/RNCallKeep`.

![iOS Search Paths](pictures/ios-search-paths.png)

### 3. Allow voip background

3.1. Open `Info.plist` file and add `voip` in `UIBackgroundModes`.

![iOS info.plist](pictures/ios-info-plist.png)

Expand All @@ -71,15 +79,15 @@ By editing this file with a text editor, your should see:
</array>
```

### 3. Updating AppDelegate.m
### 4. Updating AppDelegate.m

3.1. Import Library:
4.1. Import Library:

```diff
+ #import "RNCallKeep.h"
```

3.2. Handling User Activity.
4.2. Handling User Activity.

This delegate will be called when the user tries to start a call from native Phone App.

Expand Down
Binary file added docs/pictures/ios-search-paths.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { listeners } from './actions'

const RNCallKeepModule = NativeModules.RNCallKeep;
const isIOS = Platform.OS === 'ios';
const hasConnectionService = !isIOS && Platform.Version >= 23;
const supportConnectionService = !isIOS && Platform.Version >= 23;

class RNCallKeep {

Expand Down Expand Up @@ -69,6 +69,14 @@ class RNCallKeep {
isIOS ? RNCallKeepModule.endAllCalls() : RNCallKeepModule.endCall();
}

supportConnectionService() {
return supportConnectionService;
}

async hasPhoneAccount() {
return isIOS ? true : await RNCallKeepModule.hasPhoneAccount();
}

setMutedCAll(uuid, muted) {
if (!isIOS) {
// Can't mute on Android
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-callkeep",
"version": "0.0.1",
"version": "0.0.2",
"description": "iOS 10 CallKit and Android ConnectionService Framework For React Native",
"main": "index.js",
"scripts": {},
Expand Down