docs(react-native): update deep link setup instructions#668
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughReplaces manual native linking steps with a declarative Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx`:
- Around line 235-253: The code calls
authorizationFlowManagerDelegate.resumeExternalUserAgentFlow(with:) using
userActivity.webpageURL which is an optional; update the
AppDelegate.application(_:continue:restorationHandler:) branch to safely unwrap
the URL (e.g., if let url = userActivity.webpageURL) and pass the non-optional
url to delegate.resumeExternalUserAgentFlow(with:), only returning true when
both the delegate exists and the unwrapped url is passed; keep the fallback to
RCTLinkingManager.application(...).
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx (2)
275-284: Inconsistent nil-guard onauthorizationFlowManagerDelegateacross ObjC handlers.The custom-scheme handler (line 280) calls
resumeExternalUserAgentFlowWithURL:directly onself.authorizationFlowManagerDelegatewithout a nil-check, while the universal-link handler (line 295) wraps the same call inif (self.authorizationFlowManagerDelegate). Messagingnilin Objective-C is safe and returnsNO, so there is no crash risk, but for consistency either pattern should be applied uniformly.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx` around lines 275 - 284, The custom-scheme handler method application:openURL:options: calls [self.authorizationFlowManagerDelegate resumeExternalUserAgentFlowWithURL:url] without a nil-check; make this consistent with the universal-link handler by first checking self.authorizationFlowManagerDelegate before invoking resumeExternalUserAgentFlowWithURL: (i.e., only call resumeExternalUserAgentFlowWithURL: if self.authorizationFlowManagerDelegate is non-nil and return YES when it returns YES, otherwise fall back to calling RCTLinkingManager application:openURL:options:).
261-263:RCTLinkingManager.himport belongs inAppDelegate.m, notAppDelegate.h.
RCTLinkingManageris only referenced in the.mimplementation methods. Importing it in the public.hheader needlessly widens the visible interface. Moving it to the.mfile follows the standard Objective-C convention of importing symbols where they are used.♻️ Proposed refactor
// AppDelegate.h + `#import` <React/RCTLinkingManager.h> ← remove from here `#import` "RNAppAuthAuthorizationFlowManager.h"// AppDelegate.m (add at the top of the file) + `#import` <React/RCTLinkingManager.h>🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx` around lines 261 - 263, The import of RCTLinkingManager.h should be removed from AppDelegate.h and added to AppDelegate.m where the linking methods are implemented; update the header to only include RNAppAuthAuthorizationFlowManager.h (or other public headers) and move `#import <React/RCTLinkingManager.h>` into AppDelegate.m near the implementation of the methods that reference RCTLinkingManager to keep the public interface clean and follow Objective-C import conventions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx`:
- Around line 186-202: The bridging header guidance is incomplete: ensure
AppDelegate+RNAppAuth.h (or your existing Objective-C Bridging Header) also
imports RCTLinkingManager so Swift can call RCTLinkingManager methods used by
RNAppAuth; add `#import` <React/RCTLinkingManager.h> alongside the existing
RNAppAuthAuthorizationFlowManager import, and update Step 2 to instruct
developers to add these imports to their existing bridging header instead of
replacing it if one already exists.
---
Duplicate comments:
In `@src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx`:
- Around line 235-254: The conditional previously passed an optional to a
non-optional parameter; update the AppDelegate
application(_:continue:restorationHandler:) to safely unwrap
userActivity.webpageURL in the if-chain and pass the unwrapped url to
authorizationFlowManagerDelegate.resumeExternalUserAgentFlow(with:), as shown by
the new let url = userActivity.webpageURL check and the call to
resumeExternalUserAgentFlow(with: url); if that returns false, fall back to
RCTLinkingManager.application(..., continue: userActivity, restorationHandler:
restorationHandler).
---
Nitpick comments:
In `@src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx`:
- Around line 275-284: The custom-scheme handler method
application:openURL:options: calls [self.authorizationFlowManagerDelegate
resumeExternalUserAgentFlowWithURL:url] without a nil-check; make this
consistent with the universal-link handler by first checking
self.authorizationFlowManagerDelegate before invoking
resumeExternalUserAgentFlowWithURL: (i.e., only call
resumeExternalUserAgentFlowWithURL: if self.authorizationFlowManagerDelegate is
non-nil and return YES when it returns YES, otherwise fall back to calling
RCTLinkingManager application:openURL:options:).
- Around line 261-263: The import of RCTLinkingManager.h should be removed from
AppDelegate.h and added to AppDelegate.m where the linking methods are
implemented; update the header to only include
RNAppAuthAuthorizationFlowManager.h (or other public headers) and move `#import
<React/RCTLinkingManager.h>` into AppDelegate.m near the implementation of the
methods that reference RCTLinkingManager to keep the public interface clean and
follow Objective-C import conventions.
src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx
Outdated
Show resolved
Hide resolved
dtoxvanilla1991
left a comment
There was a problem hiding this comment.
Good work 🥇 left my 💭 s
src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx
Outdated
Show resolved
Hide resolved
…ojects with already existing Objective-C bridging headers
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx (1)
314-321: Consider adding a nil check forwebpageURLin the Objective-C universal link handler.In Objective-C,
userActivity.webpageURLcan benil. While passingnilto an Objective-C method typically won't crash (it becomes a no-op), theresumeExternalUserAgentFlowWithURL:method may not behave correctly with anilURL. For consistency with the Swift implementation (which unwraps the optional at line 262), consider adding a nil guard:Suggested improvement
+ - (BOOL) application: (UIApplication *) application + continueUserActivity: (nonnull NSUserActivity *)userActivity + restorationHandler: (nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler + { + if ([userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) { - + if (self.authorizationFlowManagerDelegate) { - + BOOL resumableAuth = [self.authorizationFlowManagerDelegate resumeExternalUserAgentFlowWithURL:userActivity.webpageURL]; + + if (self.authorizationFlowManagerDelegate && userActivity.webpageURL) { + + BOOL resumableAuth = [self.authorizationFlowManagerDelegate resumeExternalUserAgentFlowWithURL:userActivity.webpageURL]; if (resumableAuth) { return YES; } } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx` around lines 314 - 321, The universal link handler currently calls [self.authorizationFlowManagerDelegate resumeExternalUserAgentFlowWithURL:userActivity.webpageURL] without verifying userActivity.webpageURL; add a nil guard so you only call resumeExternalUserAgentFlowWithURL: when userActivity.webpageURL is non-nil (and return NO or continue otherwise). Locate the branch that checks userActivity.activityType == NSUserActivityTypeBrowsingWeb and the use of self.authorizationFlowManagerDelegate/resumeExternalUserAgentFlowWithURL: and ensure webpageURL is unwrapped/checked before invoking the delegate method to avoid passing nil.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx`:
- Around line 314-321: The universal link handler currently calls
[self.authorizationFlowManagerDelegate
resumeExternalUserAgentFlowWithURL:userActivity.webpageURL] without verifying
userActivity.webpageURL; add a nil guard so you only call
resumeExternalUserAgentFlowWithURL: when userActivity.webpageURL is non-nil (and
return NO or continue otherwise). Locate the branch that checks
userActivity.activityType == NSUserActivityTypeBrowsingWeb and the use of
self.authorizationFlowManagerDelegate/resumeExternalUserAgentFlowWithURL: and
ensure webpageURL is unwrapped/checked before invoking the delegate method to
avoid passing nil.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 40741a9c-2fa4-4ce4-9a2d-4f6f6ae32900
📒 Files selected for processing (1)
src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx
…ppDelegate.m file
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx (1)
162-175:⚠️ Potential issue | 🟠 MajorAdd Android AppAuth redirect configuration to the deep linking section.
The Android section currently only documents the app's deep-link intent-filter, but
react-native-app-authrequires its own redirect handler to be configured. Without this, auth callbacks will not reach the application. iOS setup includes detailed AppAuth configuration, but the Android equivalent is completely missing.Configure the redirect scheme in
android/app/build.gradleusing a scheme distinct from your app's regular deep-link scheme:Suggested Android AppAuth setup
### **Android** -Open `AndroidManifest.xml` and update your scheme by adding a new block in activity. +First, configure the AppAuth redirect scheme in `android/app/build.gradle`: + +```gradle title="android/app/build.gradle" +android { + defaultConfig { + manifestPlaceholders = [ + appAuthRedirectScheme: "myapp.auth" + ] + } +} +``` + +Use a different scheme from your app's deep-link scheme to avoid conflicts. Then open `AndroidManifest.xml` and add your app's deep-link intent-filter:🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx` around lines 162 - 175, Add Android AppAuth redirect configuration alongside the existing deep-link intent-filter: in android/app/build.gradle add a manifestPlaceholders entry (e.g., appAuthRedirectScheme = "myapp.auth") and ensure the value is a scheme distinct from your app deep-link scheme; then reference that placeholder in AndroidManifest.xml for the AppAuth redirect activity/intent-filter so react-native-app-auth callbacks reach the app (keep the existing deep-link intent-filter for your normal scheme).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx`:
- Around line 177-180: Add a brief prerequisite section before the AppDelegate
snippets explaining that iOS deep links require registration: document that
custom URL schemes must be added to Info.plist under CFBundleURLTypes (URL
Types) and that universal links require the Associated Domains entitlement plus
hosting a valid apple-app-site-association file on the domain; mention these
steps before showing the AppDelegate methods (openURL and continueUserActivity)
so readers know to perform them first and that handlers will not be invoked
without these registrations.
---
Outside diff comments:
In `@src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx`:
- Around line 162-175: Add Android AppAuth redirect configuration alongside the
existing deep-link intent-filter: in android/app/build.gradle add a
manifestPlaceholders entry (e.g., appAuthRedirectScheme = "myapp.auth") and
ensure the value is a scheme distinct from your app deep-link scheme; then
reference that placeholder in AndroidManifest.xml for the AppAuth redirect
activity/intent-filter so react-native-app-auth callbacks reach the app (keep
the existing deep-link intent-filter for your normal scheme).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 5de9ee77-a94e-40bf-8a36-5f095b4a6a83
📒 Files selected for processing (1)
src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx (1)
178-181:⚠️ Potential issue | 🟠 MajorAdd iOS prerequisite registration steps before
AppDelegatecode.The AppDelegate modifications handle incoming deep links, but the documentation omits the required iOS registration steps. Without these, iOS won't invoke the handlers:
- Custom URL schemes: Register under Info.plist > URL Types (
CFBundleURLTypes)- Universal links: Enable Associated Domains capability with
applinks:<domain>and host a validapple-app-site-associationfileConsider adding a brief prerequisite note before the Swift/Objective-C tabs.
,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx` around lines 178 - 181, Add a short prerequisite section before the AppDelegate Swift/Obj-C tabs explaining the required iOS registration steps: instruct developers to register custom URL schemes in Info.plist under CFBundleURLTypes and to enable the Associated Domains capability with applinks:<domain> for universal links (and host a valid apple-app-site-association file on the domain). Reference that these steps are required for the AppDelegate modifications (the deep link handlers in AppDelegate) to be invoked by iOS.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx`:
- Around line 178-181: Add a short prerequisite section before the AppDelegate
Swift/Obj-C tabs explaining the required iOS registration steps: instruct
developers to register custom URL schemes in Info.plist under CFBundleURLTypes
and to enable the Associated Domains capability with applinks:<domain> for
universal links (and host a valid apple-app-site-association file on the
domain). Reference that these steps are required for the AppDelegate
modifications (the deep link handlers in AppDelegate) to be invoked by iOS.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 517bb182-826b-454f-acb6-90c01b456163
📒 Files selected for processing (1)
src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx
Description (required)
This PR updates the deep link setup instructions to the SDK's latest version requirements.
Summary by CodeRabbit