@dashx/react-native 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -7
- package/android/.gitignore +10 -0
- package/android/build/.transforms/9dceace6c3787533d2dbb1a387e9284c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/DashXReactNativeFirebaseMessagingService.dex +0 -0
- package/android/build/.transforms/9dceace6c3787533d2dbb1a387e9284c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/DashXReactNativeModule.dex +0 -0
- package/android/build/.transforms/9dceace6c3787533d2dbb1a387e9284c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/MessageReceivedEventHolder.dex +0 -0
- package/android/build/.transforms/9dceace6c3787533d2dbb1a387e9284c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/ReactNativeLibraryInfoProvider.dex +0 -0
- package/android/build/.transforms/9dceace6c3787533d2dbb1a387e9284c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/util/Utils$WhenMappings.dex +0 -0
- package/android/build/.transforms/9dceace6c3787533d2dbb1a387e9284c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/util/Utils.dex +0 -0
- package/android/build/.transforms/9dceace6c3787533d2dbb1a387e9284c/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
- package/android/build/.transforms/f3c6049e7ab4bb564c79f3a246b8575e/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +16 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
- package/android/build/intermediates/java_res/debug/processDebugJavaRes/out/META-INF/services/com.dashx.android.DashXLibraryInfoProvider +1 -0
- package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +31 -5
- package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +16 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/dashx/rn/sdk/DashXReactNativeFirebaseMessagingService.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/dashx/rn/sdk/DashXReactNativeModule.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/dashx/rn/sdk/MessageReceivedEventHolder.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/dashx/rn/sdk/ReactNativeLibraryInfoProvider.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/dashx/rn/sdk/util/Utils$WhenMappings.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/dashx/rn/sdk/util/Utils.class +0 -0
- package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +1 -1
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +25 -3
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/dashx/rn/sdk/DashXReactNativeFirebaseMessagingService.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/dashx/rn/sdk/DashXReactNativeModule.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/dashx/rn/sdk/MessageReceivedEventHolder.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/dashx/rn/sdk/ReactNativeLibraryInfoProvider.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/dashx/rn/sdk/util/Utils$WhenMappings.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/dashx/rn/sdk/util/Utils.class +0 -0
- package/android/build.gradle +6 -4
- package/android/src/main/AndroidManifest.xml +15 -3
- package/android/src/main/java/com/dashx/rn/sdk/DashXReactNativeFirebaseMessagingService.kt +72 -0
- package/android/src/main/java/com/dashx/rn/sdk/DashXReactNativeModule.kt +97 -19
- package/android/src/main/java/com/dashx/rn/sdk/MessageReceivedEventHolder.kt +14 -0
- package/android/src/main/java/com/dashx/rn/sdk/ReactNativeLibraryInfoProvider.kt +8 -0
- package/android/src/main/java/com/dashx/rn/sdk/util/Utils.kt +14 -0
- package/android/src/main/resources/META-INF/services/com.dashx.android.DashXLibraryInfoProvider +1 -0
- package/index.d.ts +129 -0
- package/index.js +124 -63
- package/ios/DashXEventEmitter.swift +3 -2
- package/ios/DashXRCTAppDelegate.swift +38 -0
- package/ios/DashXReactNative.mm +4 -0
- package/ios/DashXReactNative.swift +15 -3
- package/package.json +7 -12
- package/yarn.lock +1555 -2562
- package/ContentOptionsBuilder.js +0 -62
- package/android/build/.transforms/103e3bf16f310520880af8bd348f4f94/results.bin +0 -1
- package/android/build/.transforms/103e3bf16f310520880af8bd348f4f94/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/.transforms/1a91a107d670af17a51b8ccf1674f99e/results.bin +0 -1
- package/android/build/.transforms/1a91a107d670af17a51b8ccf1674f99e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/BuildConfig.dex +0 -0
- package/android/build/.transforms/1a91a107d670af17a51b8ccf1674f99e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/DashXPackage.dex +0 -0
- package/android/build/.transforms/1a91a107d670af17a51b8ccf1674f99e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/DashXReactNativeModule.dex +0 -0
- package/android/build/.transforms/1a91a107d670af17a51b8ccf1674f99e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/util/ArrayUtil$1.dex +0 -0
- package/android/build/.transforms/1a91a107d670af17a51b8ccf1674f99e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/util/ArrayUtil.dex +0 -0
- package/android/build/.transforms/1a91a107d670af17a51b8ccf1674f99e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/util/MapUtil$1.dex +0 -0
- package/android/build/.transforms/1a91a107d670af17a51b8ccf1674f99e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/util/MapUtil.dex +0 -0
- package/android/build/.transforms/1a91a107d670af17a51b8ccf1674f99e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/util/Utils$WhenMappings.dex +0 -0
- package/android/build/.transforms/1a91a107d670af17a51b8ccf1674f99e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/util/Utils.dex +0 -0
- package/android/build/.transforms/1a91a107d670af17a51b8ccf1674f99e/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
- package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +0 -2
- package/utils/RestAPIClient.js +0 -154
- package/utils.js +0 -21
package/README.md
CHANGED
|
@@ -161,16 +161,25 @@ import DashX from '@dashx/react-native';
|
|
|
161
161
|
|
|
162
162
|
### Configure
|
|
163
163
|
|
|
164
|
-
Initialize the SDK
|
|
164
|
+
Initialize the SDK once at app startup. Call `configure` at the top level of your entry file (e.g. `App.js`) so it runs before any component mounts:
|
|
165
165
|
|
|
166
166
|
```js
|
|
167
|
+
// App.js — call at module level, before the component
|
|
168
|
+
import DashX from '@dashx/react-native';
|
|
169
|
+
|
|
167
170
|
DashX.configure({
|
|
168
171
|
publicKey: 'your-public-key',
|
|
169
172
|
// baseURI: 'https://api.dashx.com', // optional, custom API endpoint
|
|
170
173
|
// targetEnvironment: 'production', // optional
|
|
171
174
|
});
|
|
175
|
+
|
|
176
|
+
export default function App() {
|
|
177
|
+
// ...
|
|
178
|
+
}
|
|
172
179
|
```
|
|
173
180
|
|
|
181
|
+
Calling from `useEffect` in your root component also works, but module-level init is preferred so the SDK is ready as early as possible.
|
|
182
|
+
|
|
174
183
|
| Option | Type | Required | Description |
|
|
175
184
|
|--------|------|----------|-------------|
|
|
176
185
|
| `publicKey` | `string` | Yes | Your DashX public key |
|
|
@@ -218,6 +227,51 @@ DashX.screen('HomeScreen', {
|
|
|
218
227
|
});
|
|
219
228
|
```
|
|
220
229
|
|
|
230
|
+
### Fetch a record
|
|
231
|
+
|
|
232
|
+
Fetch a single record by URN (e.g. `"article/123"`) with optional options (matches [dashx-android](https://github.com/dashxhq/dashx-android) `fetchRecord`). **Android only**; on iOS the promise rejects until the native SDK supports it.
|
|
233
|
+
|
|
234
|
+
```js
|
|
235
|
+
const record = await DashX.fetchRecord('article/123', {
|
|
236
|
+
preview: false,
|
|
237
|
+
language: 'en',
|
|
238
|
+
// fields, include, exclude as arrays of objects if needed
|
|
239
|
+
});
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
| Option | Type | Description |
|
|
243
|
+
|--------|------|-------------|
|
|
244
|
+
| `preview` | `boolean` | Include draft/preview content |
|
|
245
|
+
| `language` | `string` | Content language |
|
|
246
|
+
| `fields` | `object[]` | Fields to return |
|
|
247
|
+
| `include` | `object[]` | Related data to include |
|
|
248
|
+
| `exclude` | `object[]` | Fields to exclude |
|
|
249
|
+
|
|
250
|
+
### Search records
|
|
251
|
+
|
|
252
|
+
Search records by resource with optional filter, order, limit, and other options (matches [dashx-android](https://github.com/dashxhq/dashx-android) `searchRecords`). **Android only**; on iOS the promise rejects until the native SDK supports it.
|
|
253
|
+
|
|
254
|
+
```js
|
|
255
|
+
const records = await DashX.searchRecords('article', {
|
|
256
|
+
filter: { status: 'published' },
|
|
257
|
+
order: [{ field: 'createdAt', direction: 'desc' }],
|
|
258
|
+
limit: 10,
|
|
259
|
+
preview: false,
|
|
260
|
+
language: 'en',
|
|
261
|
+
});
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
| Option | Type | Description |
|
|
265
|
+
|--------|------|-------------|
|
|
266
|
+
| `filter` | `object` | Filter criteria |
|
|
267
|
+
| `order` | `object[]` | Sort order (e.g. `[{ field, direction }]`) |
|
|
268
|
+
| `limit` | `number` | Max records to return |
|
|
269
|
+
| `preview` | `boolean` | Preview/draft content |
|
|
270
|
+
| `language` | `string` | Content language |
|
|
271
|
+
| `fields` | `object[]` | Fields to return |
|
|
272
|
+
| `include` | `object[]` | Related data to include |
|
|
273
|
+
| `exclude` | `object[]` | Fields to exclude |
|
|
274
|
+
|
|
221
275
|
### Push notifications
|
|
222
276
|
|
|
223
277
|
Subscribe the current device to push notifications:
|
|
@@ -232,6 +286,22 @@ Unsubscribe:
|
|
|
232
286
|
DashX.unsubscribe();
|
|
233
287
|
```
|
|
234
288
|
|
|
289
|
+
### Listen for incoming messages
|
|
290
|
+
|
|
291
|
+
Register a listener to handle push notifications when they arrive:
|
|
292
|
+
|
|
293
|
+
```js
|
|
294
|
+
import { useEffect } from 'react';
|
|
295
|
+
|
|
296
|
+
useEffect(() => {
|
|
297
|
+
const subscription = DashX.onMessageReceived((message) => {
|
|
298
|
+
console.log('Notification received:', message);
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
return () => subscription.remove();
|
|
302
|
+
}, []);
|
|
303
|
+
```
|
|
304
|
+
|
|
235
305
|
### Notification preferences
|
|
236
306
|
|
|
237
307
|
Fetch the user's stored notification preferences:
|
|
@@ -264,16 +334,15 @@ Below is a full example of integrating DashX in a React Native Android app:
|
|
|
264
334
|
|
|
265
335
|
```js
|
|
266
336
|
// App.js
|
|
267
|
-
import React
|
|
337
|
+
import React from 'react';
|
|
268
338
|
import { View, Text, Button, StyleSheet } from 'react-native';
|
|
269
339
|
import DashX from '@dashx/react-native';
|
|
270
340
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
DashX.subscribe();
|
|
275
|
-
}, []);
|
|
341
|
+
// Initialize once at app load
|
|
342
|
+
DashX.configure({ publicKey: 'your-public-key' });
|
|
343
|
+
DashX.subscribe();
|
|
276
344
|
|
|
345
|
+
export default function App() {
|
|
277
346
|
const handleLogin = () => {
|
|
278
347
|
DashX.setIdentity('user-123', 'auth-token');
|
|
279
348
|
DashX.identify({
|
|
@@ -318,11 +387,14 @@ const styles = StyleSheet.create({
|
|
|
318
387
|
| `reset` | `()` | `void` | Clear the current user identity |
|
|
319
388
|
| `track` | `(event: string, data?: object)` | `void` | Track a named event with optional data |
|
|
320
389
|
| `screen` | `(screenName: string, data?: object)` | `void` | Track a screen view with optional data |
|
|
390
|
+
| `fetchRecord` | `(urn: string, options?: object)` | `Promise<object>` | Fetch a single record by URN (e.g. `"article/123"`). Options: preview, language, fields, include, exclude. Android only; iOS rejects until implemented. |
|
|
391
|
+
| `searchRecords` | `(resource: string, options?: object)` | `Promise<object[]>` | Search records (filter, order, limit, preview, language, fields, include, exclude). Android only; iOS rejects until implemented. |
|
|
321
392
|
| `subscribe` | `()` | `void` | Subscribe device for push notifications |
|
|
322
393
|
| `unsubscribe` | `()` | `void` | Unsubscribe device from push notifications |
|
|
323
394
|
| `fetchStoredPreferences` | `()` | `Promise<object>` | Fetch stored notification preferences |
|
|
324
395
|
| `saveStoredPreferences` | `(data: object)` | `Promise<object>` | Save notification preferences |
|
|
325
396
|
| `setLogLevel` | `(level: number)` | `void` | Set SDK log verbosity |
|
|
397
|
+
| `onMessageReceived` | `(callback: function)` | `EmitterSubscription` | Listen for incoming push notifications |
|
|
326
398
|
|
|
327
399
|
For detailed usage and advanced features, refer to the [DashX documentation](https://docs.dashx.com/developer).
|
|
328
400
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
2
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
xmlns:tools="http://schemas.android.com/tools"
|
|
3
4
|
package="com.dashx.rn.sdk" >
|
|
4
5
|
|
|
5
6
|
<uses-sdk android:minSdkVersion="26" />
|
|
6
7
|
|
|
8
|
+
<application>
|
|
9
|
+
|
|
10
|
+
<!-- Replace dashx-android's FCM service with our subclass that also emits to JS. -->
|
|
11
|
+
<service
|
|
12
|
+
android:name="com.dashx.android.DashXFirebaseMessagingService"
|
|
13
|
+
tools:node="remove" />
|
|
14
|
+
<service
|
|
15
|
+
android:name="com.dashx.rn.sdk.DashXReactNativeFirebaseMessagingService"
|
|
16
|
+
android:exported="false" >
|
|
17
|
+
<intent-filter>
|
|
18
|
+
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
|
19
|
+
</intent-filter>
|
|
20
|
+
</service>
|
|
21
|
+
</application>
|
|
22
|
+
|
|
7
23
|
</manifest>
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
#
|
|
1
|
+
#Tue Mar 17 06:39:15 IST 2026
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
com.dashx.rn.sdk.ReactNativeLibraryInfoProvider
|
|
@@ -1,7 +1,33 @@
|
|
|
1
1
|
1<?xml version="1.0" encoding="utf-8"?>
|
|
2
2
|
2<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
-
3
|
|
4
|
-
4
|
|
5
|
-
5
|
|
6
|
-
6
|
|
7
|
-
7
|
|
3
|
+
3 xmlns:tools="http://schemas.android.com/tools"
|
|
4
|
+
4 package="com.dashx.rn.sdk" >
|
|
5
|
+
5
|
|
6
|
+
6 <uses-sdk android:minSdkVersion="26" />
|
|
7
|
+
7
|
|
8
|
+
8 <application>
|
|
9
|
+
8-->/Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:3:5-15:19
|
|
10
|
+
9
|
|
11
|
+
10 <!-- Replace dashx-android's FCM service with our subclass that also emits to JS. -->
|
|
12
|
+
11 <service
|
|
13
|
+
11-->/Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:5:9-7:35
|
|
14
|
+
12 android:name="com.dashx.android.DashXFirebaseMessagingService"
|
|
15
|
+
12-->/Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:6:13-75
|
|
16
|
+
13 tools:node="remove" />
|
|
17
|
+
13-->/Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:7:13-32
|
|
18
|
+
14 <service
|
|
19
|
+
14-->/Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:8:9-14:19
|
|
20
|
+
15 android:name="com.dashx.rn.sdk.DashXReactNativeFirebaseMessagingService"
|
|
21
|
+
15-->/Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:9:13-85
|
|
22
|
+
16 android:exported="false" >
|
|
23
|
+
16-->/Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:10:13-37
|
|
24
|
+
17 <intent-filter>
|
|
25
|
+
17-->/Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:11:13-13:29
|
|
26
|
+
18 <action android:name="com.google.firebase.MESSAGING_EVENT" />
|
|
27
|
+
18-->/Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:12:17-78
|
|
28
|
+
18-->/Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:12:25-75
|
|
29
|
+
19 </intent-filter>
|
|
30
|
+
20 </service>
|
|
31
|
+
21 </application>
|
|
32
|
+
22
|
|
33
|
+
23</manifest>
|
package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
2
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
xmlns:tools="http://schemas.android.com/tools"
|
|
3
4
|
package="com.dashx.rn.sdk" >
|
|
4
5
|
|
|
5
6
|
<uses-sdk android:minSdkVersion="26" />
|
|
6
7
|
|
|
8
|
+
<application>
|
|
9
|
+
|
|
10
|
+
<!-- Replace dashx-android's FCM service with our subclass that also emits to JS. -->
|
|
11
|
+
<service
|
|
12
|
+
android:name="com.dashx.android.DashXFirebaseMessagingService"
|
|
13
|
+
tools:node="remove" />
|
|
14
|
+
<service
|
|
15
|
+
android:name="com.dashx.rn.sdk.DashXReactNativeFirebaseMessagingService"
|
|
16
|
+
android:exported="false" >
|
|
17
|
+
<intent-filter>
|
|
18
|
+
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
|
19
|
+
</intent-filter>
|
|
20
|
+
</service>
|
|
21
|
+
</application>
|
|
22
|
+
|
|
7
23
|
</manifest>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len
CHANGED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i
CHANGED
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream
CHANGED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len
CHANGED
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len
CHANGED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i
CHANGED
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len
CHANGED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i
CHANGED
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
9
|
|
2
2
|
0
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len
CHANGED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len
CHANGED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i
CHANGED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream
CHANGED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len
CHANGED
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -1,11 +1,33 @@
|
|
|
1
1
|
-- Merging decision tree log ---
|
|
2
2
|
manifest
|
|
3
|
-
ADDED from /Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:
|
|
4
|
-
INJECTED from /Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:
|
|
3
|
+
ADDED from /Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:1:1-16:12
|
|
4
|
+
INJECTED from /Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:1:1-16:12
|
|
5
5
|
package
|
|
6
6
|
INJECTED from /Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml
|
|
7
|
+
xmlns:tools
|
|
8
|
+
ADDED from /Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:2:5-51
|
|
7
9
|
xmlns:android
|
|
8
|
-
ADDED from /Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:
|
|
10
|
+
ADDED from /Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:1:11-69
|
|
11
|
+
application
|
|
12
|
+
ADDED from /Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:3:5-15:19
|
|
13
|
+
service#com.dashx.android.DashXFirebaseMessagingService
|
|
14
|
+
ADDED from /Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:5:9-7:35
|
|
15
|
+
tools:node
|
|
16
|
+
ADDED from /Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:7:13-32
|
|
17
|
+
android:name
|
|
18
|
+
ADDED from /Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:6:13-75
|
|
19
|
+
service#com.dashx.rn.sdk.DashXReactNativeFirebaseMessagingService
|
|
20
|
+
ADDED from /Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:8:9-14:19
|
|
21
|
+
android:exported
|
|
22
|
+
ADDED from /Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:10:13-37
|
|
23
|
+
android:name
|
|
24
|
+
ADDED from /Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:9:13-85
|
|
25
|
+
intent-filter#action:name:com.google.firebase.MESSAGING_EVENT
|
|
26
|
+
ADDED from /Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:11:13-13:29
|
|
27
|
+
action#com.google.firebase.MESSAGING_EVENT
|
|
28
|
+
ADDED from /Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:12:17-78
|
|
29
|
+
android:name
|
|
30
|
+
ADDED from /Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml:12:25-75
|
|
9
31
|
uses-sdk
|
|
10
32
|
INJECTED from /Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml reason: use-sdk injection requested
|
|
11
33
|
INJECTED from /Users/gulshan/Work/dashx-demo-rn/node_modules/@dashx/react-native/android/src/main/AndroidManifest.xml
|
|
Binary file
|
|
Binary file
|
package/android/build/tmp/kotlin-classes/debug/com/dashx/rn/sdk/DashXReactNativeModule.class
CHANGED
|
Binary file
|
package/android/build/tmp/kotlin-classes/debug/com/dashx/rn/sdk/MessageReceivedEventHolder.class
ADDED
|
Binary file
|
package/android/build/tmp/kotlin-classes/debug/com/dashx/rn/sdk/ReactNativeLibraryInfoProvider.class
ADDED
|
Binary file
|
package/android/build/tmp/kotlin-classes/debug/com/dashx/rn/sdk/util/Utils$WhenMappings.class
CHANGED
|
Binary file
|
|
Binary file
|
package/android/build.gradle
CHANGED
|
@@ -48,10 +48,12 @@ repositories {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
dependencies {
|
|
51
|
-
|
|
52
|
-
implementation 'com.facebook.react:react-native:+'
|
|
51
|
+
compileOnly 'com.facebook.react:react-android:+'
|
|
53
52
|
implementation 'com.google.code.gson:gson:2.9.0'
|
|
54
|
-
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.
|
|
53
|
+
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0'
|
|
55
54
|
|
|
56
|
-
|
|
55
|
+
// Ensure Firebase Messaging types are available for FCM service subclass
|
|
56
|
+
implementation 'com.google.firebase:firebase-messaging-ktx:23.1.2'
|
|
57
|
+
|
|
58
|
+
implementation "com.dashx:dashx-android:1.1.4"
|
|
57
59
|
}
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
2
|
+
xmlns:tools="http://schemas.android.com/tools">
|
|
3
|
+
<application>
|
|
4
|
+
<!-- Replace dashx-android's FCM service with our subclass that also emits to JS. -->
|
|
5
|
+
<service
|
|
6
|
+
android:name="com.dashx.android.DashXFirebaseMessagingService"
|
|
7
|
+
tools:node="remove" />
|
|
8
|
+
<service
|
|
9
|
+
android:name="com.dashx.rn.sdk.DashXReactNativeFirebaseMessagingService"
|
|
10
|
+
android:exported="false">
|
|
11
|
+
<intent-filter>
|
|
12
|
+
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
|
13
|
+
</intent-filter>
|
|
14
|
+
</service>
|
|
15
|
+
</application>
|
|
4
16
|
</manifest>
|