Deep links
This app supports deep links in web and native (Capacitor) contexts.
Entry points
- Web fallback page:
/openroute (client/src/utils/Open.js) - Native handlers (mounted in
client/src/App.js):BranchDeepLinkHandler(client/src/utils/BranchDeepLinkHandler.js)DeepLinkHandler(client/src/utils/DeepLinkHandler.js)
What we store from links
Deep links commonly set these localStorage keys:
intendedVenue: venue id (fromvenue=or/venue/:id)intendedVenueRef: referral/ref code (fromref=)pendingServerCode: signup server code (created in Branch.io and delivered to the app as a link parameter)
Venue parsing/storage is implemented in:
client/src/utils/appDeeplink.js(storeIntendedVenueFromUrlFromString)
Common link shapes
Signup/server code
.../open?server_code=XXXX- any URL with
server_codeorserverCodequery param
Behavior:
- store
pendingServerCode - navigate to
/signup
Where the server code comes from:
- The value is set when you generate/configure the Branch.io link (as
server_codeorserverCode). - On native, the app reads it from Branch “referring params” (it checks top-level params and also nested
data/control_params).
Venue
.../open?venue=123https://getfoodfight.link/venue/123foodfight://open?venue=123
Behavior:
- store
intendedVenue - navigate to
/app/restaurant
Lucra
Both native handlers try to detect Lucra links and call:
handleLucraDeeplink(...)(fromclient/src/utils/lucraUtils)
Native (Capacitor) behavior
Branch handler (preferred for Branch links)
BranchDeepLinkHandler listens to Branch events via capacitor-branch-deep-links:
initdeferredDeepLinkinitError
It extracts server code from multiple possible Branch param locations (top-level, data, control_params) and supports retrying getLatestReferringParams() on appStateChange because some in-app browsers don’t reliably deliver URLs.
Generic URL handler (Capacitor appUrlOpen)
DeepLinkHandler listens to:
- cold start:
CapacitorApp.getLaunchUrl() - warm:
CapacitorApp.addListener('appUrlOpen', ...)
It also has special logic to resolve Branch short links (*.app.link) by fetching the URL and extracting server_code from redirects or interstitial HTML.
Web behavior (/open)
Open.js is a lightweight landing route that:
- stores
venue,ref,server_codeintolocalStorage - attempts to generate a Branch short link via
generateBranchLink(client/src/utils/BranchLinkGenerator.js) - falls back to:
- iOS: attempt
foodfight://open?...then App Store - Android/desktop: redirect to web signup (
https://www.getfoodfight.link/signup)
- iOS: attempt
Debugging
Both native handlers support a lightweight debug trail:
- enable:
localStorage.setItem('dlDbgEnabled', '1') - logs: console prefix
[DLDBG] - trail:
localStorage['dlDbgTrail'](last ~30 events)