@dpdpguard/react-native 0.0.0 → 1.0.0

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 (67) hide show
  1. package/README.md +26 -8
  2. package/package.json +18 -28
  3. package/src/client.ts +27 -0
  4. package/src/{index.tsx → index.ts} +0 -2
  5. package/.github/workflows/ci.yml +0 -15
  6. package/ReactNative.podspec +0 -20
  7. package/android/build.gradle +0 -51
  8. package/android/src/main/AndroidManifest.xml +0 -2
  9. package/android/src/main/java/com/dpdpguard/reactnative/ReactNativeModule.kt +0 -15
  10. package/android/src/main/java/com/dpdpguard/reactnative/ReactNativePackage.kt +0 -31
  11. package/example/.bundle/config +0 -2
  12. package/example/.watchmanconfig +0 -1
  13. package/example/Gemfile +0 -17
  14. package/example/README.md +0 -97
  15. package/example/android/app/build.gradle +0 -119
  16. package/example/android/app/debug.keystore +0 -0
  17. package/example/android/app/proguard-rules.pro +0 -10
  18. package/example/android/app/src/main/AndroidManifest.xml +0 -27
  19. package/example/android/app/src/main/java/com/dpdpguard.reactnative.example/MainActivity.kt +0 -22
  20. package/example/android/app/src/main/java/com/dpdpguard.reactnative.example/MainApplication.kt +0 -27
  21. package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +0 -37
  22. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  23. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  24. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  25. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  26. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  27. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  28. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  29. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  30. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  31. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  32. package/example/android/app/src/main/res/values/strings.xml +0 -3
  33. package/example/android/app/src/main/res/values/styles.xml +0 -9
  34. package/example/android/build.gradle +0 -21
  35. package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  36. package/example/android/gradle/wrapper/gradle-wrapper.properties +0 -7
  37. package/example/android/gradle.properties +0 -44
  38. package/example/android/gradlew +0 -248
  39. package/example/android/gradlew.bat +0 -98
  40. package/example/android/settings.gradle +0 -6
  41. package/example/app.json +0 -4
  42. package/example/babel.config.js +0 -12
  43. package/example/index.js +0 -5
  44. package/example/ios/.xcode.env +0 -11
  45. package/example/ios/Podfile +0 -34
  46. package/example/ios/ReactNativeExample/AppDelegate.swift +0 -48
  47. package/example/ios/ReactNativeExample/Images.xcassets/AppIcon.appiconset/Contents.json +0 -53
  48. package/example/ios/ReactNativeExample/Images.xcassets/Contents.json +0 -6
  49. package/example/ios/ReactNativeExample/Info.plist +0 -59
  50. package/example/ios/ReactNativeExample/LaunchScreen.storyboard +0 -47
  51. package/example/ios/ReactNativeExample/PrivacyInfo.xcprivacy +0 -37
  52. package/example/ios/ReactNativeExample.xcodeproj/project.pbxproj +0 -475
  53. package/example/ios/ReactNativeExample.xcodeproj/xcshareddata/xcschemes/ReactNativeExample.xcscheme +0 -88
  54. package/example/jest.config.js +0 -3
  55. package/example/metro.config.js +0 -11
  56. package/example/package.json +0 -34
  57. package/example/react-native.config.js +0 -21
  58. package/ios/ReactNative.h +0 -5
  59. package/ios/ReactNative.mm +0 -21
  60. package/jest.config.js +0 -6
  61. package/src/NativeReactNative.ts +0 -7
  62. package/src/client.test.ts +0 -119
  63. package/src/consentGate.test.ts +0 -17
  64. package/src/errorCatalog.test.ts +0 -19
  65. package/src/multiply.native.tsx +0 -5
  66. package/src/multiply.tsx +0 -3
  67. package/tsconfig.json +0 -18
package/README.md CHANGED
@@ -9,17 +9,24 @@ https://github.com/dpdp-guard-ai/dpdpbot/blob/main/docs/specs/mobile-server-sdk.
9
9
 
10
10
  ## What's here vs. what's not
11
11
 
12
- This repo was scaffolded as a `create-react-native-library` turbo-module
13
- (`multiply()` native stub, Android/iOS native folders) intended to
14
- eventually bridge over native Android/iOS consent engines (ADR-005) — that
15
- native bridge is **not built yet**; it depends on the native
16
- `dpdpguard-android-sdk`/`dpdpguard-ios-sdk` consent engines (ADR-003)
17
- existing first, which they don't.
18
-
19
- What's implemented now is the **HTTP client layer**: a typed
12
+ This repo was originally scaffolded as a `create-react-native-library`
13
+ turbo-module (`multiply()` native stub, Android/iOS native folders) on the
14
+ assumption it would eventually bridge over the native Android/iOS consent
15
+ engines (ADR-005). That native bridge was never built, and on review it
16
+ isn't the right shape for this package anyway: `dpdpguard-android-sdk` and
17
+ `dpdpguard-ios-sdk` are separate, independently-versioned native libraries
18
+ (ADR-003), and bridging to them would tie every RN release to whatever
19
+ native SDK versions happen to be vendored alongside it, for no benefit —
20
+ none of this SDK's functionality needs on-device native code. The
21
+ turbo-module scaffold (native folders, `NativeReactNative.ts`,
22
+ `multiply()`) has been removed.
23
+
24
+ What's implemented instead is the **HTTP client layer**: a typed
20
25
  `DpdpGuardClient` over DPDP Guard's public `/api/v1` (spec §4.2), following
21
26
  the same pattern as `dpdpguard-server-sdk`/`dpdpguard-js-sdk` — usable
22
27
  today from RN app code via plain `fetch`, with no native module involved.
28
+ This is also the pattern `dpdpguard-flutter-sdk` follows, for consistency
29
+ across both hybrid SDKs.
23
30
 
24
31
  **Deliberately excluded, for security, not by omission:**
25
32
 
@@ -54,6 +61,17 @@ await client.createDsrRequest({ organizationId, type: 'erasure' });
54
61
  // Public reads need no auth at all.
55
62
  const org = await client.getOrganization('acme');
56
63
  const { notices } = await client.getNotices(org.orgId);
64
+
65
+ // Recording consent from a banner shown *before* login (ADR-004 D6) needs
66
+ // no auth either — just a client-generated anonymousId. Reconcile it into
67
+ // the signed-in user's profile later with linkAnonymousConsent().
68
+ await client.giveConsentAnonymous({
69
+ organizationId: org.orgId,
70
+ noticeId: notices[0]._id,
71
+ purpose: 'Analytics',
72
+ dataTypes: ['deviceId'],
73
+ anonymousId,
74
+ });
57
75
  ```
58
76
 
59
77
  Every non-2xx response throws a `DpdpGuardApiError` with a `code` from the
package/package.json CHANGED
@@ -1,49 +1,39 @@
1
1
  {
2
2
  "name": "@dpdpguard/react-native",
3
- "version": "0.0.0",
4
- "description": "DPDP Guard React Native SDK - bridge over the native Android/iOS consent engines",
3
+ "version": "1.0.0",
4
+ "description": "DPDP Guard React Native SDK - typed HTTP client over the DPDP Guard /api/v1 surface, usable via plain fetch (no native module)",
5
5
  "main": "src/index",
6
+ "files": [
7
+ "src",
8
+ "!src/**/*.test.ts",
9
+ "!src/generated",
10
+ "scripts/codegen.mjs"
11
+ ],
6
12
  "scripts": {
7
13
  "codegen": "node scripts/codegen.mjs",
8
14
  "postinstall": "node scripts/codegen.mjs",
9
15
  "test": "jest",
10
16
  "typecheck": "tsc --noEmit"
11
17
  },
12
- "codegenConfig": {
13
- "name": "ReactNativeSpec",
14
- "type": "modules",
15
- "jsSrcsDir": "src",
16
- "android": {
17
- "javaPackageName": "com.dpdpguard.reactnative"
18
- }
18
+ "publishConfig": {
19
+ "access": "public",
20
+ "provenance": true
19
21
  },
20
- "author": " <> ()",
22
+ "author": "DPDP Guard",
21
23
  "license": "MIT",
22
- "homepage": "#readme",
24
+ "homepage": "https://github.com/dpdp-guard-ai/dpdpguard-react-native-sdk#readme",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "https://github.com/dpdp-guard-ai/dpdpguard-react-native-sdk"
28
+ },
23
29
  "devDependencies": {
24
- "@react-native/babel-preset": "0.85.0",
25
30
  "@types/jest": "^29.5.14",
26
31
  "@types/node": "^22.20.1",
27
- "@types/react": "^19.2.0",
28
32
  "jest": "^29.7.0",
29
- "react": "19.2.3",
30
- "react-native": "0.85.0",
31
33
  "ts-jest": "^29.4.11",
32
34
  "typescript": "~5.8"
33
35
  },
34
- "create-react-native-library": {
35
- "type": "turbo-module",
36
- "languages": "kotlin-objc",
37
- "tools": [
38
- "eslint",
39
- "jest",
40
- "lefthook",
41
- "release-it",
42
- "vite"
43
- ],
44
- "version": "0.63.0"
45
- },
46
36
  "dependencies": {
47
- "@dpdpguard/contract": "^0.2.0"
37
+ "@dpdpguard/contract": "^1.0.1"
48
38
  }
49
39
  }
package/src/client.ts CHANGED
@@ -149,6 +149,33 @@ export class DpdpGuardClient {
149
149
  });
150
150
  }
151
151
 
152
+ /**
153
+ * Records consent for a not-yet-authenticated guest (ADR-004 D6), e.g.
154
+ * from a consent banner shown before login. Unauthenticated, rate-limited
155
+ * public write, keyed by a client-generated `anonymousId`.
156
+ */
157
+ giveConsentAnonymous(
158
+ input: {
159
+ organizationId: string;
160
+ noticeId: string;
161
+ purpose: string;
162
+ dataTypes: string[];
163
+ anonymousId: string;
164
+ },
165
+ idempotencyKey?: string,
166
+ ): Promise<{
167
+ consentId: string;
168
+ purpose: string;
169
+ dataTypes: string[];
170
+ givenAt: number;
171
+ }> {
172
+ const options: RequestOptions = { body: input, auth: "none" };
173
+ if (idempotencyKey !== undefined) {
174
+ options.headers = { "Idempotency-Key": idempotencyKey };
175
+ }
176
+ return this.request("POST", "/api/v1/consents/anonymous", options);
177
+ }
178
+
152
179
  // --- DSR (spec §4.2) ---
153
180
 
154
181
  listDsrRequests(): Promise<{ requests: DsrRequest[] }> {
@@ -1,5 +1,3 @@
1
- export { multiply } from './multiply';
2
-
3
1
  export { DpdpGuardClient } from './client';
4
2
  export type { DpdpGuardClientOptions } from './client';
5
3
  export { DpdpGuardApiError, ERROR_CATALOG } from './errorCatalog';
@@ -1,15 +0,0 @@
1
- name: CI
2
- on: [push, pull_request]
3
- jobs:
4
- build:
5
- runs-on: ubuntu-latest
6
- steps:
7
- - uses: actions/checkout@v4
8
- - uses: actions/setup-node@v4
9
- with: { node-version: 20 }
10
- # npm install runs codegen via postinstall (scripts/codegen.mjs), which
11
- # regenerates src/generated/api-types.ts from the installed
12
- # @dpdpguard/contract's openapi/v1.yaml.
13
- - run: npm install
14
- - run: npm run typecheck
15
- - run: npm test
@@ -1,20 +0,0 @@
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 = "ReactNative"
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
-
13
- s.platforms = { :ios => min_ios_version_supported }
14
- s.source = { :git => ".git", :tag => "#{s.version}" }
15
-
16
- s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
17
- s.private_header_files = "ios/**/*.h"
18
-
19
- install_modules_dependencies(s)
20
- end
@@ -1,51 +0,0 @@
1
- buildscript {
2
- ext.ReactNative = [
3
- kotlinVersion: "2.0.21",
4
- minSdkVersion: 24,
5
- compileSdkVersion: 36
6
- ]
7
-
8
- ext.getExtOrDefault = { prop ->
9
- if (rootProject.ext.has(prop)) {
10
- return rootProject.ext.get(prop)
11
- }
12
-
13
- return ReactNative[prop]
14
- }
15
-
16
- repositories {
17
- google()
18
- mavenCentral()
19
- }
20
-
21
- dependencies {
22
- classpath "com.android.tools.build:gradle:8.7.2"
23
- // noinspection DifferentKotlinGradleVersion
24
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
25
- }
26
- }
27
-
28
-
29
- apply plugin: "com.android.library"
30
- apply plugin: "kotlin-android"
31
-
32
- apply plugin: "com.facebook.react"
33
-
34
- android {
35
- namespace "com.dpdpguard.reactnative"
36
-
37
- compileSdkVersion getExtOrDefault("compileSdkVersion")
38
-
39
- defaultConfig {
40
- minSdkVersion getExtOrDefault("minSdkVersion")
41
- }
42
-
43
- compileOptions {
44
- sourceCompatibility JavaVersion.VERSION_17
45
- targetCompatibility JavaVersion.VERSION_17
46
- }
47
- }
48
-
49
- dependencies {
50
- implementation "com.facebook.react:react-android"
51
- }
@@ -1,2 +0,0 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
- </manifest>
@@ -1,15 +0,0 @@
1
- package com.dpdpguard.reactnative
2
-
3
- import com.facebook.react.bridge.ReactApplicationContext
4
-
5
- class ReactNativeModule(reactContext: ReactApplicationContext) :
6
- NativeReactNativeSpec(reactContext) {
7
-
8
- override fun multiply(a: Double, b: Double): Double {
9
- return a * b
10
- }
11
-
12
- companion object {
13
- const val NAME = NativeReactNativeSpec.NAME
14
- }
15
- }
@@ -1,31 +0,0 @@
1
- package com.dpdpguard.reactnative
2
-
3
- import com.facebook.react.BaseReactPackage
4
- import com.facebook.react.bridge.NativeModule
5
- import com.facebook.react.bridge.ReactApplicationContext
6
- import com.facebook.react.module.model.ReactModuleInfo
7
- import com.facebook.react.module.model.ReactModuleInfoProvider
8
- import java.util.HashMap
9
-
10
- class ReactNativePackage : BaseReactPackage() {
11
- override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
12
- return if (name == ReactNativeModule.NAME) {
13
- ReactNativeModule(reactContext)
14
- } else {
15
- null
16
- }
17
- }
18
-
19
- override fun getReactModuleInfoProvider() = ReactModuleInfoProvider {
20
- mapOf(
21
- ReactNativeModule.NAME to ReactModuleInfo(
22
- name = ReactNativeModule.NAME,
23
- className = ReactNativeModule.NAME,
24
- canOverrideExistingModule = false,
25
- needsEagerInit = false,
26
- isCxxModule = false,
27
- isTurboModule = true
28
- )
29
- )
30
- }
31
- }
@@ -1,2 +0,0 @@
1
- BUNDLE_PATH: "vendor/bundle"
2
- BUNDLE_FORCE_RUBY_PLATFORM: 1
@@ -1 +0,0 @@
1
- {}
package/example/Gemfile DELETED
@@ -1,17 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4
- ruby ">= 2.6.10"
5
-
6
- # Exclude problematic versions of cocoapods and activesupport that causes build failures.
7
- gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
8
- gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
9
- gem 'xcodeproj', '< 1.26.0'
10
- gem 'concurrent-ruby', '< 1.3.4'
11
-
12
- # Ruby 3.4.0 has removed some libraries from the standard library.
13
- gem 'bigdecimal'
14
- gem 'logger'
15
- gem 'benchmark'
16
- gem 'mutex_m'
17
- gem 'nkf'
package/example/README.md DELETED
@@ -1,97 +0,0 @@
1
- This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli).
2
-
3
- # Getting Started
4
-
5
- > **Note**: Make sure you have completed the [Set Up Your Environment](https://reactnative.dev/docs/set-up-your-environment) guide before proceeding.
6
-
7
- ## Step 1: Start Metro
8
-
9
- First, you will need to run **Metro**, the JavaScript build tool for React Native.
10
-
11
- To start the Metro dev server, run the following command from the root of your React Native project:
12
-
13
- ```sh
14
- # Using npm
15
- npm start
16
-
17
- # OR using Yarn
18
- yarn start
19
- ```
20
-
21
- ## Step 2: Build and run your app
22
-
23
- With Metro running, open a new terminal window/pane from the root of your React Native project, and use one of the following commands to build and run your Android or iOS app:
24
-
25
- ### Android
26
-
27
- ```sh
28
- # Using npm
29
- npm run android
30
-
31
- # OR using Yarn
32
- yarn android
33
- ```
34
-
35
- ### iOS
36
-
37
- For iOS, remember to install CocoaPods dependencies (this only needs to be run on first clone or after updating native deps).
38
-
39
- The first time you create a new project, run the Ruby bundler to install CocoaPods itself:
40
-
41
- ```sh
42
- bundle install
43
- ```
44
-
45
- Then, and every time you update your native dependencies, run:
46
-
47
- ```sh
48
- bundle exec pod install
49
- ```
50
-
51
- For more information, please visit [CocoaPods Getting Started guide](https://guides.cocoapods.org/using/getting-started.html).
52
-
53
- ```sh
54
- # Using npm
55
- npm run ios
56
-
57
- # OR using Yarn
58
- yarn ios
59
- ```
60
-
61
- If everything is set up correctly, you should see your new app running in the Android Emulator, iOS Simulator, or your connected device.
62
-
63
- This is one way to run your app — you can also build it directly from Android Studio or Xcode.
64
-
65
- ## Step 3: Modify your app
66
-
67
- Now that you have successfully run the app, let's make changes!
68
-
69
- Open `App.tsx` in your text editor of choice and make some changes. When you save, your app will automatically update and reflect these changes — this is powered by [Fast Refresh](https://reactnative.dev/docs/fast-refresh).
70
-
71
- When you want to forcefully reload, for example to reset the state of your app, you can perform a full reload:
72
-
73
- - **Android**: Press the <kbd>R</kbd> key twice or select **"Reload"** from the **Dev Menu**, accessed via <kbd>Ctrl</kbd> + <kbd>M</kbd> (Windows/Linux) or <kbd>Cmd ⌘</kbd> + <kbd>M</kbd> (macOS).
74
- - **iOS**: Press <kbd>R</kbd> in iOS Simulator.
75
-
76
- ## Congratulations! :tada:
77
-
78
- You've successfully run and modified your React Native App. :partying_face:
79
-
80
- ### Now what?
81
-
82
- - If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps).
83
- - If you're curious to learn more about React Native, check out the [docs](https://reactnative.dev/docs/getting-started).
84
-
85
- # Troubleshooting
86
-
87
- If you're having issues getting the above steps to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page.
88
-
89
- # Learn More
90
-
91
- To learn more about React Native, take a look at the following resources:
92
-
93
- - [React Native Website](https://reactnative.dev) - learn more about React Native.
94
- - [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment.
95
- - [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**.
96
- - [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts.
97
- - [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native.
@@ -1,119 +0,0 @@
1
- apply plugin: "com.android.application"
2
- apply plugin: "org.jetbrains.kotlin.android"
3
- apply plugin: "com.facebook.react"
4
-
5
- /**
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.
8
- */
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. Default is "debug", "debugOptimized".
23
- // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
24
- // debuggableVariants = ["liteDebug", "liteDebugOptimized", "prodDebug", "prodDebugOptimized"]
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
- }
56
-
57
- /**
58
- * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
59
- */
60
- def enableProguardInReleaseBuilds = false
61
-
62
- /**
63
- * The preferred build flavor of JavaScriptCore (JSC)
64
- *
65
- * For example, to use the international variant, you can use:
66
- * `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+`
67
- *
68
- * The international variant includes ICU i18n library and necessary data
69
- * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
70
- * give correct results when using with locales other than en-US. Note that
71
- * this variant is about 6MiB larger per architecture than default.
72
- */
73
- def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
74
-
75
- android {
76
- ndkVersion rootProject.ext.ndkVersion
77
- buildToolsVersion rootProject.ext.buildToolsVersion
78
- compileSdk rootProject.ext.compileSdkVersion
79
-
80
- namespace "dpdpguard.reactnative.example"
81
- defaultConfig {
82
- applicationId "dpdpguard.reactnative.example"
83
- minSdkVersion rootProject.ext.minSdkVersion
84
- targetSdkVersion rootProject.ext.targetSdkVersion
85
- versionCode 1
86
- versionName "1.0"
87
- }
88
- signingConfigs {
89
- debug {
90
- storeFile file('debug.keystore')
91
- storePassword 'android'
92
- keyAlias 'androiddebugkey'
93
- keyPassword 'android'
94
- }
95
- }
96
- buildTypes {
97
- debug {
98
- signingConfig signingConfigs.debug
99
- }
100
- release {
101
- // Caution! In production, you need to generate your own keystore file.
102
- // see https://reactnative.dev/docs/signed-apk-android.
103
- signingConfig signingConfigs.debug
104
- minifyEnabled enableProguardInReleaseBuilds
105
- proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
106
- }
107
- }
108
- }
109
-
110
- dependencies {
111
- // The version of react-native is set by the React Native Gradle Plugin
112
- implementation("com.facebook.react:react-android")
113
-
114
- if (hermesEnabled.toBoolean()) {
115
- implementation("com.facebook.react:hermes-android")
116
- } else {
117
- implementation jscFlavor
118
- }
119
- }
Binary file
@@ -1,10 +0,0 @@
1
- # Add project specific ProGuard rules here.
2
- # By default, the flags in this file are appended to flags specified
3
- # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4
- # You can edit the include path and order by changing the proguardFiles
5
- # directive in build.gradle.
6
- #
7
- # For more details, see
8
- # http://developer.android.com/guide/developing/tools/proguard.html
9
-
10
- # Add any project specific keep options here:
@@ -1,27 +0,0 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
-
3
- <uses-permission android:name="android.permission.INTERNET" />
4
-
5
- <application
6
- android:name=".MainApplication"
7
- android:label="@string/app_name"
8
- android:icon="@mipmap/ic_launcher"
9
- android:roundIcon="@mipmap/ic_launcher_round"
10
- android:allowBackup="false"
11
- android:theme="@style/AppTheme"
12
- android:usesCleartextTraffic="${usesCleartextTraffic}"
13
- android:supportsRtl="true">
14
- <activity
15
- android:name=".MainActivity"
16
- android:label="@string/app_name"
17
- android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
18
- android:launchMode="singleTask"
19
- android:windowSoftInputMode="adjustResize"
20
- android:exported="true">
21
- <intent-filter>
22
- <action android:name="android.intent.action.MAIN" />
23
- <category android:name="android.intent.category.LAUNCHER" />
24
- </intent-filter>
25
- </activity>
26
- </application>
27
- </manifest>
@@ -1,22 +0,0 @@
1
- package dpdpguard.reactnative.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 = "ReactNativeExample"
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
- }
@@ -1,27 +0,0 @@
1
- package dpdpguard.reactnative.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.ReactNativeApplicationEntryPoint.loadReactNative
8
- import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
9
-
10
- class MainApplication : Application(), ReactApplication {
11
-
12
- override val reactHost: ReactHost by lazy {
13
- getDefaultReactHost(
14
- context = applicationContext,
15
- packageList =
16
- PackageList(this).packages.apply {
17
- // Packages that cannot be autolinked yet can be added manually here, for example:
18
- // add(MyReactNativePackage())
19
- },
20
- )
21
- }
22
-
23
- override fun onCreate() {
24
- super.onCreate()
25
- loadReactNative(this)
26
- }
27
- }