Skip to content

Conversation

@MorganBerger
Copy link
Contributor

Adds prevent methods for click events : onSubscribeClick, onLoginClick, onDataPolicyClick
& onDiscoveryLinkClick.
Working only for iOS so far.

⚠️ Since this modifications trigger a crash when trying to use the above listed events with the
current iOS SDK version, it would probably be a good idea to wait until Access IOS v2.10.1 is
available before releasing this (This PR fixes that specific issue).

To test this (if the fix has not been released) :

  • clone paywall-ios repo
  • checkout fix/escaping-events-prevent branch
  • run ./script/build.sh
  • drag the newly generated ./build/AccessIOS.xcframework into this project ios/ directory.
  • uncomment the s.vendored_frameworks line in RNAccessIOS.podspec
    and comment the s.dependency one.
  • run cd example/ios && pod install
  • you can now run the test app from XCode or run yarn example ios.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a “prevent default” mechanism for several paywall click events (currently iOS-focused), allowing JS handlers to optionally block the native SDK’s default click behavior.

Changes:

  • Extend click events with _messageId / prevented and add JS-side prevent() handlers for click events.
  • Add iOS bridging to correlate click events with a JS response and conditionally invoke the native prevent() callback.
  • Update example app and iOS dependency versions to exercise the new behavior.

Reviewed changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/specs/PaywallViewNativeComponent.ts Extends ClickEvent payload to support preventable click actions.
src/Paywall/index.tsx Adds JS handler signatures that expose prevent() and sends resolve/reject messages back to native.
ios/PaywallView.mm Adds iOS-side observer wiring to call the SDK’s prevent() based on JS response.
ios/NativePaywallModule.mm Changes notification routing to be derived from the emitted JS event name.
RNAccessIOS.podspec Updates pinned AccessIOS dependency version.
example/src/App.tsx Demonstrates new click handlers and prevent calls.
example/ios/Podfile.lock Updates example iOS pods (including AccessIOS version and CocoaPods metadata).
example/Gemfile.lock Updates Ruby/Bundler/CocoaPods lock metadata for the example app.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants