Repository navigation
[INTER-2397] SPM Support #269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
1b6cc83
feat: migrate to strict react-native API
TheUnderScorer 7af274f
feat: add experimental SPM support
TheUnderScorer 7a6fbb6
feat(spm): update Fingerprint iOS SDK to new repository URL
TheUnderScorer 353c612
feat(spm): fix Fingerprint iOS SDK import and Swift language mode
TheUnderScorer 9438500
feat(ios): make RNFingerprintjsPro class public
TheUnderScorer 85bc10a
fix(ios): update import logic for Swift compatibility
TheUnderScorer 7ca5591
feat(spm): rename module to `RNFingerprintjsPro` for consistency
TheUnderScorer 1ee6900
docs(spm): add clarification for local path dependencies
TheUnderScorer 5447f8a
feat: add bare rn app to test spm support
TheUnderScorer 7646dc9
fix(ios): make RNFingerprintjsPro class non-public
TheUnderScorer 072a7de
chore: integrate react-native-dotenv
TheUnderScorer 1e61482
chore: fix linter
TheUnderScorer b61e973
chore: update linter comment in bare rn app
TheUnderScorer 4688c7d
fix(ios): simplify Fingerprint-iOS dependency definition
TheUnderScorer 7955c0a
fix(ios): simplify import logic in RNFingerprintjsPro
TheUnderScorer c69a78e
chore: remove bare rn app
TheUnderScorer ee5f04b
chore: loosen Fingerprint-ios constraint
TheUnderScorer 111ba96
docs: fix casing
TheUnderScorer 0fc355b
docs: improve wording
TheUnderScorer 5ead202
Merge branch 'feature/INTER-2190-v4-support' into feature/INTER-2397-…
TheUnderScorer ce3ac4f
Merge branch 'feature/INTER-2190-v4-support' into feature/INTER-2397-…
TheUnderScorer 5c2530a
Merge remote-tracking branch 'origin/feature/INTER-2190-v4-support' i…
TheUnderScorer ad69ce5
Merge branch 'feature/INTER-2190-v4-support' into feature/INTER-2397-…
TheUnderScorer af67e14
Merge branch 'feature/INTER-2190-v4-support' into feature/INTER-2397-…
TheUnderScorer e4884eb
Merge branch 'feature/INTER-2190-v4-support' into feature/INTER-2397-…
TheUnderScorer a6a9dbe
Merge branch 'feature/INTER-2190-v4-support' into feature/INTER-2397-…
TheUnderScorer 369c6b6
Merge branch 'feature/INTER-2190-v4-support' into feature/INTER-2397-…
TheUnderScorer 19b20ca
feat(sdk): add tvOS support and update iOS to 15.1
TheUnderScorer 971224d
fix(sdk): align tvOS version with iOS at 15.1
TheUnderScorer 56c8820
Merge branch 'feature/INTER-2190-v4-support' into feature/INTER-2397-…
TheUnderScorer 6f19b44
Merge branch 'feature/INTER-2190-v4-support' into feature/INTER-2397-…
TheUnderScorer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| --- | ||
| '@fingerprintjs/fingerprintjs-pro-react-native': minor | ||
| --- | ||
|
|
||
| Added experimental support for [Swift Package Manager](https://swift.org/package-manager/). The library now ships with its own `Package.swift`. | ||
|
|
||
| If you are on React Native >= 0.87, you can run: | ||
| ```bash | ||
| cd ios | ||
| # deintegrate will remove CocoaPods from your project | ||
| npx react-native spm --deintegrate | ||
| ``` | ||
| to consume the library via Swift Package Manager. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| // swift-tools-version: 6.0 | ||
| // | ||
| // Swift Package Manager manifest for | ||
| // @fingerprintjs/fingerprintjs-pro-react-native, consumed by React Native | ||
| // 0.87's experimental SwiftPM autolinking (`npx react-native spm`). | ||
| // | ||
| // ───────────────────────────────────────────────────────────────────────────── | ||
| // WHY THIS IS HAND-WRITTEN (not produced by `react-native spm scaffold`) | ||
| // ───────────────────────────────────────────────────────────────────────────── | ||
| // The scaffolder SKIPS this library ("skipped-mixed-language"): ios/ mixes Swift | ||
| // and Objective-C++, and a single SwiftPM target cannot contain both languages | ||
| // (SE-0403 would lift this but is not shipped). The ObjC++ file is unavoidable — | ||
| // RN 0.87 has no Swift path for the TurboModule `getTurboModule:` step, which | ||
| // must return the codegen'd C++ JSI spec. The supported workaround is the | ||
| // two-target split below: a pure-Swift target plus a thin ObjC++ glue target | ||
| // that depends on it. | ||
| // | ||
| // ───────────────────────────────────────────────────────────────────────────── | ||
| // ⚠️ NOT YET VALIDATED BY A REAL BUILD | ||
| // ───────────────────────────────────────────────────────────────────────────── | ||
| // RN's SwiftPM support is experimental ("do not use in production yet"). This | ||
| // manifest evaluates cleanly (`swift package dump-package`) but has NOT been | ||
| // exercised by an Xcode SwiftPM build in a consuming app. Confirm on a machine | ||
| // with Xcode + the e2e-app (via `npx react-native spm --deintegrate` then a | ||
| // detox build): | ||
| // 1. The Swift target resolves RCTPromise* via `import React` (RCT_SPM flag). | ||
| // 2. The Fingerprint v4 SwiftPM product/module identity below is correct. | ||
| // 3. The ObjC++ glue picks up RNFingerprintjsProSwift-Swift.h. | ||
| // | ||
| // The package/product name is pinned to `RNFingerprintjsPro` (matching the pod / | ||
| // native module) via `spm.name` in react-native.config.js. The autolinker uses | ||
| // that name for its libs/<name> symlink and the product it references, so the | ||
| // product below must match it. | ||
| // | ||
| // The React / React-GeneratedCode packages use RELATIVE paths that assume this | ||
| // manifest is reached through the autolinker's libs/RNFingerprintjsPro symlink — | ||
| // the same fixed depth `react-native spm scaffold` targets. They are resolved | ||
| // from the CONSUMING APP, not this repo; do not repoint them here. | ||
|
|
||
| import PackageDescription | ||
|
|
||
| let package = Package( | ||
| name: "RNFingerprintjsPro", | ||
| platforms: [.iOS("15.1"), .tvOS("15.1")], | ||
| products: [ | ||
| .library( | ||
| name: "RNFingerprintjsPro", | ||
| targets: ["RNFingerprintjsPro"] | ||
| ), | ||
| ], | ||
| dependencies: [ | ||
| // These two are parts of the CONSUMING APP, not registry packages, so | ||
| // they're referenced by local path. `ReactNative` is RN's prebuilt | ||
| // xcframeworks + header products; `React-GeneratedCode` is the app's | ||
| // per-app codegen output (the `ReactAppHeaders` product). The relative | ||
| // paths resolve from the autolinker's libs/RNFingerprintjsPro symlink | ||
| // (a fixed depth in <app>/ios/build/generated/autolinking/), NOT from | ||
| // this repo, so `../../../../xcframeworks` lands on <app>/ios/build/ | ||
| // xcframeworks and `../../../ios` on the generated codegen package. | ||
| // They look wrong relative to sdk/ but are correct in every app; do not | ||
| // repoint them. (This mirrors what `react-native spm scaffold` emits.) | ||
| .package(name: "ReactNative", path: "../../../../xcframeworks"), | ||
| .package(name: "React-GeneratedCode", path: "../../../ios"), | ||
| .package( | ||
| url: "https://github.com/fingerprintjs/fingerprint-ios", | ||
| from: "4.0.0" | ||
| ), | ||
| ], | ||
| targets: [ | ||
| // Pure-Swift implementation: all business logic + the Fingerprint SDK | ||
| // calls. Kept single-language so SwiftPM accepts the target. | ||
| .target( | ||
| name: "RNFingerprintjsProSwift", | ||
| dependencies: [ | ||
| .product(name: "ReactHeaders", package: "ReactNative"), | ||
| .product(name: "ReactNativeHeaders", package: "ReactNative"), | ||
| .product(name: "ReactNativeDependenciesHeaders", package: "ReactNative"), | ||
| .product(name: "Fingerprint", package: "fingerprint-ios"), | ||
| ], | ||
| path: "ios", | ||
| exclude: [ | ||
| "turbomodule", | ||
| "RNFingerprintjsPro-Bridging-Header.h", | ||
| "RNFingerprintjsPro.xcodeproj", | ||
| "build", | ||
| ], | ||
| sources: [ | ||
| "FPJSError+React.swift", | ||
| "JSONTypeConvertor.swift", | ||
| "RNFingerprintjsPro.swift", | ||
| ], | ||
| // swift-tools-version 6.0 defaults targets to Swift 6 language mode, | ||
| // whose strict concurrency rejects capturing the non-Sendable ObjC | ||
| // block typedefs RCTPromiseResolveBlock/RCTPromiseRejectBlock inside | ||
| // the Fingerprint SDK's @Sendable completion closure. CocoaPods builds | ||
| // this pod in Swift 5 mode; match that so behavior is identical. | ||
| swiftSettings: [.define("RCT_SPM"), .swiftLanguageMode(.v5)] | ||
| ), | ||
| // Objective-C++ TurboModule glue: registers the native module and returns | ||
| // the codegen'd C++ JSI spec (`NativeRNFingerprintjsProSpecJSI`). This | ||
| // cannot be Swift. Depends on the Swift target for its generated header. | ||
| .target( | ||
| name: "RNFingerprintjsPro", | ||
| dependencies: [ | ||
| "RNFingerprintjsProSwift", | ||
| .product(name: "ReactHeaders", package: "ReactNative"), | ||
| .product(name: "ReactNativeHeaders", package: "ReactNative"), | ||
| .product(name: "ReactNativeDependenciesHeaders", package: "ReactNative"), | ||
| .product(name: "ReactAppHeaders", package: "React-GeneratedCode"), | ||
| ], | ||
| path: "ios/turbomodule", | ||
| publicHeadersPath: ".", | ||
| cSettings: [ | ||
| .headerSearchPath("."), | ||
| .unsafeFlags(["-include", "react-native-spm-prefix.h"]), | ||
| ], | ||
| cxxSettings: [ | ||
| .headerSearchPath("."), | ||
| .unsafeFlags(["-include", "react-native-spm-prefix.h"]), | ||
| // Match the prebuilt React.framework's config-gated C++ ABI | ||
| // (NDEBUG in Release), mirroring what `spm scaffold` emits. | ||
| .define("DEBUG", .when(configuration: .debug)), | ||
| .define("NDEBUG", .when(configuration: .release)), | ||
| ], | ||
| linkerSettings: [ | ||
| .linkedFramework("UIKit"), | ||
| .linkedFramework("Foundation"), | ||
| .linkedFramework("CoreGraphics"), | ||
| ] | ||
| ), | ||
| ], | ||
| cxxLanguageStandard: .cxx20 | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| // Mirrors CocoaPods' default prefix header so this Objective-C++ source, which | ||
| // relies on an implicit Foundation import, compiles under SwiftPM (which | ||
| // has no prefix-header mechanism). Force-included via `-include` from the | ||
| // FingerprintjsProReactNative target in Package.swift. Inert for CocoaPods | ||
| // (excluded from the podspec's source_files). | ||
| #ifdef __OBJC__ | ||
| #import <Foundation/Foundation.h> | ||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| // Pin this library's Swift Package Manager module name for RN 0.87's SPM | ||
| // autolinking. Without an override the autolinker derives the name from the npm | ||
| // package (`FingerprintjsProReactNative`); we pin it to `RNFingerprintjsPro` to | ||
| // match the CocoaPods pod and the native module name. The autolinker uses this | ||
| // for its libs/<name> symlink and the product it references, so it must equal | ||
| // the product/package name declared in Package.swift. | ||
| module.exports = { | ||
| spm: { name: 'RNFingerprintjsPro' }, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.