@cloudflare/realtimekit-react-native 0.1.2 → 0.1.3-staging.2

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 (60) hide show
  1. package/android/src/main/AndroidManifest.xml +8 -1
  2. package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/BackgroundTimer/RNBackgroundTimer.java +3 -3
  3. package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/Constants.java +4 -4
  4. package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/CoreModule.java +1 -1
  5. package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/CorePackage.java +6 -6
  6. package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/ForegroundService.java +5 -5
  7. package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/NotificationHelper.java +2 -2
  8. package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/RNPermissionsModule.java +2 -2
  9. package/android/src/main/java/com/{reactnativecore/DyteHelperModule.java → cloudflare/realtimekit/RTKHelperModule.java} +12 -12
  10. package/android/src/main/java/com/{reactnativecore/DyteHolder.java → cloudflare/realtimekit/RTKHolder.java} +2 -2
  11. package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/incallmanager/AppRTCBluetoothManager.java +4 -4
  12. package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/incallmanager/AppRTCProximitySensor.java +4 -4
  13. package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/incallmanager/AppRTCUtils.java +1 -1
  14. package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/incallmanager/InCallManagerModule.java +4 -4
  15. package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/incallmanager/InCallProximityManager.java +3 -3
  16. package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/incallmanager/InCallWakeLockUtils.java +2 -2
  17. package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/incallmanager/ThreadUtils.java +1 -1
  18. package/android/src/main/res/values/strings.xml +3 -0
  19. package/app.plugin.js +1 -1
  20. package/ios/{DyteRNBackgroundTimer.h → RTKRNBackgroundTimer.h} +1 -1
  21. package/ios/{DyteRNBackgroundTimer.m → RTKRNBackgroundTimer.m} +10 -9
  22. package/ios/{DyteRNPermissionHandlerNotifications.h → RTKRNPermissionHandlerNotifications.h} +2 -2
  23. package/ios/{DyteRNPermissionHandlerNotifications.m → RTKRNPermissionHandlerNotifications.m} +3 -3
  24. package/ios/{DyteRNPermissions.h → RTKRNPermissions.h} +2 -2
  25. package/ios/{DyteRNPermissions.m → RTKRNPermissions.m} +33 -33
  26. package/ios/{DyteScreensharePickerView.h → RTKScreensharePickerView.h} +1 -1
  27. package/ios/{DyteScreensharePickerView.m → RTKScreensharePickerView.m} +2 -2
  28. package/ios/permissions/RTKRNPermissionHandlerBluetoothPeripheral.h +4 -0
  29. package/ios/permissions/{DyteRNPermissionHandlerBluetoothPeripheral.m → RTKRNPermissionHandlerBluetoothPeripheral.m} +3 -3
  30. package/ios/permissions/RTKRNPermissionHandlerCamera.h +5 -0
  31. package/ios/permissions/{DyteRNPermissionHandlerCamera.m → RTKRNPermissionHandlerCamera.m} +2 -2
  32. package/ios/permissions/RTKRNPermissionHandlerMicrophone.h +5 -0
  33. package/ios/permissions/{DyteRNPermissionHandlerMicrophone.m → RTKRNPermissionHandlerMicrophone.m} +2 -2
  34. package/ios/permissions/{DyteRNPermissionHandlerPhotoLibrary.h → RTKRNPermissionHandlerPhotoLibrary.h} +2 -2
  35. package/ios/permissions/{DyteRNPermissionHandlerPhotoLibrary.m → RTKRNPermissionHandlerPhotoLibrary.m} +2 -2
  36. package/ios/screenshare/{DyteDarwinNotificationCenter.swift → RTKDarwinNotificationCenter.swift} +4 -4
  37. package/ios/screenshare/{DyteScreenshareAtomic.swift → RTKScreenshareAtomic.swift} +1 -1
  38. package/ios/screenshare/{DyteScreenshareHandler.swift → RTKScreenshareHandler.swift} +8 -8
  39. package/ios/screenshare/{DyteScreenshareUploader.swift → RTKScreenshareUploader.swift} +6 -6
  40. package/ios/screenshare/{DyteSocketConnection.swift → RTKSocketConnection.swift} +3 -3
  41. package/lib/AudioSampleHandler.d.ts +14 -0
  42. package/lib/AudioSampleHandler.js +57 -0
  43. package/lib/BackgroundHandler.d.ts +1 -0
  44. package/lib/BackgroundHandler.js +17 -14
  45. package/lib/LocalMediaHandler.js +9 -9
  46. package/lib/PermissionHandler.js +7 -7
  47. package/lib/ReactContext.d.ts +4 -4
  48. package/lib/ReactContext.js +5 -5
  49. package/lib/ReactHooks.d.ts +1 -1
  50. package/lib/ReactHooks.js +1 -1
  51. package/lib/index.js +12 -0
  52. package/package.json +4 -6
  53. package/plugin/build/{withDyte.js → withRTK.js} +1 -1
  54. package/plugin/src/{withDyte.ts → withRTK.ts} +4 -1
  55. package/plugin/tsconfig.tsbuildinfo +1 -1
  56. package/LICENSE +0 -13
  57. package/ios/permissions/DyteRNPermissionHandlerBluetoothPeripheral.h +0 -4
  58. package/ios/permissions/DyteRNPermissionHandlerCamera.h +0 -5
  59. package/ios/permissions/DyteRNPermissionHandlerMicrophone.h +0 -5
  60. /package/plugin/build/{withDyte.d.ts → withRTK.d.ts} +0 -0
@@ -1,7 +1,7 @@
1
1
  #import <React/RCTBridgeModule.h>
2
2
  #import <ReplayKit/ReplayKit.h>
3
3
 
4
- @interface DyteScreensharePickerView : NSObject <RCTBridgeModule>
4
+ @interface RTKScreensharePickerView : NSObject <RCTBridgeModule>
5
5
 
6
6
  - (void)showScreenSharePickerView;
7
7
 
@@ -1,7 +1,7 @@
1
- #import "DyteScreensharePickerView.h"
1
+ #import "RTKScreensharePickerView.h"
2
2
  #import <React/RCTLog.h>
3
3
 
4
- @implementation DyteScreensharePickerView
4
+ @implementation RTKScreensharePickerView
5
5
 
6
6
  RCT_EXPORT_MODULE()
7
7
 
@@ -0,0 +1,4 @@
1
+ #import "RTKRNPermissions.h"
2
+ @interface RTKRNPermissionHandlerBluetoothPeripheral : NSObject<RTKRNPermissionHandler>
3
+
4
+ @end
@@ -1,8 +1,8 @@
1
- #import "DyteRNPermissionHandlerBluetoothPeripheral.h"
1
+ #import "RTKRNPermissionHandlerBluetoothPeripheral.h"
2
2
 
3
3
  @import CoreBluetooth;
4
4
 
5
- @interface DyteRNPermissionHandlerBluetoothPeripheral() <CBPeripheralManagerDelegate>
5
+ @interface RTKRNPermissionHandlerBluetoothPeripheral() <CBPeripheralManagerDelegate>
6
6
 
7
7
  @property (nonatomic, strong) CBPeripheralManager* manager;
8
8
  @property (nonatomic, strong) void (^resolve)(RNPermissionStatus status);
@@ -10,7 +10,7 @@
10
10
 
11
11
  @end
12
12
 
13
- @implementation DyteRNPermissionHandlerBluetoothPeripheral
13
+ @implementation RTKRNPermissionHandlerBluetoothPeripheral
14
14
 
15
15
  + (NSArray<NSString *> * _Nonnull)usageDescriptionKeys {
16
16
  return @[
@@ -0,0 +1,5 @@
1
+ #import "RTKRNPermissions.h"
2
+
3
+ @interface RTKRNPermissionHandlerCamera : NSObject<RTKRNPermissionHandler>
4
+
5
+ @end
@@ -1,9 +1,9 @@
1
- #import "DyteRNPermissionHandlerCamera.h"
1
+ #import "RTKRNPermissionHandlerCamera.h"
2
2
  //#import <React/RCTLog.h>
3
3
 
4
4
  @import AVFoundation;
5
5
 
6
- @implementation DyteRNPermissionHandlerCamera
6
+ @implementation RTKRNPermissionHandlerCamera
7
7
 
8
8
  + (NSArray<NSString *> * _Nonnull)usageDescriptionKeys {
9
9
  return @[@"NSCameraUsageDescription"];
@@ -0,0 +1,5 @@
1
+ #import "RTKRNPermissions.h"
2
+
3
+ @interface RTKRNPermissionHandlerMicrophone : NSObject<RTKRNPermissionHandler>
4
+
5
+ @end
@@ -1,8 +1,8 @@
1
- #import "DyteRNPermissionHandlerMicrophone.h"
1
+ #import "RTKRNPermissionHandlerMicrophone.h"
2
2
 
3
3
  @import AVFoundation;
4
4
 
5
- @implementation DyteRNPermissionHandlerMicrophone
5
+ @implementation RTKRNPermissionHandlerMicrophone
6
6
 
7
7
  + (NSArray<NSString *> * _Nonnull)usageDescriptionKeys {
8
8
  return @[@"NSMicrophoneUsageDescription"];
@@ -1,6 +1,6 @@
1
- #import "DyteRNPermissions.h"
1
+ #import "RTKRNPermissions.h"
2
2
 
3
- @interface DyteRNPermissionHandlerPhotoLibrary : NSObject<DyteRNPermissionHandler>
3
+ @interface RTKRNPermissionHandlerPhotoLibrary : NSObject<RTKRNPermissionHandler>
4
4
 
5
5
  - (void)openLimitedPhotoLibraryPickerWithResolver:(RCTPromiseResolveBlock _Nonnull)resolve
6
6
  rejecter:(RCTPromiseRejectBlock _Nonnull)reject;
@@ -1,10 +1,10 @@
1
- #import "DyteRNPermissionHandlerPhotoLibrary.h"
1
+ #import "RTKRNPermissionHandlerPhotoLibrary.h"
2
2
  #import <React/RCTUtils.h>
3
3
 
4
4
  @import Photos;
5
5
  @import PhotosUI;
6
6
 
7
- @implementation DyteRNPermissionHandlerPhotoLibrary
7
+ @implementation RTKRNPermissionHandlerPhotoLibrary
8
8
 
9
9
  + (NSArray<NSString *> * _Nonnull)usageDescriptionKeys {
10
10
  return @[@"NSPhotoLibraryUsageDescription"];
@@ -1,13 +1,13 @@
1
1
  import Foundation
2
2
 
3
- enum DyteDarwinNotification: String {
3
+ enum RTKDarwinNotification: String {
4
4
  case broadcastStarted = "iOS_BroadcastStarted"
5
5
  case broadcastStopped = "iOS_BroadcastStopped"
6
6
  }
7
7
 
8
- class DyteDarwinNotificationCenter {
8
+ class RTKDarwinNotificationCenter {
9
9
 
10
- static let shared = DyteDarwinNotificationCenter()
10
+ static let shared = RTKDarwinNotificationCenter()
11
11
 
12
12
  private let notificationCenter: CFNotificationCenter
13
13
 
@@ -15,7 +15,7 @@ class DyteDarwinNotificationCenter {
15
15
  notificationCenter = CFNotificationCenterGetDarwinNotifyCenter()
16
16
  }
17
17
 
18
- func postNotification(_ name: DyteDarwinNotification) {
18
+ func postNotification(_ name: RTKDarwinNotification) {
19
19
  CFNotificationCenterPostNotification(notificationCenter, CFNotificationName(rawValue: name.rawValue as CFString), nil, nil, true)
20
20
  }
21
21
  }
@@ -1,7 +1,7 @@
1
1
  import Foundation
2
2
 
3
3
  @propertyWrapper
4
- struct DyteScreenshareAtomic<Value> {
4
+ struct RTKScreenshareAtomic<Value> {
5
5
 
6
6
  private var value: Value
7
7
  private let lock = NSLock()
@@ -2,8 +2,8 @@ import ReplayKit
2
2
 
3
3
  open class RTKScreenshareHandler: RPBroadcastSampleHandler {
4
4
 
5
- private var clientConnection: DyteSocketConnection?
6
- private var uploader: DyteScreenshareUploader?
5
+ private var clientConnection: RTKSocketConnection?
6
+ private var uploader: RTKScreenshareUploader?
7
7
  private var frameCount: Int = 0
8
8
 
9
9
  private let appGroupIdentifier: String
@@ -19,10 +19,10 @@ open class RTKScreenshareHandler: RPBroadcastSampleHandler {
19
19
  self.appGroupIdentifier = appGroupIdentifier
20
20
  self.bundleIdentifier = bundleIdentifier
21
21
  super.init()
22
- if let connection = DyteSocketConnection(filePath: socketFilePath) {
22
+ if let connection = RTKSocketConnection(filePath: socketFilePath) {
23
23
  clientConnection = connection
24
24
  setupConnection()
25
- uploader = DyteScreenshareUploader(connection: connection, bundleIdentifier: bundleIdentifier)
25
+ uploader = RTKScreenshareUploader(connection: connection, bundleIdentifier: bundleIdentifier)
26
26
  }
27
27
  }
28
28
 
@@ -34,7 +34,7 @@ open class RTKScreenshareHandler: RPBroadcastSampleHandler {
34
34
  public override func broadcastStarted(withSetupInfo setupInfo: [String: NSObject]?) {
35
35
  // User has requested to start the broadcast. Setup info from the UI extension can be supplied but optional.
36
36
  frameCount = 0
37
- DyteDarwinNotificationCenter.shared.postNotification(.broadcastStarted)
37
+ RTKDarwinNotificationCenter.shared.postNotification(.broadcastStarted)
38
38
  openConnection()
39
39
  }
40
40
 
@@ -48,7 +48,7 @@ open class RTKScreenshareHandler: RPBroadcastSampleHandler {
48
48
 
49
49
  public override func broadcastFinished() {
50
50
  // User has requested to finish the broadcast.
51
- DyteDarwinNotificationCenter.shared.postNotification(.broadcastStopped)
51
+ RTKDarwinNotificationCenter.shared.postNotification(.broadcastStopped)
52
52
  clientConnection?.close()
53
53
  }
54
54
 
@@ -76,8 +76,8 @@ private extension RTKScreenshareHandler {
76
76
  self?.finishBroadcastWithError(error)
77
77
  } else {
78
78
  // the displayed failure message is more user friendly when using NSError instead of Error
79
- let DyteScreenSharingStopped = 10001
80
- let customError = NSError(domain: RPRecordingErrorDomain, code: DyteScreenSharingStopped, userInfo: [NSLocalizedDescriptionKey: "Screen sharing stopped"])
79
+ let RTKScreenSharingStopped = 10001
80
+ let customError = NSError(domain: RPRecordingErrorDomain, code: RTKScreenSharingStopped, userInfo: [NSLocalizedDescriptionKey: "Screen sharing stopped"])
81
81
  self?.finishBroadcastWithError(customError)
82
82
  }
83
83
  }
@@ -5,19 +5,19 @@ private enum Constants {
5
5
  static let bufferMaxLength = 10240
6
6
  }
7
7
 
8
- class DyteScreenshareUploader {
8
+ class RTKScreenshareUploader {
9
9
 
10
10
  private static var imageContext = CIContext(options: nil)
11
11
 
12
- @DyteScreenshareAtomic private var isReady = false
13
- private var connection: DyteSocketConnection
12
+ @RTKScreenshareAtomic private var isReady = false
13
+ private var connection: RTKSocketConnection
14
14
 
15
15
  private var dataToSend: Data?
16
16
  private var byteIndex = 0
17
17
 
18
18
  private let serialQueue: DispatchQueue
19
19
 
20
- init(connection: DyteSocketConnection, bundleIdentifier: String) {
20
+ init(connection: RTKSocketConnection, bundleIdentifier: String) {
21
21
  self.connection = connection
22
22
  self.serialQueue = DispatchQueue(label: bundleIdentifier)
23
23
 
@@ -42,7 +42,7 @@ class DyteScreenshareUploader {
42
42
  }
43
43
  }
44
44
 
45
- private extension DyteScreenshareUploader {
45
+ private extension RTKScreenshareUploader {
46
46
 
47
47
  func setupConnection() {
48
48
  connection.didOpen = { [weak self] in
@@ -133,7 +133,7 @@ private extension DyteScreenshareUploader {
133
133
 
134
134
  let options: [CIImageRepresentationOption: Float] = [kCGImageDestinationLossyCompressionQuality as CIImageRepresentationOption: 1.0]
135
135
 
136
- return DyteScreenshareUploader.imageContext.jpegRepresentation(of: image, colorSpace: colorSpace, options: options)
136
+ return RTKScreenshareUploader.imageContext.jpegRepresentation(of: image, colorSpace: colorSpace, options: options)
137
137
  }
138
138
  }
139
139
 
@@ -1,6 +1,6 @@
1
1
  import Foundation
2
2
 
3
- class DyteSocketConnection: NSObject {
3
+ class RTKSocketConnection: NSObject {
4
4
  var didOpen: (() -> Void)?
5
5
  var didClose: ((Error?) -> Void)?
6
6
  var streamHasSpaceAvailable: (() -> Void)?
@@ -67,7 +67,7 @@ class DyteSocketConnection: NSObject {
67
67
  }
68
68
  }
69
69
 
70
- extension DyteSocketConnection: StreamDelegate {
70
+ extension RTKSocketConnection: StreamDelegate {
71
71
 
72
72
  func stream(_ aStream: Stream, handle eventCode: Stream.Event) {
73
73
  switch eventCode {
@@ -101,7 +101,7 @@ extension DyteSocketConnection: StreamDelegate {
101
101
  }
102
102
  }
103
103
 
104
- private extension DyteSocketConnection {
104
+ private extension RTKSocketConnection {
105
105
 
106
106
  func setupAddress() -> Bool {
107
107
  var addr = sockaddr_un()
@@ -0,0 +1,14 @@
1
+ import { EventEmitter } from 'events';
2
+ export default class AudioSampleHandler extends EventEmitter {
3
+ private webRTCModuleEmitter;
4
+ private _audioSamplesListener?;
5
+ private _isListening;
6
+ private _currentSamples;
7
+ constructor();
8
+ static init(): Promise<AudioSampleHandler>;
9
+ private _audioSampleHandler;
10
+ private initialiseSampler;
11
+ getFloatTimeDomainData(samples: Float32Array): void;
12
+ stopListening(): void;
13
+ destructor(): void;
14
+ }
@@ -0,0 +1,57 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { NativeEventEmitter, NativeModules, Platform, } from 'react-native';
11
+ import { EventEmitter } from 'events';
12
+ const { WebRTCModule } = NativeModules;
13
+ export default class AudioSampleHandler extends EventEmitter {
14
+ constructor() {
15
+ super();
16
+ this._isListening = false;
17
+ this.webRTCModuleEmitter = new NativeEventEmitter(WebRTCModule);
18
+ this._audioSampleHandler = this._audioSampleHandler.bind(this);
19
+ this._currentSamples = new Float32Array(1024);
20
+ this.initialiseSampler();
21
+ }
22
+ static init() {
23
+ return __awaiter(this, void 0, void 0, function* () {
24
+ return new AudioSampleHandler();
25
+ });
26
+ }
27
+ _audioSampleHandler(audioData) {
28
+ this._currentSamples.fill(0);
29
+ if (Platform.OS === 'android') {
30
+ this._currentSamples.set(audioData);
31
+ }
32
+ else {
33
+ this._currentSamples.set(audioData.samples);
34
+ }
35
+ }
36
+ initialiseSampler() {
37
+ this._audioSamplesListener = this.webRTCModuleEmitter.addListener('audioSamples', this._audioSampleHandler);
38
+ this._isListening = true;
39
+ }
40
+ getFloatTimeDomainData(samples) {
41
+ if (!this._isListening) {
42
+ this.initialiseSampler();
43
+ }
44
+ samples.set(this._currentSamples);
45
+ }
46
+ stopListening() {
47
+ if (this._audioSamplesListener) {
48
+ this._audioSamplesListener.remove();
49
+ this._audioSamplesListener = undefined;
50
+ this._isListening = false;
51
+ this._currentSamples.fill(0);
52
+ }
53
+ }
54
+ destructor() {
55
+ this.stopListening();
56
+ }
57
+ }
@@ -6,6 +6,7 @@ declare class BackgroundTimer {
6
6
  backgroundTimer: number | NodeJS.Timeout | null;
7
7
  backgroundListener: any;
8
8
  constructor();
9
+ init(): BackgroundTimer;
9
10
  start(delay?: number): any;
10
11
  stop(): any;
11
12
  runBackgroundTimer(callback: any, delay: any): void;
@@ -1,6 +1,6 @@
1
1
  import { DeviceEventEmitter, NativeAppEventEmitter, NativeEventEmitter, NativeModules, Platform, } from 'react-native';
2
- const { DyteRNBackgroundTimer } = NativeModules;
3
- const Emitter = new NativeEventEmitter(DyteRNBackgroundTimer);
2
+ const { RTKRNBackgroundTimer } = NativeModules;
3
+ const Emitter = new NativeEventEmitter(RTKRNBackgroundTimer);
4
4
  class BackgroundTimer {
5
5
  constructor() {
6
6
  this.uniqueId = 0;
@@ -14,24 +14,27 @@ class BackgroundTimer {
14
14
  }
15
15
  else {
16
16
  Platform.OS === 'android'
17
- ? DyteRNBackgroundTimer.backgroundTimerSetTimeout(id, this.callbacks[id].timeout)
18
- : DyteRNBackgroundTimer.setTimeout(id, this.callbacks[id].timeout);
17
+ ? RTKRNBackgroundTimer.backgroundTimerSetTimeout(id, this.callbacks[id].timeout)
18
+ : RTKRNBackgroundTimer.setTimeout(id, this.callbacks[id].timeout);
19
19
  }
20
20
  callback();
21
21
  }
22
22
  });
23
23
  }
24
+ init() {
25
+ return new BackgroundTimer();
26
+ }
24
27
  // Original API
25
28
  start(delay = 0) {
26
29
  return Platform.OS === 'android'
27
- ? DyteRNBackgroundTimer.backgroundTimerStart(delay)
28
- : DyteRNBackgroundTimer.start(delay);
30
+ ? RTKRNBackgroundTimer.backgroundTimerStart(delay)
31
+ : RTKRNBackgroundTimer.start(delay);
29
32
  }
30
33
  stop() {
31
34
  Emitter.removeAllListeners('backgroundTimer.timeout');
32
35
  return Platform.OS === 'android'
33
- ? DyteRNBackgroundTimer.backgroundTimerStop()
34
- : DyteRNBackgroundTimer.stop();
36
+ ? RTKRNBackgroundTimer.backgroundTimerStop()
37
+ : RTKRNBackgroundTimer.stop();
35
38
  }
36
39
  runBackgroundTimer(callback, delay) {
37
40
  const EventEmitter = Platform.select({
@@ -64,14 +67,14 @@ class BackgroundTimer {
64
67
  timeout,
65
68
  };
66
69
  Platform.OS === 'android'
67
- ? DyteRNBackgroundTimer.backgroundTimerSetTimeout(timeoutId, timeout)
68
- : DyteRNBackgroundTimer.setTimeout(timeoutId, timeout);
70
+ ? RTKRNBackgroundTimer.backgroundTimerSetTimeout(timeoutId, timeout)
71
+ : RTKRNBackgroundTimer.setTimeout(timeoutId, timeout);
69
72
  return timeoutId;
70
73
  }
71
74
  clearTimeout(timeoutId) {
72
75
  if (this.callbacks[timeoutId]) {
73
76
  delete this.callbacks[timeoutId];
74
- // DyteRNBackgroundTimer.clearTimeout(timeoutId);
77
+ // RTKRNBackgroundTimer.clearTimeout(timeoutId);
75
78
  }
76
79
  }
77
80
  setInterval(callback, timeout) {
@@ -83,14 +86,14 @@ class BackgroundTimer {
83
86
  timeout,
84
87
  };
85
88
  Platform.OS === 'android'
86
- ? DyteRNBackgroundTimer.backgroundTimerSetTimeout(intervalId, timeout)
87
- : DyteRNBackgroundTimer.setTimeout(intervalId, timeout);
89
+ ? RTKRNBackgroundTimer.backgroundTimerSetTimeout(intervalId, timeout)
90
+ : RTKRNBackgroundTimer.setTimeout(intervalId, timeout);
88
91
  return intervalId;
89
92
  }
90
93
  clearInterval(intervalId) {
91
94
  if (this.callbacks[intervalId]) {
92
95
  delete this.callbacks[intervalId];
93
- // DyteRNBackgroundTimer.clearTimeout(intervalId);
96
+ // RTKRNBackgroundTimer.clearTimeout(intervalId);
94
97
  }
95
98
  }
96
99
  }
@@ -26,7 +26,7 @@ import { AppState, NativeEventEmitter, NativeModules, PermissionsAndroid, Platfo
26
26
  import BackgroundTimer from './BackgroundHandler';
27
27
  import InCallManger from './NativeAudioManager';
28
28
  import { setupPermissions } from './PermissionHandler';
29
- const { DyteHelper, BroadcastEventEmitter } = NativeModules;
29
+ const { RTKHelper, BroadcastEventEmitter } = NativeModules;
30
30
  const broadcastEmitter = new NativeEventEmitter(BroadcastEventEmitter);
31
31
  // eslint-disable-next-line no-shadow
32
32
  export var MediaEvents;
@@ -49,7 +49,7 @@ class LocalMediaHandler extends EventEmitter {
49
49
  return __awaiter(this, void 0, void 0, function* () {
50
50
  if (Platform.OS !== 'android')
51
51
  return;
52
- const val = yield DyteHelper.isForegroundServiceRunning();
52
+ const val = yield RTKHelper.isForegroundServiceRunning();
53
53
  if (!val) {
54
54
  if (Platform.Version >= 33) {
55
55
  const res = yield PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS);
@@ -58,10 +58,10 @@ class LocalMediaHandler extends EventEmitter {
58
58
  }
59
59
  }
60
60
  if (Platform.Version >= 26) {
61
- yield DyteHelper.createNotificationChannel();
61
+ yield RTKHelper.createNotificationChannel();
62
62
  }
63
63
  try {
64
- yield DyteHelper.startService();
64
+ yield RTKHelper.startService();
65
65
  }
66
66
  catch (e) {
67
67
  console.warn('Failed to start foreground service', e);
@@ -677,7 +677,7 @@ class LocalMediaHandler extends EventEmitter {
677
677
  if (this.screenShareEnabled && Platform.OS !== 'ios') {
678
678
  this.removeScreenShareTracks();
679
679
  try {
680
- yield DyteHelper.stopService();
680
+ yield RTKHelper.stopService();
681
681
  }
682
682
  catch (e) {
683
683
  console.warn('Failed to stop foreground service', e);
@@ -685,7 +685,7 @@ class LocalMediaHandler extends EventEmitter {
685
685
  return;
686
686
  }
687
687
  if (Platform.OS === 'ios' && this.screenShareEnabled) {
688
- NativeModules.DyteScreensharePickerView.showScreenSharePickerView();
688
+ NativeModules.RTKScreensharePickerView.showScreenSharePickerView();
689
689
  return;
690
690
  }
691
691
  if (Platform.OS === 'android') {
@@ -698,7 +698,7 @@ class LocalMediaHandler extends EventEmitter {
698
698
  catch (e) {
699
699
  console.warn('Failed to start screenshare', e);
700
700
  this.screenShareEnabled = false;
701
- yield DyteHelper.stopService();
701
+ yield RTKHelper.stopService();
702
702
  this._pendingScreenShare = false;
703
703
  }
704
704
  finally {
@@ -706,7 +706,7 @@ class LocalMediaHandler extends EventEmitter {
706
706
  }
707
707
  }
708
708
  if (Platform.OS === 'ios') {
709
- NativeModules.DyteScreensharePickerView.showScreenSharePickerView();
709
+ NativeModules.RTKScreensharePickerView.showScreenSharePickerView();
710
710
  }
711
711
  });
712
712
  }
@@ -812,7 +812,7 @@ class LocalMediaHandler extends EventEmitter {
812
812
  BackgroundTimer.stop();
813
813
  try {
814
814
  if (Platform.OS === 'android')
815
- DyteHelper.stopService();
815
+ RTKHelper.stopService();
816
816
  }
817
817
  catch (_err) { }
818
818
  InCallManger.stop(undefined);
@@ -32,18 +32,18 @@ export const RESULTS = Object.freeze({
32
32
  LIMITED: 'limited',
33
33
  PROMPTED: 'prompted',
34
34
  });
35
- const { DyteRNPermissions } = NativeModules;
35
+ const { RTKRNPermissions } = NativeModules;
36
36
  function request(permission) {
37
37
  return __awaiter(this, void 0, void 0, function* () {
38
- return DyteRNPermissions.available.includes(permission)
39
- ? yield DyteRNPermissions.request(permission)
38
+ return RTKRNPermissions.available.includes(permission)
39
+ ? yield RTKRNPermissions.request(permission)
40
40
  : RESULTS.UNAVAILABLE;
41
41
  });
42
42
  }
43
43
  function check(permission) {
44
44
  return __awaiter(this, void 0, void 0, function* () {
45
- return DyteRNPermissions.available.includes(permission)
46
- ? yield DyteRNPermissions.check(permission)
45
+ return RTKRNPermissions.available.includes(permission)
46
+ ? yield RTKRNPermissions.check(permission)
47
47
  : RESULTS.UNAVAILABLE;
48
48
  });
49
49
  }
@@ -61,7 +61,7 @@ function requestMultiplePermissions(permissions) {
61
61
  }
62
62
  return output;
63
63
  }
64
- const output = yield DyteRNPermissions.requestMultiplePermissions(permissions, true);
64
+ const output = yield RTKRNPermissions.requestMultiplePermissions(permissions, true);
65
65
  return output;
66
66
  });
67
67
  }
@@ -76,7 +76,7 @@ function checkMultiplePermissions(permissions) {
76
76
  }
77
77
  return output;
78
78
  }
79
- const output = yield DyteRNPermissions.checkMultiplePermissions(permissions);
79
+ const output = yield RTKRNPermissions.checkMultiplePermissions(permissions);
80
80
  return output;
81
81
  });
82
82
  }
@@ -15,10 +15,10 @@ export declare const RealtimeKitContext: React.Context<{
15
15
  updates: RealtimeKitUpdates | undefined;
16
16
  }>;
17
17
  /**
18
- * Provider component which makes the DyteClient object
18
+ * Provider component which makes the RealtimeKitClient object
19
19
  * available to nested components
20
20
  * @component
21
- * @param value The DyteClient instance from `useDyteClient()`
21
+ * @param value The RealtimeKitClient instance from `useRealtimeKitClient()`
22
22
  * @param renderBeforeLoad The provider will not render children by default
23
23
  * until it gets a client object, renderBeforeLoad can be used to override that
24
24
  */
@@ -28,8 +28,8 @@ export declare function RealtimeKitProvider({ value, children, fallback, }: {
28
28
  fallback?: ReactChild | ReactChild[];
29
29
  }): JSX.Element;
30
30
  /**
31
- * Hook which returns the reference to the DyteClient object
32
- * @returns meeting instance from `useDyteClient()`
31
+ * Hook which returns the reference to the RealtimeKitClient object
32
+ * @returns meeting instance from `useRealtimeKitClient()`
33
33
  */
34
34
  export declare const useRealtimeKitMeeting: () => {
35
35
  meeting: RealtimeKitClient;
@@ -52,10 +52,10 @@ export const RealtimeKitContext = createContext({
52
52
  updates: undefined,
53
53
  });
54
54
  /**
55
- * Provider component which makes the DyteClient object
55
+ * Provider component which makes the RealtimeKitClient object
56
56
  * available to nested components
57
57
  * @component
58
- * @param value The DyteClient instance from `useDyteClient()`
58
+ * @param value The RealtimeKitClient instance from `useRealtimeKitClient()`
59
59
  * @param renderBeforeLoad The provider will not render children by default
60
60
  * until it gets a client object, renderBeforeLoad can be used to override that
61
61
  */
@@ -79,12 +79,12 @@ export function RealtimeKitProvider({ value, children, fallback = null, }) {
79
79
  } }, value ? children : fallback));
80
80
  }
81
81
  /**
82
- * Hook which returns the reference to the DyteClient object
83
- * @returns meeting instance from `useDyteClient()`
82
+ * Hook which returns the reference to the RealtimeKitClient object
83
+ * @returns meeting instance from `useRealtimeKitClient()`
84
84
  */
85
85
  export const useRealtimeKitMeeting = () => {
86
86
  const { meeting } = useContext(RealtimeKitContext);
87
87
  if (!meeting)
88
- throw new Error('useRealtimeKitMeeting must be used within the DyteProvider');
88
+ throw new Error('useRealtimeKitMeeting must be used within the RealtimeKitProvider');
89
89
  return { meeting };
90
90
  };
@@ -5,7 +5,7 @@ import RealtimeKitClient from '@cloudflare/realtimekit';
5
5
  export declare const useRealtimeKitClient: () => [RealtimeKitClient | undefined, (options: any) => {}];
6
6
  type StateSelector<T extends object, U> = (state: T) => U;
7
7
  /**
8
- * Hook which extracts data from the DyteClient object
8
+ * Hook which extracts data from the RealtimeKitClient object
9
9
  */
10
10
  export declare const useRTKSelector: <StateSlice>(selector: StateSelector<RealtimeKitClient, StateSlice>) => StateSlice;
11
11
  export * from './ReactContext';
package/lib/ReactHooks.js CHANGED
@@ -37,7 +37,7 @@ const shouldUpdate = (slice, newSlice) => {
37
37
  return false;
38
38
  };
39
39
  /**
40
- * Hook which extracts data from the DyteClient object
40
+ * Hook which extracts data from the RealtimeKitClient object
41
41
  */
42
42
  export const useRTKSelector = (selector) => {
43
43
  const { meeting, updates } = useContext(RealtimeKitContext);
package/lib/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import { NativeModules, Platform } from 'react-native';
2
2
  import RealtimeKitMeeting from '@cloudflare/realtimekit';
3
3
  import LocalMediaHandler from './LocalMediaHandler';
4
+ import AudioSampleHandler from './AudioSampleHandler';
5
+ import BackgroundTimer from './BackgroundHandler';
4
6
  import { registerGlobals } from '@cloudflare/react-native-webrtc';
5
7
  import './utils/crypto';
6
8
  import 'text-encoding-polyfill';
@@ -37,4 +39,14 @@ Object.defineProperty(navigator, 'RNLocalMediaHandlerImpl', {
37
39
  return LocalMediaHandler;
38
40
  },
39
41
  });
42
+ Object.defineProperty(navigator, 'RNAudioSampleHandlerImpl', {
43
+ get: function () {
44
+ return AudioSampleHandler;
45
+ },
46
+ });
47
+ Object.defineProperty(navigator, 'RNBackgroundTimerImpl', {
48
+ get: function () {
49
+ return BackgroundTimer;
50
+ },
51
+ });
40
52
  export default RealtimeKitMeeting;