-
Notifications
You must be signed in to change notification settings - Fork 0
(feat) [ONR-511] Migration to Nitro Modules #1
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 17 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
eca7091
chore(example-bare): scaffold stock RN 0.85 app for Nitro spike
YouCanKeepSilence 3528b07
chore: add Nitro tooling, drop Expo autolinking + build wiring
YouCanKeepSilence 88f7fb4
spike: Nitro HybridObject (ping) wired; RN-CLI autolinking via react-…
YouCanKeepSilence 760aed4
fix(nitro): drop invalid package react-native.config.js + podspec lic…
YouCanKeepSilence 658ea8a
fix(example-bare): build RN core from source (RCT_USE_PREBUILT_RNCORE=0)
YouCanKeepSilence f3c1e19
fix(nitro): move podspec to package root so add_nitrogen_files globs …
YouCanKeepSilence d2aff80
chore(nitro): drop unneeded RCT_USE_PREBUILT_RNCORE workaround; publi…
YouCanKeepSilence b637e32
spike: proofs #2 SDK interop, #3 SwiftUI Nitro View, #4 event callback
YouCanKeepSilence 0736cd5
fix(example-bare): adaptive text colors so the on-screen log is reada…
YouCanKeepSilence d7b8f2f
feat(nitro): Phase 1 core module — configure/initialize/reset/signOut…
YouCanKeepSilence 6cf8c28
test(nitro): rewire jest to the Nitro hybrid object mock
YouCanKeepSilence 7579ca7
feat(nitro): Phase 2 — checkout view as a Nitro View + getCheckoutReq…
YouCanKeepSilence b165d01
feat(nitro): map new provider-lifecycle CheckoutEvents from the SDK
YouCanKeepSilence c994fea
refactor(types): type checkoutFinalized.response against the SDK
YouCanKeepSilence 453537c
feat(nitro): Expo config plugin — support Expo prebuild consumers too
YouCanKeepSilence 9b811a8
fix(example): install react-native-nitro-modules in the Expo example
YouCanKeepSilence 093453e
docs: update README + integration guide for the Nitro migration
YouCanKeepSilence f8abe37
fix(nitro): lower iOS floor to 16.0; stop the config plugin forcing d…
YouCanKeepSilence f7e55d0
build(nitro): replace expo-module-scripts with react-native-builder-bob
YouCanKeepSilence 48940ab
fix(nitro): scope prepared-intent single-flight per client; fix butto…
YouCanKeepSilence 4dd37a5
chore(example): enable App Attest in example-bare; fix NitroModules p…
YouCanKeepSilence f480de9
Regenerated xcode files
YouCanKeepSilence 4fb024c
ci(ios): pass RELEASE_REPO_TOKEN to fetch-xcframework
YouCanKeepSilence bdfcad9
Added LICENSE
YouCanKeepSilence 08925c7
refactor(example): promote bare RN app to primary example; rename Exp…
YouCanKeepSilence 5f09710
chore(deps): lower react-native peer floor 0.85 -> 0.79
YouCanKeepSilence 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,3 +69,4 @@ jsconfig.json | |
| .env.local | ||
| example/.env | ||
| example/.env.local | ||
| example-bare/env.local.ts | ||
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,36 @@ | ||
| require 'json' | ||
|
|
||
| package = JSON.parse(File.read(File.join(__dir__, 'package.json'))) | ||
|
|
||
| Pod::Spec.new do |s| | ||
| s.name = 'OnramperReactNative' | ||
| s.version = package['version'] | ||
| s.summary = package['description'] | ||
| s.description = package['description'] | ||
| s.license = { :type => 'UNLICENSED' } | ||
| s.author = package['author'] | ||
| s.homepage = package['homepage'] | ||
| s.platforms = { :ios => '16.4' } | ||
| s.swift_version = '5.9' | ||
| s.source = { :git => "#{package['repository']}.git", :tag => "v#{s.version}" } | ||
|
|
||
| s.pod_target_xcconfig = { | ||
| 'DEFINES_MODULE' => 'YES', | ||
| } | ||
|
|
||
| # This podspec lives at the package root (not ios/) because nitrogen emits its | ||
| # generated source globs (nitrogen/generated/**) relative to the podspec's | ||
| # directory via add_nitrogen_files below. Our own sources are ios/-prefixed. | ||
| s.source_files = 'ios/*.swift' | ||
| s.vendored_frameworks = 'ios/Frameworks/OnramperSDK.xcframework' | ||
|
|
||
| load File.join(__dir__, 'nitrogen', 'generated', 'ios', 'OnramperReactNative+autolinking.rb') | ||
| add_nitrogen_files(s) | ||
|
|
||
| # Wires up the React Native new-architecture dependencies and header search | ||
| # paths (React-Core, React-RCTFabric, ReactCommon, Yoga, folly, …). Required | ||
| # because our Nitro View's generated code includes React Fabric headers, which | ||
| # transitively include yoga/style/Style.h — without this the pod fails to | ||
| # compile with "'yoga/style/Style.h' file not found". | ||
| install_modules_dependencies(s) | ||
| end |
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 was deleted.
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,58 @@ | ||
| // Mocks the native Nitro hybrid object. `createHybridObject` returns a fresh | ||
| // instance per call (matching production, where each OnramperClient owns one), | ||
| // capturing the registered callbacks so tests can drive state / event / session | ||
| // flows. Grab the most-recently-created instance via `__lastNative()`. | ||
|
|
||
| export interface MockNative { | ||
| configure: jest.Mock; | ||
| initialize: jest.Mock; | ||
| reset: jest.Mock; | ||
| signOut: jest.Mock; | ||
| setStateListener: jest.Mock; | ||
| setEventListener: jest.Mock; | ||
| setSessionExpirationHandler: jest.Mock; | ||
| dispose: jest.Mock; | ||
| // Captured callbacks (set by the corresponding setters): | ||
| __stateListener?: (json: string) => void; | ||
| __eventListener?: (json: string) => void; | ||
| __sessionHandler?: () => Promise<{ sessionId: string; sessionToken: string }>; | ||
| } | ||
|
YouCanKeepSilence marked this conversation as resolved.
|
||
|
|
||
| function makeNative(): MockNative { | ||
| const native = { | ||
| configure: jest.fn().mockResolvedValue(undefined), | ||
| initialize: jest.fn().mockResolvedValue(undefined), | ||
| reset: jest.fn().mockResolvedValue(undefined), | ||
| signOut: jest.fn().mockResolvedValue(undefined), | ||
| setStateListener: jest.fn((fn: (json: string) => void) => { | ||
| native.__stateListener = fn; | ||
| }), | ||
| setEventListener: jest.fn((fn: (json: string) => void) => { | ||
| native.__eventListener = fn; | ||
| }), | ||
| setSessionExpirationHandler: jest.fn((fn: () => Promise<{ sessionId: string; sessionToken: string }>) => { | ||
| native.__sessionHandler = fn; | ||
| }), | ||
| dispose: jest.fn(), | ||
| } as MockNative; | ||
|
YouCanKeepSilence marked this conversation as resolved.
|
||
| return native; | ||
| } | ||
|
|
||
| let last: MockNative | undefined; | ||
|
|
||
| export const NitroModules = { | ||
| createHybridObject: jest.fn(() => { | ||
| last = makeNative(); | ||
| return last; | ||
| }), | ||
| }; | ||
|
|
||
| /** The most-recently-created mock hybrid object (one per OnramperClient). */ | ||
| export function __lastNative(): MockNative { | ||
| if (!last) throw new Error('no hybrid object created yet'); | ||
| return last; | ||
| } | ||
|
|
||
| // View host factory. Tests don't render the native button, so a dummy component | ||
| // that ignores its props is sufficient. | ||
| export const getHostComponent = jest.fn(() => () => null); | ||
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.