freerasp-react-native 3.13.0 → 3.14.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.
Files changed (123) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +4 -2
  3. package/android/build.gradle +3 -3
  4. package/android/gradle.properties +2 -2
  5. package/android/proguard-rules.pro +8 -0
  6. package/android/src/main/java/com/freeraspreactnative/FreeraspReactNativeModule.kt +59 -10
  7. package/android/src/main/java/com/freeraspreactnative/FreeraspThreatHandler.kt +8 -0
  8. package/android/src/main/java/com/freeraspreactnative/ScreenProtector.kt +164 -0
  9. package/android/src/main/java/com/freeraspreactnative/Threat.kt +5 -1
  10. package/android/src/main/java/com/freeraspreactnative/utils/Extensions.kt +1 -1
  11. package/example/Gemfile +6 -2
  12. package/example/Gemfile.lock +121 -0
  13. package/example/android/app/build.gradle +64 -265
  14. package/example/android/app/src/debug/AndroidManifest.xml +1 -5
  15. package/example/android/app/src/main/AndroidManifest.xml +5 -3
  16. package/example/android/app/src/main/java/com/freerasp/rn/example/MainActivity.kt +22 -0
  17. package/example/android/app/src/main/java/com/freerasp/rn/example/MainApplication.kt +44 -0
  18. package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +3 -2
  19. package/example/android/app/src/main/res/values/strings.xml +1 -1
  20. package/example/android/build.gradle +16 -45
  21. package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  22. package/example/android/gradle/wrapper/gradle-wrapper.properties +3 -1
  23. package/example/android/gradle.properties +5 -6
  24. package/example/android/gradlew +30 -13
  25. package/example/android/gradlew.bat +21 -16
  26. package/example/android/settings.gradle +5 -10
  27. package/example/app.json +3 -3
  28. package/example/index.js +4 -0
  29. package/example/ios/FreeraspRNExample/AppDelegate.swift +30 -0
  30. package/example/ios/{FreeraspReactNativeExample → FreeraspRNExample}/Info.plist +8 -12
  31. package/example/ios/{FreeraspReactNativeExample → FreeraspRNExample}/LaunchScreen.storyboard +1 -1
  32. package/example/ios/FreeraspRNExample/PrivacyInfo.xcprivacy +37 -0
  33. package/example/ios/FreeraspRNExample.xcodeproj/project.pbxproj +488 -0
  34. package/example/ios/{FreeraspReactNativeExample.xcodeproj/xcshareddata/xcschemes/FreeraspReactNativeExample.xcscheme → FreeraspRNExample.xcodeproj/xcshareddata/xcschemes/FreeraspRNExample.xcscheme} +12 -12
  35. package/example/ios/{FreeraspReactNativeExample.xcworkspace → FreeraspRNExample.xcworkspace}/contents.xcworkspacedata +1 -1
  36. package/example/ios/Podfile +19 -32
  37. package/example/metro.config.js +13 -14
  38. package/example/package.json +23 -12
  39. package/example/src/App.tsx +18 -0
  40. package/example/src/DemoApp.tsx +181 -79
  41. package/example/src/MalwareModal.tsx +2 -12
  42. package/example/src/checks.ts +2 -0
  43. package/example/yarn.lock +3825 -1613
  44. package/ios/FreeraspReactNative.swift +6 -2
  45. package/ios/TalsecRuntime.xcframework/Info.plist +5 -5
  46. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeDirectory +0 -0
  47. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeRequirements-1 +0 -0
  48. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeResources +87 -87
  49. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeSignature +0 -0
  50. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/CurlWrapper.h +1 -1
  51. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/TalsecRuntime-Swift.h +1 -1
  52. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/curl.h +7 -7
  53. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/multi.h +4 -4
  54. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/options.h +1 -1
  55. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/urlapi.h +1 -1
  56. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Info.plist +0 -0
  57. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.abi.json +316 -178
  58. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.private.swiftinterface +2 -0
  59. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  60. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.swiftinterface +2 -0
  61. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/TalsecRuntime +0 -0
  62. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/CurlWrapper.h +1 -1
  63. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/TalsecRuntime-Swift.h +2 -2
  64. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/curl.h +7 -7
  65. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/multi.h +4 -4
  66. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/options.h +1 -1
  67. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/urlapi.h +1 -1
  68. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Info.plist +0 -0
  69. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.abi.json +316 -178
  70. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +2 -0
  71. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  72. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.swiftinterface +2 -0
  73. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.abi.json +316 -178
  74. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +2 -0
  75. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  76. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +2 -0
  77. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/TalsecRuntime +0 -0
  78. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/_CodeSignature/CodeResources +33 -33
  79. package/lib/commonjs/index.js +25 -3
  80. package/lib/commonjs/index.js.map +1 -1
  81. package/lib/commonjs/threat.js +3 -1
  82. package/lib/commonjs/threat.js.map +1 -1
  83. package/lib/module/index.js +19 -1
  84. package/lib/module/index.js.map +1 -1
  85. package/lib/module/threat.js +3 -1
  86. package/lib/module/threat.js.map +1 -1
  87. package/lib/typescript/src/index.d.ts +2 -0
  88. package/lib/typescript/src/index.d.ts.map +1 -1
  89. package/lib/typescript/src/threat.d.ts +2 -0
  90. package/lib/typescript/src/threat.d.ts.map +1 -1
  91. package/lib/typescript/src/types.d.ts +2 -0
  92. package/lib/typescript/src/types.d.ts.map +1 -1
  93. package/package.json +1 -1
  94. package/src/index.tsx +24 -0
  95. package/src/threat.ts +6 -0
  96. package/src/types.ts +2 -0
  97. package/example/android/app/_BUCK +0 -55
  98. package/example/android/app/build_defs.bzl +0 -19
  99. package/example/android/app/src/debug/java/com/freeraspreactnativeexample/ReactNativeFlipper.java +0 -73
  100. package/example/android/app/src/main/java/com/freeraspreactnativeexample/MainActivity.java +0 -48
  101. package/example/android/app/src/main/java/com/freeraspreactnativeexample/MainApplication.java +0 -91
  102. package/example/android/app/src/main/java/com/freeraspreactnativeexample/newarchitecture/MainApplicationReactNativeHost.java +0 -116
  103. package/example/android/app/src/main/java/com/freeraspreactnativeexample/newarchitecture/components/MainComponentsRegistry.java +0 -36
  104. package/example/android/app/src/main/java/com/freeraspreactnativeexample/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java +0 -48
  105. package/example/android/app/src/main/jni/CMakeLists.txt +0 -7
  106. package/example/android/app/src/main/jni/MainApplicationModuleProvider.cpp +0 -32
  107. package/example/android/app/src/main/jni/MainApplicationModuleProvider.h +0 -16
  108. package/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp +0 -45
  109. package/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h +0 -38
  110. package/example/android/app/src/main/jni/MainComponentsRegistry.cpp +0 -65
  111. package/example/android/app/src/main/jni/MainComponentsRegistry.h +0 -32
  112. package/example/android/app/src/main/jni/OnLoad.cpp +0 -11
  113. package/example/ios/File.swift +0 -6
  114. package/example/ios/FreeraspReactNativeExample/AppDelegate.h +0 -8
  115. package/example/ios/FreeraspReactNativeExample/AppDelegate.mm +0 -133
  116. package/example/ios/FreeraspReactNativeExample/main.m +0 -10
  117. package/example/ios/FreeraspReactNativeExample-Bridging-Header.h +0 -3
  118. package/example/ios/FreeraspReactNativeExample.xcodeproj/project.pbxproj +0 -729
  119. package/example/ios/FreeraspReactNativeExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  120. package/example/ios/FreeraspReactNativeExampleTests/FreeraspReactNativeExampleTests.m +0 -66
  121. package/example/ios/FreeraspReactNativeExampleTests/Info.plist +0 -24
  122. /package/example/ios/{FreeraspReactNativeExample → FreeraspRNExample}/Images.xcassets/AppIcon.appiconset/Contents.json +0 -0
  123. /package/example/ios/{FreeraspReactNativeExample → FreeraspRNExample}/Images.xcassets/Contents.json +0 -0
@@ -1,214 +1,89 @@
1
1
  apply plugin: "com.android.application"
2
-
3
- import com.android.build.OutputFile
4
- import org.apache.tools.ant.taskdefs.condition.Os
2
+ apply plugin: "org.jetbrains.kotlin.android"
3
+ apply plugin: "com.facebook.react"
5
4
 
6
5
  /**
7
- * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
8
- * and bundleReleaseJsAndAssets).
9
- * These basically call `react-native bundle` with the correct arguments during the Android build
10
- * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
11
- * bundle directly from the development server. Below you can see all the possible configurations
12
- * and their defaults. If you decide to add a configuration block, make sure to add it before the
13
- * `apply from: "../../node_modules/react-native/react.gradle"` line.
14
- *
15
- * project.ext.react = [
16
- * // the name of the generated asset file containing your JS bundle
17
- * bundleAssetName: "index.android.bundle",
18
- *
19
- * // the entry file for bundle generation. If none specified and
20
- * // "index.android.js" exists, it will be used. Otherwise "index.js" is
21
- * // default. Can be overridden with ENTRY_FILE environment variable.
22
- * entryFile: "index.android.js",
23
- *
24
- * // https://reactnative.dev/docs/performance#enable-the-ram-format
25
- * bundleCommand: "ram-bundle",
26
- *
27
- * // whether to bundle JS and assets in debug mode
28
- * bundleInDebug: false,
29
- *
30
- * // whether to bundle JS and assets in release mode
31
- * bundleInRelease: true,
32
- *
33
- * // whether to bundle JS and assets in another build variant (if configured).
34
- * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
35
- * // The configuration property can be in the following formats
36
- * // 'bundleIn${productFlavor}${buildType}'
37
- * // 'bundleIn${buildType}'
38
- * // bundleInFreeDebug: true,
39
- * // bundleInPaidRelease: true,
40
- * // bundleInBeta: true,
41
- *
42
- * // whether to disable dev mode in custom build variants (by default only disabled in release)
43
- * // for example: to disable dev mode in the staging build type (if configured)
44
- * devDisabledInStaging: true,
45
- * // The configuration property can be in the following formats
46
- * // 'devDisabledIn${productFlavor}${buildType}'
47
- * // 'devDisabledIn${buildType}'
48
- *
49
- * // the root of your project, i.e. where "package.json" lives
50
- * root: "../../",
51
- *
52
- * // where to put the JS bundle asset in debug mode
53
- * jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
54
- *
55
- * // where to put the JS bundle asset in release mode
56
- * jsBundleDirRelease: "$buildDir/intermediates/assets/release",
57
- *
58
- * // where to put drawable resources / React Native assets, e.g. the ones you use via
59
- * // require('./image.png')), in debug mode
60
- * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
61
- *
62
- * // where to put drawable resources / React Native assets, e.g. the ones you use via
63
- * // require('./image.png')), in release mode
64
- * resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
65
- *
66
- * // by default the gradle tasks are skipped if none of the JS files or assets change; this means
67
- * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
68
- * // date; if you have any other folders that you want to ignore for performance reasons (gradle
69
- * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
70
- * // for example, you might want to remove it from here.
71
- * inputExcludes: ["android/**", "ios/**"],
72
- *
73
- * // override which node gets called and with what additional arguments
74
- * nodeExecutableAndArgs: ["node"],
75
- *
76
- * // supply additional arguments to the packager
77
- * extraPackagerArgs: []
78
- * ]
6
+ * This is the configuration block to customize your React Native Android app.
7
+ * By default you don't need to apply any configuration, just uncomment the lines you need.
79
8
  */
80
-
81
- project.ext.react = [
82
- enableHermes: true, // clean and rebuild if changing
83
- ]
84
-
85
- apply from: "../../node_modules/react-native/react.gradle"
86
-
87
- /**
88
- * Set this to true to create two separate APKs instead of one:
89
- * - An APK that only works on ARM devices
90
- * - An APK that only works on x86 devices
91
- * The advantage is the size of the APK is reduced by about 4MB.
92
- * Upload all the APKs to the Play Store and people will download
93
- * the correct one based on the CPU architecture of their device.
94
- */
95
- def enableSeparateBuildPerCPUArchitecture = false
9
+ react {
10
+ /* Folders */
11
+ // The root of your project, i.e. where "package.json" lives. Default is '../..'
12
+ // root = file("../../")
13
+ // The folder where the react-native NPM package is. Default is ../../node_modules/react-native
14
+ // reactNativeDir = file("../../node_modules/react-native")
15
+ // The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
16
+ // codegenDir = file("../../node_modules/@react-native/codegen")
17
+ // The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
18
+ // cliFile = file("../../node_modules/react-native/cli.js")
19
+
20
+ /* Variants */
21
+ // The list of variants to that are debuggable. For those we're going to
22
+ // skip the bundling of the JS bundle and the assets. By default is just 'debug'.
23
+ // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
24
+ // debuggableVariants = ["liteDebug", "prodDebug"]
25
+
26
+ /* Bundling */
27
+ // A list containing the node command and its flags. Default is just 'node'.
28
+ // nodeExecutableAndArgs = ["node"]
29
+ //
30
+ // The command to run when bundling. By default is 'bundle'
31
+ // bundleCommand = "ram-bundle"
32
+ //
33
+ // The path to the CLI configuration file. Default is empty.
34
+ // bundleConfig = file(../rn-cli.config.js)
35
+ //
36
+ // The name of the generated asset file containing your JS bundle
37
+ // bundleAssetName = "MyApplication.android.bundle"
38
+ //
39
+ // The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
40
+ // entryFile = file("../js/MyApplication.android.js")
41
+ //
42
+ // A list of extra flags to pass to the 'bundle' commands.
43
+ // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
44
+ // extraPackagerArgs = []
45
+
46
+ /* Hermes Commands */
47
+ // The hermes compiler command to run. By default it is 'hermesc'
48
+ // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
49
+ //
50
+ // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
51
+ // hermesFlags = ["-O", "-output-source-map"]
52
+
53
+ /* Autolinking */
54
+ autolinkLibrariesWithApp()
55
+ }
96
56
 
97
57
  /**
98
- * Run Proguard to shrink the Java bytecode in release builds.
58
+ * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
99
59
  */
100
60
  def enableProguardInReleaseBuilds = true
101
61
 
102
62
  /**
103
- * The preferred build flavor of JavaScriptCore.
63
+ * The preferred build flavor of JavaScriptCore (JSC)
104
64
  *
105
65
  * For example, to use the international variant, you can use:
106
- * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
66
+ * `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+`
107
67
  *
108
68
  * The international variant includes ICU i18n library and necessary data
109
69
  * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
110
- * give correct results when using with locales other than en-US. Note that
70
+ * give correct results when using with locales other than en-US. Note that
111
71
  * this variant is about 6MiB larger per architecture than default.
112
72
  */
113
- def jscFlavor = 'org.webkit:android-jsc:+'
114
-
115
- /**
116
- * Whether to enable the Hermes VM.
117
- *
118
- * This should be set on project.ext.react and that value will be read here. If it is not set
119
- * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
120
- * and the benefits of using Hermes will therefore be sharply reduced.
121
- */
122
- def enableHermes = project.ext.react.get("enableHermes", false);
123
-
124
- /**
125
- * Architectures to build native code for.
126
- */
127
- def reactNativeArchitectures() {
128
- def value = project.getProperties().get("reactNativeArchitectures")
129
- return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
130
- }
73
+ def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
131
74
 
132
75
  android {
133
76
  ndkVersion rootProject.ext.ndkVersion
77
+ buildToolsVersion rootProject.ext.buildToolsVersion
78
+ compileSdk rootProject.ext.compileSdkVersion
134
79
 
135
- compileSdkVersion rootProject.ext.compileSdkVersion
136
-
80
+ namespace "com.freerasp.rn.example"
137
81
  defaultConfig {
138
- applicationId "com.freeraspreactnativeexample"
82
+ applicationId "com.freerasp.rn.example"
139
83
  minSdkVersion rootProject.ext.minSdkVersion
140
84
  targetSdkVersion rootProject.ext.targetSdkVersion
141
85
  versionCode 1
142
86
  versionName "1.0"
143
- buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
144
-
145
- if (isNewArchitectureEnabled()) {
146
- // We configure the CMake build only if you decide to opt-in for the New Architecture.
147
- externalNativeBuild {
148
- cmake {
149
- arguments "-DPROJECT_BUILD_DIR=$buildDir",
150
- "-DREACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
151
- "-DREACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",
152
- "-DNODE_MODULES_DIR=$rootDir/../node_modules",
153
- "-DANDROID_STL=c++_shared"
154
- }
155
- }
156
- if (!enableSeparateBuildPerCPUArchitecture) {
157
- ndk {
158
- abiFilters (*reactNativeArchitectures())
159
- }
160
- }
161
- }
162
- }
163
-
164
- if (isNewArchitectureEnabled()) {
165
- // We configure the NDK build only if you decide to opt-in for the New Architecture.
166
- externalNativeBuild {
167
- cmake {
168
- path "$projectDir/src/main/jni/CMakeLists.txt"
169
- }
170
- }
171
- def reactAndroidProjectDir = project(':ReactAndroid').projectDir
172
- def packageReactNdkDebugLibs = tasks.register("packageReactNdkDebugLibs", Copy) {
173
- dependsOn(":ReactAndroid:packageReactNdkDebugLibsForBuck")
174
- from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
175
- into("$buildDir/react-ndk/exported")
176
- }
177
- def packageReactNdkReleaseLibs = tasks.register("packageReactNdkReleaseLibs", Copy) {
178
- dependsOn(":ReactAndroid:packageReactNdkReleaseLibsForBuck")
179
- from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
180
- into("$buildDir/react-ndk/exported")
181
- }
182
- afterEvaluate {
183
- // If you wish to add a custom TurboModule or component locally,
184
- // you should uncomment this line.
185
- // preBuild.dependsOn("generateCodegenArtifactsFromSchema")
186
- preDebugBuild.dependsOn(packageReactNdkDebugLibs)
187
- preReleaseBuild.dependsOn(packageReactNdkReleaseLibs)
188
-
189
- // Due to a bug inside AGP, we have to explicitly set a dependency
190
- // between configureCMakeDebug* tasks and the preBuild tasks.
191
- // This can be removed once this is solved: https://issuetracker.google.com/issues/207403732
192
- configureCMakeRelWithDebInfo.dependsOn(preReleaseBuild)
193
- configureCMakeDebug.dependsOn(preDebugBuild)
194
- reactNativeArchitectures().each { architecture ->
195
- tasks.findByName("configureCMakeDebug[${architecture}]")?.configure {
196
- dependsOn("preDebugBuild")
197
- }
198
- tasks.findByName("configureCMakeRelWithDebInfo[${architecture}]")?.configure {
199
- dependsOn("preReleaseBuild")
200
- }
201
- }
202
- }
203
- }
204
-
205
- splits {
206
- abi {
207
- reset()
208
- enable enableSeparateBuildPerCPUArchitecture
209
- universalApk false // If true, also generate a universal APK
210
- include (*reactNativeArchitectures())
211
- }
212
87
  }
213
88
  signingConfigs {
214
89
  debug {
@@ -226,96 +101,20 @@ android {
226
101
  // Caution! In production, you need to generate your own keystore file.
227
102
  // see https://reactnative.dev/docs/signed-apk-android.
228
103
  signingConfig signingConfigs.debug
229
- // Enables code shrinking, obfuscation, and optimization for only
230
- // your project's release build type. Make sure to use a build
231
- // variant with `debuggable false`.
232
104
  minifyEnabled enableProguardInReleaseBuilds
233
- // Enables resource shrinking, which is performed by the
234
- // Android Gradle plugin.
235
105
  shrinkResources true
236
- // Includes the default ProGuard rules files that are packaged with
237
- // the Android Gradle plugin.
238
106
  proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
239
107
  }
240
108
  }
241
-
242
- // applicationVariants are e.g. debug, release
243
- applicationVariants.all { variant ->
244
- variant.outputs.each { output ->
245
- // For each separate APK per architecture, set a unique version code as described here:
246
- // https://developer.android.com/studio/build/configure-apk-splits.html
247
- // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
248
- def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
249
- def abi = output.getFilter(OutputFile.ABI)
250
- if (abi != null) { // null for the universal-debug, universal-release variants
251
- output.versionCodeOverride =
252
- defaultConfig.versionCode * 1000 + versionCodes.get(abi)
253
- }
254
-
255
- }
256
- }
257
109
  }
258
110
 
259
111
  dependencies {
260
- implementation fileTree(dir: "libs", include: ["*.jar"])
261
-
262
- //noinspection GradleDynamicVersion
263
- implementation "com.facebook.react:react-native:+" // From node_modules
264
-
265
- implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
112
+ // The version of react-native is set by the React Native Gradle Plugin
113
+ implementation("com.facebook.react:react-android")
266
114
 
267
- debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
268
- exclude group:'com.facebook.fbjni'
269
- }
270
-
271
- debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
272
- exclude group:'com.facebook.flipper'
273
- exclude group:'com.squareup.okhttp3', module:'okhttp'
274
- }
275
-
276
- debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
277
- exclude group:'com.facebook.flipper'
278
- }
279
-
280
- if (enableHermes) {
281
- //noinspection GradleDynamicVersion
282
- implementation("com.facebook.react:hermes-engine:+") { // From node_modules
283
- exclude group:'com.facebook.fbjni'
284
- }
115
+ if (hermesEnabled.toBoolean()) {
116
+ implementation("com.facebook.react:hermes-android")
285
117
  } else {
286
118
  implementation jscFlavor
287
119
  }
288
120
  }
289
-
290
- if (isNewArchitectureEnabled()) {
291
- // If new architecture is enabled, we let you build RN from source
292
- // Otherwise we fallback to a prebuilt .aar bundled in the NPM package.
293
- // This will be applied to all the imported transtitive dependency.
294
- configurations.all {
295
- resolutionStrategy.dependencySubstitution {
296
- substitute(module("com.facebook.react:react-native"))
297
- .using(project(":ReactAndroid"))
298
- .because("On New Architecture we're building React Native from source")
299
- substitute(module("com.facebook.react:hermes-engine"))
300
- .using(project(":ReactAndroid:hermes-engine"))
301
- .because("On New Architecture we're building Hermes from source")
302
- }
303
- }
304
- }
305
-
306
- // Run this once to be able to run the application with BUCK
307
- // puts all compile dependencies into folder libs for BUCK to use
308
- task copyDownloadableDepsToLibs(type: Copy) {
309
- from configurations.implementation
310
- into 'libs'
311
- }
312
-
313
- apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
314
-
315
- def isNewArchitectureEnabled() {
316
- // To opt-in for the New Architecture, you can either:
317
- // - Set `newArchEnabled` to true inside the `gradle.properties` file
318
- // - Invoke gradle with `-newArchEnabled=true`
319
- // - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
320
- return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
321
- }
@@ -2,12 +2,8 @@
2
2
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
3
  xmlns:tools="http://schemas.android.com/tools">
4
4
 
5
- <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
6
-
7
5
  <application
8
6
  android:usesCleartextTraffic="true"
9
7
  tools:targetApi="28"
10
- tools:ignore="GoogleAppIndexingWarning">
11
- <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" />
12
- </application>
8
+ tools:ignore="GoogleAppIndexingWarning"/>
13
9
  </manifest>
@@ -1,7 +1,8 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- package="com.freeraspreactnativeexample">
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
3
2
 
4
3
  <uses-permission android:name="android.permission.INTERNET" />
4
+ <uses-permission android:name="android.permission.DETECT_SCREEN_CAPTURE" />
5
+ <uses-permission android:name="android.permission.DETECT_SCREEN_RECORDING" />
5
6
 
6
7
  <application
7
8
  android:name=".MainApplication"
@@ -9,7 +10,8 @@
9
10
  android:icon="@mipmap/ic_launcher"
10
11
  android:roundIcon="@mipmap/ic_launcher_round"
11
12
  android:allowBackup="false"
12
- android:theme="@style/AppTheme">
13
+ android:theme="@style/AppTheme"
14
+ android:supportsRtl="true">
13
15
  <activity
14
16
  android:name=".MainActivity"
15
17
  android:label="@string/app_name"
@@ -0,0 +1,22 @@
1
+ package com.freerasp.rn.example
2
+
3
+ import com.facebook.react.ReactActivity
4
+ import com.facebook.react.ReactActivityDelegate
5
+ import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
6
+ import com.facebook.react.defaults.DefaultReactActivityDelegate
7
+
8
+ class MainActivity : ReactActivity() {
9
+
10
+ /**
11
+ * Returns the name of the main component registered from JavaScript. This is used to schedule
12
+ * rendering of the component.
13
+ */
14
+ override fun getMainComponentName(): String = "FreeraspRNExample"
15
+
16
+ /**
17
+ * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
18
+ * which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
19
+ */
20
+ override fun createReactActivityDelegate(): ReactActivityDelegate =
21
+ DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
22
+ }
@@ -0,0 +1,44 @@
1
+ package com.freerasp.rn.example
2
+
3
+ import android.app.Application
4
+ import com.facebook.react.PackageList
5
+ import com.facebook.react.ReactApplication
6
+ import com.facebook.react.ReactHost
7
+ import com.facebook.react.ReactNativeHost
8
+ import com.facebook.react.ReactPackage
9
+ import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
10
+ import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
11
+ import com.facebook.react.defaults.DefaultReactNativeHost
12
+ import com.facebook.react.soloader.OpenSourceMergedSoMapping
13
+ import com.facebook.soloader.SoLoader
14
+
15
+ class MainApplication : Application(), ReactApplication {
16
+
17
+ override val reactNativeHost: ReactNativeHost =
18
+ object : DefaultReactNativeHost(this) {
19
+ override fun getPackages(): List<ReactPackage> =
20
+ PackageList(this).packages.apply {
21
+ // Packages that cannot be autolinked yet can be added manually here, for example:
22
+ // add(MyReactNativePackage())
23
+ }
24
+
25
+ override fun getJSMainModuleName(): String = "index"
26
+
27
+ override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
28
+
29
+ override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
30
+ override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
31
+ }
32
+
33
+ override val reactHost: ReactHost
34
+ get() = getDefaultReactHost(applicationContext, reactNativeHost)
35
+
36
+ override fun onCreate() {
37
+ super.onCreate()
38
+ SoLoader.init(this, OpenSourceMergedSoMapping)
39
+ if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
40
+ // If you opted-in for the New Architecture, we load the native entry point for this app.
41
+ load()
42
+ }
43
+ }
44
+ }
@@ -17,10 +17,11 @@
17
17
  android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material"
18
18
  android:insetRight="@dimen/abc_edit_text_inset_horizontal_material"
19
19
  android:insetTop="@dimen/abc_edit_text_inset_top_material"
20
- android:insetBottom="@dimen/abc_edit_text_inset_bottom_material">
20
+ android:insetBottom="@dimen/abc_edit_text_inset_bottom_material"
21
+ >
21
22
 
22
23
  <selector>
23
- <!--
24
+ <!--
24
25
  This file is a copy of abc_edit_text_material (https://bit.ly/3k8fX7I).
25
26
  The item below with state_pressed="false" and state_focused="false" causes a NullPointerException.
26
27
  NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)'
@@ -1,3 +1,3 @@
1
1
  <resources>
2
- <string name="app_name">FreeraspReactNativeExample</string>
2
+ <string name="app_name">FreeraspRNExample</string>
3
3
  </resources>
@@ -1,50 +1,21 @@
1
- // Top-level build file where you can add configuration options common to all sub-projects/modules.
2
-
3
1
  buildscript {
4
- ext {
5
- buildToolsVersion = "31.0.0"
6
- minSdkVersion = 23
7
- compileSdkVersion = 31
8
- targetSdkVersion = 31
9
-
10
- if (System.properties['os.arch'] == "aarch64") {
11
- // For M1 Users we need to use the NDK 24 which added support for aarch64
12
- ndkVersion = "24.0.8215888"
13
- } else {
14
- // Otherwise we default to the side-by-side NDK version from AGP.
15
- ndkVersion = "21.4.7075529"
16
- }
17
- }
18
- repositories {
19
- google()
20
- mavenCentral()
21
- }
22
- dependencies {
23
- classpath("com.android.tools.build:gradle:7.2.1")
24
- classpath("com.facebook.react:react-native-gradle-plugin")
25
- classpath("de.undercouch:gradle-download-task:5.0.1")
26
- // NOTE: Do not place your application dependencies here; they belong
27
- // in the individual module build.gradle files
28
- }
29
- }
30
-
31
- allprojects {
32
- repositories {
33
- maven {
34
- // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
35
- url("$rootDir/../node_modules/react-native/android")
2
+ ext {
3
+ buildToolsVersion = "35.0.0"
4
+ minSdkVersion = 24
5
+ compileSdkVersion = 35
6
+ targetSdkVersion = 35
7
+ ndkVersion = "27.1.12297006"
8
+ kotlinVersion = "2.0.21"
36
9
  }
37
- maven {
38
- // Android JSC is installed from npm
39
- url("$rootDir/../node_modules/jsc-android/dist")
10
+ repositories {
11
+ google()
12
+ mavenCentral()
40
13
  }
41
- mavenCentral {
42
- // We don't want to fetch react-native from Maven Central as there are
43
- // older versions over there.
44
- content {
45
- excludeGroup "com.facebook.react"
46
- }
14
+ dependencies {
15
+ classpath("com.android.tools.build:gradle")
16
+ classpath("com.facebook.react:react-native-gradle-plugin")
17
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
47
18
  }
48
- google()
49
- }
50
19
  }
20
+
21
+ apply plugin: "com.facebook.react.rootproject"
@@ -1,5 +1,7 @@
1
1
  distributionBase=GRADLE_USER_HOME
2
2
  distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip
4
+ networkTimeout=10000
5
+ validateDistributionUrl=true
4
6
  zipStoreBase=GRADLE_USER_HOME
5
7
  zipStorePath=wrapper/dists
@@ -21,11 +21,6 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
21
21
  # Android operating system, and which are packaged with your app's APK
22
22
  # https://developer.android.com/topic/libraries/support-library/androidx-rn
23
23
  android.useAndroidX=true
24
- # Automatically convert third-party libraries to use AndroidX
25
- android.enableJetifier=true
26
-
27
- # Version of flipper SDK to use with React Native
28
- FLIPPER_VERSION=0.125.0
29
24
 
30
25
  # Use this property to specify which architecture you want to build.
31
26
  # You can also override it from the CLI using
@@ -37,4 +32,8 @@ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
37
32
  # your application. You should enable this flag either if you want
38
33
  # to write custom TurboModules/Fabric components OR use libraries that
39
34
  # are providing them.
40
- newArchEnabled=false
35
+ newArchEnabled=true
36
+
37
+ # Use this property to enable or disable the Hermes JS engine.
38
+ # If set to false, you will be using JSC instead.
39
+ hermesEnabled=true