@nativetalkcommunications/react-native-call-sdk 0.1.0
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/LICENSE +21 -0
- package/NativetalkCallSdk.podspec +31 -0
- package/README.md +494 -0
- package/android/build.gradle +58 -0
- package/android/gradle.properties +2 -0
- package/android/src/main/AndroidManifest.xml +84 -0
- package/android/src/main/java/io/nativetalk/callsdk/BackgroundService.kt +149 -0
- package/android/src/main/java/io/nativetalk/callsdk/CallActionReceiver.kt +24 -0
- package/android/src/main/java/io/nativetalk/callsdk/CallService.kt +45 -0
- package/android/src/main/java/io/nativetalk/callsdk/Compatibility.kt +96 -0
- package/android/src/main/java/io/nativetalk/callsdk/CoreManager.kt +801 -0
- package/android/src/main/java/io/nativetalk/callsdk/NativetalkCallScreeningService.kt +105 -0
- package/android/src/main/java/io/nativetalk/callsdk/NativetalkCallSdkModule.kt +205 -0
- package/android/src/main/java/io/nativetalk/callsdk/NativetalkCallSdkPackage.kt +18 -0
- package/android/src/main/java/io/nativetalk/callsdk/TelephonyMonitor.kt +229 -0
- package/android/src/main/java/io/nativetalk/callsdk/Utils.kt +42 -0
- package/android/src/main/res/drawable/ic_nativetalk_call.xml +9 -0
- package/android/src/main/res/values/strings.xml +9 -0
- package/app.plugin.js +1 -0
- package/ios/NativetalkCallSdk-Bridging-Header.h +4 -0
- package/ios/NativetalkCallSdk.swift +738 -0
- package/ios/NativetalkCallSdkBridge.m +35 -0
- package/lib/commonjs/CallProvider.js +602 -0
- package/lib/commonjs/helpers.js +173 -0
- package/lib/commonjs/index.js +96 -0
- package/lib/commonjs/native.js +146 -0
- package/lib/commonjs/types.js +8 -0
- package/lib/commonjs/ui/Avatar.js +29 -0
- package/lib/commonjs/ui/Dialer.js +189 -0
- package/lib/commonjs/ui/IncomingCallView.js +128 -0
- package/lib/commonjs/ui/OutgoingCallView.js +117 -0
- package/lib/commonjs/ui/index.js +22 -0
- package/lib/commonjs/ui/theme.js +21 -0
- package/lib/module/CallProvider.js +573 -0
- package/lib/module/helpers.js +161 -0
- package/lib/module/index.js +57 -0
- package/lib/module/native.js +123 -0
- package/lib/module/types.js +7 -0
- package/lib/module/ui/Avatar.js +22 -0
- package/lib/module/ui/Dialer.js +162 -0
- package/lib/module/ui/IncomingCallView.js +101 -0
- package/lib/module/ui/OutgoingCallView.js +110 -0
- package/lib/module/ui/index.js +13 -0
- package/lib/module/ui/theme.js +17 -0
- package/lib/typescript/CallProvider.d.ts +46 -0
- package/lib/typescript/helpers.d.ts +52 -0
- package/lib/typescript/index.d.ts +77 -0
- package/lib/typescript/native.d.ts +53 -0
- package/lib/typescript/types.d.ts +155 -0
- package/lib/typescript/ui/Avatar.d.ts +13 -0
- package/lib/typescript/ui/Dialer.d.ts +29 -0
- package/lib/typescript/ui/IncomingCallView.d.ts +39 -0
- package/lib/typescript/ui/OutgoingCallView.d.ts +28 -0
- package/lib/typescript/ui/index.d.ts +13 -0
- package/lib/typescript/ui/theme.d.ts +20 -0
- package/linphonesw-pod/Sources/LinphoneSdkInfos.swift +4 -0
- package/linphonesw-pod/Sources/LinphoneWrapper.swift +42949 -0
- package/linphonesw-pod/linphonesw.podspec +46 -0
- package/package.json +90 -0
- package/plugin/build/index.js +12 -0
- package/plugin/build/withAndroid.js +78 -0
- package/plugin/build/withIos.js +66 -0
- package/src/CallProvider.tsx +675 -0
- package/src/helpers.ts +179 -0
- package/src/index.ts +84 -0
- package/src/native.ts +185 -0
- package/src/types.ts +202 -0
- package/src/ui/Avatar.tsx +46 -0
- package/src/ui/Dialer.tsx +248 -0
- package/src/ui/IncomingCallView.tsx +161 -0
- package/src/ui/OutgoingCallView.tsx +203 -0
- package/src/ui/index.ts +13 -0
- package/src/ui/theme.ts +36 -0
- package/ui/package.json +6 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
Pod::Spec.new do |s|
|
|
2
|
+
linphone_version = "5.4.117"
|
|
3
|
+
linphone_base_url = "https://download.linphone.org/releases/ios//spm//linphone-sdk-swift-ios-#{linphone_version}/XCFrameworks"
|
|
4
|
+
linphone_frameworks = %w[
|
|
5
|
+
bctoolbox-ios bctoolbox belle-sip belr belcard lime
|
|
6
|
+
linphone mbedcrypto mbedtls mbedx509 mediastreamer2
|
|
7
|
+
msamr mscodec2 msopenh264 mssilk ortp
|
|
8
|
+
]
|
|
9
|
+
|
|
10
|
+
s.name = 'linphonesw'
|
|
11
|
+
s.version = linphone_version
|
|
12
|
+
s.summary = 'Linphone SDK Swift wrapper — bundled with @nativetalkcommunications/react-native-call-sdk'
|
|
13
|
+
s.description = 'Self-contained CocoaPod that downloads and wraps the Linphone xcframeworks.'
|
|
14
|
+
s.homepage = 'https://gitlab.linphone.org/BC/public/linphone-sdk-swift-ios'
|
|
15
|
+
s.license = { :type => 'GPL', :text => 'See https://gitlab.linphone.org/BC/public/linphone-sdk-swift-ios' }
|
|
16
|
+
s.authors = { 'Belledonne Communications' => 'contact@belledonne-communications.com' }
|
|
17
|
+
|
|
18
|
+
s.platform = :ios, '13.0'
|
|
19
|
+
s.source = { :path => '.' }
|
|
20
|
+
|
|
21
|
+
s.source_files = 'Sources/*.swift'
|
|
22
|
+
s.requires_arc = true
|
|
23
|
+
s.swift_version = '5.0'
|
|
24
|
+
|
|
25
|
+
# Download Linphone xcframeworks on first pod install.
|
|
26
|
+
# CocoaPods caches the prepared pod so this only runs once per machine per version.
|
|
27
|
+
s.prepare_command = <<-CMD
|
|
28
|
+
set -e
|
|
29
|
+
mkdir -p Frameworks
|
|
30
|
+
for fw in #{linphone_frameworks.join(" ")}; do
|
|
31
|
+
if [ ! -d "Frameworks/${fw}.xcframework" ]; then
|
|
32
|
+
echo " ▸ Downloading ${fw}.xcframework (Linphone #{linphone_version})..."
|
|
33
|
+
curl -fsSL "#{linphone_base_url}/${fw}.xcframework.zip" -o "/tmp/${fw}.xcframework.zip"
|
|
34
|
+
unzip -q -o "/tmp/${fw}.xcframework.zip" -d "Frameworks/"
|
|
35
|
+
rm -f "/tmp/${fw}.xcframework.zip"
|
|
36
|
+
fi
|
|
37
|
+
done
|
|
38
|
+
CMD
|
|
39
|
+
|
|
40
|
+
s.vendored_frameworks = linphone_frameworks.map { |fw| "Frameworks/#{fw}.xcframework" }
|
|
41
|
+
|
|
42
|
+
s.pod_target_xcconfig = {
|
|
43
|
+
'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => '',
|
|
44
|
+
'BUILD_LIBRARY_FOR_DISTRIBUTION' => 'NO',
|
|
45
|
+
}
|
|
46
|
+
end
|
package/package.json
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nativetalkcommunications/react-native-call-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Plug-and-play SIP/VoIP calling SDK for React Native, powered by Linphone. Provides registration, dial, answer, hold, mute, speaker, DTMF, and call logs — plus optional UI components.",
|
|
5
|
+
"main": "lib/commonjs/index.js",
|
|
6
|
+
"module": "lib/module/index.js",
|
|
7
|
+
"types": "lib/typescript/index.d.ts",
|
|
8
|
+
"react-native": "src/index.ts",
|
|
9
|
+
"source": "src/index.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"react-native": "./src/index.ts",
|
|
13
|
+
"types": "./lib/typescript/index.d.ts",
|
|
14
|
+
"import": "./lib/module/index.js",
|
|
15
|
+
"require": "./lib/commonjs/index.js",
|
|
16
|
+
"default": "./lib/commonjs/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./ui": {
|
|
19
|
+
"react-native": "./src/ui/index.ts",
|
|
20
|
+
"types": "./lib/typescript/ui/index.d.ts",
|
|
21
|
+
"import": "./lib/module/ui/index.js",
|
|
22
|
+
"require": "./lib/commonjs/ui/index.js",
|
|
23
|
+
"default": "./lib/commonjs/ui/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"src",
|
|
29
|
+
"lib",
|
|
30
|
+
"ui",
|
|
31
|
+
"android",
|
|
32
|
+
"!android/build",
|
|
33
|
+
"ios",
|
|
34
|
+
"linphonesw-pod/Sources",
|
|
35
|
+
"linphonesw-pod/linphonesw.podspec",
|
|
36
|
+
"plugin/build",
|
|
37
|
+
"app.plugin.js",
|
|
38
|
+
"*.podspec",
|
|
39
|
+
"!**/__tests__",
|
|
40
|
+
"!**/__fixtures__",
|
|
41
|
+
"!**/__mocks__",
|
|
42
|
+
"!**/.*"
|
|
43
|
+
],
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsc --project tsconfig.build.json --module commonjs --outDir lib/commonjs && tsc --project tsconfig.build.json --module esnext --outDir lib/module && tsc --project tsconfig.build.json --emitDeclarationOnly --declaration --outDir lib/typescript",
|
|
46
|
+
"build:plugin": "tsc --project plugin/tsconfig.json",
|
|
47
|
+
"typecheck": "tsc --noEmit",
|
|
48
|
+
"clean": "rimraf lib plugin/build"
|
|
49
|
+
},
|
|
50
|
+
"expo": {
|
|
51
|
+
"plugin": "./plugin/build/index.js"
|
|
52
|
+
},
|
|
53
|
+
"keywords": [
|
|
54
|
+
"react-native",
|
|
55
|
+
"sip",
|
|
56
|
+
"voip",
|
|
57
|
+
"linphone",
|
|
58
|
+
"calling",
|
|
59
|
+
"dialer",
|
|
60
|
+
"callkit",
|
|
61
|
+
"telephony"
|
|
62
|
+
],
|
|
63
|
+
"repository": {
|
|
64
|
+
"type": "git",
|
|
65
|
+
"url": "https://github.com/Tech4mation/nativetalk-call-sdk.git"
|
|
66
|
+
},
|
|
67
|
+
"license": "MIT",
|
|
68
|
+
"peerDependencies": {
|
|
69
|
+
"@expo/config-plugins": ">=8.0.0",
|
|
70
|
+
"react": ">=17.0.0",
|
|
71
|
+
"react-native": ">=0.70.0"
|
|
72
|
+
},
|
|
73
|
+
"peerDependenciesMeta": {
|
|
74
|
+
"@expo/config-plugins": {
|
|
75
|
+
"optional": true
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"devDependencies": {
|
|
79
|
+
"@expo/config-plugins": "^10.1.2",
|
|
80
|
+
"@types/node": "^20.19.41",
|
|
81
|
+
"@types/react": "^19.1.0",
|
|
82
|
+
"react": "19.1.0",
|
|
83
|
+
"react-native": "0.80.1",
|
|
84
|
+
"rimraf": "^5.0.0",
|
|
85
|
+
"typescript": "5.0.4"
|
|
86
|
+
},
|
|
87
|
+
"engines": {
|
|
88
|
+
"node": ">=18"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
4
|
+
const withAndroid_1 = require("./withAndroid");
|
|
5
|
+
const withIos_1 = require("./withIos");
|
|
6
|
+
const withNativetalkCallSdk = (config, options = {}) => {
|
|
7
|
+
config = (0, withAndroid_1.withAndroidMavenRepo)(config);
|
|
8
|
+
config = (0, withIos_1.withIosPlist)(config, { microphonePermission: options.microphonePermission });
|
|
9
|
+
config = (0, withIos_1.withIosPodfile)(config);
|
|
10
|
+
return config;
|
|
11
|
+
};
|
|
12
|
+
exports.default = (0, config_plugins_1.createRunOncePlugin)(withNativetalkCallSdk, '@nativetalkcommunications/react-native-call-sdk', '0.1.0');
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.withAndroidMavenRepo = void 0;
|
|
27
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
28
|
+
const fs = __importStar(require("fs"));
|
|
29
|
+
const path = __importStar(require("path"));
|
|
30
|
+
const LINPHONE_MAVEN_ENTRY = ` maven {
|
|
31
|
+
name = "linphone.org maven repository"
|
|
32
|
+
url "https://download.linphone.org/maven_repository"
|
|
33
|
+
content {
|
|
34
|
+
includeGroup "org.linphone"
|
|
35
|
+
}
|
|
36
|
+
}`;
|
|
37
|
+
function insertIntoAllprojectsRepos(contents) {
|
|
38
|
+
if (contents.includes('download.linphone.org/maven_repository')) {
|
|
39
|
+
return contents; // already present
|
|
40
|
+
}
|
|
41
|
+
// Find allprojects { repositories { } } and insert before its closing brace.
|
|
42
|
+
const allprojectsMatch = /allprojects\s*\{/.exec(contents);
|
|
43
|
+
if (allprojectsMatch) {
|
|
44
|
+
const afterAllprojects = allprojectsMatch.index + allprojectsMatch[0].length;
|
|
45
|
+
const repoMatch = /repositories\s*\{/.exec(contents.slice(afterAllprojects));
|
|
46
|
+
if (repoMatch) {
|
|
47
|
+
const repoStart = afterAllprojects + repoMatch.index + repoMatch[0].length;
|
|
48
|
+
let depth = 1;
|
|
49
|
+
let i = repoStart;
|
|
50
|
+
while (i < contents.length && depth > 0) {
|
|
51
|
+
if (contents[i] === '{')
|
|
52
|
+
depth++;
|
|
53
|
+
if (contents[i] === '}')
|
|
54
|
+
depth--;
|
|
55
|
+
i++;
|
|
56
|
+
}
|
|
57
|
+
const closingBrace = i - 1;
|
|
58
|
+
return (contents.slice(0, closingBrace) +
|
|
59
|
+
`\n${LINPHONE_MAVEN_ENTRY}\n ` +
|
|
60
|
+
contents.slice(closingBrace));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return contents;
|
|
64
|
+
}
|
|
65
|
+
const withAndroidMavenRepo = (config) => {
|
|
66
|
+
return (0, config_plugins_1.withDangerousMod)(config, [
|
|
67
|
+
'android',
|
|
68
|
+
(mod) => {
|
|
69
|
+
const buildGradlePath = path.join(mod.modRequest.platformProjectRoot, 'build.gradle');
|
|
70
|
+
if (!fs.existsSync(buildGradlePath))
|
|
71
|
+
return mod;
|
|
72
|
+
const contents = fs.readFileSync(buildGradlePath, 'utf-8');
|
|
73
|
+
fs.writeFileSync(buildGradlePath, insertIntoAllprojectsRepos(contents));
|
|
74
|
+
return mod;
|
|
75
|
+
},
|
|
76
|
+
]);
|
|
77
|
+
};
|
|
78
|
+
exports.withAndroidMavenRepo = withAndroidMavenRepo;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.withIosPodfile = exports.withIosPlist = void 0;
|
|
27
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
28
|
+
const fs = __importStar(require("fs"));
|
|
29
|
+
const path = __importStar(require("path"));
|
|
30
|
+
const withIosPlist = (config, { microphonePermission = 'Microphone access is required for calls.' } = {}) => {
|
|
31
|
+
return (0, config_plugins_1.withInfoPlist)(config, (mod) => {
|
|
32
|
+
var _a;
|
|
33
|
+
if (!mod.modResults['NSMicrophoneUsageDescription']) {
|
|
34
|
+
mod.modResults['NSMicrophoneUsageDescription'] = microphonePermission;
|
|
35
|
+
}
|
|
36
|
+
const bgModes = (_a = mod.modResults['UIBackgroundModes']) !== null && _a !== void 0 ? _a : [];
|
|
37
|
+
if (!bgModes.includes('audio'))
|
|
38
|
+
bgModes.push('audio');
|
|
39
|
+
if (!bgModes.includes('voip'))
|
|
40
|
+
bgModes.push('voip');
|
|
41
|
+
mod.modResults['UIBackgroundModes'] = bgModes;
|
|
42
|
+
return mod;
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
exports.withIosPlist = withIosPlist;
|
|
46
|
+
const withIosPodfile = (config) => {
|
|
47
|
+
return (0, config_plugins_1.withDangerousMod)(config, [
|
|
48
|
+
'ios',
|
|
49
|
+
(mod) => {
|
|
50
|
+
const podfilePath = path.join(mod.modRequest.platformProjectRoot, 'Podfile');
|
|
51
|
+
if (!fs.existsSync(podfilePath))
|
|
52
|
+
return mod;
|
|
53
|
+
let contents = fs.readFileSync(podfilePath, 'utf-8');
|
|
54
|
+
if (!contents.includes('linphonesw')) {
|
|
55
|
+
// Point to the linphonesw-pod bundled inside the SDK npm package.
|
|
56
|
+
// The xcframeworks are downloaded automatically by its prepare_command
|
|
57
|
+
// on first pod install — no SPM step required.
|
|
58
|
+
const podPath = '../node_modules/@nativetalkcommunications/react-native-call-sdk/linphonesw-pod';
|
|
59
|
+
contents = contents.replace(/(use_native_modules![^\n]*)/, `$1\n pod 'linphonesw', :path => '${podPath}'`);
|
|
60
|
+
fs.writeFileSync(podfilePath, contents);
|
|
61
|
+
}
|
|
62
|
+
return mod;
|
|
63
|
+
},
|
|
64
|
+
]);
|
|
65
|
+
};
|
|
66
|
+
exports.withIosPodfile = withIosPodfile;
|