omikit-plugin 4.0.2 → 4.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.
Files changed (62) hide show
  1. package/README.md +272 -24
  2. package/android/src/main/java/com/omikitplugin/OmiLocalCameraView.kt +112 -0
  3. package/android/src/main/java/com/omikitplugin/OmiRemoteCameraView.kt +99 -0
  4. package/android/src/main/java/com/omikitplugin/OmikitPluginModule.kt +5 -4
  5. package/android/src/main/java/com/omikitplugin/OmikitPluginPackage.kt +11 -8
  6. package/ios/CallProcess/CallManager.swift +99 -29
  7. package/ios/Library/OmikitPlugin.m +18 -0
  8. package/ios/Library/OmikitPlugin.swift +233 -1
  9. package/ios/OmikitPlugin-Bridging-Header.h +1 -0
  10. package/ios/OmikitPlugin.xcodeproj/project.pbxproj +4 -4
  11. package/ios/VideoCall/OmiLocalCameraViewBridge.m +14 -0
  12. package/ios/VideoCall/OmiLocalCameraViewManager.swift +41 -0
  13. package/ios/VideoCall/OmiRemoteCameraViewBridge.m +14 -0
  14. package/ios/VideoCall/OmiRemoteCameraViewManager.swift +40 -0
  15. package/lib/commonjs/NativeOmikitPlugin.js +2 -1
  16. package/lib/commonjs/NativeOmikitPlugin.js.map +1 -1
  17. package/lib/commonjs/index.js.map +1 -1
  18. package/lib/commonjs/omi_audio_type.js +5 -7
  19. package/lib/commonjs/omi_audio_type.js.map +1 -1
  20. package/lib/commonjs/omi_call_state.js +5 -3
  21. package/lib/commonjs/omi_call_state.js.map +1 -1
  22. package/lib/commonjs/omi_local_camera.js +19 -17
  23. package/lib/commonjs/omi_local_camera.js.map +1 -1
  24. package/lib/commonjs/omi_remote_camera.js +20 -17
  25. package/lib/commonjs/omi_remote_camera.js.map +1 -1
  26. package/lib/commonjs/omi_start_call_status.js +5 -24
  27. package/lib/commonjs/omi_start_call_status.js.map +1 -1
  28. package/lib/commonjs/omikit.js +56 -3
  29. package/lib/commonjs/omikit.js.map +1 -1
  30. package/lib/commonjs/types/index.d.js.map +1 -1
  31. package/lib/module/NativeOmikitPlugin.js.map +1 -1
  32. package/lib/module/index.js.map +1 -1
  33. package/lib/module/omi_audio_type.js +4 -7
  34. package/lib/module/omi_audio_type.js.map +1 -1
  35. package/lib/module/omi_call_state.js +4 -3
  36. package/lib/module/omi_call_state.js.map +1 -1
  37. package/lib/module/omi_local_camera.js +19 -18
  38. package/lib/module/omi_local_camera.js.map +1 -1
  39. package/lib/module/omi_remote_camera.js +20 -18
  40. package/lib/module/omi_remote_camera.js.map +1 -1
  41. package/lib/module/omi_start_call_status.js +4 -24
  42. package/lib/module/omi_start_call_status.js.map +1 -1
  43. package/lib/module/omikit.js +49 -1
  44. package/lib/module/omikit.js.map +1 -1
  45. package/lib/module/types/index.d.js.map +1 -1
  46. package/omikit-plugin.podspec +1 -1
  47. package/package.json +2 -11
  48. package/react-native.config.js +14 -0
  49. package/src/NativeOmikitPlugin.ts +1 -0
  50. package/src/omi_call_state.tsx +1 -0
  51. package/src/omi_local_camera.tsx +15 -19
  52. package/src/omi_remote_camera.tsx +16 -19
  53. package/src/omikit.tsx +63 -0
  54. package/src/types/index.d.ts +344 -62
  55. package/android/src/main/java/com/omikitplugin/FLLocalCameraModule.kt +0 -34
  56. package/android/src/main/java/com/omikitplugin/FLLocalCameraView.kt +0 -44
  57. package/android/src/main/java/com/omikitplugin/FLRemoteCameraModule.kt +0 -37
  58. package/android/src/main/java/com/omikitplugin/FLRemoteCameraView.kt +0 -23
  59. package/ios/VideoCall/FLLocalCameraView.m +0 -17
  60. package/ios/VideoCall/FLLocalCameraView.swift +0 -44
  61. package/ios/VideoCall/FLRemoteCameraView.m +0 -18
  62. package/ios/VideoCall/FLRemoteCameraView.swift +0 -124
@@ -1,20 +1,85 @@
1
1
  declare module 'omikit-plugin' {
2
- import { NativeEventEmitter } from 'react-native';
2
+ import type { NativeEventEmitter } from 'react-native';
3
+ import type { ComponentType } from 'react';
4
+ import type { ViewProps } from 'react-native';
3
5
 
4
6
  // ============================================
5
- // FUNCTIONS
7
+ // SERVICE & AUTHENTICATION
6
8
  // ============================================
7
9
 
8
- export function startServices(): Promise<any>;
10
+ /**
11
+ * Initialize SDK services. Call once on app launch (e.g., App.tsx or index.js).
12
+ * Sets up native audio system and event listeners.
13
+ * Do NOT call multiple times.
14
+ */
15
+ export function startServices(): Promise<boolean>;
16
+
17
+ /**
18
+ * Configure push notification settings.
19
+ * Call after startServices(), before or after login.
20
+ */
9
21
  export function configPushNotification(data: any): Promise<any>;
22
+
23
+ /**
24
+ * Get pending call data on cold start (app launched from push notification).
25
+ * Returns call info if there's a pending incoming call, null otherwise.
26
+ */
10
27
  export function getInitialCall(): Promise<any>;
11
- export function initCallWithUserPassword(data: any): Promise<boolean>;
12
- export function initCallWithApiKey(data: any): Promise<boolean>;
13
28
 
14
29
  /**
15
- * Starts a new call
16
- * @param data - Call configuration { phoneNumber: string, isVideo: boolean }
17
- * @returns Promise with call result { status: OmiStartCallStatus, message?: string, _id?: string }
30
+ * Login with SIP username/password credentials.
31
+ * @param data.userName - SIP username
32
+ * @param data.password - SIP password
33
+ * @param data.realm - SIP realm/domain
34
+ * @param data.host - SIP proxy server (optional, defaults to vh.omicrm.com)
35
+ * @param data.isVideo - Enable video capability (required true for video calls)
36
+ * @param data.fcmToken - Firebase token for push notifications
37
+ * @param data.projectId - OMICALL project ID (optional)
38
+ * @param data.isSkipDevices - true = Customer mode, false = Agent mode (default)
39
+ */
40
+ export function initCallWithUserPassword(data: {
41
+ userName: string;
42
+ password: string;
43
+ realm: string;
44
+ host?: string;
45
+ isVideo: boolean;
46
+ fcmToken: string;
47
+ projectId?: string;
48
+ isSkipDevices?: boolean;
49
+ }): Promise<boolean>;
50
+
51
+ /**
52
+ * Login with API key.
53
+ * @param data.fullName - Display name
54
+ * @param data.usrUuid - User UUID from OMICALL
55
+ * @param data.apiKey - API key from OMICALL dashboard
56
+ * @param data.isVideo - Enable video capability
57
+ * @param data.phone - Phone number
58
+ * @param data.fcmToken - Firebase token for push notifications
59
+ * @param data.projectId - OMICALL project ID (optional)
60
+ */
61
+ export function initCallWithApiKey(data: {
62
+ fullName: string;
63
+ usrUuid: string;
64
+ apiKey: string;
65
+ isVideo: boolean;
66
+ phone: string;
67
+ fcmToken: string;
68
+ projectId?: string;
69
+ }): Promise<boolean>;
70
+
71
+ /** Logout and unregister SIP */
72
+ export function logout(): Promise<boolean>;
73
+
74
+ // ============================================
75
+ // CALL CONTROL
76
+ // ============================================
77
+
78
+ /**
79
+ * Start an outgoing call.
80
+ * @param data.phoneNumber - Number to call
81
+ * @param data.isVideo - true for video call, false for audio
82
+ * @returns { status: OmiStartCallStatus, message?: string, _id?: string }
18
83
  */
19
84
  export function startCall(data: {
20
85
  phoneNumber: string;
@@ -25,73 +90,271 @@ declare module 'omikit-plugin' {
25
90
  _id?: string;
26
91
  }>;
27
92
 
28
- export function startCallWithUuid(data: any): Promise<boolean>;
93
+ /** Start call by user UUID */
94
+ export function startCallWithUuid(data: {
95
+ usrUuid: string;
96
+ isVideo: boolean;
97
+ }): Promise<boolean>;
98
+
99
+ /** Accept incoming call */
29
100
  export function joinCall(): Promise<any>;
101
+
102
+ /** End active call (sends SIP BYE) */
30
103
  export function endCall(): Promise<any>;
31
- export function toggleMute(): Promise<boolean>;
32
- export function toggleHold(): Promise<boolean>;
104
+
105
+ /** Reject call on this device only (sends 486 Busy) */
106
+ export function rejectCall(): Promise<boolean>;
107
+
108
+ /** Reject call and stop ringing on ALL devices (sends 603 Decline) */
109
+ export function dropCall(): Promise<boolean>;
110
+
111
+ /** Blind transfer active call to another number */
112
+ export function transferCall(data: { phoneNumber: string }): Promise<boolean>;
113
+
114
+ // ============================================
115
+ // MEDIA CONTROL
116
+ // ============================================
117
+
118
+ /** Toggle microphone mute. Returns new mute state or null */
119
+ export function toggleMute(): Promise<boolean | null>;
120
+
121
+ /** Toggle speakerphone. Returns new speaker state */
33
122
  export function toggleSpeaker(): Promise<boolean>;
34
- export function onHold(data: any): Promise<boolean>;
35
- export function sendDTMF(data: any): Promise<boolean>;
36
- export function switchOmiCamera(): Promise<boolean>;
123
+
124
+ /** Toggle call hold */
125
+ export function toggleHold(): Promise<void>;
126
+
127
+ /** Set hold state explicitly */
128
+ export function onHold(data: { holdStatus: boolean }): Promise<boolean>;
129
+
130
+ /** Send DTMF tone (0-9, *, #) */
131
+ export function sendDTMF(data: { character: string }): Promise<boolean>;
132
+
133
+ /** List available audio output devices */
134
+ export function getAudio(): Promise<any>;
135
+
136
+ /** Set audio output device */
137
+ export function setAudio(data: { portType: OmiAudioType | number }): Promise<void>;
138
+
139
+ /** Get current audio output device */
140
+ export function getCurrentAudio(): Promise<any>;
141
+
142
+ // ============================================
143
+ // VIDEO CONTROL
144
+ // ============================================
145
+
146
+ /**
147
+ * Toggle video stream on/off during a video call.
148
+ * When off, remote party sees a black/frozen frame.
149
+ */
37
150
  export function toggleOmiVideo(): Promise<boolean>;
38
- export function logout(): Promise<boolean>;
151
+
152
+ /** Switch between front and back camera */
153
+ export function switchOmiCamera(): Promise<boolean>;
154
+
155
+ /**
156
+ * Register for video event notifications (iOS only).
157
+ * Call before starting/receiving a video call.
158
+ * Not needed on Android.
159
+ */
39
160
  export function registerVideoEvent(): Promise<boolean>;
161
+
162
+ /**
163
+ * Unregister video event notifications (iOS only).
164
+ * Call when leaving video call screen.
165
+ */
40
166
  export function removeVideoEvent(): Promise<boolean>;
167
+
168
+ /**
169
+ * Connect remote video feed to native TextureView surface.
170
+ * Call when call is confirmed (OmiCallState.confirmed).
171
+ * On Android: connects SDK incoming video to TextureView.
172
+ * On iOS Old Arch: triggers prepareForVideoDisplay.
173
+ */
174
+ export function refreshRemoteCamera(): Promise<boolean>;
175
+
176
+ /**
177
+ * Connect local camera feed to native TextureView surface.
178
+ * Call when call is confirmed (OmiCallState.confirmed).
179
+ * On Android: connects SDK local camera to TextureView (300ms delay for camera init).
180
+ * On iOS Old Arch: triggers prepareForVideoDisplay.
181
+ */
182
+ export function refreshLocalCamera(): Promise<boolean>;
183
+
184
+ /**
185
+ * Create native video containers and add to UIWindow (iOS New Arch / Fabric only).
186
+ * On Fabric, RCTViewManager.view() is not called, so containers must be created manually.
187
+ * Call when call is confirmed, then use setCameraConfig() to adjust position/style.
188
+ * On Android, this is a no-op.
189
+ */
190
+ export function setupVideoContainers(): Promise<boolean>;
191
+
192
+ /**
193
+ * Configure native video container style (iOS New Arch / Fabric only).
194
+ * Controls position, size, appearance, and visibility of video containers on UIWindow.
195
+ * On Android, use React style props on OmiRemoteCameraView/OmiLocalCameraView instead.
196
+ *
197
+ * @param config.target - Which camera: 'local' or 'remote'
198
+ * @param config.x - X position on screen
199
+ * @param config.y - Y position on screen
200
+ * @param config.width - View width
201
+ * @param config.height - View height
202
+ * @param config.borderRadius - Corner radius
203
+ * @param config.borderWidth - Border width
204
+ * @param config.borderColor - Border color (hex: '#RRGGBB' or '#RRGGBBAA')
205
+ * @param config.backgroundColor - Background color (hex)
206
+ * @param config.opacity - View opacity (0.0 - 1.0)
207
+ * @param config.hidden - Show/hide the video container
208
+ * @param config.scaleMode - Video scaling: 'fill' (aspect fill), 'fit' (aspect fit), 'stretch'
209
+ */
210
+ export function setCameraConfig(config: {
211
+ target: 'local' | 'remote';
212
+ x?: number;
213
+ y?: number;
214
+ width?: number;
215
+ height?: number;
216
+ borderRadius?: number;
217
+ borderWidth?: number;
218
+ borderColor?: string;
219
+ backgroundColor?: string;
220
+ opacity?: number;
221
+ hidden?: boolean;
222
+ scaleMode?: 'fill' | 'fit' | 'stretch';
223
+ }): Promise<boolean>;
224
+
225
+ // ============================================
226
+ // VIDEO COMPONENTS
227
+ // ============================================
228
+
229
+ /**
230
+ * Remote camera view — displays the other party's video.
231
+ * Android: renders via native TextureView. Style with React props.
232
+ * iOS Old Arch: renders via RCTViewManager. Style with React props.
233
+ * iOS New Arch (Fabric): falls back to plain View (use setupVideoContainers instead).
234
+ */
235
+ export const OmiRemoteCameraView: ComponentType<ViewProps>;
236
+
237
+ /**
238
+ * Local camera view — displays your own camera preview (PiP).
239
+ * Same platform behavior as OmiRemoteCameraView.
240
+ */
241
+ export const OmiLocalCameraView: ComponentType<ViewProps>;
242
+
243
+ // ============================================
244
+ // USER & INFO
245
+ // ============================================
246
+
247
+ /** Get logged-in user details (extension, name, etc.) */
41
248
  export function getCurrentUser(): Promise<any>;
249
+
250
+ /** Get remote/guest user details during a call */
42
251
  export function getGuestUser(): Promise<any>;
43
- export function systemAlertWindow(): Promise<boolean>;
44
- export function openSystemAlertSetting(): Promise<void>;
45
- export function getAudio(): Promise<any>;
46
- export function setAudio(data: { portType: OmiAudioType | number }): Promise<void>;
47
- export function getCurrentAudio(): Promise<any>;
48
- export function transferCall(data: any): Promise<boolean>;
49
- export function rejectCall(): Promise<boolean>;
50
- export function dropCall(): Promise<boolean>;
51
- export function getKeepAliveStatus(): Promise<any>;
52
- export function triggerKeepAlivePing(): Promise<boolean>;
252
+
253
+ /** Look up user info by phone number */
254
+ export function getUserInfo(phone: string): Promise<any>;
255
+
256
+ // ============================================
257
+ // GETTER FUNCTIONS (v4.0.1+)
258
+ // ============================================
259
+
260
+ /** Get the current Firebase project ID */
261
+ export function getProjectId(): Promise<string | null>;
262
+
263
+ /** Get the current app ID */
264
+ export function getAppId(): Promise<string | null>;
265
+
266
+ /** Get the current device ID */
267
+ export function getDeviceId(): Promise<string | null>;
268
+
269
+ /** Get the FCM push token */
270
+ export function getFcmToken(): Promise<string | null>;
271
+
272
+ /** Get SIP registration info (format: user@realm) */
273
+ export function getSipInfo(): Promise<string | null>;
274
+
275
+ /** Get VoIP push token (iOS only, returns null on Android) */
276
+ export function getVoipToken(): Promise<string | null>;
277
+
278
+ // ============================================
279
+ // NOTIFICATION CONTROL
280
+ // ============================================
281
+
282
+ /** Hide system notification without unregistering SIP */
283
+ export function hideSystemNotificationSafely(): Promise<boolean>;
284
+
285
+ /** Hide notification only (no SIP changes) */
286
+ export function hideSystemNotificationOnly(): Promise<boolean>;
287
+
288
+ /** Hide notification and unregister SIP with reason */
289
+ export function hideSystemNotificationAndUnregister(reason: string): Promise<boolean>;
290
+
291
+ // ============================================
292
+ // PERMISSIONS (Android)
293
+ // ============================================
294
+
295
+ /** Check current permission status. Returns detailed permission info */
53
296
  export function checkPermissionStatus(): Promise<any>;
297
+
298
+ /**
299
+ * Check and request all required permissions.
300
+ * @param isVideo - true to also request camera permission
301
+ */
54
302
  export function checkAndRequestPermissions(isVideo?: boolean): Promise<boolean>;
303
+
304
+ /** Request SYSTEM_ALERT_WINDOW permission for overlay (Android) */
55
305
  export function requestSystemAlertWindowPermission(): Promise<boolean>;
306
+
307
+ /** Check if app can draw overlays (Android M+) */
308
+ export function systemAlertWindow(): Promise<boolean>;
309
+
310
+ /** Open system alert window settings page */
311
+ export function openSystemAlertSetting(): Promise<void>;
312
+
313
+ /**
314
+ * Request specific permissions by status codes.
315
+ * @param codes - Array of permission codes (450=mic, 451=camera, 452=overlay)
316
+ */
56
317
  export function requestPermissionsByCodes(codes: number[]): Promise<boolean>;
57
- export function hideSystemNotificationSafely(): Promise<boolean>;
58
- export function hideSystemNotificationOnly(): Promise<boolean>;
59
- export function hideSystemNotificationAndUnregister(reason: string): Promise<boolean>;
60
- export function checkCredentials(data: any): Promise<{
318
+
319
+ // ============================================
320
+ // ADVANCED FEATURES
321
+ // ============================================
322
+
323
+ /**
324
+ * Validate SIP credentials without establishing a connection.
325
+ * @returns { success, statusCode, message }
326
+ */
327
+ export function checkCredentials(data: {
328
+ userName: string;
329
+ password: string;
330
+ realm: string;
331
+ }): Promise<{
61
332
  success: boolean;
62
333
  statusCode?: number;
63
334
  message?: string;
64
335
  }>;
336
+
337
+ /**
338
+ * Register with full control over registration behavior.
339
+ * @returns { success, statusCode, message }
340
+ */
65
341
  export function registerWithOptions(data: any): Promise<{
66
342
  success: boolean;
67
343
  statusCode?: number;
68
344
  message?: string;
69
345
  }>;
70
346
 
71
- // User & Info
72
- export function getUserInfo(phone: string): Promise<any>;
347
+ /** Check current keep-alive status */
348
+ export function getKeepAliveStatus(): Promise<any>;
73
349
 
74
- // Getter Functions
75
- /** Get the current project ID */
76
- export function getProjectId(): Promise<string | null>;
77
- /** Get the current app ID */
78
- export function getAppId(): Promise<string | null>;
79
- /** Get the current device ID */
80
- export function getDeviceId(): Promise<string | null>;
81
- /** Get the FCM token (Android) or push token */
82
- export function getFcmToken(): Promise<string | null>;
83
- /** Get SIP registration info (format: user@realm) */
84
- export function getSipInfo(): Promise<string | null>;
85
- /** Get VoIP token (iOS only, returns null on Android) */
86
- export function getVoipToken(): Promise<string | null>;
350
+ /** Manually trigger a keep-alive ping */
351
+ export function triggerKeepAlivePing(): Promise<boolean>;
87
352
 
88
353
  // ============================================
89
354
  // ENUMS
90
355
  // ============================================
91
356
 
92
- /**
93
- * Call state enum for tracking call lifecycle
94
- */
357
+ /** Call state enum for tracking call lifecycle */
95
358
  export enum OmiCallState {
96
359
  unknown = 0,
97
360
  calling = 1,
@@ -101,43 +364,34 @@ declare module 'omikit-plugin' {
101
364
  confirmed = 5,
102
365
  disconnected = 6,
103
366
  hold = 7,
367
+ /** Call is being disconnected (BYE sent, waiting for response) */
368
+ disconnecting = 12,
104
369
  }
105
370
 
106
371
  /**
107
- * Status codes returned by startCall() function
108
- * Use these to handle different call initiation results
372
+ * Status codes returned by startCall().
373
+ * Check these to handle different call initiation results.
109
374
  */
110
375
  export enum OmiStartCallStatus {
111
- // Validation errors (0-3)
112
376
  invalidUuid = 0,
113
377
  invalidPhoneNumber = 1,
114
378
  samePhoneNumber = 2,
115
379
  maxRetry = 3,
116
-
117
- // Permission errors (4, 450-452)
118
380
  permissionDenied = 4,
119
381
  permissionMicrophone = 450,
120
382
  permissionCamera = 451,
121
383
  permissionOverlay = 452,
122
-
123
- // Call errors (5-7)
124
384
  couldNotFindEndpoint = 5,
125
385
  accountRegisterFailed = 6,
126
386
  startCallFailed = 7,
127
-
128
- // Success statuses (8, 407)
129
387
  startCallSuccess = 8,
130
388
  startCallSuccessIOS = 407,
131
-
132
- // Other errors (9+)
133
389
  haveAnotherCall = 9,
134
390
  accountTurnOffNumberInternal = 10,
135
391
  noNetwork = 11,
136
392
  }
137
393
 
138
- /**
139
- * Audio output types for setAudio()
140
- */
394
+ /** Audio output types for setAudio() */
141
395
  export enum OmiAudioType {
142
396
  receiver = 0,
143
397
  speaker = 1,
@@ -146,21 +400,49 @@ declare module 'omikit-plugin' {
146
400
  }
147
401
 
148
402
  // ============================================
149
- // CONSTANTS & EVENTS
403
+ // EVENTS
150
404
  // ============================================
151
405
 
406
+ /** Event name constants — use with omiEmitter.addListener() */
152
407
  export const OmiCallEvent: {
408
+ /** Call lifecycle changes. Payload: { status, callerNumber, isVideo, incoming, codeEndCall } */
153
409
  onCallStateChanged: string;
410
+ /** Speaker toggled. Payload: boolean */
154
411
  onSpeaker: string;
412
+ /** Microphone mute toggled. Payload: boolean */
155
413
  onMuted: string;
414
+ /** Hold state changed. Payload: boolean */
156
415
  onHold: string;
416
+ /** Remote video stream ready. Call refreshRemoteCamera() */
157
417
  onRemoteVideoReady: string;
418
+ /** User tapped missed call notification. Payload: { callerNumber } */
158
419
  onClickMissedCall: string;
420
+ /** Switchboard answered. Payload: { data } */
159
421
  onSwitchboardAnswer: string;
422
+ /** Call quality metrics. Payload: { quality: 0|1|2, stat: { mos, jitter, latency, packetLoss } } */
160
423
  onCallQuality: string;
424
+ /** Audio device changed. Payload: { data } */
161
425
  onAudioChange: string;
426
+ /** Permission request needed (Android). Payload: { permissions } */
162
427
  onRequestPermissionAndroid: string;
163
428
  };
164
429
 
430
+ /**
431
+ * Event emitter for listening to SDK events.
432
+ * iOS: NativeEventEmitter (receives from RCTEventEmitter).
433
+ * Android: DeviceEventEmitter.
434
+ *
435
+ * Usage:
436
+ * ```typescript
437
+ * const sub = omiEmitter.addListener(OmiCallEvent.onCallStateChanged, (data) => {
438
+ * console.log('Status:', data.status);
439
+ * });
440
+ * // Cleanup:
441
+ * sub.remove();
442
+ * ```
443
+ *
444
+ * Important: use subscription.remove() — NOT removeAllListeners()
445
+ * (removeAllListeners removes listeners from ALL screens).
446
+ */
165
447
  export const omiEmitter: NativeEventEmitter;
166
448
  }
@@ -1,34 +0,0 @@
1
- package com.omikitplugin
2
-
3
- import android.view.Surface
4
- import android.view.TextureView
5
- import android.widget.LinearLayout
6
- import com.facebook.react.bridge.Promise
7
- import com.facebook.react.bridge.ReactApplicationContext
8
- import com.facebook.react.bridge.ReactContextBaseJavaModule
9
- import com.facebook.react.bridge.ReactMethod
10
- import vn.vihat.omicall.omisdk.OmiClient
11
- import vn.vihat.omicall.omisdk.videoutils.ScaleManager
12
- import vn.vihat.omicall.omisdk.videoutils.Size
13
-
14
- class FLLocalCameraModule(reactContext: ReactApplicationContext, localViewManager: FLLocalCameraView) :
15
- ReactContextBaseJavaModule(reactContext) {
16
-
17
- var cameraView: LinearLayout
18
- lateinit var localViewManager : FLLocalCameraView
19
-
20
- override fun getName(): String {
21
- return "FLLocalCameraModule"
22
- }
23
-
24
- init {
25
- cameraView = localViewManager.localView
26
- this.localViewManager = localViewManager
27
- }
28
-
29
- @ReactMethod
30
- fun refresh(promise: Promise) {
31
- this.localViewManager.refreshTexture()
32
- promise.resolve(true)
33
- }
34
- }
@@ -1,44 +0,0 @@
1
- package com.omikitplugin
2
-
3
- import android.view.Surface
4
- import android.view.TextureView
5
- import android.widget.LinearLayout
6
- import com.facebook.react.bridge.ReactApplicationContext
7
- import com.facebook.react.uimanager.SimpleViewManager
8
- import com.facebook.react.uimanager.ThemedReactContext
9
- import vn.vihat.omicall.omisdk.OmiClient
10
- import vn.vihat.omicall.omisdk.videoutils.ScaleManager
11
- import vn.vihat.omicall.omisdk.videoutils.Size
12
-
13
- class FLLocalCameraView(private val context: ReactApplicationContext) :
14
- SimpleViewManager<LinearLayout>() {
15
- val localView : LinearLayout = LinearLayout(context)
16
- private val cameraView : TextureView = TextureView(context)
17
-
18
- init {
19
- localView.addView(cameraView)
20
- }
21
-
22
- override fun getName(): String {
23
- return "FLLocalCameraView"
24
- }
25
-
26
- override fun createViewInstance(p0: ThemedReactContext): LinearLayout {
27
- return localView
28
- }
29
-
30
- fun localViewInstance(): LinearLayout {
31
- return localView
32
- }
33
-
34
- fun refreshTexture() {
35
- cameraView.surfaceTexture?.let {
36
- // OmiClient.getInstance().setupLocalVideoFeed(Surface(it))
37
- ScaleManager.adjustAspectRatio(
38
- cameraView,
39
- Size(cameraView.width, cameraView.height),
40
- Size(1280, 720)
41
- )
42
- }
43
- }
44
- }
@@ -1,37 +0,0 @@
1
- package com.omikitplugin
2
-
3
- import android.view.Surface
4
- import android.view.TextureView
5
- import com.facebook.react.bridge.Promise
6
- import com.facebook.react.bridge.ReactApplicationContext
7
- import com.facebook.react.bridge.ReactContextBaseJavaModule
8
- import com.facebook.react.bridge.ReactMethod
9
- import vn.vihat.omicall.omisdk.OmiClient
10
- import vn.vihat.omicall.omisdk.videoutils.ScaleManager
11
- import vn.vihat.omicall.omisdk.videoutils.Size
12
-
13
- class FLRemoteCameraModule(reactContext: ReactApplicationContext, remoteViewManager: FLRemoteCameraView) :
14
- ReactContextBaseJavaModule(reactContext) {
15
-
16
- var cameraView: TextureView
17
-
18
- override fun getName(): String {
19
- return "FLRemoteCameraModule"
20
- }
21
-
22
- init {
23
- cameraView = remoteViewManager.remoteView
24
- }
25
-
26
- @ReactMethod
27
- fun refresh(promise: Promise) {
28
- cameraView.surfaceTexture?.let {
29
- // OmiClient.instance.setupIncomingVideoFeed(Surface(it))
30
- ScaleManager.adjustAspectRatio(cameraView,
31
- Size(cameraView.width, cameraView.height),
32
- Size(1280,720)
33
- )
34
- promise.resolve(true)
35
- }
36
- }
37
- }
@@ -1,23 +0,0 @@
1
- package com.omikitplugin
2
-
3
- import android.view.TextureView
4
- import com.facebook.react.bridge.ReactApplicationContext
5
- import com.facebook.react.uimanager.SimpleViewManager
6
- import com.facebook.react.uimanager.ThemedReactContext
7
-
8
- class FLRemoteCameraView(private val context: ReactApplicationContext) :
9
- SimpleViewManager<TextureView>() {
10
- val remoteView : TextureView = TextureView(context)
11
-
12
- override fun getName(): String {
13
- return "FLRemoteCameraView"
14
- }
15
-
16
- override fun createViewInstance(p0: ThemedReactContext): TextureView {
17
- return remoteView
18
- }
19
-
20
- fun localViewInstance(): TextureView {
21
- return remoteView
22
- }
23
- }
@@ -1,17 +0,0 @@
1
- //
2
- // FLLocalCameraView.m
3
- // omikit-plugin
4
- //
5
- // Created by PRO 2019 16' on 03/04/2023.
6
- //
7
-
8
- #import <Foundation/Foundation.h>
9
- #import <React/RCTBridgeModule.h>
10
- #import <React/RCTViewManager.h>
11
-
12
-
13
- @interface RCT_EXTERN_MODULE(FLLocalCameraView, RCTViewManager)
14
- RCT_EXTERN_METHOD(refresh:
15
- (RCTPromiseResolveBlock)resolve
16
- withRejecter:(RCTPromiseRejectBlock)reject)
17
- @end