@cloudflare/realtimekit-react-native 0.1.2 → 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/{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 +14 -14
- package/lib/LocalMediaHandler.js +9 -9
- 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 +2 -4
- 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');
|
|
@@ -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
|
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
#import "
|
|
1
|
+
#import "RTKRNPermissions.h"
|
|
2
2
|
#import <React/RCTLog.h>
|
|
3
3
|
#import <React/RCTConvert.h>
|
|
4
|
-
#import "
|
|
5
|
-
#import "
|
|
6
|
-
#import "
|
|
7
|
-
#import "
|
|
8
|
-
#import "
|
|
4
|
+
#import "RTKRNPermissionHandlerBluetoothPeripheral.h"
|
|
5
|
+
#import "RTKRNPermissionHandlerCamera.h"
|
|
6
|
+
#import "RTKRNPermissionHandlerMicrophone.h"
|
|
7
|
+
#import "RTKRNPermissionHandlerPhotoLibrary.h"
|
|
8
|
+
#import "RTKRNPermissionHandlerNotifications.h"
|
|
9
9
|
|
|
10
10
|
static NSString* SETTING_KEY = @"@RNPermissions:Requested";
|
|
11
11
|
|
|
12
12
|
@implementation RCTConvert(RNPermission)
|
|
13
13
|
|
|
14
14
|
RCT_ENUM_CONVERTER(RNPermission, (@{
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
15
|
+
[RTKRNPermissionHandlerBluetoothPeripheral handlerUniqueId]: @(RNPermissionBluetoothPeripheral),
|
|
16
|
+
[RTKRNPermissionHandlerCamera handlerUniqueId]: @(RNPermissionCamera),
|
|
17
|
+
[RTKRNPermissionHandlerMicrophone handlerUniqueId]: @(RNPermissionMicrophone),
|
|
18
|
+
[RTKRNPermissionHandlerPhotoLibrary handlerUniqueId]: @(RNPermissionPhotoLibrary),
|
|
19
19
|
}), RNPermissionUnknown, integerValue);
|
|
20
20
|
|
|
21
21
|
@end
|
|
22
22
|
|
|
23
|
-
@interface
|
|
23
|
+
@interface RTKRNPermissions()
|
|
24
24
|
|
|
25
|
-
@property (nonatomic, strong) NSMutableDictionary<NSString *, id<
|
|
25
|
+
@property (nonatomic, strong) NSMutableDictionary<NSString *, id<RTKRNPermissionHandler>> *_Nonnull handlers;
|
|
26
26
|
|
|
27
27
|
@end
|
|
28
28
|
|
|
29
|
-
@implementation
|
|
29
|
+
@implementation RTKRNPermissions
|
|
30
30
|
|
|
31
31
|
RCT_EXPORT_MODULE();
|
|
32
32
|
|
|
@@ -42,10 +42,10 @@ RCT_EXPORT_MODULE();
|
|
|
42
42
|
NSMutableArray<NSString *> *available = [NSMutableArray new];
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
[available addObject:[
|
|
46
|
-
[available addObject:[
|
|
47
|
-
[available addObject:[
|
|
48
|
-
[available addObject:[
|
|
45
|
+
[available addObject:[RTKRNPermissionHandlerBluetoothPeripheral handlerUniqueId]];
|
|
46
|
+
[available addObject:[RTKRNPermissionHandlerCamera handlerUniqueId]];
|
|
47
|
+
[available addObject:[RTKRNPermissionHandlerMicrophone handlerUniqueId]];
|
|
48
|
+
[available addObject:[RTKRNPermissionHandlerPhotoLibrary handlerUniqueId]];
|
|
49
49
|
|
|
50
50
|
#if RCT_DEV
|
|
51
51
|
if ([available count] == 0) {
|
|
@@ -74,23 +74,23 @@ RCT_EXPORT_MODULE();
|
|
|
74
74
|
#endif
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
- (id<
|
|
78
|
-
id<
|
|
77
|
+
- (id<RTKRNPermissionHandler> _Nullable)handlerForPermission:(RNPermission)permission {
|
|
78
|
+
id<RTKRNPermissionHandler> handler = nil;
|
|
79
79
|
|
|
80
80
|
switch (permission) {
|
|
81
81
|
|
|
82
82
|
case RNPermissionBluetoothPeripheral:
|
|
83
|
-
handler = [
|
|
83
|
+
handler = [RTKRNPermissionHandlerBluetoothPeripheral new];
|
|
84
84
|
break;
|
|
85
85
|
|
|
86
86
|
case RNPermissionCamera:
|
|
87
|
-
handler = [
|
|
87
|
+
handler = [RTKRNPermissionHandlerCamera new];
|
|
88
88
|
break;
|
|
89
89
|
case RNPermissionMicrophone:
|
|
90
|
-
handler = [
|
|
90
|
+
handler = [RTKRNPermissionHandlerMicrophone new];
|
|
91
91
|
break;
|
|
92
92
|
case RNPermissionPhotoLibrary:
|
|
93
|
-
handler = [
|
|
93
|
+
handler = [RTKRNPermissionHandlerPhotoLibrary new];
|
|
94
94
|
break;
|
|
95
95
|
case RNPermissionUnknown:
|
|
96
96
|
break; // RCTConvert prevents this case
|
|
@@ -116,7 +116,7 @@ RCT_EXPORT_MODULE();
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
- (NSString *)lockHandler:(id<
|
|
119
|
+
- (NSString *)lockHandler:(id<RTKRNPermissionHandler>)handler {
|
|
120
120
|
if (_handlers == nil) {
|
|
121
121
|
_handlers = [NSMutableDictionary new];
|
|
122
122
|
}
|
|
@@ -172,7 +172,7 @@ RCT_REMAP_METHOD(check,
|
|
|
172
172
|
checkWithPermission:(RNPermission)permission
|
|
173
173
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
174
174
|
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
175
|
-
id<
|
|
175
|
+
id<RTKRNPermissionHandler> handler = [self handlerForPermission:permission];
|
|
176
176
|
NSString *lockId = [self lockHandler:handler];
|
|
177
177
|
|
|
178
178
|
[handler checkWithResolver:^(RNPermissionStatus status) {
|
|
@@ -188,7 +188,7 @@ RCT_REMAP_METHOD(request,
|
|
|
188
188
|
requestWithPermission:(RNPermission)permission
|
|
189
189
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
190
190
|
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
191
|
-
id<
|
|
191
|
+
id<RTKRNPermissionHandler> handler = [self handlerForPermission:permission];
|
|
192
192
|
NSString *lockId = [self lockHandler:handler]; [handler requestWithResolver:^(RNPermissionStatus status) {
|
|
193
193
|
resolve([self stringForStatus:status]);
|
|
194
194
|
[self unlockHandler:lockId];
|
|
@@ -201,9 +201,9 @@ RCT_REMAP_METHOD(request,
|
|
|
201
201
|
RCT_REMAP_METHOD(checkNotifications,
|
|
202
202
|
checkNotificationsWithResolver:(RCTPromiseResolveBlock)resolve
|
|
203
203
|
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
204
|
-
#if __has_include("
|
|
205
|
-
|
|
206
|
-
NSString *lockId = [self lockHandler:(id<
|
|
204
|
+
#if __has_include("RTKRNPermissionHandlerNotifications.h")
|
|
205
|
+
RTKRNPermissionHandlerNotifications *handler = [RTKRNPermissionHandlerNotifications new];
|
|
206
|
+
NSString *lockId = [self lockHandler:(id<RTKRNPermissionHandler>)handler];
|
|
207
207
|
|
|
208
208
|
[handler checkWithResolver:^(RNPermissionStatus status, NSDictionary * _Nonnull settings) {
|
|
209
209
|
resolve(@{ @"status": [self stringForStatus:status], @"settings": settings });
|
|
@@ -221,9 +221,9 @@ RCT_REMAP_METHOD(requestNotifications,
|
|
|
221
221
|
requestNotificationsWithOptions:(NSArray<NSString *> * _Nonnull)options
|
|
222
222
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
223
223
|
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
224
|
-
#if __has_include("
|
|
225
|
-
|
|
226
|
-
NSString *lockId = [self lockHandler:(id<
|
|
224
|
+
#if __has_include("RTKRNPermissionHandlerNotifications.h")
|
|
225
|
+
RTKRNPermissionHandlerNotifications *handler = [RTKRNPermissionHandlerNotifications new];
|
|
226
|
+
NSString *lockId = [self lockHandler:(id<RTKRNPermissionHandler>)handler];
|
|
227
227
|
|
|
228
228
|
[handler requestWithResolver:^(RNPermissionStatus status, NSDictionary * _Nonnull settings) {
|
|
229
229
|
resolve(@{ @"status": [self stringForStatus:status], @"settings": settings });
|
|
@@ -241,7 +241,7 @@ RCT_REMAP_METHOD(openLimitedPhotoLibraryPicker,
|
|
|
241
241
|
openLimitedPhotoLibraryPickerWithResolver:(RCTPromiseResolveBlock)resolve
|
|
242
242
|
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
243
243
|
|
|
244
|
-
|
|
244
|
+
RTKRNPermissionHandlerPhotoLibrary *handler = [RTKRNPermissionHandlerPhotoLibrary new];
|
|
245
245
|
[handler openLimitedPhotoLibraryPickerWithResolver:resolve rejecter:reject];
|
|
246
246
|
}
|
|
247
247
|
|