omikit-plugin 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 +20 -0
- package/README.md +31 -0
- package/android/build.gradle +134 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/omikitplugin/OmikitPluginModule.kt +190 -0
- package/android/src/main/java/com/omikitplugin/OmikitPluginPackage.kt +17 -0
- package/android/src/main/java/com/omikitplugin/constants/constant.kt +31 -0
- package/ios/CallProcess/CallManager.swift +367 -0
- package/ios/CallProcess/NSUserActivity.swift +58 -0
- package/ios/CallProcess/StringUtils.swift +18 -0
- package/ios/Constant/Constant.swift +47 -0
- package/ios/OmikitPlugin-Bridging-Header.h +2 -0
- package/ios/OmikitPlugin.m +17 -0
- package/ios/OmikitPlugin.swift +19 -0
- package/ios/OmikitPlugin.xcodeproj/project.pbxproj +321 -0
- package/ios/OmikitPlugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata +4 -0
- package/ios/OmikitPlugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/OmikitPlugin.xcodeproj/project.xcworkspace/xcuserdata/pro201916.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/OmikitPlugin.xcodeproj/xcuserdata/pro201916.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/ios/VideoCall/FLLocalCameraView.swift +81 -0
- package/ios/VideoCall/FLRemoteCameraView.swift +84 -0
- package/lib/commonjs/index.js +58 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/index.js +42 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/index.d.ts +12 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/omikit-plugin.podspec +36 -0
- package/package.json +166 -0
- package/src/index.tsx +59 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
5
|
+
|
|
6
|
+
Pod::Spec.new do |s|
|
|
7
|
+
s.name = "omikit-plugin"
|
|
8
|
+
s.version = package["version"]
|
|
9
|
+
s.summary = package["description"]
|
|
10
|
+
s.homepage = package["homepage"]
|
|
11
|
+
s.license = package["license"]
|
|
12
|
+
s.authors = package["author"]
|
|
13
|
+
|
|
14
|
+
s.platforms = { :ios => "11.0" }
|
|
15
|
+
s.source = { :git => "https://github.com/stevennguyenn/omikit-plugin.git", :tag => "#{s.version}" }
|
|
16
|
+
|
|
17
|
+
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
|
+
|
|
19
|
+
s.dependency "React-Core"
|
|
20
|
+
|
|
21
|
+
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
22
|
+
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
23
|
+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
24
|
+
s.pod_target_xcconfig = {
|
|
25
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
26
|
+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
27
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
28
|
+
}
|
|
29
|
+
s.dependency "React-Codegen"
|
|
30
|
+
s.dependency "RCT-Folly"
|
|
31
|
+
s.dependency "RCTRequired"
|
|
32
|
+
s.dependency "RCTTypeSafety"
|
|
33
|
+
s.dependency "ReactCommon/turbomodule/core"
|
|
34
|
+
end
|
|
35
|
+
s.dependency "OmiKit"
|
|
36
|
+
end
|
package/package.json
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "omikit-plugin",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "test",
|
|
5
|
+
"main": "lib/commonjs/index",
|
|
6
|
+
"module": "lib/module/index",
|
|
7
|
+
"types": "lib/typescript/index.d.ts",
|
|
8
|
+
"react-native": "src/index",
|
|
9
|
+
"source": "src/index",
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"lib",
|
|
13
|
+
"android",
|
|
14
|
+
"ios",
|
|
15
|
+
"cpp",
|
|
16
|
+
"*.podspec",
|
|
17
|
+
"!lib/typescript/example",
|
|
18
|
+
"!ios/build",
|
|
19
|
+
"!android/build",
|
|
20
|
+
"!android/gradle",
|
|
21
|
+
"!android/gradlew",
|
|
22
|
+
"!android/gradlew.bat",
|
|
23
|
+
"!android/local.properties",
|
|
24
|
+
"!**/__tests__",
|
|
25
|
+
"!**/__fixtures__",
|
|
26
|
+
"!**/__mocks__",
|
|
27
|
+
"!**/.*"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"test": "jest",
|
|
31
|
+
"typecheck": "tsc --noEmit",
|
|
32
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
33
|
+
"prepack": "bob build",
|
|
34
|
+
"release": "release-it",
|
|
35
|
+
"example": "yarn --cwd example",
|
|
36
|
+
"bootstrap": "yarn example && yarn install && yarn example pods",
|
|
37
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build"
|
|
38
|
+
},
|
|
39
|
+
"keywords": [
|
|
40
|
+
"react-native",
|
|
41
|
+
"ios",
|
|
42
|
+
"android"
|
|
43
|
+
],
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "git+https://github.com/stevennguyenn/omikit-plugin.git"
|
|
47
|
+
},
|
|
48
|
+
"author": "ViHAT Group <chaunguyen4297@gmail.com> (https://github.com/chauminhienglish)",
|
|
49
|
+
"license": "MIT",
|
|
50
|
+
"bugs": {
|
|
51
|
+
"url": "https://github.com/stevennguyenn/omikit-plugin/issues"
|
|
52
|
+
},
|
|
53
|
+
"homepage": "https://github.com/stevennguyenn/omikit-plugin#readme",
|
|
54
|
+
"publishConfig": {
|
|
55
|
+
"registry": "https://registry.npmjs.org/"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@commitlint/config-conventional": "^17.0.2",
|
|
59
|
+
"@evilmartians/lefthook": "^1.2.2",
|
|
60
|
+
"@react-native-community/eslint-config": "^3.0.2",
|
|
61
|
+
"@release-it/conventional-changelog": "^5.0.0",
|
|
62
|
+
"@types/jest": "^28.1.2",
|
|
63
|
+
"@types/react": "~17.0.21",
|
|
64
|
+
"@types/react-native": "0.70.0",
|
|
65
|
+
"commitlint": "^17.0.2",
|
|
66
|
+
"del-cli": "^5.0.0",
|
|
67
|
+
"eslint": "^8.4.1",
|
|
68
|
+
"eslint-config-prettier": "^8.5.0",
|
|
69
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
70
|
+
"jest": "^28.1.1",
|
|
71
|
+
"pod-install": "^0.1.0",
|
|
72
|
+
"prettier": "^2.0.5",
|
|
73
|
+
"react": "18.2.0",
|
|
74
|
+
"react-native": "0.71.3",
|
|
75
|
+
"react-native-builder-bob": "^0.20.0",
|
|
76
|
+
"release-it": "^15.0.0",
|
|
77
|
+
"typescript": "^4.5.2"
|
|
78
|
+
},
|
|
79
|
+
"resolutions": {
|
|
80
|
+
"@types/react": "17.0.21"
|
|
81
|
+
},
|
|
82
|
+
"peerDependencies": {
|
|
83
|
+
"react": "*",
|
|
84
|
+
"react-native": "*"
|
|
85
|
+
},
|
|
86
|
+
"engines": {
|
|
87
|
+
"node": ">= 16.0.0"
|
|
88
|
+
},
|
|
89
|
+
"packageManager": "^yarn@1.22.15",
|
|
90
|
+
"jest": {
|
|
91
|
+
"preset": "react-native",
|
|
92
|
+
"modulePathIgnorePatterns": [
|
|
93
|
+
"<rootDir>/example/node_modules",
|
|
94
|
+
"<rootDir>/lib/"
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
"commitlint": {
|
|
98
|
+
"extends": [
|
|
99
|
+
"@commitlint/config-conventional"
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
"release-it": {
|
|
103
|
+
"git": {
|
|
104
|
+
"commitMessage": "chore: release ${version}",
|
|
105
|
+
"tagName": "v${version}"
|
|
106
|
+
},
|
|
107
|
+
"npm": {
|
|
108
|
+
"publish": true
|
|
109
|
+
},
|
|
110
|
+
"github": {
|
|
111
|
+
"release": true
|
|
112
|
+
},
|
|
113
|
+
"plugins": {
|
|
114
|
+
"@release-it/conventional-changelog": {
|
|
115
|
+
"preset": "angular"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"eslintConfig": {
|
|
120
|
+
"root": true,
|
|
121
|
+
"extends": [
|
|
122
|
+
"@react-native-community",
|
|
123
|
+
"prettier"
|
|
124
|
+
],
|
|
125
|
+
"rules": {
|
|
126
|
+
"prettier/prettier": [
|
|
127
|
+
"error",
|
|
128
|
+
{
|
|
129
|
+
"quoteProps": "consistent",
|
|
130
|
+
"singleQuote": true,
|
|
131
|
+
"tabWidth": 2,
|
|
132
|
+
"trailingComma": "es5",
|
|
133
|
+
"useTabs": false
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"eslintIgnore": [
|
|
139
|
+
"node_modules/",
|
|
140
|
+
"lib/"
|
|
141
|
+
],
|
|
142
|
+
"prettier": {
|
|
143
|
+
"quoteProps": "consistent",
|
|
144
|
+
"singleQuote": true,
|
|
145
|
+
"tabWidth": 2,
|
|
146
|
+
"trailingComma": "es5",
|
|
147
|
+
"useTabs": false
|
|
148
|
+
},
|
|
149
|
+
"react-native-builder-bob": {
|
|
150
|
+
"source": "src",
|
|
151
|
+
"output": "lib",
|
|
152
|
+
"targets": [
|
|
153
|
+
"commonjs",
|
|
154
|
+
"module",
|
|
155
|
+
[
|
|
156
|
+
"typescript",
|
|
157
|
+
{
|
|
158
|
+
"project": "tsconfig.build.json"
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
]
|
|
162
|
+
},
|
|
163
|
+
"directories": {
|
|
164
|
+
"example": "example"
|
|
165
|
+
}
|
|
166
|
+
}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { NativeModules, Platform, NativeEventEmitter } from 'react-native';
|
|
2
|
+
|
|
3
|
+
const LINKING_ERROR =
|
|
4
|
+
`The package 'omikit-plugin' doesn't seem to be linked. Make sure: \n\n` +
|
|
5
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
6
|
+
'- You rebuilt the app after installing the package\n' +
|
|
7
|
+
'- You are not using Expo Go\n';
|
|
8
|
+
|
|
9
|
+
const OmikitPlugin = NativeModules.OmikitPlugin
|
|
10
|
+
? NativeModules.OmikitPlugin
|
|
11
|
+
: new Proxy(
|
|
12
|
+
{},
|
|
13
|
+
{
|
|
14
|
+
get() {
|
|
15
|
+
throw new Error(LINKING_ERROR);
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export function initCall(data: any): Promise<boolean> {
|
|
21
|
+
console.log(data);
|
|
22
|
+
return OmikitPlugin.initCall(data);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function updateToken(data: any): Promise<void> {
|
|
26
|
+
console.log(data);
|
|
27
|
+
return OmikitPlugin.updateToken(data);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function startCall(data: any): Promise<boolean> {
|
|
31
|
+
console.log(data);
|
|
32
|
+
return OmikitPlugin.startCall(data);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function endCall(): Promise<boolean> {
|
|
36
|
+
return OmikitPlugin.endCall();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function toggleMute(): Promise<boolean> {
|
|
40
|
+
return OmikitPlugin.toggleMute();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function toggleSpeak(data: any): Promise<boolean> {
|
|
44
|
+
return OmikitPlugin.toggleMute(data);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function onHold(data: any): Promise<boolean> {
|
|
48
|
+
return OmikitPlugin.onHold(data);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function onMute(data: any): Promise<boolean> {
|
|
52
|
+
return OmikitPlugin.onMute(data);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function sendDTMF(data: any): Promise<boolean> {
|
|
56
|
+
return OmikitPlugin.sendDTMF(data);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const omiEmitter = new NativeEventEmitter(OmikitPlugin);
|