omikit-plugin 1.0.0 → 2.0.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.
Files changed (47) hide show
  1. package/README.md +296 -66
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/com/omikitplugin/FLLocalCameraModule.kt +37 -0
  4. package/android/src/main/java/com/omikitplugin/FLLocalCameraView.kt +23 -0
  5. package/android/src/main/java/com/omikitplugin/FLRemoteCameraModule.kt +37 -0
  6. package/android/src/main/java/com/omikitplugin/FLRemoteCameraView.kt +23 -0
  7. package/android/src/main/java/com/omikitplugin/OmikitPluginModule.kt +249 -85
  8. package/android/src/main/java/com/omikitplugin/OmikitPluginPackage.kt +21 -2
  9. package/android/src/main/java/com/omikitplugin/constants/constant.kt +23 -12
  10. package/ios/CallProcess/CallManager.swift +109 -71
  11. package/ios/Constant/Constant.swift +15 -10
  12. package/ios/OmikitPlugin.m +34 -2
  13. package/ios/OmikitPlugin.swift +69 -32
  14. package/ios/VideoCall/FLLocalCameraView.m +17 -0
  15. package/ios/VideoCall/FLLocalCameraView.swift +41 -80
  16. package/ios/VideoCall/FLRemoteCameraView.m +18 -0
  17. package/ios/VideoCall/FLRemoteCameraView.swift +39 -1
  18. package/lib/commonjs/index.js +32 -64
  19. package/lib/commonjs/index.js.map +1 -1
  20. package/lib/commonjs/omi_local_camera.js +15 -0
  21. package/lib/commonjs/omi_local_camera.js.map +1 -0
  22. package/lib/commonjs/omi_remote_camera.js +15 -0
  23. package/lib/commonjs/omi_remote_camera.js.map +1 -0
  24. package/lib/commonjs/omikit.js +98 -0
  25. package/lib/commonjs/omikit.js.map +1 -0
  26. package/lib/module/index.js +3 -51
  27. package/lib/module/index.js.map +1 -1
  28. package/lib/module/omi_local_camera.js +7 -0
  29. package/lib/module/omi_local_camera.js.map +1 -0
  30. package/lib/module/omi_remote_camera.js +7 -0
  31. package/lib/module/omi_remote_camera.js.map +1 -0
  32. package/lib/module/omikit.js +73 -0
  33. package/lib/module/omikit.js.map +1 -0
  34. package/lib/typescript/index.d.ts +3 -19
  35. package/lib/typescript/index.d.ts.map +1 -1
  36. package/lib/typescript/omi_local_camera.d.ts +5 -0
  37. package/lib/typescript/omi_local_camera.d.ts.map +1 -0
  38. package/lib/typescript/omi_remote_camera.d.ts +5 -0
  39. package/lib/typescript/omi_remote_camera.d.ts.map +1 -0
  40. package/lib/typescript/omikit.d.ts +26 -0
  41. package/lib/typescript/omikit.d.ts.map +1 -0
  42. package/omikit-plugin.podspec +1 -1
  43. package/package.json +1 -1
  44. package/src/index.tsx +3 -71
  45. package/src/omi_local_camera.tsx +11 -0
  46. package/src/omi_remote_camera.tsx +11 -0
  47. package/src/omikit.tsx +98 -0
package/src/index.tsx CHANGED
@@ -1,71 +1,3 @@
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 getInitialCall(): Promise<any> {
21
- return OmikitPlugin.getInitialCall();
22
- }
23
-
24
- export function initCall(data: any): Promise<boolean> {
25
- console.log(data);
26
- return OmikitPlugin.initCall(data);
27
- }
28
-
29
- export function updateToken(data: any): Promise<void> {
30
- console.log(data);
31
- return OmikitPlugin.updateToken(data);
32
- }
33
-
34
- export function startCall(data: any): Promise<boolean> {
35
- console.log(data);
36
- return OmikitPlugin.startCall(data);
37
- }
38
-
39
- export function joinCall(): Promise<boolean> {
40
- return OmikitPlugin.joinCall();
41
- }
42
-
43
- export function endCall(): Promise<boolean> {
44
- return OmikitPlugin.endCall();
45
- }
46
-
47
- export function toggleMute(): Promise<boolean> {
48
- return OmikitPlugin.toggleMute();
49
- }
50
-
51
- export function toggleSpeak(): Promise<boolean> {
52
- return OmikitPlugin.toggleSpeak();
53
- }
54
-
55
- export function onHold(data: any): Promise<boolean> {
56
- return OmikitPlugin.onHold(data);
57
- }
58
-
59
- export function sendDTMF(data: any): Promise<boolean> {
60
- return OmikitPlugin.sendDTMF(data);
61
- }
62
-
63
- export const omiEmitter = new NativeEventEmitter(OmikitPlugin);
64
-
65
- export const OmiCallEvent = {
66
- onCallEstablished: 'CALL_ESTABLISHED',
67
- onCallEnd: 'CALL_END',
68
- incomingReceived: 'INCOMING_RECEIVED',
69
- onSpeaker: 'SPEAKER',
70
- onMuted: 'MUTED',
71
- };
1
+ export * from './omikit';
2
+ export * from './omi_local_camera';
3
+ export * from './omi_remote_camera';
@@ -0,0 +1,11 @@
1
+ import type { HostComponent } from 'react-native';
2
+ import { NativeModules, requireNativeComponent, ViewProps } from 'react-native';
3
+
4
+ const FLLocalCamera = NativeModules.FLLocalCameraView;
5
+
6
+ export const OmiLocalCameraView: HostComponent<ViewProps> =
7
+ requireNativeComponent('FLLocalCameraView');
8
+
9
+ export function refreshLocalCamera(): Promise<boolean> {
10
+ return FLLocalCamera.refresh();
11
+ }
@@ -0,0 +1,11 @@
1
+ import type { HostComponent } from 'react-native';
2
+ import { NativeModules, requireNativeComponent, ViewProps } from 'react-native';
3
+
4
+ const FLRemoteCamera = NativeModules.FLRemoteCameraView;
5
+
6
+ export const OmiRemoteCameraView: HostComponent<ViewProps> =
7
+ requireNativeComponent('FLRemoteCameraView');
8
+
9
+ export function refreshRemoteCamera(): Promise<boolean> {
10
+ return FLRemoteCamera.refresh();
11
+ }
package/src/omikit.tsx ADDED
@@ -0,0 +1,98 @@
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 startServices(): Promise<any> {
21
+ return OmikitPlugin.startServices();
22
+ }
23
+
24
+ export function configPushNotification(data: any): Promise<any> {
25
+ return OmikitPlugin.configPushNotification(data);
26
+ }
27
+
28
+ export function getInitialCall(): Promise<any> {
29
+ return OmikitPlugin.getInitialCall();
30
+ }
31
+
32
+ export function initCallWithUserPassword(data: any): Promise<boolean> {
33
+ console.log(data);
34
+ return OmikitPlugin.initCallWithUserPassword(data);
35
+ }
36
+
37
+ export function initCallWithApiKey(data: any): Promise<boolean> {
38
+ console.log(data);
39
+ return OmikitPlugin.initCallWithApiKey(data);
40
+ }
41
+
42
+ export function updateToken(data: any): Promise<void> {
43
+ console.log(data);
44
+ return OmikitPlugin.updateToken(data);
45
+ }
46
+
47
+ export function startCall(data: any): Promise<boolean> {
48
+ console.log(data);
49
+ return OmikitPlugin.startCall(data);
50
+ }
51
+
52
+ export function startCallWithUuid(data: any): Promise<boolean> {
53
+ console.log(data);
54
+ return OmikitPlugin.startCallWithUuid(data);
55
+ }
56
+
57
+ export function joinCall(): Promise<boolean> {
58
+ return OmikitPlugin.joinCall();
59
+ }
60
+
61
+ export function endCall(): Promise<boolean> {
62
+ return OmikitPlugin.endCall();
63
+ }
64
+
65
+ export function toggleMute(): Promise<boolean> {
66
+ return OmikitPlugin.toggleMute();
67
+ }
68
+
69
+ export function toggleSpeaker(): Promise<boolean> {
70
+ return OmikitPlugin.toggleSpeaker();
71
+ }
72
+
73
+ export function onHold(data: any): Promise<boolean> {
74
+ return OmikitPlugin.onHold(data);
75
+ }
76
+
77
+ export function sendDTMF(data: any): Promise<boolean> {
78
+ return OmikitPlugin.sendDTMF(data);
79
+ }
80
+
81
+ export function switchOmiCamera(): Promise<boolean> {
82
+ return OmikitPlugin.switchOmiCamera();
83
+ }
84
+
85
+ export function toggleOmiVideo(): Promise<boolean> {
86
+ return OmikitPlugin.toggleOmiVideo();
87
+ }
88
+
89
+ export const omiEmitter = new NativeEventEmitter(OmikitPlugin);
90
+
91
+ export const OmiCallEvent = {
92
+ onCallEstablished: 'CALL_ESTABLISHED',
93
+ onCallEnd: 'CALL_END',
94
+ incomingReceived: 'INCOMING_RECEIVED',
95
+ onSpeaker: 'SPEAKER',
96
+ onMuted: 'MUTED',
97
+ // onVideo: 'VIDEO',
98
+ };