@cloudflare/realtimekit-react-native 0.1.2-staging.9 → 0.1.3-staging.1
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/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/BackgroundTimer/RNBackgroundTimer.java +3 -3
- package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/Constants.java +4 -4
- package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/CoreModule.java +1 -1
- package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/CorePackage.java +6 -6
- package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/ForegroundService.java +5 -5
- package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/NotificationHelper.java +2 -2
- package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/RNPermissionsModule.java +2 -2
- package/android/src/main/java/com/{reactnativecore/DyteHelperModule.java → cloudflare/realtimekit/RTKHelperModule.java} +12 -12
- package/android/src/main/java/com/{reactnativecore/DyteHolder.java → cloudflare/realtimekit/RTKHolder.java} +2 -2
- package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/incallmanager/AppRTCBluetoothManager.java +4 -4
- package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/incallmanager/AppRTCProximitySensor.java +4 -4
- package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/incallmanager/AppRTCUtils.java +1 -1
- package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/incallmanager/InCallManagerModule.java +4 -4
- package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/incallmanager/InCallProximityManager.java +3 -3
- package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/incallmanager/InCallWakeLockUtils.java +2 -2
- package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/incallmanager/ThreadUtils.java +1 -1
- package/app.plugin.js +1 -1
- package/ios/RNInCallManager.m +26 -18
- package/ios/{DyteRNBackgroundTimer.h → RTKRNBackgroundTimer.h} +1 -1
- package/ios/{DyteRNBackgroundTimer.m → RTKRNBackgroundTimer.m} +2 -2
- package/ios/{DyteRNPermissionHandlerNotifications.h → RTKRNPermissionHandlerNotifications.h} +2 -2
- package/ios/{DyteRNPermissionHandlerNotifications.m → RTKRNPermissionHandlerNotifications.m} +3 -3
- package/ios/{DyteRNPermissions.h → RTKRNPermissions.h} +2 -2
- package/ios/{DyteRNPermissions.m → RTKRNPermissions.m} +33 -33
- package/ios/{DyteScreensharePickerView.h → RTKScreensharePickerView.h} +1 -1
- package/ios/{DyteScreensharePickerView.m → RTKScreensharePickerView.m} +2 -2
- package/ios/permissions/RTKRNPermissionHandlerBluetoothPeripheral.h +4 -0
- package/ios/permissions/{DyteRNPermissionHandlerBluetoothPeripheral.m → RTKRNPermissionHandlerBluetoothPeripheral.m} +3 -3
- package/ios/permissions/RTKRNPermissionHandlerCamera.h +5 -0
- package/ios/permissions/{DyteRNPermissionHandlerCamera.m → RTKRNPermissionHandlerCamera.m} +2 -2
- package/ios/permissions/RTKRNPermissionHandlerMicrophone.h +5 -0
- package/ios/permissions/{DyteRNPermissionHandlerMicrophone.m → RTKRNPermissionHandlerMicrophone.m} +2 -2
- package/ios/permissions/{DyteRNPermissionHandlerPhotoLibrary.h → RTKRNPermissionHandlerPhotoLibrary.h} +2 -2
- package/ios/permissions/{DyteRNPermissionHandlerPhotoLibrary.m → RTKRNPermissionHandlerPhotoLibrary.m} +2 -2
- package/ios/screenshare/{DyteDarwinNotificationCenter.swift → RTKDarwinNotificationCenter.swift} +4 -4
- package/ios/screenshare/{DyteScreenshareAtomic.swift → RTKScreenshareAtomic.swift} +1 -1
- package/ios/screenshare/{DyteScreenshareHandler.swift → RTKScreenshareHandler.swift} +8 -8
- package/ios/screenshare/{DyteScreenshareUploader.swift → RTKScreenshareUploader.swift} +6 -6
- package/ios/screenshare/{DyteSocketConnection.swift → RTKSocketConnection.swift} +3 -3
- package/lib/BackgroundHandler.js +19 -9
- package/lib/LocalMediaHandler.d.ts +0 -3
- package/lib/LocalMediaHandler.js +26 -46
- package/lib/PermissionHandler.js +7 -7
- package/lib/ReactContext.d.ts +4 -4
- package/lib/ReactContext.js +5 -5
- package/lib/ReactHooks.d.ts +1 -1
- package/lib/ReactHooks.js +1 -1
- package/package.json +1 -1
- package/plugin/build/{withDyte.js → withRTK.js} +1 -1
- package/plugin/src/{withDyte.ts → withRTK.ts} +4 -1
- package/plugin/tsconfig.tsbuildinfo +1 -1
- package/LICENSE +0 -13
- package/ios/permissions/DyteRNPermissionHandlerBluetoothPeripheral.h +0 -4
- package/ios/permissions/DyteRNPermissionHandlerCamera.h +0 -5
- package/ios/permissions/DyteRNPermissionHandlerMicrophone.h +0 -5
- /package/plugin/build/{withDyte.d.ts → withRTK.d.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
2
|
-
package="com.
|
|
2
|
+
package="com.cloudflare.realtimekit">
|
|
3
3
|
<uses-feature android:name="android.hardware.camera" />
|
|
4
4
|
<uses-feature android:name="android.hardware.bluetooth" android:required="false"/>
|
|
5
5
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.cloudflare.realtimekit.BackgroundTimer;
|
|
2
2
|
|
|
3
3
|
import android.os.Handler;
|
|
4
4
|
import android.os.PowerManager;
|
|
@@ -40,13 +40,13 @@ public class RNBackgroundTimer extends ReactContextBaseJavaModule {
|
|
|
40
40
|
super(reactContext);
|
|
41
41
|
this.reactContext = reactContext;
|
|
42
42
|
this.powerManager = (PowerManager) getReactApplicationContext().getSystemService(reactContext.POWER_SERVICE);
|
|
43
|
-
this.wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "
|
|
43
|
+
this.wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "realtimekit:wakelock");
|
|
44
44
|
reactContext.addLifecycleEventListener(listener);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
@Override
|
|
48
48
|
public String getName() {
|
|
49
|
-
return "
|
|
49
|
+
return "RTKRNBackgroundTimer";
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
|
-
package com.
|
|
2
|
+
package com.cloudflare.realtimekit;
|
|
3
3
|
|
|
4
4
|
class Constants {
|
|
5
|
-
static final String ACTION_FOREGROUND_SERVICE_START = "package com.
|
|
6
|
-
static final String ACTION_FOREGROUND_SERVICE_STOP = "package com.
|
|
5
|
+
static final String ACTION_FOREGROUND_SERVICE_START = "package com.cloudflare.realtimekit.service_start";
|
|
6
|
+
static final String ACTION_FOREGROUND_SERVICE_STOP = "package com.cloudflare.realtimekit.service_stop";
|
|
7
7
|
|
|
8
|
-
static final String NOTIFICATION_CONFIG = "package com.
|
|
8
|
+
static final String NOTIFICATION_CONFIG = "package com.cloudflare.realtimekit.notif_config";
|
|
9
9
|
|
|
10
10
|
static final String ERROR_INVALID_CONFIG = "ERROR_INVALID_CONFIG";
|
|
11
11
|
static final String ERROR_SERVICE_ERROR = "ERROR_SERVICE_ERROR";
|
package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/CorePackage.java
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.cloudflare.realtimekit;
|
|
2
2
|
|
|
3
3
|
import androidx.annotation.NonNull;
|
|
4
4
|
|
|
@@ -9,10 +9,10 @@ import com.facebook.react.uimanager.ViewManager;
|
|
|
9
9
|
|
|
10
10
|
import java.util.*;
|
|
11
11
|
|
|
12
|
-
import com.
|
|
13
|
-
import com.
|
|
14
|
-
import com.
|
|
15
|
-
import com.
|
|
12
|
+
import com.cloudflare.realtimekit.incallmanager.InCallManagerModule;
|
|
13
|
+
import com.cloudflare.realtimekit.RNPermissionsModule;
|
|
14
|
+
import com.cloudflare.realtimekit.BackgroundTimer.RNBackgroundTimer;
|
|
15
|
+
import com.cloudflare.realtimekit.RTKHelperModule;
|
|
16
16
|
|
|
17
17
|
public class CorePackage implements ReactPackage {
|
|
18
18
|
@NonNull
|
|
@@ -22,7 +22,7 @@ public class CorePackage implements ReactPackage {
|
|
|
22
22
|
new RNPermissionsModule(reactContext),
|
|
23
23
|
new InCallManagerModule(reactContext),
|
|
24
24
|
new RNBackgroundTimer(reactContext),
|
|
25
|
-
new
|
|
25
|
+
new RTKHelperModule(reactContext)
|
|
26
26
|
);
|
|
27
27
|
}
|
|
28
28
|
|
package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/ForegroundService.java
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.cloudflare.realtimekit;
|
|
2
2
|
|
|
3
3
|
import android.app.Notification;
|
|
4
4
|
import android.app.Service;
|
|
@@ -10,7 +10,7 @@ import android.os.IBinder;
|
|
|
10
10
|
import android.util.Log;
|
|
11
11
|
import android.app.Activity;
|
|
12
12
|
import android.widget.Toast;
|
|
13
|
-
import com.
|
|
13
|
+
import com.cloudflare.realtimekit.RTKHolder;
|
|
14
14
|
|
|
15
15
|
public class ForegroundService extends Service {
|
|
16
16
|
@Override
|
|
@@ -22,9 +22,9 @@ public class ForegroundService extends Service {
|
|
|
22
22
|
String action = intent.getAction();
|
|
23
23
|
if (action != null) {
|
|
24
24
|
if (action.equals(Constants.ACTION_FOREGROUND_SERVICE_START)) {
|
|
25
|
-
if(
|
|
26
|
-
NotificationHelper notificationHelper = NotificationHelper.getInstance(
|
|
27
|
-
Notification notification = notificationHelper.buildNotification(
|
|
25
|
+
if(RTKHolder.currActivity!=null) {
|
|
26
|
+
NotificationHelper notificationHelper = NotificationHelper.getInstance(RTKHolder.currActivity);
|
|
27
|
+
Notification notification = notificationHelper.buildNotification(RTKHolder.currActivity);
|
|
28
28
|
if (notification != null) {
|
|
29
29
|
try {
|
|
30
30
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
package/android/src/main/java/com/{reactnativecore → cloudflare/realtimekit}/NotificationHelper.java
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.cloudflare.realtimekit;
|
|
2
2
|
|
|
3
3
|
import android.app.Notification;
|
|
4
4
|
import android.app.NotificationChannel;
|
|
@@ -51,7 +51,7 @@ class NotificationHelper {
|
|
|
51
51
|
mNotificationManager.createNotificationChannel(channel);
|
|
52
52
|
promise.resolve(null);
|
|
53
53
|
} else {
|
|
54
|
-
promise.reject(Constants.ERROR_ANDROID_VERSION, "
|
|
54
|
+
promise.reject(Constants.ERROR_ANDROID_VERSION, "RTKForegroundService: Notification channel can be created on Android O+");
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.cloudflare.realtimekit;
|
|
2
2
|
|
|
3
3
|
import android.Manifest;
|
|
4
4
|
import android.app.Activity;
|
|
@@ -55,7 +55,7 @@ public class RNPermissionsModule extends ReactContextBaseJavaModule implements P
|
|
|
55
55
|
|
|
56
56
|
@Override
|
|
57
57
|
public String getName() {
|
|
58
|
-
return "
|
|
58
|
+
return "RTKRNPermissions";
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.cloudflare.realtimekit;
|
|
2
2
|
|
|
3
3
|
import android.app.Activity;
|
|
4
4
|
import android.app.ActivityManager;
|
|
@@ -12,7 +12,7 @@ import android.os.PowerManager;
|
|
|
12
12
|
import android.util.Log;
|
|
13
13
|
import android.view.WindowManager;
|
|
14
14
|
|
|
15
|
-
import com.
|
|
15
|
+
import com.cloudflare.realtimekit.ForegroundService;
|
|
16
16
|
import com.facebook.react.bridge.Callback;
|
|
17
17
|
import com.facebook.react.bridge.LifecycleEventListener;
|
|
18
18
|
import com.facebook.react.bridge.Promise;
|
|
@@ -27,10 +27,10 @@ import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
|
27
27
|
import java.io.Serializable;
|
|
28
28
|
import java.util.HashMap;
|
|
29
29
|
|
|
30
|
-
import com.
|
|
30
|
+
import com.cloudflare.realtimekit.RTKHolder;
|
|
31
31
|
|
|
32
|
-
@ReactModule(name = "
|
|
33
|
-
public class
|
|
32
|
+
@ReactModule(name = "RTKHelperModule")
|
|
33
|
+
public class RTKHelperModule extends ReactContextBaseJavaModule {
|
|
34
34
|
|
|
35
35
|
private final ReactApplicationContext reactContext;
|
|
36
36
|
private static final String ERROR_INVALID_ACTIVITY = "E_INVALID_ACTIVITY";
|
|
@@ -74,17 +74,17 @@ public class DyteHelperModule extends ReactContextBaseJavaModule {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
public
|
|
77
|
+
public RTKHelperModule(ReactApplicationContext reactContext) {
|
|
78
78
|
super(reactContext);
|
|
79
79
|
this.reactContext = reactContext;
|
|
80
80
|
this.powerManager = (PowerManager) getReactApplicationContext().getSystemService(reactContext.POWER_SERVICE);
|
|
81
|
-
this.wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "
|
|
81
|
+
this.wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "realtimekit:wakelock");
|
|
82
82
|
reactContext.addLifecycleEventListener(listener);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
@Override
|
|
86
86
|
public String getName() {
|
|
87
|
-
return "
|
|
87
|
+
return "RTKHelper";
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
@ReactMethod
|
|
@@ -95,7 +95,7 @@ public class DyteHelperModule extends ReactContextBaseJavaModule {
|
|
|
95
95
|
@ReactMethod
|
|
96
96
|
public void startService(Promise promise) {
|
|
97
97
|
ComponentName mediaService;
|
|
98
|
-
|
|
98
|
+
RTKHolder.currActivity = this.getCurrentActivity();
|
|
99
99
|
Intent intent = new Intent(getReactApplicationContext(), ForegroundService.class);
|
|
100
100
|
intent.setAction(Constants.ACTION_FOREGROUND_SERVICE_START);
|
|
101
101
|
try{
|
|
@@ -107,13 +107,13 @@ public class DyteHelperModule extends ReactContextBaseJavaModule {
|
|
|
107
107
|
} catch (RuntimeException e) {
|
|
108
108
|
// Avoid crashing due to ForegroundServiceStartNotAllowedException (API level 31).
|
|
109
109
|
// See: https://developer.android.com/guide/components/foreground-services#background-start-restrictions
|
|
110
|
-
Log.w("
|
|
110
|
+
Log.w("RTKHelperModule", "Media projection service not started", e);
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
113
|
if (mediaService != null) {
|
|
114
114
|
promise.resolve(null);
|
|
115
115
|
} else {
|
|
116
|
-
promise.reject(Constants.ERROR_SERVICE_ERROR, "
|
|
116
|
+
promise.reject(Constants.ERROR_SERVICE_ERROR, "RTKForegroundService: Foreground service is not started");
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
|
|
@@ -125,7 +125,7 @@ public class DyteHelperModule extends ReactContextBaseJavaModule {
|
|
|
125
125
|
if (stopped) {
|
|
126
126
|
promise.resolve(null);
|
|
127
127
|
} else {
|
|
128
|
-
promise.reject(Constants.ERROR_SERVICE_ERROR, "
|
|
128
|
+
promise.reject(Constants.ERROR_SERVICE_ERROR, "RTKForegroundService: Foreground service failed to stop");
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
@ReactMethod
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* in the file PATENTS. All contributing project authors may
|
|
8
8
|
* be found in the AUTHORS file in the root of the source tree.
|
|
9
9
|
*/
|
|
10
|
-
package com.
|
|
10
|
+
package com.cloudflare.realtimekit.incallmanager;
|
|
11
11
|
import android.annotation.SuppressLint;
|
|
12
12
|
import android.bluetooth.BluetoothClass;
|
|
13
13
|
import android.bluetooth.BluetoothAdapter;
|
|
@@ -33,9 +33,9 @@ import androidx.annotation.RequiresApi;
|
|
|
33
33
|
import java.util.List;
|
|
34
34
|
import java.util.Set;
|
|
35
35
|
import java.util.ArrayList;
|
|
36
|
-
import com.
|
|
37
|
-
import com.
|
|
38
|
-
import com.
|
|
36
|
+
import com.cloudflare.realtimekit.incallmanager.AppRTCUtils;
|
|
37
|
+
import com.cloudflare.realtimekit.incallmanager.ThreadUtils;
|
|
38
|
+
import com.cloudflare.realtimekit.incallmanager.InCallManagerModule;
|
|
39
39
|
/**
|
|
40
40
|
* AppRTCProximitySensor manages functions related to Bluetoth devices in the
|
|
41
41
|
* AppRTC demo.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* in the file PATENTS. All contributing project authors may
|
|
8
8
|
* be found in the AUTHORS file in the root of the source tree.
|
|
9
9
|
*/
|
|
10
|
-
package com.
|
|
10
|
+
package com.cloudflare.realtimekit.incallmanager;
|
|
11
11
|
import android.content.Context;
|
|
12
12
|
import android.hardware.Sensor;
|
|
13
13
|
import android.hardware.SensorEvent;
|
|
@@ -16,8 +16,8 @@ import android.hardware.SensorManager;
|
|
|
16
16
|
import android.os.Build;
|
|
17
17
|
import android.util.Log;
|
|
18
18
|
import androidx.annotation.Nullable;
|
|
19
|
-
import com.
|
|
20
|
-
import com.
|
|
19
|
+
import com.cloudflare.realtimekit.incallmanager.AppRTCUtils;
|
|
20
|
+
import com.cloudflare.realtimekit.incallmanager.ThreadUtils;
|
|
21
21
|
/**
|
|
22
22
|
* AppRTCProximitySensor manages functions related to the proximity sensor in
|
|
23
23
|
* the AppRTC demo.
|
|
@@ -28,7 +28,7 @@ import com.reactnativecore.incallmanager.ThreadUtils;
|
|
|
28
28
|
* Anything less than the threshold value and the sensor returns "NEAR".
|
|
29
29
|
*/
|
|
30
30
|
public class AppRTCProximitySensor implements SensorEventListener {
|
|
31
|
-
private static final String TAG = "
|
|
31
|
+
private static final String TAG = "realtimekit:AppRTCProximity";
|
|
32
32
|
// This class should be created, started and stopped on one thread
|
|
33
33
|
// (e.g. the main thread). We use `nonThreadSafe` to ensure that this is
|
|
34
34
|
// the case. Only active when `DEBUG` is set to true.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* in the file PATENTS. All contributing project authors may
|
|
8
8
|
* be found in the AUTHORS file in the root of the source tree.
|
|
9
9
|
*/
|
|
10
|
-
package com.
|
|
10
|
+
package com.cloudflare.realtimekit.incallmanager;
|
|
11
11
|
import android.os.Build;
|
|
12
12
|
import android.util.Log;
|
|
13
13
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.cloudflare.realtimekit.incallmanager;
|
|
2
2
|
|
|
3
3
|
import android.app.Activity;
|
|
4
4
|
import android.content.Context;
|
|
@@ -50,13 +50,13 @@ import java.util.Random;
|
|
|
50
50
|
import java.util.Set;
|
|
51
51
|
import java.util.List;
|
|
52
52
|
|
|
53
|
-
import com.
|
|
54
|
-
import com.
|
|
53
|
+
import com.cloudflare.realtimekit.incallmanager.AppRTCBluetoothManager;
|
|
54
|
+
import com.cloudflare.realtimekit.incallmanager.InCallManagerModule.AudioDevice;
|
|
55
55
|
|
|
56
56
|
public class InCallManagerModule extends ReactContextBaseJavaModule implements LifecycleEventListener, AudioManager.OnAudioFocusChangeListener {
|
|
57
57
|
private static final String REACT_NATIVE_MODULE_NAME = "InCallManager";
|
|
58
58
|
private static final String TAG = REACT_NATIVE_MODULE_NAME;
|
|
59
|
-
private String mPackageName = "com.
|
|
59
|
+
private String mPackageName = "com.cloudflare.realtimekit.incallmanager";
|
|
60
60
|
|
|
61
61
|
// --- Screen Manager
|
|
62
62
|
private PowerManager mPowerManager;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
package com.
|
|
17
|
+
package com.cloudflare.realtimekit.incallmanager;
|
|
18
18
|
|
|
19
19
|
import android.content.Context;
|
|
20
20
|
import android.hardware.Sensor;
|
|
@@ -29,10 +29,10 @@ import java.lang.Runnable;
|
|
|
29
29
|
|
|
30
30
|
import com.facebook.react.bridge.UiThreadUtil;
|
|
31
31
|
|
|
32
|
-
import com.
|
|
32
|
+
import com.cloudflare.realtimekit.incallmanager.AppRTCProximitySensor;
|
|
33
33
|
|
|
34
34
|
public class InCallProximityManager {
|
|
35
|
-
private static final String TAG = "
|
|
35
|
+
private static final String TAG = "realtimekit:InCallProximity";
|
|
36
36
|
|
|
37
37
|
private WakeLock mProximityLock = null;
|
|
38
38
|
private Method mPowerManagerRelease;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
package com.
|
|
17
|
+
package com.cloudflare.realtimekit.incallmanager;
|
|
18
18
|
|
|
19
19
|
import android.content.Context;
|
|
20
20
|
import android.os.PowerManager;
|
|
@@ -22,7 +22,7 @@ import android.os.PowerManager.WakeLock;
|
|
|
22
22
|
import android.util.Log;
|
|
23
23
|
|
|
24
24
|
public class InCallWakeLockUtils {
|
|
25
|
-
private static final String TAG = "
|
|
25
|
+
private static final String TAG = "realtimekit:InCallWakeLock";
|
|
26
26
|
|
|
27
27
|
private PowerManager mPowerManager;
|
|
28
28
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* in the file PATENTS. All contributing project authors may
|
|
8
8
|
* be found in the AUTHORS file in the root of the source tree.
|
|
9
9
|
*/
|
|
10
|
-
package com.
|
|
10
|
+
package com.cloudflare.realtimekit.incallmanager;
|
|
11
11
|
import android.os.Looper;
|
|
12
12
|
import androidx.annotation.Nullable;
|
|
13
13
|
public class ThreadUtils {
|
package/app.plugin.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = require('./plugin/build/
|
|
1
|
+
module.exports = require('./plugin/build/withRTK');
|
package/ios/RNInCallManager.m
CHANGED
|
@@ -181,8 +181,7 @@ RCT_EXPORT_METHOD(chooseAudioRoute: (NSString *)audioRoute Promise:(RCTPromiseR
|
|
|
181
181
|
if (![_userSelectedAudioRoute isEqualToString:_currentAudioRoute]) {
|
|
182
182
|
if ([audioRoute isEqual: @"SPEAKER_PHONE"] || [audioRoute isEqualToString:@"speaker"]) {
|
|
183
183
|
_forceSpeakerOn = 1;
|
|
184
|
-
[self
|
|
185
|
-
success = true;
|
|
184
|
+
success = [self routeAudioFromSpeakerphone];
|
|
186
185
|
} else if ([audioRoute isEqualToString:@"WIRED_HEADSET"] || [audioRoute isEqualToString:@"wired"]) {
|
|
187
186
|
_forceSpeakerOn = 0;
|
|
188
187
|
success = [self routeAudioFromEarpiece];
|
|
@@ -286,8 +285,19 @@ RCT_EXPORT_METHOD(setSpeakerphoneOn:(BOOL)enable)
|
|
|
286
285
|
}
|
|
287
286
|
|
|
288
287
|
- (BOOL)routeAudioFromBluetooth {
|
|
288
|
+
BOOL success;
|
|
289
289
|
NSError *error = nil;
|
|
290
290
|
_audioSession = [AVAudioSession sharedInstance];
|
|
291
|
+
success = [_audioSession setCategory:AVAudioSessionCategoryPlayAndRecord
|
|
292
|
+
withOptions:AVAudioSessionCategoryOptionAllowBluetooth
|
|
293
|
+
error:&error];
|
|
294
|
+
if (!success) {
|
|
295
|
+
NSLog(@"📕 Cannot set category due to error: %@", error);
|
|
296
|
+
}
|
|
297
|
+
success = [_audioSession setMode:AVAudioSessionModeVoiceChat error: &error];
|
|
298
|
+
if (!success) {
|
|
299
|
+
NSLog(@"📕 Cannot set mode due to error: %@", error);
|
|
300
|
+
}
|
|
291
301
|
for (AVAudioSessionPortDescription* input in [_audioSession availableInputs]) {
|
|
292
302
|
if ([[input portType] isEqualToString:AVAudioSessionPortBluetoothHFP] ||
|
|
293
303
|
[[input portType] isEqualToString:AVAudioSessionPortBluetoothA2DP] ||
|
|
@@ -351,7 +361,7 @@ RCT_EXPORT_METHOD(setSpeakerphoneOn:(BOOL)enable)
|
|
|
351
361
|
@try {
|
|
352
362
|
success = [_audioSession setCategory:AVAudioSessionCategoryPlayAndRecord
|
|
353
363
|
withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker
|
|
354
|
-
error
|
|
364
|
+
error:&error];
|
|
355
365
|
if (!success) {
|
|
356
366
|
NSLog(@"📕 Cannot set category due to error: %@", error);
|
|
357
367
|
}
|
|
@@ -639,11 +649,6 @@ RCT_EXPORT_METHOD(isBluetoothHeadsetConnected: (RCTPromiseResolveBlock) resolve
|
|
|
639
649
|
[self audioSessionSetMode:audioMode
|
|
640
650
|
callerMemo:NSStringFromSelector(_cmd)];
|
|
641
651
|
|
|
642
|
-
@try {
|
|
643
|
-
[self sendEventWithName:@"onAudioDeviceChanged" body:@{@"devices": audioMode}];
|
|
644
|
-
} @catch (NSException *exception) {
|
|
645
|
-
NSLog(@"Error sending event 'onAudioDeviceChanged': %@", exception.reason);
|
|
646
|
-
}
|
|
647
652
|
// NSLog(@"👨💻 RNInCallManager.updateAudioRoute() audio mode has changed to %@", audioMode);
|
|
648
653
|
return true;
|
|
649
654
|
} else {
|
|
@@ -962,60 +967,63 @@ RCT_EXPORT_METHOD(isBluetoothHeadsetConnected: (RCTPromiseResolveBlock) resolve
|
|
|
962
967
|
// NSLog(@"🧑💻 RNInCallManager.AudioRouteChange.Reason: NewDeviceAvailable");
|
|
963
968
|
if ([self checkAudioRoute:@[AVAudioSessionPortHeadsetMic]
|
|
964
969
|
routeType:@"input"]) {
|
|
965
|
-
|
|
970
|
+
self->_forceSpeakerOn = 0;
|
|
966
971
|
@try {
|
|
967
972
|
[self sendEventWithName:@"onAudioDeviceChanged"
|
|
968
973
|
body:@{
|
|
969
974
|
@"availableAudioDeviceList": @"[speaker, earpiece, wired]",
|
|
970
|
-
@"selectedAudioDevice":
|
|
975
|
+
@"selectedAudioDevice": @"wired",
|
|
971
976
|
}];
|
|
972
977
|
} @catch (NSException *exception) {
|
|
973
978
|
NSLog(@"Error sending event 'onAudioDeviceChanged' (HeadsetMic): %@", exception.reason);
|
|
974
979
|
}
|
|
975
980
|
} else if ([self checkAudioRoute:@[AVAudioSessionPortHeadphones]
|
|
976
981
|
routeType:@"output"]) {
|
|
977
|
-
|
|
982
|
+
self->_forceSpeakerOn = 0;
|
|
978
983
|
@try {
|
|
979
984
|
[self sendEventWithName:@"onAudioDeviceChanged"
|
|
980
985
|
body:@{
|
|
981
986
|
@"availableAudioDeviceList": @"[speaker, earpiece, wired]",
|
|
982
|
-
@"selectedAudioDevice":
|
|
987
|
+
@"selectedAudioDevice": @"wired",
|
|
983
988
|
}];
|
|
984
989
|
} @catch (NSException *exception) {
|
|
985
990
|
NSLog(@"Error sending event 'onAudioDeviceChanged' (Headphones): %@", exception.reason);
|
|
986
991
|
}
|
|
987
992
|
} else if ([self checkAudioRoute:@[AVAudioSessionPortBluetoothHFP]
|
|
988
993
|
routeType:@"input"]) {
|
|
989
|
-
_forceSpeakerOn = 0;
|
|
994
|
+
self->_forceSpeakerOn = 0;
|
|
995
|
+
[self routeAudioFromBluetooth];
|
|
990
996
|
@try {
|
|
991
997
|
[self sendEventWithName:@"onAudioDeviceChanged"
|
|
992
998
|
body:@{
|
|
993
999
|
@"availableAudioDeviceList": @"[speaker, earpiece, bluetooth]",
|
|
994
|
-
@"selectedAudioDevice":
|
|
1000
|
+
@"selectedAudioDevice": @"bluetooth",
|
|
995
1001
|
}];
|
|
996
1002
|
} @catch (NSException *exception) {
|
|
997
1003
|
NSLog(@"Error sending event 'onAudioDeviceChanged' (BluetoothHFP): %@", exception.reason);
|
|
998
1004
|
}
|
|
999
1005
|
} else if ([self checkAudioRoute:@[AVAudioSessionPortBluetoothA2DP]
|
|
1000
1006
|
routeType:@"input"]) {
|
|
1001
|
-
_forceSpeakerOn = 0;
|
|
1007
|
+
self->_forceSpeakerOn = 0;
|
|
1008
|
+
[self routeAudioFromBluetooth];
|
|
1002
1009
|
@try {
|
|
1003
1010
|
[self sendEventWithName:@"onAudioDeviceChanged"
|
|
1004
1011
|
body:@{
|
|
1005
1012
|
@"availableAudioDeviceList": @"[speaker, earpiece, bluetooth]",
|
|
1006
|
-
@"selectedAudioDevice":
|
|
1013
|
+
@"selectedAudioDevice": @"bluetooth",
|
|
1007
1014
|
}];
|
|
1008
1015
|
} @catch (NSException *exception) {
|
|
1009
1016
|
NSLog(@"Error sending event 'onAudioDeviceChanged' (BluetoothA2DP): %@", exception.reason);
|
|
1010
1017
|
}
|
|
1011
1018
|
} else if ([self checkAudioRoute:@[AVAudioSessionPortBluetoothLE]
|
|
1012
1019
|
routeType:@"input"]) {
|
|
1013
|
-
_forceSpeakerOn = 0;
|
|
1020
|
+
self->_forceSpeakerOn = 0;
|
|
1021
|
+
[self routeAudioFromBluetooth];
|
|
1014
1022
|
@try {
|
|
1015
1023
|
[self sendEventWithName:@"onAudioDeviceChanged"
|
|
1016
1024
|
body:@{
|
|
1017
1025
|
@"availableAudioDeviceList": @"[speaker, earpiece, bluetooth]",
|
|
1018
|
-
@"selectedAudioDevice":
|
|
1026
|
+
@"selectedAudioDevice": @"bluetooth",
|
|
1019
1027
|
}];
|
|
1020
1028
|
} @catch (NSException *exception) {
|
|
1021
1029
|
NSLog(@"Error sending event 'onAudioDeviceChanged' (BluetoothLE): %@", exception.reason);
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
// Copyright (c) ATO Gear. All rights reserved.
|
|
7
7
|
//
|
|
8
8
|
@import UIKit;
|
|
9
|
-
#import "
|
|
9
|
+
#import "RTKRNBackgroundTimer.h"
|
|
10
10
|
|
|
11
|
-
@implementation
|
|
11
|
+
@implementation RTKRNBackgroundTimer {
|
|
12
12
|
UIBackgroundTaskIdentifier bgTask;
|
|
13
13
|
int delay;
|
|
14
14
|
}
|
package/ios/{DyteRNPermissionHandlerNotifications.h → RTKRNPermissionHandlerNotifications.h}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#import <React/RCTBridgeModule.h>
|
|
2
2
|
#import <React/RCTConvert.h>
|
|
3
3
|
#import <Foundation/Foundation.h>
|
|
4
|
-
#import "
|
|
4
|
+
#import "RTKRNPermissions.h"
|
|
5
5
|
|
|
6
|
-
@interface
|
|
6
|
+
@interface RTKRNPermissionHandlerNotifications : NSObject
|
|
7
7
|
|
|
8
8
|
+ (NSString * _Nonnull)handlerUniqueId;
|
|
9
9
|
|
package/ios/{DyteRNPermissionHandlerNotifications.m → RTKRNPermissionHandlerNotifications.m}
RENAMED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#import "
|
|
1
|
+
#import "RTKRNPermissionHandlerNotifications.h"
|
|
2
2
|
|
|
3
3
|
@import UserNotifications;
|
|
4
4
|
@import UIKit;
|
|
5
5
|
|
|
6
|
-
@interface
|
|
6
|
+
@interface RTKRNPermissionHandlerNotifications()
|
|
7
7
|
|
|
8
8
|
@property (nonatomic, strong) void (^resolve)(RNPermissionStatus status, NSDictionary * _Nonnull settings);
|
|
9
9
|
@property (nonatomic, strong) void (^reject)(NSError *error);
|
|
10
10
|
|
|
11
11
|
@end
|
|
12
12
|
|
|
13
|
-
@implementation
|
|
13
|
+
@implementation RTKRNPermissionHandlerNotifications
|
|
14
14
|
|
|
15
15
|
+ (NSString * _Nonnull)handlerUniqueId {
|
|
16
16
|
return @"ios.permission.NOTIFICATIONS";
|
|
@@ -24,7 +24,7 @@ typedef enum {
|
|
|
24
24
|
RNPermissionStatusLimited = 5,
|
|
25
25
|
} RNPermissionStatus;
|
|
26
26
|
|
|
27
|
-
@protocol
|
|
27
|
+
@protocol RTKRNPermissionHandler <NSObject>
|
|
28
28
|
|
|
29
29
|
@required
|
|
30
30
|
|
|
@@ -40,7 +40,7 @@ typedef enum {
|
|
|
40
40
|
|
|
41
41
|
@end
|
|
42
42
|
|
|
43
|
-
@interface
|
|
43
|
+
@interface RTKRNPermissions : NSObject <RCTBridgeModule>
|
|
44
44
|
|
|
45
45
|
+ (bool)isFlaggedAsRequested:(NSString * _Nonnull)handlerId;
|
|
46
46
|
|