Skip to content

Add preventUniversalLinks prop + Android no-op stub#11

Merged
artemlitch merged 6 commits intoreadwise/v13.16.0from
artem/prevent-universal-links-v2
May 8, 2026
Merged

Add preventUniversalLinks prop + Android no-op stub#11
artemlitch merged 6 commits intoreadwise/v13.16.0from
artem/prevent-universal-links-v2

Conversation

@artemlitch
Copy link
Copy Markdown
Collaborator

Summary

Adds preventUniversalLinks prop (iOS) — host-list that re-issues top-frame navigations via [webView loadRequest:] to bypass Universal Link handoff (e.g. Goodreads sign-in WebView being yanked into the Goodreads app mid-flow).

Also adds the matching Android no-op stub. Codegen generates a single RNCWebViewManagerInterface for both platforms, so Android fails to compile without it:

error: RNCWebViewManager is not abstract and does not override
abstract method setPreventUniversalLinks(RNCWebViewWrapper, ReadableArray)
in RNCWebViewManagerInterface

Mirrors the existing iOS-only stub pattern (b3919a9).

Test plan

  • Bookwise iOS build succeeds with the new prop applied
  • Bookwise Android build (EAS) succeeds — was failing on :react-native-webview:compileReleaseJavaWithJavac, this PR fixes it

🤖 Generated with Claude Code

artemlitch and others added 6 commits February 9, 2026 13:07
Commit 010b9de added scrollsToTop, dragInteractionEnabled, and
setTintColor to the codegen spec (RNCWebViewNativeComponent.ts) but
only implemented them on iOS. Codegen generates a single Java interface
for all platforms, so Android fails to compile without these stubs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add Android no-op stubs for iOS-only codegen props
- Remove lib/ from .gitignore and commit pre-built output
- Rename prepare script so it doesn't auto-run during pnpm git installs
- Disable packageManager field to prevent pnpm from invoking yarn

This makes the git-hosted fork behave like an npm-published package:
consumers get pre-built output without needing yarn to build.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When iOS triggers a Universal Link handoff mid-flow inside a WebView, the
user is yanked into the linked third-party app and the embedded flow
breaks. This shows up most commonly in embedded auth: e.g. a Goodreads
sign-in WebView whose post-Amazon-SSO redirect lands on a UL-eligible
URL like /ap-handler/sign-in?IDP=lwa, sending the user into the
installed Goodreads app.

iOS does not expose a way to predict UL handoff at the navigation
delegate — UL is decided in WebKit's process before
decidePolicyForNavigationAction fires. The only nav type iOS reliably
does NOT consider for UL handoff is host-app-initiated
[webView loadRequest:].

This adds a preventUniversalLinks prop (NSArray<NSString *>) for iOS:
when set, top-frame navigations whose host matches an entry are
canceled and re-issued via [webView loadRequest:]. Match is
domain-suffix with a dot boundary, so passing 'goodreads.com' covers
'goodreads.com', 'www.goodreads.com', and any subdomain — but not
'evilgoodreads.com'.

The prop takes a host list rather than a boolean because reissuing
every top-frame nav unconditionally breaks anything that's not a plain
GET — POST form bodies are stripped by NSURLRequest in the navigation
action, and reissuing single-use OAuth codes (Amazon callbacks etc.)
double-consumes them. Only hosts that actually have AASA registered
for this app's bundle ID are at risk of UL handoff, so the app
declares them.

An associated-object flag on the WKWebView breaks the cancel/reissue
loop: the reissued nav re-enters decidePolicyForNavigationAction with
the flag set, the impl clears it and falls through to the normal
handler.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
(cherry picked from commit 7fbf264)
Commit 588534c added preventUniversalLinks to the codegen spec
(src/RNCWebViewNativeComponent.ts) but only implemented iOS. Codegen
generates a single Java interface for all platforms, so Android fails
to compile (RNCWebViewManager is not abstract and does not override
setPreventUniversalLinks) without a stub. Mirrors b3919a9.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@artemlitch artemlitch merged commit 4fd11f3 into readwise/v13.16.0 May 8, 2026
5 of 9 checks passed
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.

1 participant