@dashx/react-native 1.5.0 → 1.5.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.
- package/README.md +1 -1
- package/ios/DashXReactNative.mm +7 -7
- package/ios/DashXReactNative.swift +15 -11
- package/package.json +13 -11
- package/.claude/settings.local.json +0 -7
- package/.claude/worktrees/autocapture-conventions-review-78f665/.gitattributes +0 -1
- package/.claude/worktrees/autocapture-conventions-review-78f665/.github/workflows/ci.yml +0 -67
- package/.claude/worktrees/autocapture-conventions-review-78f665/.gitignore +0 -49
- package/.claude/worktrees/autocapture-conventions-review-78f665/.nvmrc +0 -1
- package/.claude/worktrees/autocapture-conventions-review-78f665/CHANGELOG.md +0 -144
- package/.claude/worktrees/autocapture-conventions-review-78f665/CONTRIBUTING.md +0 -190
- package/.claude/worktrees/autocapture-conventions-review-78f665/DashXReactNative.podspec +0 -38
- package/.claude/worktrees/autocapture-conventions-review-78f665/LICENSE +0 -21
- package/.claude/worktrees/autocapture-conventions-review-78f665/README.md +0 -97
- package/.claude/worktrees/autocapture-conventions-review-78f665/__tests__/fallback.test.js +0 -72
- package/.claude/worktrees/autocapture-conventions-review-78f665/__tests__/index.test.js +0 -702
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/.gitignore +0 -10
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/.gradle/8.14.3/checksums/checksums.lock +0 -0
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/.gradle/8.14.3/fileChanges/last-build.bin +0 -0
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/.gradle/8.14.3/fileHashes/fileHashes.lock +0 -0
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/.gradle/8.14.3/gc.properties +0 -0
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/.gradle/vcs-1/gc.properties +0 -0
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/build/reports/problems/problems-report.html +0 -663
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/build.gradle +0 -121
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/gradle/wrapper/gradle-wrapper.properties +0 -6
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/gradle.properties +0 -1
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/gradlew +0 -185
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/gradlew.bat +0 -89
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/settings.gradle +0 -27
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/src/main/AndroidManifest.xml +0 -19
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/src/main/java/com/dashx/rn/sdk/DashXNotificationClickedListener.kt +0 -113
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/src/main/java/com/dashx/rn/sdk/DashXReactNativeFirebaseMessagingService.kt +0 -72
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/src/main/java/com/dashx/rn/sdk/DashXReactNativeModuleImpl.kt +0 -445
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/src/main/java/com/dashx/rn/sdk/MessageReceivedEventHolder.kt +0 -14
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/src/main/java/com/dashx/rn/sdk/ReactNativeLibraryInfoProvider.kt +0 -8
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/src/main/java/com/dashx/rn/sdk/util/Utils.kt +0 -208
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/src/main/resources/META-INF/services/com.dashx.android.DashXLibraryInfoProvider +0 -1
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/src/newarch/java/com/dashx/rn/sdk/DashXReactNativeModule.kt +0 -85
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/src/newarch/java/com/dashx/rn/sdk/DashXReactNativePackage.kt +0 -33
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/src/oldarch/java/com/dashx/rn/sdk/DashXReactNativeModule.kt +0 -106
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/src/oldarch/java/com/dashx/rn/sdk/DashXReactNativePackage.kt +0 -33
- package/.claude/worktrees/autocapture-conventions-review-78f665/android/src/test/java/com/dashx/rn/sdk/util/UtilsTest.kt +0 -305
- package/.claude/worktrees/autocapture-conventions-review-78f665/babel.config.js +0 -3
- package/.claude/worktrees/autocapture-conventions-review-78f665/index.d.ts +0 -321
- package/.claude/worktrees/autocapture-conventions-review-78f665/index.js +0 -300
- package/.claude/worktrees/autocapture-conventions-review-78f665/ios/DashXEventEmitter.swift +0 -15
- package/.claude/worktrees/autocapture-conventions-review-78f665/ios/DashXNotificationHandler.swift +0 -301
- package/.claude/worktrees/autocapture-conventions-review-78f665/ios/DashXReactNative-Bridging-Header.h +0 -3
- package/.claude/worktrees/autocapture-conventions-review-78f665/ios/DashXReactNative.mm +0 -77
- package/.claude/worktrees/autocapture-conventions-review-78f665/ios/DashXReactNative.swift +0 -244
- package/.claude/worktrees/autocapture-conventions-review-78f665/ios/DashXReactNative.xcodeproj/project.pbxproj +0 -280
- package/.claude/worktrees/autocapture-conventions-review-78f665/ios/DashXReactNative.xcworkspace/contents.xcworkspacedata +0 -7
- package/.claude/worktrees/autocapture-conventions-review-78f665/ios/DashXReactNative.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/.claude/worktrees/autocapture-conventions-review-78f665/package.json +0 -123
- package/.claude/worktrees/autocapture-conventions-review-78f665/scripts/generate-bridge-shim.js +0 -259
- package/.claude/worktrees/autocapture-conventions-review-78f665/src/NativeDashXReactNative.ts +0 -42
- package/.claude/worktrees/autocapture-conventions-review-78f665/yarn.lock +0 -6244
- package/.gitattributes +0 -1
- package/.github/workflows/ci.yml +0 -67
- package/.gitignore +0 -49
- package/.nvmrc +0 -1
- package/CHANGELOG.md +0 -144
- package/CONTRIBUTING.md +0 -190
- package/__tests__/fallback.test.js +0 -72
- package/__tests__/index.test.js +0 -702
- package/android/.gitignore +0 -10
- package/android/.gradle/8.14.3/checksums/checksums.lock +0 -0
- package/android/.gradle/8.14.3/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.14.3/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.14.3/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/build/reports/problems/problems-report.html +0 -663
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -6
- package/android/gradlew +0 -185
- package/android/gradlew.bat +0 -89
- package/android/src/test/java/com/dashx/rn/sdk/util/UtilsTest.kt +0 -305
- package/babel.config.js +0 -3
- package/scripts/generate-bridge-shim.js +0 -259
- package/yarn.lock +0 -6244
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/* eslint-disable no-console */
|
|
3
|
-
//
|
|
4
|
-
// generate-bridge-shim.js — regenerate `ios/DashXReactNative.mm` from the
|
|
5
|
-
// Swift bridge's @objc declarations.
|
|
6
|
-
//
|
|
7
|
-
// Why this exists:
|
|
8
|
-
//
|
|
9
|
-
// React Native's iOS bridge needs each Swift method to be declared TWICE for
|
|
10
|
-
// dual-arch support — once in Swift (`@objc(selector:parts:) func name(...)`)
|
|
11
|
-
// and once in ObjC++ (`RCT_EXTERN_METHOD(selector:(Type)arg ...)` in the .mm).
|
|
12
|
-
// The two declarations must agree on selector and arg types — when they
|
|
13
|
-
// don't, the new-arch TurboModule runtime can't find the method and JS calls
|
|
14
|
-
// fail with "Objective-C method signature ... can not be found." We learned
|
|
15
|
-
// that the hard way when we widened `unsubscribe` to a Promise method,
|
|
16
|
-
// updated the Swift side, and forgot the .mm.
|
|
17
|
-
//
|
|
18
|
-
// This script makes the Swift file the single source of truth and emits the
|
|
19
|
-
// matching .mm. Run via `yarn sync-bridge-shim` after editing the Swift
|
|
20
|
-
// bridge; CI verifies the .mm is up to date by re-running the script and
|
|
21
|
-
// failing on a non-empty `git diff`.
|
|
22
|
-
//
|
|
23
|
-
// Conventions assumed about the Swift bridge file:
|
|
24
|
-
// 1. Each bridged method is preceded by `@objc` (zero-arg) or
|
|
25
|
-
// `@objc(selector:parts:)` (multi-arg) on its own line.
|
|
26
|
-
// 2. The `@objc` line is immediately followed by `func name(...)`. Blank
|
|
27
|
-
// lines between are tolerated.
|
|
28
|
-
// 3. Multi-arg methods always use the explicit `@objc(...)` form so the
|
|
29
|
-
// selector parts are unambiguous (no auto-derivation).
|
|
30
|
-
// 4. Zero-arg methods use bare `@objc`. The selector is just the method
|
|
31
|
-
// name.
|
|
32
|
-
// 5. The class itself is decorated with `@objc(DashXReactNative)` — this
|
|
33
|
-
// script ignores any `@objc` decoration that's NOT followed by `func`.
|
|
34
|
-
//
|
|
35
|
-
// If the Swift file uses a parameter type the SWIFT_TO_OBJC table doesn't
|
|
36
|
-
// know, the script errors loudly with the offending type name. Adding new
|
|
37
|
-
// types is a one-line entry in the table — preferred to a silent fallback.
|
|
38
|
-
|
|
39
|
-
const fs = require('fs')
|
|
40
|
-
const path = require('path')
|
|
41
|
-
|
|
42
|
-
const REPO_ROOT = path.resolve(__dirname, '..')
|
|
43
|
-
const SWIFT_PATH = path.join(REPO_ROOT, 'ios', 'DashXReactNative.swift')
|
|
44
|
-
const MM_PATH = path.join(REPO_ROOT, 'ios', 'DashXReactNative.mm')
|
|
45
|
-
|
|
46
|
-
// Swift parameter type → ObjC declaration. The values are written verbatim
|
|
47
|
-
// into the .mm so they include pointers and `_Nullable` annotations where
|
|
48
|
-
// applicable. Add new entries when the bridge starts using a new type.
|
|
49
|
-
const SWIFT_TO_OBJC = {
|
|
50
|
-
'String': 'NSString *',
|
|
51
|
-
'String?': 'NSString * _Nullable',
|
|
52
|
-
'NSString': 'NSString *',
|
|
53
|
-
'NSString?': 'NSString * _Nullable',
|
|
54
|
-
'NSDictionary': 'NSDictionary *',
|
|
55
|
-
'NSDictionary?': 'NSDictionary * _Nullable',
|
|
56
|
-
'Bool': 'BOOL',
|
|
57
|
-
'Double': 'double',
|
|
58
|
-
'@escaping RCTPromiseResolveBlock': 'RCTPromiseResolveBlock',
|
|
59
|
-
'@escaping RCTPromiseRejectBlock': 'RCTPromiseRejectBlock',
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const HEADER = `//
|
|
63
|
-
// AUTO-GENERATED FROM DashXReactNative.swift — DO NOT EDIT.
|
|
64
|
-
// Regenerate with \`yarn sync-bridge-shim\` after editing the Swift file.
|
|
65
|
-
//
|
|
66
|
-
// The Swift class's @objc method declarations are the source of truth.
|
|
67
|
-
// This file mirrors them so old-arch React Native consumers (which discover
|
|
68
|
-
// methods via RCT_EXTERN_METHOD) and new-arch consumers (which dispatch via
|
|
69
|
-
// the codegen-generated TurboModule spec) both find consistent signatures.
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
#import <React/RCTBridgeModule.h>
|
|
73
|
-
#import <React/RCTEventEmitter.h>
|
|
74
|
-
|
|
75
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
76
|
-
#import "RNDashXReactNativeSpec.h"
|
|
77
|
-
#endif
|
|
78
|
-
|
|
79
|
-
@interface RCT_EXTERN_MODULE(DashXReactNative, RCTEventEmitter)
|
|
80
|
-
|
|
81
|
-
`
|
|
82
|
-
|
|
83
|
-
const FOOTER = `
|
|
84
|
-
@end
|
|
85
|
-
|
|
86
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
87
|
-
@interface DashXReactNative () <NativeDashXReactNativeSpec>
|
|
88
|
-
@end
|
|
89
|
-
|
|
90
|
-
@implementation DashXReactNative (TurboModule)
|
|
91
|
-
|
|
92
|
-
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
93
|
-
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
94
|
-
{
|
|
95
|
-
return std::make_shared<facebook::react::NativeDashXReactNativeSpecJSI>(params);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
@end
|
|
99
|
-
#endif
|
|
100
|
-
`
|
|
101
|
-
|
|
102
|
-
function fail(message) {
|
|
103
|
-
console.error(`generate-bridge-shim: ${message}`)
|
|
104
|
-
process.exit(1)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function translateType(swiftType) {
|
|
108
|
-
const trimmed = swiftType.trim()
|
|
109
|
-
if (!(trimmed in SWIFT_TO_OBJC)) {
|
|
110
|
-
fail(
|
|
111
|
-
`unknown Swift parameter type "${trimmed}". Add a mapping to ` +
|
|
112
|
-
`SWIFT_TO_OBJC in scripts/generate-bridge-shim.js if this is a ` +
|
|
113
|
-
`legitimate new type the bridge needs.`
|
|
114
|
-
)
|
|
115
|
-
}
|
|
116
|
-
return SWIFT_TO_OBJC[trimmed]
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Parse a Swift parameter list like "_ urn: String, options: NSDictionary?,
|
|
120
|
-
// resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock"
|
|
121
|
-
// into an array of { argName, type } pairs in declaration order. The Swift
|
|
122
|
-
// argument LABEL ("_" or the external label) is irrelevant for emitting the
|
|
123
|
-
// .mm — the selector parts already encode the labels.
|
|
124
|
-
function parseSwiftParams(paramsRaw) {
|
|
125
|
-
if (paramsRaw.trim() === '') return []
|
|
126
|
-
|
|
127
|
-
// Split on commas that are NOT inside angle brackets / parens. The bridge
|
|
128
|
-
// doesn't currently use generics, so a plain split is enough.
|
|
129
|
-
const parts = paramsRaw.split(',').map((p) => p.trim()).filter(Boolean)
|
|
130
|
-
|
|
131
|
-
return parts.map((part) => {
|
|
132
|
-
// Forms:
|
|
133
|
-
// "_ name: Type"
|
|
134
|
-
// "label name: Type"
|
|
135
|
-
// "name: Type" (label = name)
|
|
136
|
-
const m = part.match(/^(?:(\S+)\s+)?(\w+)\s*:\s*(.+)$/)
|
|
137
|
-
if (!m) {
|
|
138
|
-
fail(`could not parse parameter "${part}" in DashXReactNative.swift`)
|
|
139
|
-
}
|
|
140
|
-
const argName = m[2]
|
|
141
|
-
const type = m[3]
|
|
142
|
-
return { argName, type }
|
|
143
|
-
})
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// Read the Swift bridge and walk it for @objc-decorated funcs. Returns an
|
|
147
|
-
// array of { name, selectorOverride, params } in source order. Decorations
|
|
148
|
-
// without a following `func` (e.g. the class-level @objc(DashXReactNative))
|
|
149
|
-
// are skipped.
|
|
150
|
-
function extractMethods(source) {
|
|
151
|
-
const lines = source.split('\n')
|
|
152
|
-
const methods = []
|
|
153
|
-
|
|
154
|
-
for (let i = 0; i < lines.length; i++) {
|
|
155
|
-
const trimmed = lines[i].trim()
|
|
156
|
-
const objc = trimmed.match(/^@objc(?:\(([^)]+)\))?\s*$/)
|
|
157
|
-
if (!objc) continue
|
|
158
|
-
const selectorOverride = objc[1] || null
|
|
159
|
-
|
|
160
|
-
// Find the next non-blank line. If it's not a `func`, this @objc isn't
|
|
161
|
-
// for us (could be a class declaration, a property, etc.).
|
|
162
|
-
let j = i + 1
|
|
163
|
-
while (j < lines.length && lines[j].trim() === '') j++
|
|
164
|
-
if (j >= lines.length) continue
|
|
165
|
-
|
|
166
|
-
let sig = lines[j]
|
|
167
|
-
if (!/^\s*func\s/.test(sig)) continue
|
|
168
|
-
|
|
169
|
-
// Multi-line param lists: keep accumulating until parens balance.
|
|
170
|
-
let openParens = (sig.match(/\(/g) || []).length
|
|
171
|
-
let closeParens = (sig.match(/\)/g) || []).length
|
|
172
|
-
while (openParens > closeParens && j + 1 < lines.length) {
|
|
173
|
-
j++
|
|
174
|
-
sig += ' ' + lines[j].trim()
|
|
175
|
-
openParens += (lines[j].match(/\(/g) || []).length
|
|
176
|
-
closeParens += (lines[j].match(/\)/g) || []).length
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
const m = sig.match(/func\s+(\w+)\s*\(([^)]*)\)/)
|
|
180
|
-
if (!m) {
|
|
181
|
-
fail(
|
|
182
|
-
`could not parse @objc'd function signature near line ${j + 1}: ` +
|
|
183
|
-
`"${sig.trim()}"`
|
|
184
|
-
)
|
|
185
|
-
}
|
|
186
|
-
const [, name, paramsRaw] = m
|
|
187
|
-
|
|
188
|
-
methods.push({
|
|
189
|
-
name,
|
|
190
|
-
selectorOverride,
|
|
191
|
-
params: parseSwiftParams(paramsRaw),
|
|
192
|
-
})
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
return methods
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// Build the RCT_EXTERN_METHOD line for one method. Selector parts come from
|
|
199
|
-
// the @objc(selector:parts:) override (or the bare method name for zero-arg
|
|
200
|
-
// methods). Types come from the parsed Swift params.
|
|
201
|
-
function emitDeclaration(method) {
|
|
202
|
-
const { name, selectorOverride, params } = method
|
|
203
|
-
|
|
204
|
-
if (params.length === 0) {
|
|
205
|
-
// Zero-arg method — RCT_EXTERN_METHOD(name) with no parens.
|
|
206
|
-
return `RCT_EXTERN_METHOD(${name})`
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
if (!selectorOverride) {
|
|
210
|
-
fail(
|
|
211
|
-
`multi-arg method "${name}" must use explicit @objc(selector:parts:) ` +
|
|
212
|
-
`form so its selector is unambiguous.`
|
|
213
|
-
)
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// Selector parts: "fetchRecord:options:resolve:reject:" → ["fetchRecord",
|
|
217
|
-
// "options", "resolve", "reject"]. The first part is the method name.
|
|
218
|
-
// Expect (params.length) parts total — if the count differs, the @objc
|
|
219
|
-
// override and the func signature have drifted.
|
|
220
|
-
const labels = selectorOverride.split(':').filter(Boolean)
|
|
221
|
-
if (labels.length !== params.length) {
|
|
222
|
-
fail(
|
|
223
|
-
`method "${name}" has ${labels.length} selector parts but ` +
|
|
224
|
-
`${params.length} parameters — these must match. Update the ` +
|
|
225
|
-
`@objc(...) override or the func signature in DashXReactNative.swift.`
|
|
226
|
-
)
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// Interleave: "label1:(Type1)argName1 label2:(Type2)argName2 ..."
|
|
230
|
-
// The first label is the method name; subsequent labels precede their
|
|
231
|
-
// typed arg.
|
|
232
|
-
const pieces = labels.map((label, idx) => {
|
|
233
|
-
const { argName, type } = params[idx]
|
|
234
|
-
const objcType = translateType(type)
|
|
235
|
-
return `${label}:(${objcType})${argName}`
|
|
236
|
-
})
|
|
237
|
-
|
|
238
|
-
return `RCT_EXTERN_METHOD(${pieces.join(' ')})`
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
function main() {
|
|
242
|
-
const source = fs.readFileSync(SWIFT_PATH, 'utf8')
|
|
243
|
-
const methods = extractMethods(source)
|
|
244
|
-
|
|
245
|
-
if (methods.length === 0) {
|
|
246
|
-
fail(`no @objc-decorated methods found in ${SWIFT_PATH}`)
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
const declarations = methods.map((m) => emitDeclaration(m) + ';').join('\n\n')
|
|
250
|
-
const out = HEADER + declarations + '\n' + FOOTER
|
|
251
|
-
|
|
252
|
-
fs.writeFileSync(MM_PATH, out)
|
|
253
|
-
console.log(
|
|
254
|
-
`generate-bridge-shim: wrote ${methods.length} RCT_EXTERN_METHOD ` +
|
|
255
|
-
`declarations to ios/DashXReactNative.mm`
|
|
256
|
-
)
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
main()
|