@cloudflare/realtimekit-react-native 0.0.0 → 0.0.1-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 (83) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +83 -0
  3. package/RealtimeKitCore.podspec +19 -0
  4. package/android/build.gradle +58 -0
  5. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  6. package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
  7. package/android/gradlew +185 -0
  8. package/android/gradlew.bat +89 -0
  9. package/android/src/main/AndroidManifest.xml +23 -0
  10. package/android/src/main/java/com/reactnativecore/BackgroundTimer/RNBackgroundTimer.java +97 -0
  11. package/android/src/main/java/com/reactnativecore/Constants.java +14 -0
  12. package/android/src/main/java/com/reactnativecore/CoreModule.java +49 -0
  13. package/android/src/main/java/com/reactnativecore/CorePackage.java +34 -0
  14. package/android/src/main/java/com/reactnativecore/DyteHelperModule.java +268 -0
  15. package/android/src/main/java/com/reactnativecore/DyteHolder.java +7 -0
  16. package/android/src/main/java/com/reactnativecore/ForegroundService.java +48 -0
  17. package/android/src/main/java/com/reactnativecore/NotificationHelper.java +127 -0
  18. package/android/src/main/java/com/reactnativecore/RNPermissionsModule.java +226 -0
  19. package/android/src/main/java/com/reactnativecore/incallmanager/AppRTCBluetoothManager.java +637 -0
  20. package/android/src/main/java/com/reactnativecore/incallmanager/AppRTCProximitySensor.java +133 -0
  21. package/android/src/main/java/com/reactnativecore/incallmanager/AppRTCUtils.java +41 -0
  22. package/android/src/main/java/com/reactnativecore/incallmanager/InCallManagerModule.java +1881 -0
  23. package/android/src/main/java/com/reactnativecore/incallmanager/InCallProximityManager.java +162 -0
  24. package/android/src/main/java/com/reactnativecore/incallmanager/InCallWakeLockUtils.java +116 -0
  25. package/android/src/main/java/com/reactnativecore/incallmanager/ThreadUtils.java +39 -0
  26. package/app.plugin.js +1 -0
  27. package/ios/BroadcastEventEmitter.h +11 -0
  28. package/ios/BroadcastEventEmitter.m +72 -0
  29. package/ios/Core.h +5 -0
  30. package/ios/Core.m +28 -0
  31. package/ios/Core.xcodeproj/project.pbxproj +287 -0
  32. package/ios/DyteRNBackgroundTimer.h +22 -0
  33. package/ios/DyteRNBackgroundTimer.m +90 -0
  34. package/ios/DyteRNPermissionHandlerNotifications.h +17 -0
  35. package/ios/DyteRNPermissionHandlerNotifications.m +127 -0
  36. package/ios/DyteRNPermissions.h +50 -0
  37. package/ios/DyteRNPermissions.m +275 -0
  38. package/ios/DyteScreensharePickerView.h +8 -0
  39. package/ios/DyteScreensharePickerView.m +27 -0
  40. package/ios/PrivacyInfo.xcprivacy +60 -0
  41. package/ios/RNInCallManager.h +16 -0
  42. package/ios/RNInCallManager.m +1354 -0
  43. package/ios/permissions/DyteRNPermissionHandlerBluetoothPeripheral.h +4 -0
  44. package/ios/permissions/DyteRNPermissionHandlerBluetoothPeripheral.m +87 -0
  45. package/ios/permissions/DyteRNPermissionHandlerCamera.h +5 -0
  46. package/ios/permissions/DyteRNPermissionHandlerCamera.m +38 -0
  47. package/ios/permissions/DyteRNPermissionHandlerMicrophone.h +5 -0
  48. package/ios/permissions/DyteRNPermissionHandlerMicrophone.m +34 -0
  49. package/ios/permissions/DyteRNPermissionHandlerPhotoLibrary.h +8 -0
  50. package/ios/permissions/DyteRNPermissionHandlerPhotoLibrary.m +70 -0
  51. package/ios/screenshare/DyteDarwinNotificationCenter.swift +21 -0
  52. package/ios/screenshare/DyteScreenshareAtomic.swift +29 -0
  53. package/ios/screenshare/DyteScreenshareHandler.swift +103 -0
  54. package/ios/screenshare/DyteScreenshareUploader.swift +139 -0
  55. package/ios/screenshare/DyteSocketConnection.swift +190 -0
  56. package/lib/BackgroundHandler.d.ts +20 -0
  57. package/lib/BackgroundHandler.js +87 -0
  58. package/lib/LocalMediaError.d.ts +4 -0
  59. package/lib/LocalMediaError.js +6 -0
  60. package/lib/LocalMediaHandler.d.ts +118 -0
  61. package/lib/LocalMediaHandler.js +853 -0
  62. package/lib/LocalMediaInterfaces.d.ts +76 -0
  63. package/lib/LocalMediaInterfaces.js +1 -0
  64. package/lib/LocalMediaUtils.d.ts +93 -0
  65. package/lib/LocalMediaUtils.js +276 -0
  66. package/lib/NativeAudioManager.d.ts +16 -0
  67. package/lib/NativeAudioManager.js +93 -0
  68. package/lib/PermissionHandler.d.ts +34 -0
  69. package/lib/PermissionHandler.js +179 -0
  70. package/lib/ReactContext.d.ts +42 -0
  71. package/lib/ReactContext.js +96 -0
  72. package/lib/ReactHooks.d.ts +11 -0
  73. package/lib/ReactHooks.js +73 -0
  74. package/lib/index.d.ts +10 -0
  75. package/lib/index.js +40 -0
  76. package/lib/utils/crypto.d.ts +17 -0
  77. package/lib/utils/crypto.js +82 -0
  78. package/package.json +51 -4
  79. package/plugin/build/withDyte.d.ts +25 -0
  80. package/plugin/build/withDyte.js +100 -0
  81. package/plugin/src/withDyte.ts +150 -0
  82. package/plugin/tsconfig.json +10 -0
  83. package/plugin/tsconfig.tsbuildinfo +1 -0
package/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2021-present DYTE INC, Inc.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,83 @@
1
+ <!-- PROJECT LOGO -->
2
+ <p align="center">
3
+ <a href="https://dyte.io">
4
+ <img src="https://assets.dyte.io/logo-outlined.png" alt="Logo" width="120" />
5
+ </a>
6
+
7
+ <h2 align="center">React Native Core</h3>
8
+
9
+ <p align="center">
10
+ React Native SDK that provides Dyte's core functionality in mobile.
11
+ <br />
12
+ <a href="https://www.notion.so/dyte/React-Native-Core-1a17935890c0806d9ea6cabc9c496fd0?pvs=4"><strong>Explore the docs »</strong></a>
13
+ <br />
14
+ <br />
15
+ ·
16
+ <a href="https://docs.dyte.io/discuss">Report Bug</a>
17
+ ·
18
+ <a href="https://docs.dyte.io/discuss">Request Feature</a>
19
+ </p>
20
+ </p>
21
+
22
+ <!-- TABLE OF CONTENTS -->
23
+
24
+ ## Table of Contents
25
+
26
+ - [About the Project](#about-the-project)
27
+ - [Built With](#built-with)
28
+ - [Installation](#installation)
29
+ - [Usage](#usage)
30
+ - [About](#about)
31
+
32
+ <!-- ABOUT THE PROJECT -->
33
+ ## About The Project
34
+
35
+ The core SDK provides Dyte's core functionality, while letting a developer build a custom UI over it.
36
+
37
+ ### Built With
38
+
39
+ - [Dyte](https://dyte.io/)
40
+ - [Typescript](https://www.typescriptlang.org/)
41
+ - [Java](https://dev.java/learn/)
42
+ - [Objective C](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Introduction/Introduction.html#//apple_ref/doc/uid/TP40011210)
43
+
44
+
45
+ ## Installation
46
+
47
+ 1. Install NPM packages
48
+
49
+ ```sh
50
+ npm install @dytesdk/react-native-core @dyteinternals/react-native-webrtc
51
+ ```
52
+
53
+ _Note: For platform specific installation instructions, please refer to the [Documentation](https://docs.dyte.io/rn-core)._
54
+ <!-- USAGE EXAMPLES -->
55
+ ## Usage
56
+
57
+ A `meeting` object can be created using the `DyteClient.init()` method.
58
+
59
+ ```ts
60
+ const meeting = await DyteClient.init({
61
+ authToken: '<authToken>',
62
+ defaults: {
63
+ audio: true,
64
+ video: true,
65
+ }
66
+ });
67
+ ```
68
+
69
+ The `meeting` object is used for all interaction with Dyte's servers. For example, the following code snippet is used for a user to join a room.
70
+
71
+ ```ts
72
+ await meeting.joinRoom();
73
+ ```
74
+
75
+ _For more examples, please refer to the [Documentation](https://docs.dyte.in)._
76
+
77
+ ## About
78
+
79
+ `@dytesdk/react-native-core` is created & maintained by Dyte, Inc. You can find us on Twitter - [@dyte_io](https://twitter.com/dyte_io) or write to us at `dev@dyte.io`.
80
+
81
+ The names and logos for Dyte are trademarks of Dyte, Inc.
82
+
83
+ We love open source software! See [our other projects](https://github.com/dyte-in) and [our products](https://dyte.io).
@@ -0,0 +1,19 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "RealtimeKitCore"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
12
+ s.swift_version = '5.0'
13
+ s.platforms = { :ios => "10.0" }
14
+ s.source = { :git => "https://github.com/dyte-in/react-native-core.git", :tag => "#{s.version}" }
15
+
16
+ s.source_files = "ios/**/*.{h,m,mm,swift,xcprivacy}"
17
+
18
+ s.dependency "React-Core"
19
+ end
@@ -0,0 +1,58 @@
1
+ buildscript {
2
+ if (project == rootProject) {
3
+ repositories {
4
+ google()
5
+ mavenCentral()
6
+ jcenter()
7
+ }
8
+
9
+ dependencies {
10
+ classpath 'com.android.tools.build:gradle:3.5.3'
11
+ }
12
+ }
13
+ }
14
+
15
+ apply plugin: 'com.android.library'
16
+
17
+ def safeExtGet(prop, fallback) {
18
+ rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
19
+ }
20
+
21
+ android {
22
+ compileSdkVersion safeExtGet('compileSdkVersion', 34)
23
+ defaultConfig {
24
+ minSdkVersion safeExtGet('minSdkVersion', 16)
25
+ targetSdkVersion safeExtGet('targetSdkVersion', 34)
26
+ versionCode 1
27
+ versionName "1.0"
28
+ }
29
+
30
+ buildTypes {
31
+ release {
32
+ minifyEnabled false
33
+ }
34
+ }
35
+ lintOptions {
36
+ disable 'GradleCompatible'
37
+ }
38
+ compileOptions {
39
+ sourceCompatibility JavaVersion.VERSION_1_8
40
+ targetCompatibility JavaVersion.VERSION_1_8
41
+ }
42
+ }
43
+
44
+ repositories {
45
+ mavenLocal()
46
+ maven {
47
+ // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
48
+ url("$rootDir/../node_modules/react-native/android")
49
+ }
50
+ google()
51
+ mavenCentral()
52
+ jcenter()
53
+ }
54
+
55
+ dependencies {
56
+ //noinspection GradleDynamicVersion
57
+ implementation "com.facebook.react:react-native:+" // From node_modules
58
+ }
@@ -0,0 +1,5 @@
1
+ distributionBase=GRADLE_USER_HOME
2
+ distributionPath=wrapper/dists
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
4
+ zipStoreBase=GRADLE_USER_HOME
5
+ zipStorePath=wrapper/dists
@@ -0,0 +1,185 @@
1
+ #!/usr/bin/env sh
2
+
3
+ #
4
+ # Copyright 2015 the original author or authors.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # https://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ ##############################################################################
20
+ ##
21
+ ## Gradle start up script for UN*X
22
+ ##
23
+ ##############################################################################
24
+
25
+ # Attempt to set APP_HOME
26
+ # Resolve links: $0 may be a link
27
+ PRG="$0"
28
+ # Need this for relative symlinks.
29
+ while [ -h "$PRG" ] ; do
30
+ ls=`ls -ld "$PRG"`
31
+ link=`expr "$ls" : '.*-> \(.*\)$'`
32
+ if expr "$link" : '/.*' > /dev/null; then
33
+ PRG="$link"
34
+ else
35
+ PRG=`dirname "$PRG"`"/$link"
36
+ fi
37
+ done
38
+ SAVED="`pwd`"
39
+ cd "`dirname \"$PRG\"`/" >/dev/null
40
+ APP_HOME="`pwd -P`"
41
+ cd "$SAVED" >/dev/null
42
+
43
+ APP_NAME="Gradle"
44
+ APP_BASE_NAME=`basename "$0"`
45
+
46
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47
+ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48
+
49
+ # Use the maximum available, or set MAX_FD != -1 to use that value.
50
+ MAX_FD="maximum"
51
+
52
+ warn () {
53
+ echo "$*"
54
+ }
55
+
56
+ die () {
57
+ echo
58
+ echo "$*"
59
+ echo
60
+ exit 1
61
+ }
62
+
63
+ # OS specific support (must be 'true' or 'false').
64
+ cygwin=false
65
+ msys=false
66
+ darwin=false
67
+ nonstop=false
68
+ case "`uname`" in
69
+ CYGWIN* )
70
+ cygwin=true
71
+ ;;
72
+ Darwin* )
73
+ darwin=true
74
+ ;;
75
+ MINGW* )
76
+ msys=true
77
+ ;;
78
+ NONSTOP* )
79
+ nonstop=true
80
+ ;;
81
+ esac
82
+
83
+ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84
+
85
+
86
+ # Determine the Java command to use to start the JVM.
87
+ if [ -n "$JAVA_HOME" ] ; then
88
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89
+ # IBM's JDK on AIX uses strange locations for the executables
90
+ JAVACMD="$JAVA_HOME/jre/sh/java"
91
+ else
92
+ JAVACMD="$JAVA_HOME/bin/java"
93
+ fi
94
+ if [ ! -x "$JAVACMD" ] ; then
95
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96
+
97
+ Please set the JAVA_HOME variable in your environment to match the
98
+ location of your Java installation."
99
+ fi
100
+ else
101
+ JAVACMD="java"
102
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103
+
104
+ Please set the JAVA_HOME variable in your environment to match the
105
+ location of your Java installation."
106
+ fi
107
+
108
+ # Increase the maximum file descriptors if we can.
109
+ if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110
+ MAX_FD_LIMIT=`ulimit -H -n`
111
+ if [ $? -eq 0 ] ; then
112
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113
+ MAX_FD="$MAX_FD_LIMIT"
114
+ fi
115
+ ulimit -n $MAX_FD
116
+ if [ $? -ne 0 ] ; then
117
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
118
+ fi
119
+ else
120
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121
+ fi
122
+ fi
123
+
124
+ # For Darwin, add options to specify how the application appears in the dock
125
+ if $darwin; then
126
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127
+ fi
128
+
129
+ # For Cygwin or MSYS, switch paths to Windows format before running java
130
+ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133
+
134
+ JAVACMD=`cygpath --unix "$JAVACMD"`
135
+
136
+ # We build the pattern for arguments to be converted via cygpath
137
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138
+ SEP=""
139
+ for dir in $ROOTDIRSRAW ; do
140
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
141
+ SEP="|"
142
+ done
143
+ OURCYGPATTERN="(^($ROOTDIRS))"
144
+ # Add a user-defined pattern to the cygpath arguments
145
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147
+ fi
148
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
149
+ i=0
150
+ for arg in "$@" ; do
151
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153
+
154
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156
+ else
157
+ eval `echo args$i`="\"$arg\""
158
+ fi
159
+ i=`expr $i + 1`
160
+ done
161
+ case $i in
162
+ 0) set -- ;;
163
+ 1) set -- "$args0" ;;
164
+ 2) set -- "$args0" "$args1" ;;
165
+ 3) set -- "$args0" "$args1" "$args2" ;;
166
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172
+ esac
173
+ fi
174
+
175
+ # Escape application args
176
+ save () {
177
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178
+ echo " "
179
+ }
180
+ APP_ARGS=`save "$@"`
181
+
182
+ # Collect all arguments for the java command, following the shell quoting and substitution rules
183
+ eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184
+
185
+ exec "$JAVACMD" "$@"
@@ -0,0 +1,89 @@
1
+ @rem
2
+ @rem Copyright 2015 the original author or authors.
3
+ @rem
4
+ @rem Licensed under the Apache License, Version 2.0 (the "License");
5
+ @rem you may not use this file except in compliance with the License.
6
+ @rem You may obtain a copy of the License at
7
+ @rem
8
+ @rem https://www.apache.org/licenses/LICENSE-2.0
9
+ @rem
10
+ @rem Unless required by applicable law or agreed to in writing, software
11
+ @rem distributed under the License is distributed on an "AS IS" BASIS,
12
+ @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ @rem See the License for the specific language governing permissions and
14
+ @rem limitations under the License.
15
+ @rem
16
+
17
+ @if "%DEBUG%" == "" @echo off
18
+ @rem ##########################################################################
19
+ @rem
20
+ @rem Gradle startup script for Windows
21
+ @rem
22
+ @rem ##########################################################################
23
+
24
+ @rem Set local scope for the variables with windows NT shell
25
+ if "%OS%"=="Windows_NT" setlocal
26
+
27
+ set DIRNAME=%~dp0
28
+ if "%DIRNAME%" == "" set DIRNAME=.
29
+ set APP_BASE_NAME=%~n0
30
+ set APP_HOME=%DIRNAME%
31
+
32
+ @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33
+ for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34
+
35
+ @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36
+ set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37
+
38
+ @rem Find java.exe
39
+ if defined JAVA_HOME goto findJavaFromJavaHome
40
+
41
+ set JAVA_EXE=java.exe
42
+ %JAVA_EXE% -version >NUL 2>&1
43
+ if "%ERRORLEVEL%" == "0" goto execute
44
+
45
+ echo.
46
+ echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47
+ echo.
48
+ echo Please set the JAVA_HOME variable in your environment to match the
49
+ echo location of your Java installation.
50
+
51
+ goto fail
52
+
53
+ :findJavaFromJavaHome
54
+ set JAVA_HOME=%JAVA_HOME:"=%
55
+ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56
+
57
+ if exist "%JAVA_EXE%" goto execute
58
+
59
+ echo.
60
+ echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61
+ echo.
62
+ echo Please set the JAVA_HOME variable in your environment to match the
63
+ echo location of your Java installation.
64
+
65
+ goto fail
66
+
67
+ :execute
68
+ @rem Setup the command line
69
+
70
+ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71
+
72
+
73
+ @rem Execute Gradle
74
+ "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75
+
76
+ :end
77
+ @rem End local scope for the variables with windows NT shell
78
+ if "%ERRORLEVEL%"=="0" goto mainEnd
79
+
80
+ :fail
81
+ rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82
+ rem the _cmd.exe /c_ return code!
83
+ if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84
+ exit /b 1
85
+
86
+ :mainEnd
87
+ if "%OS%"=="Windows_NT" endlocal
88
+
89
+ :omega
@@ -0,0 +1,23 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="com.reactnativecore">
3
+ <uses-feature android:name="android.hardware.camera" />
4
+ <uses-feature android:name="android.hardware.bluetooth" android:required="false"/>
5
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
6
+ <uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30"/>
7
+ <uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
8
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" android:maxSdkVersion="30" />
9
+ <uses-permission android:name="android.permission.CAMERA"/>
10
+ <uses-permission android:name="android.permission.INTERNET"/>
11
+ <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
12
+ <uses-permission android:name="android.permission.RECORD_AUDIO"/>
13
+ <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
14
+ <uses-permission android:name="android.permission.WAKE_LOCK"/>
15
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
16
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA" />
17
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
18
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
19
+ <uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT" />
20
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
21
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
22
+ <uses-permission android:name="android.permission.MICROPHONE" />
23
+ </manifest>
@@ -0,0 +1,97 @@
1
+ package com.reactnativecore.BackgroundTimer;
2
+
3
+ import android.os.Handler;
4
+ import android.os.PowerManager;
5
+
6
+ import com.facebook.react.bridge.LifecycleEventListener;
7
+ import com.facebook.react.bridge.ReactApplicationContext;
8
+ import com.facebook.react.bridge.ReactContext;
9
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
10
+ import com.facebook.react.bridge.ReactMethod;
11
+ import com.facebook.react.modules.core.DeviceEventManagerModule;
12
+
13
+
14
+
15
+ public class RNBackgroundTimer extends ReactContextBaseJavaModule {
16
+
17
+ private final ReactApplicationContext reactContext;
18
+ private static final String ERROR_INVALID_ACTIVITY = "E_INVALID_ACTIVITY";
19
+
20
+ private Handler handler;
21
+ private ReactContext reactContext2;
22
+ private Runnable runnable;
23
+ private PowerManager powerManager;
24
+ private PowerManager.WakeLock wakeLock;
25
+ private final LifecycleEventListener listener = new LifecycleEventListener(){
26
+ @Override
27
+ public void onHostResume() {}
28
+
29
+ @Override
30
+ public void onHostPause() {}
31
+
32
+ @Override
33
+ public void onHostDestroy() {
34
+ if (wakeLock.isHeld()) wakeLock.release();
35
+ }
36
+ };
37
+
38
+
39
+ public RNBackgroundTimer(ReactApplicationContext reactContext) {
40
+ super(reactContext);
41
+ this.reactContext = reactContext;
42
+ this.powerManager = (PowerManager) getReactApplicationContext().getSystemService(reactContext.POWER_SERVICE);
43
+ this.wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "dytesdk:wakelock");
44
+ reactContext.addLifecycleEventListener(listener);
45
+ }
46
+
47
+ @Override
48
+ public String getName() {
49
+ return "DyteRNBackgroundTimer";
50
+ }
51
+
52
+
53
+ @ReactMethod
54
+ public void backgroundTimerStart(final int delay) {
55
+ if (!wakeLock.isHeld()) wakeLock.acquire();
56
+
57
+ handler = new Handler();
58
+ runnable = new Runnable() {
59
+ @Override
60
+ public void run() {
61
+ backgroundTimerSendEvent(reactContext, "backgroundTimer");
62
+ }
63
+ };
64
+
65
+ handler.post(runnable);
66
+ }
67
+
68
+ @ReactMethod
69
+ public void backgroundTimerStop() {
70
+ if (wakeLock.isHeld()) wakeLock.release();
71
+
72
+ // avoid null pointer exceptio when stop is called without start
73
+ if (handler != null) handler.removeCallbacks(runnable);
74
+ }
75
+
76
+ private void backgroundTimerSendEvent(ReactContext reactContext, String eventName) {
77
+ reactContext
78
+ .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
79
+ .emit(eventName, null);
80
+ }
81
+
82
+ @ReactMethod
83
+ public void backgroundTimerSetTimeout(final int id, final double timeout) {
84
+ Handler handler = new Handler();
85
+ handler.postDelayed(new Runnable(){
86
+ @Override
87
+ public void run(){
88
+ if (getReactApplicationContext().hasActiveCatalystInstance()) {
89
+ getReactApplicationContext()
90
+ .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
91
+ .emit("backgroundTimer.timeout", id);
92
+ }
93
+ }
94
+ }, (long) timeout);
95
+ }
96
+
97
+ }
@@ -0,0 +1,14 @@
1
+
2
+ package com.reactnativecore;
3
+
4
+ class Constants {
5
+ static final String ACTION_FOREGROUND_SERVICE_START = "package com.dyteMobileSdk.service_start";
6
+ static final String ACTION_FOREGROUND_SERVICE_STOP = "package com.dyteMobileSdk.service_stop";
7
+
8
+ static final String NOTIFICATION_CONFIG = "package com.dyteMobileSdk.notif_config";
9
+
10
+ static final String ERROR_INVALID_CONFIG = "ERROR_INVALID_CONFIG";
11
+ static final String ERROR_SERVICE_ERROR = "ERROR_SERVICE_ERROR";
12
+ static final String ERROR_ANDROID_VERSION = "ERROR_ANDROID_VERSION";
13
+
14
+ }
@@ -0,0 +1,49 @@
1
+ package com.reactnativecore;
2
+
3
+ import android.util.Base64;
4
+
5
+ import androidx.annotation.NonNull;
6
+
7
+ import com.facebook.react.bridge.Promise;
8
+ import com.facebook.react.bridge.ReactApplicationContext;
9
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
10
+ import com.facebook.react.bridge.ReactMethod;
11
+ import com.facebook.react.module.annotations.ReactModule;
12
+
13
+ import java.security.NoSuchAlgorithmException;
14
+ import java.security.SecureRandom;
15
+
16
+ @ReactModule(name = CoreModule.NAME)
17
+ public class CoreModule extends ReactContextBaseJavaModule {
18
+ public static final String NAME = "Core";
19
+
20
+ public CoreModule(ReactApplicationContext reactContext) {
21
+ super(reactContext);
22
+ }
23
+
24
+ @Override
25
+ @NonNull
26
+ public String getName() {
27
+ return NAME;
28
+ }
29
+
30
+
31
+ // Example method
32
+ // See https://reactnative.dev/docs/native-modules-android
33
+ @ReactMethod
34
+ public void multiply(int a, int b, Promise promise) {
35
+ promise.resolve(a * b);
36
+ }
37
+
38
+ public static native int nativeMultiply(int a, int b);
39
+
40
+ @ReactMethod(isBlockingSynchronousMethod = true)
41
+ public String getRandomBase64(int byteLength) throws NoSuchAlgorithmException {
42
+ byte[] data = new byte[byteLength];
43
+ SecureRandom random = new SecureRandom();
44
+
45
+ random.nextBytes(data);
46
+
47
+ return Base64.encodeToString(data, Base64.NO_WRAP);
48
+ }
49
+ }
@@ -0,0 +1,34 @@
1
+ package com.reactnativecore;
2
+
3
+ import androidx.annotation.NonNull;
4
+
5
+ import com.facebook.react.ReactPackage;
6
+ import com.facebook.react.bridge.NativeModule;
7
+ import com.facebook.react.bridge.ReactApplicationContext;
8
+ import com.facebook.react.uimanager.ViewManager;
9
+
10
+ import java.util.*;
11
+
12
+ import com.reactnativecore.incallmanager.InCallManagerModule;
13
+ import com.reactnativecore.RNPermissionsModule;
14
+ import com.reactnativecore.BackgroundTimer.RNBackgroundTimer;
15
+ import com.reactnativecore.DyteHelperModule;
16
+
17
+ public class CorePackage implements ReactPackage {
18
+ @NonNull
19
+ @Override
20
+ public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
21
+ return Arrays.<NativeModule>asList(new CoreModule(reactContext),
22
+ new RNPermissionsModule(reactContext),
23
+ new InCallManagerModule(reactContext),
24
+ new RNBackgroundTimer(reactContext),
25
+ new DyteHelperModule(reactContext)
26
+ );
27
+ }
28
+
29
+ @NonNull
30
+ @Override
31
+ public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
32
+ return Collections.emptyList();
33
+ }
34
+ }