@dynamic-labs-sdk/client 1.7.0 → 1.8.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 (119) hide show
  1. package/android/build.gradle +231 -0
  2. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  3. package/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  4. package/android/gradle.properties +8 -0
  5. package/android/gradlew +251 -0
  6. package/android/gradlew.bat +94 -0
  7. package/android/settings.gradle +30 -0
  8. package/android/src/main/java/xyz/dynamic/client/DynamicClientPackage.kt +52 -0
  9. package/android/src/main/java/xyz/dynamic/client/keychain/KeyStoreKeyManager.kt +147 -0
  10. package/android/src/main/java/xyz/dynamic/client/keychain/KeychainModule.kt +85 -0
  11. package/android/src/main/java/xyz/dynamic/client/manifest/ReactNativeManifestModule.kt +25 -0
  12. package/android/src/main/java/xyz/dynamic/client/webview/DynamicWebViewClient.kt +83 -0
  13. package/android/src/main/java/xyz/dynamic/client/webview/DynamicWebViewHost.kt +518 -0
  14. package/android/src/main/java/xyz/dynamic/client/webview/DynamicWebViewModule.kt +147 -0
  15. package/android/src/test/java/xyz/dynamic/client/keychain/KeyStoreKeyManagerTest.kt +288 -0
  16. package/android/src/test/java/xyz/dynamic/client/webview/DynamicWebViewClientTest.kt +196 -0
  17. package/android/src/test/java/xyz/dynamic/client/webview/DynamicWebViewHostOpenTest.kt +347 -0
  18. package/android/src/test/java/xyz/dynamic/client/webview/DynamicWebViewHostTest.kt +171 -0
  19. package/android/src/test/java/xyz/dynamic/client/webview/DynamicWebViewModuleTest.kt +191 -0
  20. package/dist/{InvalidParamError-Crwntjl7.native.esm.js → InvalidParamError-BKnC9rcJ.esm.js} +441 -10
  21. package/dist/InvalidParamError-BKnC9rcJ.esm.js.map +1 -0
  22. package/dist/{InvalidParamError-fQLJaGBW.esm.js → InvalidParamError-Btv8VGSa.native.esm.js} +3 -3
  23. package/dist/InvalidParamError-Btv8VGSa.native.esm.js.map +1 -0
  24. package/dist/{InvalidParamError-CTssOe86.cjs → InvalidParamError-DGBih-LJ.cjs} +550 -4
  25. package/dist/InvalidParamError-DGBih-LJ.cjs.map +1 -0
  26. package/dist/{NotWaasWalletAccountError-DF_S7gqo.esm.js → NotWaasWalletAccountError-CHr72wTH.esm.js} +3 -3
  27. package/dist/{NotWaasWalletAccountError-DF_S7gqo.esm.js.map → NotWaasWalletAccountError-CHr72wTH.esm.js.map} +1 -1
  28. package/dist/{NotWaasWalletAccountError-BJLGGYmU.native.esm.js → NotWaasWalletAccountError-CRmyVoB3.native.esm.js} +3 -3
  29. package/dist/{NotWaasWalletAccountError-BJLGGYmU.native.esm.js.map → NotWaasWalletAccountError-CRmyVoB3.native.esm.js.map} +1 -1
  30. package/dist/{NotWaasWalletAccountError-2RaDipZu.cjs → NotWaasWalletAccountError-i1FozGep.cjs} +3 -3
  31. package/dist/{NotWaasWalletAccountError-2RaDipZu.cjs.map → NotWaasWalletAccountError-i1FozGep.cjs.map} +1 -1
  32. package/dist/core.cjs +23 -23
  33. package/dist/core.cjs.map +1 -1
  34. package/dist/core.esm.js +5 -5
  35. package/dist/core.native.esm.js +7 -7
  36. package/dist/core.native.esm.js.map +1 -1
  37. package/dist/errors/WebViewLoadFailedError.d.ts +1 -1
  38. package/dist/errors/WebViewLoadFailedError.d.ts.map +1 -1
  39. package/dist/exports/index.d.ts +2 -0
  40. package/dist/exports/index.d.ts.map +1 -1
  41. package/dist/{getNetworkProviderFromNetworkId-C1p9Rrg3.cjs → getNetworkProviderFromNetworkId-BdgI7g5U.cjs} +11 -317
  42. package/dist/getNetworkProviderFromNetworkId-BdgI7g5U.cjs.map +1 -0
  43. package/dist/{getNetworkProviderFromNetworkId-BCSmILlH.native.esm.js → getNetworkProviderFromNetworkId-Bm41knUq.native.esm.js} +6 -6
  44. package/dist/getNetworkProviderFromNetworkId-Bm41knUq.native.esm.js.map +1 -0
  45. package/dist/{getNetworkProviderFromNetworkId-BWhaD23J.esm.js → getNetworkProviderFromNetworkId-CRuh5pgc.esm.js} +4 -242
  46. package/dist/getNetworkProviderFromNetworkId-CRuh5pgc.esm.js.map +1 -0
  47. package/dist/{getSignedSessionId-CxxYNC_8.cjs → getSignedSessionId-Cwmt4BkY.cjs} +3 -3
  48. package/dist/{getSignedSessionId-CxxYNC_8.cjs.map → getSignedSessionId-Cwmt4BkY.cjs.map} +1 -1
  49. package/dist/{getSignedSessionId-c7dS4PQ9.esm.js → getSignedSessionId-D2w_IRdt.esm.js} +3 -3
  50. package/dist/{getSignedSessionId-c7dS4PQ9.esm.js.map → getSignedSessionId-D2w_IRdt.esm.js.map} +1 -1
  51. package/dist/{getSignedSessionId-DPOXdh6y.native.esm.js → getSignedSessionId-S6CBWkOn.native.esm.js} +3 -3
  52. package/dist/{getSignedSessionId-DPOXdh6y.native.esm.js.map → getSignedSessionId-S6CBWkOn.native.esm.js.map} +1 -1
  53. package/dist/getVerifiedCredentialForWalletAccount-CDuP1kaI.cjs +347 -0
  54. package/dist/getVerifiedCredentialForWalletAccount-CDuP1kaI.cjs.map +1 -0
  55. package/dist/{getVerifiedCredentialForWalletAccount-Cahp763h.esm.js → getVerifiedCredentialForWalletAccount-D33r7Drd.native.esm.js} +2 -2
  56. package/dist/{getVerifiedCredentialForWalletAccount-DuNbORNW.native.esm.js.map → getVerifiedCredentialForWalletAccount-D33r7Drd.native.esm.js.map} +1 -1
  57. package/dist/getVerifiedCredentialForWalletAccount-QwfkKHfr.esm.js +269 -0
  58. package/dist/getVerifiedCredentialForWalletAccount-QwfkKHfr.esm.js.map +1 -0
  59. package/dist/index.cjs +67 -67
  60. package/dist/index.cjs.map +1 -1
  61. package/dist/index.esm.js +5 -5
  62. package/dist/index.esm.js.map +1 -1
  63. package/dist/index.native.esm.js +5 -5
  64. package/dist/index.native.esm.js.map +1 -1
  65. package/dist/isMfaRequiredForAction-5p3i98-Z.esm.js +318 -0
  66. package/dist/isMfaRequiredForAction-5p3i98-Z.esm.js.map +1 -0
  67. package/dist/{isMfaRequiredForAction-D8G5PBAd.native.esm.js → isMfaRequiredForAction-cmElIVof.native.esm.js} +2 -2
  68. package/dist/{isMfaRequiredForAction-D8G5PBAd.native.esm.js.map → isMfaRequiredForAction-cmElIVof.native.esm.js.map} +1 -1
  69. package/dist/isMfaRequiredForAction-z74isCQ7.cjs +405 -0
  70. package/dist/isMfaRequiredForAction-z74isCQ7.cjs.map +1 -0
  71. package/dist/modules/waas/createWaasClient/createWaasClient.d.ts.map +1 -1
  72. package/dist/modules/waas/createWaasClient/translateNativeOpenError.d.ts.map +1 -1
  73. package/dist/modules/wallets/walletProvider/events/onWalletProviderEvent/onWalletProviderEvent.d.ts +1 -2
  74. package/dist/modules/wallets/walletProvider/events/onWalletProviderEvent/onWalletProviderEvent.d.ts.map +1 -1
  75. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  76. package/dist/waas.cjs +9 -9
  77. package/dist/waas.cjs.map +1 -1
  78. package/dist/waas.esm.js +3 -3
  79. package/dist/waas.native.esm.js +3 -3
  80. package/dist/waasCore.cjs +8 -5
  81. package/dist/waasCore.cjs.map +1 -1
  82. package/dist/waasCore.esm.js +8 -4
  83. package/dist/waasCore.esm.js.map +1 -1
  84. package/dist/waasCore.native.esm.js +9 -8
  85. package/dist/waasCore.native.esm.js.map +1 -1
  86. package/dynamic-labs-sdk-client.podspec +27 -0
  87. package/ios/DynamicClientKeychain.h +4 -0
  88. package/ios/DynamicClientKeychain.mm +101 -0
  89. package/ios/DynamicClientManifest.h +4 -0
  90. package/ios/DynamicClientManifest.mm +45 -0
  91. package/ios/DynamicClientWebView.h +5 -0
  92. package/ios/DynamicClientWebView.mm +143 -0
  93. package/ios/DynamicWebViewImpl.swift +603 -0
  94. package/ios/LiveSecKeyAPI.swift +86 -0
  95. package/ios/ReactNativeManifestImpl.swift +20 -0
  96. package/ios/SecKeyAPI.swift +57 -0
  97. package/ios/SecureEnclaveKeyManager.swift +191 -0
  98. package/package.json +14 -5
  99. package/react-native.config.cjs +14 -0
  100. package/src/turboModules/NativeDynamicWebView.native.spec.ts +61 -0
  101. package/src/turboModules/NativeDynamicWebView.ts +40 -0
  102. package/src/turboModules/NativeKeychain.native.spec.ts +47 -0
  103. package/src/turboModules/NativeKeychain.ts +19 -0
  104. package/src/turboModules/NativeReactNativeManifest.native.spec.ts +55 -0
  105. package/src/turboModules/NativeReactNativeManifest.ts +28 -0
  106. package/dist/InvalidParamError-CTssOe86.cjs.map +0 -1
  107. package/dist/InvalidParamError-Crwntjl7.native.esm.js.map +0 -1
  108. package/dist/InvalidParamError-fQLJaGBW.esm.js.map +0 -1
  109. package/dist/getNetworkProviderFromNetworkId-BCSmILlH.native.esm.js.map +0 -1
  110. package/dist/getNetworkProviderFromNetworkId-BWhaD23J.esm.js.map +0 -1
  111. package/dist/getNetworkProviderFromNetworkId-C1p9Rrg3.cjs.map +0 -1
  112. package/dist/getVerifiedCredentialForWalletAccount-Cahp763h.esm.js.map +0 -1
  113. package/dist/getVerifiedCredentialForWalletAccount-Di8dM5Wx.cjs +0 -887
  114. package/dist/getVerifiedCredentialForWalletAccount-Di8dM5Wx.cjs.map +0 -1
  115. package/dist/getVerifiedCredentialForWalletAccount-DuNbORNW.native.esm.js +0 -701
  116. package/dist/isMfaRequiredForAction-BjRvPrU6.esm.js +0 -79
  117. package/dist/isMfaRequiredForAction-BjRvPrU6.esm.js.map +0 -1
  118. package/dist/isMfaRequiredForAction-hlhj0qAC.cjs +0 -96
  119. package/dist/isMfaRequiredForAction-hlhj0qAC.cjs.map +0 -1
@@ -0,0 +1,231 @@
1
+ buildscript {
2
+ repositories {
3
+ google()
4
+ mavenCentral()
5
+ gradlePluginPortal()
6
+ }
7
+ dependencies {
8
+ classpath "com.android.tools.build:gradle:8.7.2"
9
+ // Standalone-only (see settings.gradle's marker). In a consuming app the
10
+ // Kotlin and React Native gradle plugins come from the app's root
11
+ // buildscript; adding them here could clash with the app's plugin versions.
12
+ // react-native-gradle-plugin is substituted by the includeBuild in
13
+ // settings.gradle.
14
+ if (gradle.ext.has('dynamicClientStandaloneBuild')) {
15
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.20"
16
+ classpath "com.facebook.react:react-native-gradle-plugin"
17
+ }
18
+ }
19
+ }
20
+
21
+ apply plugin: "com.android.library"
22
+ apply plugin: "com.facebook.react"
23
+ apply plugin: "org.jetbrains.kotlin.android"
24
+
25
+ import groovy.json.JsonSlurper
26
+
27
+ // True only when this module is built on its own for unit testing (the marker is
28
+ // set in settings.gradle, which a consuming app never evaluates). EVERYTHING
29
+ // guarded by this must stay off in an app's autolinked build, where this
30
+ // build.gradle is consumed as a subproject and the app owns React Native and
31
+ // codegen configuration. Keeping these test-only concerns out of that path is
32
+ // what makes the customer build identical to before this test setup was added.
33
+ def isStandaloneTestBuild = gradle.ext.has('dynamicClientStandaloneBuild')
34
+
35
+ def packageJson = new JsonSlurper().parseText(file("../package.json").text)
36
+ def sdkVersion = packageJson.version
37
+
38
+ def safeExtGet(prop, fallback) {
39
+ return rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
40
+ }
41
+
42
+ if (isStandaloneTestBuild) {
43
+ // Point TurboModule codegen at the monorepo-root node_modules. For a LIBRARY
44
+ // module the com.facebook.react plugin reads reactNativeDir/codegenDir from the
45
+ // root project's `privateReact` extension (the public `react {}` block only
46
+ // feeds these for app modules), and both default to `<project>/../node_modules`
47
+ // — i.e. packages/client/node_modules, which doesn't exist under pnpm. We
48
+ // repoint them at the hoisted repo-root node_modules. `root` correctly defaults
49
+ // to packages/client, so package.json's codegenConfig (name: DynamicClientSpec,
50
+ // jsSrcsDir: src/turboModules, javaPackageName: xyz.dynamic.client) is picked up
51
+ // automatically. This MUST be standalone-only: `privateReact` is the shared
52
+ // app-wide extension, so repointing it in an autolinked build would break
53
+ // codegen for the whole app and every other library.
54
+ def privateReactExtension = rootProject.extensions.getByName("privateReact")
55
+ privateReactExtension.reactNativeDir.set(file("../../../node_modules/react-native"))
56
+ privateReactExtension.codegenDir.set(file("../../../node_modules/@react-native/codegen"))
57
+ }
58
+
59
+ android {
60
+ namespace "xyz.dynamic.client"
61
+
62
+ compileSdkVersion safeExtGet("compileSdkVersion", 35)
63
+
64
+ defaultConfig {
65
+ minSdkVersion safeExtGet("minSdkVersion", 24)
66
+ targetSdkVersion safeExtGet("targetSdkVersion", 35)
67
+ buildConfigField "String", "DYNAMIC_SDK_VERSION", "\"${sdkVersion}\""
68
+ }
69
+
70
+ buildFeatures {
71
+ buildConfig true
72
+ }
73
+
74
+ buildTypes {
75
+ release {
76
+ minifyEnabled false
77
+ }
78
+ }
79
+
80
+ compileOptions {
81
+ sourceCompatibility JavaVersion.VERSION_17
82
+ targetCompatibility JavaVersion.VERSION_17
83
+ }
84
+
85
+ kotlinOptions {
86
+ jvmTarget = "17"
87
+ }
88
+
89
+ sourceSets {
90
+ main {
91
+ java.srcDirs += [
92
+ "generated/java",
93
+ "generated/jni"
94
+ ]
95
+ }
96
+ }
97
+
98
+ if (isStandaloneTestBuild) {
99
+ testOptions {
100
+ unitTests {
101
+ // Robolectric needs the merged Android resources/manifest.
102
+ includeAndroidResources = true
103
+ // FOOTGUN: returnDefaultValues makes un-shadowed android.jar stubs return
104
+ // 0/null/false instead of throwing "Method ... not mocked". It is only
105
+ // needed for the non-Robolectric tests (e.g. DynamicWebViewBridgeTest)
106
+ // that touch android types without Robolectric's shadows in place;
107
+ // Robolectric-run tests get real shadows and don't rely on it. The
108
+ // tradeoff is that a test which silently hits a real Android path won't
109
+ // fail loudly — so any new test that depends on actual framework
110
+ // behavior MUST run under @RunWith(RobolectricTestRunner) rather than
111
+ // leaning on these defaults.
112
+ returnDefaultValues = true
113
+ }
114
+ }
115
+ }
116
+ }
117
+
118
+ repositories {
119
+ mavenCentral()
120
+ google()
121
+ }
122
+
123
+ dependencies {
124
+ if (isStandaloneTestBuild) {
125
+ // Standalone build resolves the published react-android from Maven Central
126
+ // pinned to the exact React Native version installed in the monorepo. Read
127
+ // it from react-native's own package.json (the same repo-root node_modules
128
+ // the codegen repointing above targets) rather than hardcoding a literal, so
129
+ // it cannot drift from the RN version the app actually ships when RN is
130
+ // bumped.
131
+ def reactNativeVersion = new JsonSlurper()
132
+ .parseText(file("../../../node_modules/react-native/package.json").text)
133
+ .version
134
+ implementation "com.facebook.react:react-android:${reactNativeVersion}"
135
+ } else {
136
+ // App build: let the consuming app's React Native version decide.
137
+ implementation "com.facebook.react:react-android"
138
+ }
139
+
140
+ // androidx.webkit is a runtime dependency for BOTH app and standalone builds
141
+ // (unlike the test-only deps below). It exposes origin-scoped, main-frame-aware
142
+ // WebView APIs over the device's installed System WebView: WebMessageListener
143
+ // (a string-safe JS<->native channel that replaces addJavascriptInterface),
144
+ // document-start script injection, and the multi-profile store (per-instance
145
+ // ephemeral storage). Every call site is gated on
146
+ // WebViewFeature.isFeatureSupported(). Version mirrors react-native-webview's
147
+ // overridable `webkitVersion` property; the feature floor is ~1.10.0. Latest
148
+ // stable at time of writing is 1.16.0 — bumping past 1.12.x may require
149
+ // compileSdk >= 36.
150
+ implementation "androidx.webkit:webkit:${safeExtGet('webkitVersion', '1.12.1')}"
151
+ }
152
+
153
+ // ---------------------------------------------------------------------------
154
+ // Test-only setup. None of this is applied in a consuming app's autolinked
155
+ // build (guarded by isStandaloneTestBuild), so it cannot affect customers.
156
+ // ---------------------------------------------------------------------------
157
+ if (isStandaloneTestBuild) {
158
+ // JaCoCo line/branch coverage for the JVM unit tests. Report-only: it never
159
+ // fails the build, it just emits HTML + XML under build/reports/jacoco.
160
+ apply plugin: "jacoco"
161
+
162
+ // Robolectric normally downloads its instrumented `android-all` SDK jar at
163
+ // test time via its own HTTP client, which fails behind the corporate proxy
164
+ // (Gradle is configured with an SSL truststore that Robolectric's fetcher does
165
+ // not use). Instead we let Gradle resolve the exact jar Robolectric expects for
166
+ // the @Config(sdk = 35) the tests pin (matching compileSdk/targetSdk, which is
167
+ // the SDK Robolectric loads the app package against), copy it into a build dir,
168
+ // and run Robolectric in offline mode against it. The version string is tied to
169
+ // the Robolectric version below — bump both together.
170
+ def robolectricSdkVersion = "15-robolectric-12650502-i7"
171
+
172
+ configurations {
173
+ robolectricSdk
174
+ }
175
+
176
+ dependencies {
177
+ testImplementation "junit:junit:4.13.2"
178
+ // 4.14+ is required for Android API 35 (compileSdk) support.
179
+ testImplementation "org.robolectric:robolectric:4.14.1"
180
+ testImplementation "io.mockk:mockk:1.13.13"
181
+ // Real org.json implementation for the JSON-conversion util tests (the
182
+ // android.jar stub ships no-op org.json).
183
+ testImplementation "org.json:json:20240303"
184
+
185
+ robolectricSdk "org.robolectric:android-all-instrumented:${robolectricSdkVersion}"
186
+ }
187
+
188
+ def robolectricSdkDir = layout.buildDirectory.dir("robolectric-sdk")
189
+ def copyRobolectricSdk = tasks.register("copyRobolectricSdk", Copy) {
190
+ from configurations.robolectricSdk
191
+ into robolectricSdkDir
192
+ }
193
+
194
+ tasks.withType(Test).configureEach {
195
+ dependsOn(copyRobolectricSdk)
196
+ systemProperty "robolectric.offline", "true"
197
+ systemProperty "robolectric.dependency.dir", robolectricSdkDir.get().asFile.absolutePath
198
+
199
+ // Robolectric loads classes in its own sandbox classloader, which have no
200
+ // code "location"; without includeNoLocationClasses JaCoCo skips them and
201
+ // reports ~0% for every Robolectric-run test. The jdk.internal exclude
202
+ // avoids a JaCoCo instrumentation error on those classes.
203
+ jacoco {
204
+ includeNoLocationClasses = true
205
+ excludes = ["jdk.internal.*"]
206
+ }
207
+ }
208
+
209
+ tasks.register("jacocoTestReport", JacocoReport) {
210
+ dependsOn "testDebugUnitTest"
211
+ group = "verification"
212
+ description = "Generates a JaCoCo coverage report for the debug unit tests."
213
+
214
+ reports {
215
+ html.required.set(true)
216
+ xml.required.set(true)
217
+ }
218
+
219
+ def buildDirFile = layout.buildDirectory.get().asFile
220
+ // Exclude generated and framework classes that carry no testable logic:
221
+ // codegen TurboModule specs, BuildConfig, and resource R classes.
222
+ def coverageExclusions = ["**/Native*Spec*.*", "**/BuildConfig.*", "**/R.class", "**/R\$*.class"]
223
+ classDirectories.setFrom(
224
+ fileTree(dir: "${buildDirFile}/tmp/kotlin-classes/debug", excludes: coverageExclusions)
225
+ )
226
+ sourceDirectories.setFrom(files("${projectDir}/src/main/java"))
227
+ executionData.setFrom(
228
+ fileTree(dir: buildDirFile, includes: ["jacoco/testDebugUnitTest.exec"])
229
+ )
230
+ }
231
+ }
@@ -0,0 +1,7 @@
1
+ distributionBase=GRADLE_USER_HOME
2
+ distributionPath=wrapper/dists
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
4
+ networkTimeout=10000
5
+ validateDistributionUrl=true
6
+ zipStoreBase=GRADLE_USER_HOME
7
+ zipStorePath=wrapper/dists
@@ -0,0 +1,8 @@
1
+ # Standalone test-build properties. In a consuming app these come from the
2
+ # app's android/gradle.properties; here they are declared so the module can be
3
+ # built and unit-tested in isolation by `pnpm test:android`.
4
+
5
+ # react-android (and its androidx transitive deps) require AndroidX.
6
+ android.useAndroidX=true
7
+
8
+ org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
@@ -0,0 +1,251 @@
1
+ #!/bin/sh
2
+
3
+ #
4
+ # Copyright © 2015-2021 the original 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
+ # SPDX-License-Identifier: Apache-2.0
19
+ #
20
+
21
+ ##############################################################################
22
+ #
23
+ # Gradle start up script for POSIX generated by Gradle.
24
+ #
25
+ # Important for running:
26
+ #
27
+ # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
28
+ # noncompliant, but you have some other compliant shell such as ksh or
29
+ # bash, then to run this script, type that shell name before the whole
30
+ # command line, like:
31
+ #
32
+ # ksh Gradle
33
+ #
34
+ # Busybox and similar reduced shells will NOT work, because this script
35
+ # requires all of these POSIX shell features:
36
+ # * functions;
37
+ # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
38
+ # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
39
+ # * compound commands having a testable exit status, especially «case»;
40
+ # * various built-in commands including «command», «set», and «ulimit».
41
+ #
42
+ # Important for patching:
43
+ #
44
+ # (2) This script targets any POSIX shell, so it avoids extensions provided
45
+ # by Bash, Ksh, etc; in particular arrays are avoided.
46
+ #
47
+ # The "traditional" practice of packing multiple parameters into a
48
+ # space-separated string is a well documented source of bugs and security
49
+ # problems, so this is (mostly) avoided, by progressively accumulating
50
+ # options in "$@", and eventually passing that to Java.
51
+ #
52
+ # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
53
+ # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
54
+ # see the in-line comments for details.
55
+ #
56
+ # There are tweaks for specific operating systems such as AIX, CygWin,
57
+ # Darwin, MinGW, and NonStop.
58
+ #
59
+ # (3) This script is generated from the Groovy template
60
+ # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
61
+ # within the Gradle project.
62
+ #
63
+ # You can find Gradle at https://github.com/gradle/gradle/.
64
+ #
65
+ ##############################################################################
66
+
67
+ # Attempt to set APP_HOME
68
+
69
+ # Resolve links: $0 may be a link
70
+ app_path=$0
71
+
72
+ # Need this for daisy-chained symlinks.
73
+ while
74
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
75
+ [ -h "$app_path" ]
76
+ do
77
+ ls=$( ls -ld "$app_path" )
78
+ link=${ls#*' -> '}
79
+ case $link in #(
80
+ /*) app_path=$link ;; #(
81
+ *) app_path=$APP_HOME$link ;;
82
+ esac
83
+ done
84
+
85
+ # This is normally unused
86
+ # shellcheck disable=SC2034
87
+ APP_BASE_NAME=${0##*/}
88
+ # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89
+ APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
90
+
91
+ # Use the maximum available, or set MAX_FD != -1 to use that value.
92
+ MAX_FD=maximum
93
+
94
+ warn () {
95
+ echo "$*"
96
+ } >&2
97
+
98
+ die () {
99
+ echo
100
+ echo "$*"
101
+ echo
102
+ exit 1
103
+ } >&2
104
+
105
+ # OS specific support (must be 'true' or 'false').
106
+ cygwin=false
107
+ msys=false
108
+ darwin=false
109
+ nonstop=false
110
+ case "$( uname )" in #(
111
+ CYGWIN* ) cygwin=true ;; #(
112
+ Darwin* ) darwin=true ;; #(
113
+ MSYS* | MINGW* ) msys=true ;; #(
114
+ NONSTOP* ) nonstop=true ;;
115
+ esac
116
+
117
+ CLASSPATH="\\\"\\\""
118
+
119
+
120
+ # Determine the Java command to use to start the JVM.
121
+ if [ -n "$JAVA_HOME" ] ; then
122
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
123
+ # IBM's JDK on AIX uses strange locations for the executables
124
+ JAVACMD=$JAVA_HOME/jre/sh/java
125
+ else
126
+ JAVACMD=$JAVA_HOME/bin/java
127
+ fi
128
+ if [ ! -x "$JAVACMD" ] ; then
129
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
130
+
131
+ Please set the JAVA_HOME variable in your environment to match the
132
+ location of your Java installation."
133
+ fi
134
+ else
135
+ JAVACMD=java
136
+ if ! command -v java >/dev/null 2>&1
137
+ then
138
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
139
+
140
+ Please set the JAVA_HOME variable in your environment to match the
141
+ location of your Java installation."
142
+ fi
143
+ fi
144
+
145
+ # Increase the maximum file descriptors if we can.
146
+ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
147
+ case $MAX_FD in #(
148
+ max*)
149
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
150
+ # shellcheck disable=SC2039,SC3045
151
+ MAX_FD=$( ulimit -H -n ) ||
152
+ warn "Could not query maximum file descriptor limit"
153
+ esac
154
+ case $MAX_FD in #(
155
+ '' | soft) :;; #(
156
+ *)
157
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
158
+ # shellcheck disable=SC2039,SC3045
159
+ ulimit -n "$MAX_FD" ||
160
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
161
+ esac
162
+ fi
163
+
164
+ # Collect all arguments for the java command, stacking in reverse order:
165
+ # * args from the command line
166
+ # * the main class name
167
+ # * -classpath
168
+ # * -D...appname settings
169
+ # * --module-path (only if needed)
170
+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
171
+
172
+ # For Cygwin or MSYS, switch paths to Windows format before running java
173
+ if "$cygwin" || "$msys" ; then
174
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
175
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
176
+
177
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
178
+
179
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
180
+ for arg do
181
+ if
182
+ case $arg in #(
183
+ -*) false ;; # don't mess with options #(
184
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
185
+ [ -e "$t" ] ;; #(
186
+ *) false ;;
187
+ esac
188
+ then
189
+ arg=$( cygpath --path --ignore --mixed "$arg" )
190
+ fi
191
+ # Roll the args list around exactly as many times as the number of
192
+ # args, so each arg winds up back in the position where it started, but
193
+ # possibly modified.
194
+ #
195
+ # NB: a `for` loop captures its iteration list before it begins, so
196
+ # changing the positional parameters here affects neither the number of
197
+ # iterations, nor the values presented in `arg`.
198
+ shift # remove old arg
199
+ set -- "$@" "$arg" # push replacement arg
200
+ done
201
+ fi
202
+
203
+
204
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
205
+ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
206
+
207
+ # Collect all arguments for the java command:
208
+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
209
+ # and any embedded shellness will be escaped.
210
+ # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
211
+ # treated as '${Hostname}' itself on the command line.
212
+
213
+ set -- \
214
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
215
+ -classpath "$CLASSPATH" \
216
+ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
217
+ "$@"
218
+
219
+ # Stop when "xargs" is not available.
220
+ if ! command -v xargs >/dev/null 2>&1
221
+ then
222
+ die "xargs is not available"
223
+ fi
224
+
225
+ # Use "xargs" to parse quoted args.
226
+ #
227
+ # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
228
+ #
229
+ # In Bash we could simply go:
230
+ #
231
+ # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
232
+ # set -- "${ARGS[@]}" "$@"
233
+ #
234
+ # but POSIX shell has neither arrays nor command substitution, so instead we
235
+ # post-process each arg (as a line of input to sed) to backslash-escape any
236
+ # character that might be a shell metacharacter, then use eval to reverse
237
+ # that process (while maintaining the separation between arguments), and wrap
238
+ # the whole thing up as a single "set" statement.
239
+ #
240
+ # This will of course break if any of these variables contains a newline or
241
+ # an unmatched quote.
242
+ #
243
+
244
+ eval "set -- $(
245
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
246
+ xargs -n1 |
247
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
248
+ tr '\n' ' '
249
+ )" '"$@"'
250
+
251
+ exec "$JAVACMD" "$@"
@@ -0,0 +1,94 @@
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
+ @rem SPDX-License-Identifier: Apache-2.0
17
+ @rem
18
+
19
+ @if "%DEBUG%"=="" @echo off
20
+ @rem ##########################################################################
21
+ @rem
22
+ @rem Gradle startup script for Windows
23
+ @rem
24
+ @rem ##########################################################################
25
+
26
+ @rem Set local scope for the variables with windows NT shell
27
+ if "%OS%"=="Windows_NT" setlocal
28
+
29
+ set DIRNAME=%~dp0
30
+ if "%DIRNAME%"=="" set DIRNAME=.
31
+ @rem This is normally unused
32
+ set APP_BASE_NAME=%~n0
33
+ set APP_HOME=%DIRNAME%
34
+
35
+ @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36
+ for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37
+
38
+ @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39
+ set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40
+
41
+ @rem Find java.exe
42
+ if defined JAVA_HOME goto findJavaFromJavaHome
43
+
44
+ set JAVA_EXE=java.exe
45
+ %JAVA_EXE% -version >NUL 2>&1
46
+ if %ERRORLEVEL% equ 0 goto execute
47
+
48
+ echo. 1>&2
49
+ echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50
+ echo. 1>&2
51
+ echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52
+ echo location of your Java installation. 1>&2
53
+
54
+ goto fail
55
+
56
+ :findJavaFromJavaHome
57
+ set JAVA_HOME=%JAVA_HOME:"=%
58
+ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59
+
60
+ if exist "%JAVA_EXE%" goto execute
61
+
62
+ echo. 1>&2
63
+ echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64
+ echo. 1>&2
65
+ echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66
+ echo location of your Java installation. 1>&2
67
+
68
+ goto fail
69
+
70
+ :execute
71
+ @rem Setup the command line
72
+
73
+ set CLASSPATH=
74
+
75
+
76
+ @rem Execute Gradle
77
+ "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
78
+
79
+ :end
80
+ @rem End local scope for the variables with windows NT shell
81
+ if %ERRORLEVEL% equ 0 goto mainEnd
82
+
83
+ :fail
84
+ rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85
+ rem the _cmd.exe /c_ return code!
86
+ set EXIT_CODE=%ERRORLEVEL%
87
+ if %EXIT_CODE% equ 0 set EXIT_CODE=1
88
+ if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89
+ exit /b %EXIT_CODE%
90
+
91
+ :mainEnd
92
+ if "%OS%"=="Windows_NT" endlocal
93
+
94
+ :omega
@@ -0,0 +1,30 @@
1
+ // Standalone settings for the test-only Gradle build of this RN library
2
+ // module. Production consumers build it via React Native autolinking inside
3
+ // their app (e.g. apps/expo-demo/android); this file exists solely so the
4
+ // module can be compiled and unit-tested in isolation by `pnpm test:android`.
5
+ //
6
+ // We resolve @react-native/gradle-plugin out of the monorepo node_modules
7
+ // (the same `node --print require.resolve(...)` trick the Expo demo app uses
8
+ // in apps/expo-demo/android/settings.gradle) and includeBuild it as a
9
+ // composite build. A TOP-LEVEL includeBuild (not pluginManagement) is what
10
+ // lets `com.facebook.react:react-native-gradle-plugin` on the buildscript
11
+ // classpath in build.gradle be substituted by the local build, so the
12
+ // `com.facebook.react` plugin — which drives TurboModule codegen — resolves
13
+ // without being published anywhere.
14
+ def reactNativeGradlePlugin = new File(
15
+ providers.exec {
16
+ workingDir(rootDir)
17
+ commandLine("node", "--print", "require.resolve('@react-native/gradle-plugin/package.json', { paths: [require.resolve('react-native/package.json')] })")
18
+ }.standardOutput.asText.get().trim()
19
+ ).getParentFile().absolutePath
20
+
21
+ includeBuild(reactNativeGradlePlugin)
22
+
23
+ rootProject.name = 'dynamic-client-android'
24
+
25
+ // Marker read by build.gradle to gate the test-only configuration (codegen
26
+ // repointing, pinned react-android, test deps, JaCoCo). This settings file is
27
+ // only evaluated when the module is built standalone; a consuming app provides
28
+ // its own settings, so the flag stays unset there and the app build is
29
+ // unaffected.
30
+ gradle.ext.dynamicClientStandaloneBuild = true
@@ -0,0 +1,52 @@
1
+ package xyz.dynamic.client
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 xyz.dynamic.client.keychain.KeychainModule
9
+ import xyz.dynamic.client.manifest.ReactNativeManifestModule
10
+ import xyz.dynamic.client.webview.DynamicWebViewModule
11
+
12
+ class DynamicClientPackage : BaseReactPackage() {
13
+ override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
14
+ return when (name) {
15
+ KeychainModule.NAME -> KeychainModule(reactContext)
16
+ ReactNativeManifestModule.NAME -> ReactNativeManifestModule(reactContext)
17
+ DynamicWebViewModule.NAME -> DynamicWebViewModule(reactContext)
18
+ else -> null
19
+ }
20
+ }
21
+
22
+ override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
23
+ return ReactModuleInfoProvider {
24
+ mapOf(
25
+ KeychainModule.NAME to ReactModuleInfo(
26
+ KeychainModule.NAME,
27
+ KeychainModule.NAME,
28
+ false,
29
+ false,
30
+ false,
31
+ true
32
+ ),
33
+ ReactNativeManifestModule.NAME to ReactModuleInfo(
34
+ ReactNativeManifestModule.NAME,
35
+ ReactNativeManifestModule.NAME,
36
+ false,
37
+ false,
38
+ false,
39
+ true
40
+ ),
41
+ DynamicWebViewModule.NAME to ReactModuleInfo(
42
+ DynamicWebViewModule.NAME,
43
+ DynamicWebViewModule.NAME,
44
+ false,
45
+ false,
46
+ false,
47
+ true
48
+ )
49
+ )
50
+ }
51
+ }
52
+ }