voip-callkit 0.0.1
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 +154 -0
- package/VoipCallkit.podspec +17 -0
- package/android/build.gradle +58 -0
- package/android/src/main/.DS_Store +0 -0
- package/android/src/main/AndroidManifest.xml +55 -0
- package/android/src/main/java/.DS_Store +0 -0
- package/android/src/main/java/com/.DS_Store +0 -0
- package/android/src/main/java/com/test/.DS_Store +0 -0
- package/android/src/main/java/com/test/callkit/.DS_Store +0 -0
- package/android/src/main/java/com/test/callkit/CallKitVoip.java +12 -0
- package/android/src/main/java/com/test/callkit/CallKitVoipPlugin.java +81 -0
- package/android/src/main/java/com/test/callkit/MyConnectionService.java +200 -0
- package/android/src/main/java/com/test/callkit/MyFirebaseMessagingService.java +90 -0
- package/android/src/main/java/com/test/callkit/androidcall/ApiCalls.java +48 -0
- package/android/src/main/java/com/test/callkit/androidcall/CallActivity.java +1223 -0
- package/android/src/main/java/com/test/callkit/androidcall/RetreivedTokenCallback.java +5 -0
- package/android/src/main/java/com/test/callkit/androidcall/SettingsActivity.java +174 -0
- package/android/src/main/java/com/test/callkit/androidcall/VoipBackgroundService.java +103 -0
- package/android/src/main/java/com/test/callkit/androidcall/VoipForegroundService.java +210 -0
- package/android/src/main/java/com/test/callkit/androidcall/VoipForegroundServiceActionReceiver.java +77 -0
- package/android/src/main/java/com/test/callkit/androidcall/util/CameraCapturerCompat.java +185 -0
- package/android/src/main/java/com/test/callkit/androidcall/util/CodecUtils.kt +23 -0
- package/android/src/main/java/com/test/callkit/androidcall/util/Dialog.java +37 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/docs.json +262 -0
- package/dist/esm/definitions.d.ts +19 -0
- package/dist/esm/definitions.js +2 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +8 -0
- package/dist/esm/web.js +11 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +27 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +30 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Plugin/CallKitVoip.swift +1 -0
- package/ios/Plugin/CallKitVoipPlugin.h +10 -0
- package/ios/Plugin/CallKitVoipPlugin.m +8 -0
- package/ios/Plugin/CallKitVoipPlugin.swift +129 -0
- package/ios/Plugin/Info.plist +24 -0
- package/package.json +78 -0
@@ -0,0 +1,185 @@
|
|
1
|
+
package com.bfine.capactior.callkitvoip.androidcall.util;
|
2
|
+
|
3
|
+
import android.content.Context;
|
4
|
+
import android.graphics.ImageFormat;
|
5
|
+
import android.hardware.camera2.CameraCharacteristics;
|
6
|
+
import android.hardware.camera2.CameraManager;
|
7
|
+
import android.hardware.camera2.CameraMetadata;
|
8
|
+
import android.hardware.camera2.params.StreamConfigurationMap;
|
9
|
+
import android.os.Build;
|
10
|
+
import androidx.annotation.RequiresApi;
|
11
|
+
import com.twilio.video.Camera2Capturer;
|
12
|
+
import com.twilio.video.CameraCapturer;
|
13
|
+
import com.twilio.video.VideoCapturer;
|
14
|
+
import java.util.HashMap;
|
15
|
+
import java.util.Map;
|
16
|
+
import tvi.webrtc.Camera1Enumerator;
|
17
|
+
import tvi.webrtc.Camera2Enumerator;
|
18
|
+
import tvi.webrtc.CapturerObserver;
|
19
|
+
import tvi.webrtc.SurfaceTextureHelper;
|
20
|
+
|
21
|
+
/*
|
22
|
+
* Simple wrapper class that uses Camera2Capturer with supported devices.
|
23
|
+
*/
|
24
|
+
public class CameraCapturerCompat implements VideoCapturer {
|
25
|
+
private final CameraCapturer camera1Capturer;
|
26
|
+
private final Camera2Capturer camera2Capturer;
|
27
|
+
private final VideoCapturer activeCapturer;
|
28
|
+
private final Map<Source, String> camera1IdMap = new HashMap<>();
|
29
|
+
private final Map<String, Source> camera1SourceMap = new HashMap<>();
|
30
|
+
private final Map<Source, String> camera2IdMap = new HashMap<>();
|
31
|
+
private final Map<String, Source> camera2SourceMap = new HashMap<>();
|
32
|
+
private CameraManager cameraManager;
|
33
|
+
|
34
|
+
public enum Source {
|
35
|
+
FRONT_CAMERA,
|
36
|
+
BACK_CAMERA
|
37
|
+
}
|
38
|
+
|
39
|
+
public CameraCapturerCompat(Context context, Source cameraSource) {
|
40
|
+
if (Camera2Capturer.isSupported(context) && isLollipopApiSupported()) {
|
41
|
+
cameraManager = (CameraManager) context.getSystemService(Context.CAMERA_SERVICE);
|
42
|
+
setCamera2Maps(context);
|
43
|
+
camera2Capturer = new Camera2Capturer(context, camera2IdMap.get(cameraSource));
|
44
|
+
activeCapturer = camera2Capturer;
|
45
|
+
camera1Capturer = null;
|
46
|
+
} else {
|
47
|
+
setCamera1Maps();
|
48
|
+
camera1Capturer = new CameraCapturer(context, camera1IdMap.get(cameraSource));
|
49
|
+
activeCapturer = camera1Capturer;
|
50
|
+
camera2Capturer = null;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
public Source getCameraSource() {
|
55
|
+
if (usingCamera1()) {
|
56
|
+
return camera1SourceMap.get(camera1Capturer.getCameraId());
|
57
|
+
} else {
|
58
|
+
return camera2SourceMap.get(camera2Capturer.getCameraId());
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
@Override
|
63
|
+
public void initialize(
|
64
|
+
SurfaceTextureHelper surfaceTextureHelper,
|
65
|
+
Context context,
|
66
|
+
CapturerObserver capturerObserver) {
|
67
|
+
activeCapturer.initialize(surfaceTextureHelper, context, capturerObserver);
|
68
|
+
}
|
69
|
+
|
70
|
+
@Override
|
71
|
+
public void startCapture(int width, int height, int framerate) {
|
72
|
+
activeCapturer.startCapture(width, height, framerate);
|
73
|
+
}
|
74
|
+
|
75
|
+
@Override
|
76
|
+
public void stopCapture() throws InterruptedException {
|
77
|
+
activeCapturer.stopCapture();
|
78
|
+
}
|
79
|
+
|
80
|
+
@Override
|
81
|
+
public boolean isScreencast() {
|
82
|
+
return activeCapturer.isScreencast();
|
83
|
+
}
|
84
|
+
|
85
|
+
@Override
|
86
|
+
public void dispose() {
|
87
|
+
activeCapturer.dispose();
|
88
|
+
}
|
89
|
+
|
90
|
+
public void switchCamera() {
|
91
|
+
Source cameraSource = getCameraSource();
|
92
|
+
Map<Source, String> idMap = usingCamera1() ? camera1IdMap : camera2IdMap;
|
93
|
+
String newCameraId =
|
94
|
+
cameraSource == Source.FRONT_CAMERA
|
95
|
+
? idMap.get(Source.BACK_CAMERA)
|
96
|
+
: idMap.get(Source.FRONT_CAMERA);
|
97
|
+
|
98
|
+
if (usingCamera1()) {
|
99
|
+
camera1Capturer.switchCamera(newCameraId);
|
100
|
+
} else {
|
101
|
+
camera2Capturer.switchCamera(newCameraId);
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
private boolean usingCamera1() {
|
106
|
+
return camera1Capturer != null;
|
107
|
+
}
|
108
|
+
|
109
|
+
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
110
|
+
private void setCamera2Maps(Context context) {
|
111
|
+
Camera2Enumerator camera2Enumerator = new Camera2Enumerator(context);
|
112
|
+
for (String cameraId : camera2Enumerator.getDeviceNames()) {
|
113
|
+
if (isCameraIdSupported(cameraId)) {
|
114
|
+
if (camera2Enumerator.isFrontFacing(cameraId)) {
|
115
|
+
camera2IdMap.put(Source.FRONT_CAMERA, cameraId);
|
116
|
+
camera2SourceMap.put(cameraId, Source.FRONT_CAMERA);
|
117
|
+
}
|
118
|
+
if (camera2Enumerator.isBackFacing(cameraId)) {
|
119
|
+
camera2IdMap.put(Source.BACK_CAMERA, cameraId);
|
120
|
+
camera2SourceMap.put(cameraId, Source.BACK_CAMERA);
|
121
|
+
}
|
122
|
+
}
|
123
|
+
}
|
124
|
+
}
|
125
|
+
|
126
|
+
private void setCamera1Maps() {
|
127
|
+
Camera1Enumerator camera1Enumerator = new Camera1Enumerator();
|
128
|
+
for (String deviceName : camera1Enumerator.getDeviceNames()) {
|
129
|
+
if (camera1Enumerator.isFrontFacing(deviceName)) {
|
130
|
+
camera1IdMap.put(Source.FRONT_CAMERA, deviceName);
|
131
|
+
camera1SourceMap.put(deviceName, Source.FRONT_CAMERA);
|
132
|
+
}
|
133
|
+
if (camera1Enumerator.isBackFacing(deviceName)) {
|
134
|
+
camera1IdMap.put(Source.BACK_CAMERA, deviceName);
|
135
|
+
camera1SourceMap.put(deviceName, Source.BACK_CAMERA);
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}
|
139
|
+
|
140
|
+
private boolean isLollipopApiSupported() {
|
141
|
+
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
|
142
|
+
}
|
143
|
+
|
144
|
+
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
145
|
+
private boolean isCameraIdSupported(String cameraId) {
|
146
|
+
boolean isMonoChromeSupported = false;
|
147
|
+
boolean isPrivateImageFormatSupported = false;
|
148
|
+
CameraCharacteristics cameraCharacteristics;
|
149
|
+
try {
|
150
|
+
cameraCharacteristics = cameraManager.getCameraCharacteristics(cameraId);
|
151
|
+
} catch (Exception e) {
|
152
|
+
e.printStackTrace();
|
153
|
+
return false;
|
154
|
+
}
|
155
|
+
/*
|
156
|
+
* This is a temporary work around for a RuntimeException that occurs on devices which contain cameras
|
157
|
+
* that do not support ImageFormat.PRIVATE output formats. A long term fix is currently in development.
|
158
|
+
* https://github.com/twilio/video-quickstart-android/issues/431
|
159
|
+
*/
|
160
|
+
final StreamConfigurationMap streamMap =
|
161
|
+
cameraCharacteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
|
162
|
+
|
163
|
+
if (streamMap != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
164
|
+
isPrivateImageFormatSupported = streamMap.isOutputSupportedFor(ImageFormat.PRIVATE);
|
165
|
+
}
|
166
|
+
|
167
|
+
/*
|
168
|
+
* Read the color filter arrangements of the camera to filter out the ones that support
|
169
|
+
* SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_MONO or SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR.
|
170
|
+
* Visit this link for details on supported values - https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#SENSOR_INFO_COLOR_FILTER_ARRANGEMENT
|
171
|
+
*/
|
172
|
+
Integer colorFilterArrangement =
|
173
|
+
cameraCharacteristics.get(
|
174
|
+
CameraCharacteristics.SENSOR_INFO_COLOR_FILTER_ARRANGEMENT);
|
175
|
+
|
176
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && colorFilterArrangement != null) {
|
177
|
+
isMonoChromeSupported =
|
178
|
+
colorFilterArrangement
|
179
|
+
== CameraMetadata.SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_MONO
|
180
|
+
|| colorFilterArrangement
|
181
|
+
== CameraMetadata.SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR;
|
182
|
+
}
|
183
|
+
return isPrivateImageFormatSupported && !isMonoChromeSupported;
|
184
|
+
}
|
185
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
package com.bfine.capactior.callkitvoip.androidcall.util
|
2
|
+
|
3
|
+
import tvi.webrtc.HardwareVideoDecoderFactory
|
4
|
+
import tvi.webrtc.HardwareVideoEncoderFactory
|
5
|
+
|
6
|
+
class CodecUtils {
|
7
|
+
fun isH264Supported(): Boolean {
|
8
|
+
val hardwareVideoEncoderFactory =
|
9
|
+
HardwareVideoEncoderFactory(null, true, true)
|
10
|
+
val hardwareVideoDecoderFactory =
|
11
|
+
HardwareVideoDecoderFactory(null)
|
12
|
+
|
13
|
+
val h264EncoderSupported = hardwareVideoEncoderFactory.supportedCodecs.any {
|
14
|
+
it.name.equals("h264", ignoreCase = true)
|
15
|
+
}
|
16
|
+
val h264DecoderSupported = hardwareVideoDecoderFactory.supportedCodecs.any {
|
17
|
+
it.name.equals("h264", ignoreCase = true)
|
18
|
+
}
|
19
|
+
|
20
|
+
return h264EncoderSupported && h264DecoderSupported
|
21
|
+
}
|
22
|
+
|
23
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
package com.bfine.capactior.callkitvoip.androidcall.util;
|
2
|
+
|
3
|
+
|
4
|
+
import android.content.Context;
|
5
|
+
import android.content.DialogInterface;
|
6
|
+
import android.widget.EditText;
|
7
|
+
|
8
|
+
import androidx.appcompat.app.AlertDialog;
|
9
|
+
|
10
|
+
import com.bfine.capactior.callkitvoip.R;
|
11
|
+
|
12
|
+
public class Dialog {
|
13
|
+
|
14
|
+
public static AlertDialog createConnectDialog(
|
15
|
+
EditText participantEditText,
|
16
|
+
DialogInterface.OnClickListener callParticipantsClickListener,
|
17
|
+
DialogInterface.OnClickListener cancelClickListener,
|
18
|
+
Context context) {
|
19
|
+
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
|
20
|
+
|
21
|
+
alertDialogBuilder.setIcon(R.drawable.ic_videocam_green_24px);
|
22
|
+
alertDialogBuilder.setTitle("Connect to a room");
|
23
|
+
alertDialogBuilder.setPositiveButton("Connect", callParticipantsClickListener);
|
24
|
+
alertDialogBuilder.setNegativeButton("Cancel", cancelClickListener);
|
25
|
+
alertDialogBuilder.setCancelable(false);
|
26
|
+
|
27
|
+
setRoomNameFieldInDialog(participantEditText, alertDialogBuilder);
|
28
|
+
|
29
|
+
return alertDialogBuilder.create();
|
30
|
+
}
|
31
|
+
|
32
|
+
private static void setRoomNameFieldInDialog(
|
33
|
+
EditText roomNameEditText, AlertDialog.Builder alertDialogBuilder) {
|
34
|
+
roomNameEditText.setHint("room name");
|
35
|
+
alertDialogBuilder.setView(roomNameEditText);
|
36
|
+
}
|
37
|
+
}
|
File without changes
|
package/dist/docs.json
ADDED
@@ -0,0 +1,262 @@
|
|
1
|
+
{
|
2
|
+
"api": {
|
3
|
+
"name": "CallKitVoipPlugin",
|
4
|
+
"slug": "callkitvoipplugin",
|
5
|
+
"docs": "",
|
6
|
+
"tags": [],
|
7
|
+
"methods": [
|
8
|
+
{
|
9
|
+
"name": "register",
|
10
|
+
"signature": "(options: { topic: string; }) => Promise<void>",
|
11
|
+
"parameters": [
|
12
|
+
{
|
13
|
+
"name": "options",
|
14
|
+
"docs": "",
|
15
|
+
"type": "{ topic: string; }"
|
16
|
+
}
|
17
|
+
],
|
18
|
+
"returns": "Promise<void>",
|
19
|
+
"tags": [],
|
20
|
+
"docs": "",
|
21
|
+
"complexTypes": [],
|
22
|
+
"slug": "register"
|
23
|
+
},
|
24
|
+
{
|
25
|
+
"name": "incomingCall",
|
26
|
+
"signature": "(options: { from: string; }) => Promise<void>",
|
27
|
+
"parameters": [
|
28
|
+
{
|
29
|
+
"name": "options",
|
30
|
+
"docs": "",
|
31
|
+
"type": "{ from: string; }"
|
32
|
+
}
|
33
|
+
],
|
34
|
+
"returns": "Promise<void>",
|
35
|
+
"tags": [],
|
36
|
+
"docs": "",
|
37
|
+
"complexTypes": [],
|
38
|
+
"slug": "incomingcall"
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"name": "addListener",
|
42
|
+
"signature": "(eventName: 'registration', listenerFunc: (token: Token) => void) => Promise<PluginListenerHandle> & PluginListenerHandle",
|
43
|
+
"parameters": [
|
44
|
+
{
|
45
|
+
"name": "eventName",
|
46
|
+
"docs": "",
|
47
|
+
"type": "'registration'"
|
48
|
+
},
|
49
|
+
{
|
50
|
+
"name": "listenerFunc",
|
51
|
+
"docs": "",
|
52
|
+
"type": "(token: Token) => void"
|
53
|
+
}
|
54
|
+
],
|
55
|
+
"returns": "Promise<PluginListenerHandle> & PluginListenerHandle",
|
56
|
+
"tags": [],
|
57
|
+
"docs": "",
|
58
|
+
"complexTypes": [
|
59
|
+
"PluginListenerHandle",
|
60
|
+
"Token"
|
61
|
+
],
|
62
|
+
"slug": "addlistenerregistration"
|
63
|
+
},
|
64
|
+
{
|
65
|
+
"name": "addListener",
|
66
|
+
"signature": "(eventName: 'callAnswered', listenerFunc: (callDate: CallData) => void) => Promise<PluginListenerHandle> & PluginListenerHandle",
|
67
|
+
"parameters": [
|
68
|
+
{
|
69
|
+
"name": "eventName",
|
70
|
+
"docs": "",
|
71
|
+
"type": "'callAnswered'"
|
72
|
+
},
|
73
|
+
{
|
74
|
+
"name": "listenerFunc",
|
75
|
+
"docs": "",
|
76
|
+
"type": "(callDate: CallData) => void"
|
77
|
+
}
|
78
|
+
],
|
79
|
+
"returns": "Promise<PluginListenerHandle> & PluginListenerHandle",
|
80
|
+
"tags": [],
|
81
|
+
"docs": "",
|
82
|
+
"complexTypes": [
|
83
|
+
"PluginListenerHandle",
|
84
|
+
"CallData"
|
85
|
+
],
|
86
|
+
"slug": "addlistenercallanswered"
|
87
|
+
},
|
88
|
+
{
|
89
|
+
"name": "addListener",
|
90
|
+
"signature": "(eventName: 'callStarted', listenerFunc: (callDate: CallData) => void) => Promise<PluginListenerHandle> & PluginListenerHandle",
|
91
|
+
"parameters": [
|
92
|
+
{
|
93
|
+
"name": "eventName",
|
94
|
+
"docs": "",
|
95
|
+
"type": "'callStarted'"
|
96
|
+
},
|
97
|
+
{
|
98
|
+
"name": "listenerFunc",
|
99
|
+
"docs": "",
|
100
|
+
"type": "(callDate: CallData) => void"
|
101
|
+
}
|
102
|
+
],
|
103
|
+
"returns": "Promise<PluginListenerHandle> & PluginListenerHandle",
|
104
|
+
"tags": [],
|
105
|
+
"docs": "",
|
106
|
+
"complexTypes": [
|
107
|
+
"PluginListenerHandle",
|
108
|
+
"CallData"
|
109
|
+
],
|
110
|
+
"slug": "addlistenercallstarted"
|
111
|
+
}
|
112
|
+
],
|
113
|
+
"properties": []
|
114
|
+
},
|
115
|
+
"interfaces": [
|
116
|
+
{
|
117
|
+
"name": "PluginListenerHandle",
|
118
|
+
"slug": "pluginlistenerhandle",
|
119
|
+
"docs": "",
|
120
|
+
"tags": [],
|
121
|
+
"methods": [],
|
122
|
+
"properties": [
|
123
|
+
{
|
124
|
+
"name": "remove",
|
125
|
+
"tags": [],
|
126
|
+
"docs": "",
|
127
|
+
"complexTypes": [],
|
128
|
+
"type": "() => Promise<void>"
|
129
|
+
}
|
130
|
+
]
|
131
|
+
},
|
132
|
+
{
|
133
|
+
"name": "Token",
|
134
|
+
"slug": "token",
|
135
|
+
"docs": "",
|
136
|
+
"tags": [],
|
137
|
+
"methods": [],
|
138
|
+
"properties": [
|
139
|
+
{
|
140
|
+
"name": "token",
|
141
|
+
"tags": [],
|
142
|
+
"docs": "",
|
143
|
+
"complexTypes": [],
|
144
|
+
"type": "string"
|
145
|
+
}
|
146
|
+
]
|
147
|
+
},
|
148
|
+
{
|
149
|
+
"name": "CallData",
|
150
|
+
"slug": "calldata",
|
151
|
+
"docs": "",
|
152
|
+
"tags": [],
|
153
|
+
"methods": [],
|
154
|
+
"properties": [
|
155
|
+
{
|
156
|
+
"name": "connectionId",
|
157
|
+
"tags": [],
|
158
|
+
"docs": "",
|
159
|
+
"complexTypes": [],
|
160
|
+
"type": "string"
|
161
|
+
},
|
162
|
+
{
|
163
|
+
"name": "username",
|
164
|
+
"tags": [],
|
165
|
+
"docs": "",
|
166
|
+
"complexTypes": [],
|
167
|
+
"type": "string | undefined"
|
168
|
+
}
|
169
|
+
]
|
170
|
+
},
|
171
|
+
{
|
172
|
+
"name": "MessageCallData",
|
173
|
+
"slug": "messagecalldata",
|
174
|
+
"docs": "",
|
175
|
+
"tags": [],
|
176
|
+
"methods": [],
|
177
|
+
"properties": [
|
178
|
+
{
|
179
|
+
"name": "type",
|
180
|
+
"tags": [],
|
181
|
+
"docs": "",
|
182
|
+
"complexTypes": [],
|
183
|
+
"type": "'message' | undefined"
|
184
|
+
},
|
185
|
+
{
|
186
|
+
"name": "callbackId",
|
187
|
+
"tags": [],
|
188
|
+
"docs": "",
|
189
|
+
"complexTypes": [],
|
190
|
+
"type": "string"
|
191
|
+
},
|
192
|
+
{
|
193
|
+
"name": "pluginId",
|
194
|
+
"tags": [],
|
195
|
+
"docs": "",
|
196
|
+
"complexTypes": [],
|
197
|
+
"type": "string"
|
198
|
+
},
|
199
|
+
{
|
200
|
+
"name": "methodName",
|
201
|
+
"tags": [],
|
202
|
+
"docs": "",
|
203
|
+
"complexTypes": [],
|
204
|
+
"type": "string"
|
205
|
+
},
|
206
|
+
{
|
207
|
+
"name": "options",
|
208
|
+
"tags": [],
|
209
|
+
"docs": "",
|
210
|
+
"complexTypes": [],
|
211
|
+
"type": "any"
|
212
|
+
}
|
213
|
+
]
|
214
|
+
},
|
215
|
+
{
|
216
|
+
"name": "ErrorCallData",
|
217
|
+
"slug": "errorcalldata",
|
218
|
+
"docs": "",
|
219
|
+
"tags": [],
|
220
|
+
"methods": [],
|
221
|
+
"properties": [
|
222
|
+
{
|
223
|
+
"name": "type",
|
224
|
+
"tags": [],
|
225
|
+
"docs": "",
|
226
|
+
"complexTypes": [],
|
227
|
+
"type": "'js.error'"
|
228
|
+
},
|
229
|
+
{
|
230
|
+
"name": "error",
|
231
|
+
"tags": [],
|
232
|
+
"docs": "",
|
233
|
+
"complexTypes": [],
|
234
|
+
"type": "{ message: string; url: string; line: number; col: number; errorObject: string; }"
|
235
|
+
}
|
236
|
+
]
|
237
|
+
}
|
238
|
+
],
|
239
|
+
"enums": [],
|
240
|
+
"typeAliases": [
|
241
|
+
{
|
242
|
+
"name": "CallData",
|
243
|
+
"slug": "calldata",
|
244
|
+
"docs": "",
|
245
|
+
"types": [
|
246
|
+
{
|
247
|
+
"text": "MessageCallData",
|
248
|
+
"complexTypes": [
|
249
|
+
"MessageCallData"
|
250
|
+
]
|
251
|
+
},
|
252
|
+
{
|
253
|
+
"text": "ErrorCallData",
|
254
|
+
"complexTypes": [
|
255
|
+
"ErrorCallData"
|
256
|
+
]
|
257
|
+
}
|
258
|
+
]
|
259
|
+
}
|
260
|
+
],
|
261
|
+
"pluginConfigs": []
|
262
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import type { PluginListenerHandle } from "@capacitor/core";
|
2
|
+
export interface CallKitVoipPlugin {
|
3
|
+
register(options: {
|
4
|
+
topic: string;
|
5
|
+
}): Promise<void>;
|
6
|
+
incomingCall(options: {
|
7
|
+
from: string;
|
8
|
+
}): Promise<void>;
|
9
|
+
addListener(eventName: 'registration', listenerFunc: (token: Token) => void): Promise<PluginListenerHandle> & PluginListenerHandle;
|
10
|
+
addListener(eventName: 'callAnswered', listenerFunc: (callDate: CallData) => void): Promise<PluginListenerHandle> & PluginListenerHandle;
|
11
|
+
addListener(eventName: 'callStarted', listenerFunc: (callDate: CallData) => void): Promise<PluginListenerHandle> & PluginListenerHandle;
|
12
|
+
}
|
13
|
+
export declare interface Token {
|
14
|
+
token: string;
|
15
|
+
}
|
16
|
+
export declare interface CallData {
|
17
|
+
connectionId: string;
|
18
|
+
username?: string;
|
19
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type {PluginListenerHandle} from \"@capacitor/core\";\n\nexport interface CallKitVoipPlugin {\n register(options:{topic: string}): Promise<void>;\n\n incomingCall(options:{from:string}): Promise<void>\n\n addListener(\n eventName: 'registration',\n listenerFunc: (token:Token) => void\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n addListener(\n eventName: 'callAnswered',\n listenerFunc: (callDate: CallData) => void\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n addListener(\n eventName: 'callStarted',\n listenerFunc: (callDate: CallData) => void\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n}\n\nexport declare interface Token{token: string}\nexport declare interface CallData{\n connectionId : string\n username ?: string\n}"]}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { registerPlugin } from '@capacitor/core';
|
2
|
+
const CallKitVoip = registerPlugin('CallKitVoip', {
|
3
|
+
web: () => import('./web').then(m => new m.CallKitVoipWeb()),
|
4
|
+
});
|
5
|
+
export * from './definitions';
|
6
|
+
export { CallKitVoip };
|
7
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,WAAW,GAAG,cAAc,CAAoB,aAAa,EAAE;IACnE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;CAC7D,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { CallKitVoipPlugin } from './definitions';\n\nconst CallKitVoip = registerPlugin<CallKitVoipPlugin>('CallKitVoip', {\n web: () => import('./web').then(m => new m.CallKitVoipWeb()),\n});\n\nexport * from './definitions';\nexport { CallKitVoip };\n"]}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
2
|
+
import type { CallKitVoipPlugin } from './definitions';
|
3
|
+
export declare class CallKitVoipWeb extends WebPlugin implements CallKitVoipPlugin {
|
4
|
+
register(): Promise<void>;
|
5
|
+
incomingCall({ from }: {
|
6
|
+
from: string;
|
7
|
+
}): Promise<void>;
|
8
|
+
}
|
package/dist/esm/web.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,cAAe,SAAQ,SAAS;IAC3C,KAAK,CAAC,QAAQ;QACZ,OAAO;IACT,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,EAAC,IAAI,EAAe;QACrC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACjB,OAAO;IACT,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { CallKitVoipPlugin } from './definitions';\n\nexport class CallKitVoipWeb extends WebPlugin implements CallKitVoipPlugin {\n async register(): Promise<void> {\n return;\n }\n\n async incomingCall({from}:{from:string}):Promise<void>{\n console.log(from)\n return;\n }\n}\n"]}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
var core = require('@capacitor/core');
|
6
|
+
|
7
|
+
const CallKitVoip = core.registerPlugin('CallKitVoip', {
|
8
|
+
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.CallKitVoipWeb()),
|
9
|
+
});
|
10
|
+
|
11
|
+
class CallKitVoipWeb extends core.WebPlugin {
|
12
|
+
async register() {
|
13
|
+
return;
|
14
|
+
}
|
15
|
+
async incomingCall({ from }) {
|
16
|
+
console.log(from);
|
17
|
+
return;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
var web = /*#__PURE__*/Object.freeze({
|
22
|
+
__proto__: null,
|
23
|
+
CallKitVoipWeb: CallKitVoipWeb
|
24
|
+
});
|
25
|
+
|
26
|
+
exports.CallKitVoip = CallKitVoip;
|
27
|
+
//# sourceMappingURL=plugin.cjs.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CallKitVoip = registerPlugin('CallKitVoip', {\n web: () => import('./web').then(m => new m.CallKitVoipWeb()),\n});\nexport * from './definitions';\nexport { CallKitVoip };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CallKitVoipWeb extends WebPlugin {\n async register() {\n return;\n }\n async incomingCall({ from }) {\n console.log(from);\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,WAAW,GAAGA,mBAAc,CAAC,aAAa,EAAE;AAClD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;AAChE,CAAC;;ACFM,MAAM,cAAc,SAASC,cAAS,CAAC;AAC9C,IAAI,MAAM,QAAQ,GAAG;AACrB,QAAQ,OAAO;AACf,KAAK;AACL,IAAI,MAAM,YAAY,CAAC,EAAE,IAAI,EAAE,EAAE;AACjC,QAAQ,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAC1B,QAAQ,OAAO;AACf,KAAK;AACL;;;;;;;;;"}
|
package/dist/plugin.js
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
var capacitorCallKitVoip = (function (exports, core) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
const CallKitVoip = core.registerPlugin('CallKitVoip', {
|
5
|
+
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.CallKitVoipWeb()),
|
6
|
+
});
|
7
|
+
|
8
|
+
class CallKitVoipWeb extends core.WebPlugin {
|
9
|
+
async register() {
|
10
|
+
return;
|
11
|
+
}
|
12
|
+
async incomingCall({ from }) {
|
13
|
+
console.log(from);
|
14
|
+
return;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
var web = /*#__PURE__*/Object.freeze({
|
19
|
+
__proto__: null,
|
20
|
+
CallKitVoipWeb: CallKitVoipWeb
|
21
|
+
});
|
22
|
+
|
23
|
+
exports.CallKitVoip = CallKitVoip;
|
24
|
+
|
25
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
26
|
+
|
27
|
+
return exports;
|
28
|
+
|
29
|
+
})({}, capacitorExports);
|
30
|
+
//# sourceMappingURL=plugin.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CallKitVoip = registerPlugin('CallKitVoip', {\n web: () => import('./web').then(m => new m.CallKitVoipWeb()),\n});\nexport * from './definitions';\nexport { CallKitVoip };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CallKitVoipWeb extends WebPlugin {\n async register() {\n return;\n }\n async incomingCall({ from }) {\n console.log(from);\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,WAAW,GAAGA,mBAAc,CAAC,aAAa,EAAE;IAClD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;IAChE,CAAC;;ICFM,MAAM,cAAc,SAASC,cAAS,CAAC;IAC9C,IAAI,MAAM,QAAQ,GAAG;IACrB,QAAQ,OAAO;IACf,KAAK;IACL,IAAI,MAAM,YAAY,CAAC,EAAE,IAAI,EAAE,EAAE;IACjC,QAAQ,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC1B,QAAQ,OAAO;IACf,KAAK;IACL;;;;;;;;;;;;;;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#import <UIKit/UIKit.h>
|
2
|
+
|
3
|
+
//! Project version number for Plugin.
|
4
|
+
FOUNDATION_EXPORT double PluginVersionNumber;
|
5
|
+
|
6
|
+
//! Project version string for Plugin.
|
7
|
+
FOUNDATION_EXPORT const unsigned char PluginVersionString[];
|
8
|
+
|
9
|
+
// In this header, you should import all the public headers of your framework using statements like #import <Plugin/PublicHeader.h>
|
10
|
+
|
@@ -0,0 +1,8 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
#import <Capacitor/Capacitor.h>
|
3
|
+
|
4
|
+
// Define the plugin using the CAP_PLUGIN Macro, and
|
5
|
+
// each method the plugin supports using the CAP_PLUGIN_METHOD macro.
|
6
|
+
CAP_PLUGIN(CallKitVoipPlugin, "CallKitVoip",
|
7
|
+
CAP_PLUGIN_METHOD(register, CAPPluginReturnPromise);
|
8
|
+
)
|