Skip to content

Wrapper parity 0.1.1: link buffering, camelCase errors, version - #23

Merged
ahsanalidotme merged 2 commits into
mainfrom
feat/parity-0.1.1
Oct 28, 2026
Merged

ahsanalidotme merged 2 commits into
mainfrom
feat/parity-0.1.1

Conversation

@ahsanalidotme

Copy link
Copy Markdown
Contributor

Implements the wrapper parity 0.1.1 contract (linktrail-io/workspace contracts/wrapper-parity-0.1.1.md).

Includes #12. This branch merges chore/sdk-hardening-114 (Jest suite + Android requestTrackingAuthorization → true), so #12 can be closed in favour of this PR, or merged first (this PR then shrinks to its own changes).

Changes

  • Links/attribution before a listener exists. Native onLink is registered only when the first JS onLink listener subscribes (new startLinkDelivery() in the spec, iOS + Android), so the native SDK keeps a saved deferred link (persisted across launches) until JS actually receives it. Re-engagement links resolved by autoHandleLinks before then are buffered in JS (max 10, oldest dropped) and delivered once, in order, to the first listener. onAttribution keeps the last value and replays it to the first listener. Later listeners get no replays.
  • Error codes: camelCase codes from native (missingApiKey, notConfigured, notALinkTrailUrl, …). Promises reject with a LinkTrailError (native message unchanged, statusCode/body for server, legacyCode = old snake_case). onError carries the same fields. The JS layer also normalises snake_case input. CHANGELOG Changed has the mapping table.
  • LinkTrail.version (package version, test keeps it equal to package.json) and LinkTrail.nativeSdkVersion (native LinkTrail.version / LinkTrail.VERSION).
  • Pins: already per contract (podspec ~> 0.1.0, Android io.linktrail:sdk:0.1.0; RN has no SPM manifest). No change.
  • Not done: iOS setSDKIdentifier (needs iOS 0.1.1).
  • Version 0.1.1, CHANGELOG, README (buffering + errors table), example updated for the new code.

Validation (local)

  • npm run lint (0 errors, 3 existing deep-import warnings), npm run typecheck, npm run prepare, codegen script
  • npx jest: 48 tests (22 new in __tests__/parity.test.ts)
  • Example: tsc, Android assembleDebug, iOS simulator build (Xcode 27 locally needed IPHONEOS_DEPLOYMENT_TARGET=15.1 for an existing AsyncStorage pod target; CI uses macos-15)
  • Native-side unit tests: not added. The module classes need a running RN host (TurboModule base classes, emitters), and the repo has no native test harness; native behaviour is covered by the example builds.

Closes #22

…olve true

Android has no App Tracking Transparency, so the platform never restricts
tracking. Resolve true (matching Flutter) and document it. Adds tests for the
JS/TS layer with a mocked native module and an npm test script.
…ersion

Merges #12 (Jest suite, Android requestTrackingAuthorization -> true).
- Register native onLink only when the first JS listener subscribes; buffer
  re-engagement links (max 10) and replay the last attribution to the first listener.
- camelCase error codes with native message, statusCode/body, legacyCode.
- LinkTrail.version and LinkTrail.nativeSdkVersion.
- Bump to 0.1.1.
@ahsanalidotme

Copy link
Copy Markdown
Contributor Author

Impact

  • DB changes: none (client SDK wrapper).
  • Live code changes: only takes effect when apps upgrade to linktrail-react-native@0.1.1; nothing already published changes. Backend untouched.
  • Breaking for integrators: error code values change from snake_case to camelCase (legacyCode keeps the old value for one release). Apps comparing error.code === 'invalid_api_key' must update (TypeScript now flags it). Android requestTrackingAuthorization() now resolves true.
  • Behaviour: native onLink is now registered only when JS subscribes, so apps that never call onLink keep the deferred link saved natively instead of having it claimed and dropped by the bridge.
  • Critical prod impact: none. Ships only through a new npm version.

@ahsanalidotme
ahsanalidotme marked this pull request as ready for review October 27, 2026 17:37
@ahsanalidotme
ahsanalidotme merged commit ff518bc into main Oct 28, 2026
7 checks passed
@ahsanalidotme
ahsanalidotme deleted the feat/parity-0.1.1 branch October 28, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrapper parity 0.1.1

1 participant