App Launch and Onboarding
What happens from a cold start to the first real screen, including session restore, the role redirect, deep links, push notifications and the not-found screen.
Every launch starts on the splash screen. While the logo animates, the app reads the stored session, then sends the user either to Get Started (signed out) or to the home navigator for their role (signed in).
Where it lives
| Screen | Route | File | Who sees it |
|---|---|---|---|
| Root layout (providers, guards) | all routes | app/_layout.tsx | Everyone |
| Splash | / | app/(onboarding)/index.tsx | Everyone, on every launch |
| Get Started | /get-started | app/(onboarding)/get-started.tsx | Signed-out users |
| Onboarding stack | none | app/(onboarding)/_layout.tsx | Everyone |
| Not found | any unmatched route | app/+not-found.tsx | Anyone |
| Modal | /modal | app/modal.tsx | Nobody in normal use |
Supporting code: services/auth/auth-thunk.ts (restoreSession), services/auth/auth-session.ts (expiry listeners), utils/home-route.ts (role mapping), hooks/use-push-notifications.ts and lib/push-notifications.ts (push), hooks/use-theme-preference.tsx (theme).
Before you start
- No account is needed to see the splash and Get Started.
- Push notifications need a physical device, notification permission, and a build that carries an EAS project id. On a simulator the push step is skipped silently.
- No location, camera or contacts permission is requested during launch.
Flow
Cold start
RootLayoutmountsThemePreferenceProvider. It readslocal:THEME_PREFERENCEfrom AsyncStorage and renders nothing until that read finishes.RootNavigatormounts the ReduxProvider, the rootStack, the toast host, and three invisible helpers:AuthSessionHydratordispatchesrestoreSession()once.AuthExpiryRedirectsubscribes to session expiry. When it fires it dispatchesclearAuthand replaces the route with/(auth)/signin.PushNotificationsRegistrarruns the push hook described below.
restoreSession(no network call) decides whether there is a session:- If
local:REMEMBER_MEis exactlyfalse, it deletes the stored tokens and user and returns no session. - Otherwise it reads
local:USERandsession:ACCESS_TOKEN. Both must exist; a user without a token is treated as signed out. - The result goes into Redux
auth.user, andauth.sessionRestoredbecomes true whether or not a session was found.
- If
- The splash (
/) shows the logo fading and scaling in over a dark background with the line "Find your perfect space faster and smarter." A timer marks the splash finished after 4 seconds. - When both the 4 second timer and
sessionRestoredare done, the splash callsrouter.replace:- Signed in:
postAuthRouteForRole(user.role). That is/agent-onboardingforAGENT,/(tabs)forLANDLORD,LAWYERandDEVELOPER, and/tenantforTENANTor an unknown role. - Signed out:
/get-started.
- Signed in:
Remember me only matters at the next launch
Every sign-in writes the session to AsyncStorage. Leaving "Remember me" unticked stores local:REMEMBER_ME as false, which makes the next cold start wipe the session. Google and Apple sign-in never write this key, so those sessions follow whatever value the last email sign-in left behind.
Get Started
- The screen shows a three-column masonry wall of 13 bundled property photos under a dark gradient.
- Over it: the logo, the headline "Explore Verified Homes, Right at Your Fingertips" (followed by a check-mark emoji in the code), and the line "Find listings that match your lifestyle - your next home is closer than ever".
- The only control is the "Get Started" button. It pushes
/(auth)/signup. See Sign up and sign in.
There are no swipeable intro slides and no "skip" or "sign in" link on this screen. A returning user reaches sign-in through the "Log in" link on the sign-up screen.
Role-based redirect
The redirect is applied in four places, all using utils/home-route.ts:
| Where | Function | Notes |
|---|---|---|
| Splash | postAuthRouteForRole | On every launch with a stored session |
| After email, Google or Apple sign-in | postAuthRouteForRole | Uses the role in the sign-in response |
| Not-found screen "Go home" | homeRouteForRole | Falls back to / when signed out |
| Push notification tap | homeRouteForRole | Chooses the /tenant or /(tabs) prefix |
Agents are always sent to /agent-onboarding first; that screen loads the profile and forwards a fully set-up agent to /(tabs). The professional tab layout repeats the check so an agent cannot reach the tabs by another path.
Deep links
The app registers one custom URL scheme in app.json, appmobile. expo-router maps a path on that scheme to the matching file route, so appmobile://property/123 would open the property detail screen.
Deep links are not finished
There is no +native-intent file, no universal-link or app-link configuration visible in the routing code, and no code that waits for sign-in before honouring a link. The property payment screen builds its Paystack callback with a homelinkhub:// scheme, which is not the registered one; the in-app webview intercepts that redirect itself, so the OS is never asked to open it. Links produced by the property share sheet point at the website, not at the app. Treat inbound app links as untested.
Push notifications
- Registration runs once
sessionRestoredis true and a user is signed in, and again whenever the signed-in account id changes. getExpoPushToken()returns nothing on web, on a simulator ("push tokens need a physical device"), when permission is refused, or when the build has no EAS project id. On Android it first creates thedefaultchannel named "Notifications" with high importance.- If notification permission is undecided and the OS still allows asking, the system permission prompt is shown here. This is the only place the app asks.
- With a token, the app calls
POST /api/v1/users/push-tokenswithtoken,platformanddeviceName, then stores the token inlocal:PUSH_TOKEN. Failures are swallowed. - A listener re-registers if Expo rotates the token.
- While the app is in the foreground, incoming notifications still show a banner and play a sound; the badge count is not changed.
- Tapping a notification (including the tap that cold-started the app) is handled only when the user is signed in and not inside
(onboarding),(auth)oragent-onboarding:eventTypeofnew_chat_requestornew_messagewith ameta.roomIdopens the chat thread:/tenant/chats/[roomId]for tenants,/(tabs)/chats/[roomId]for professionals.- Anything else opens the role's notifications screen,
/tenant/notificationsor/(tabs)/notifications. - The handled response is cleared so the next launch does not replay it.
- On sign-out the app calls
DELETE /api/v1/users/push-tokenswith the stored token before the session is cleared, then removeslocal:PUSH_TOKEN.
Push token path may not match the backend
The app posts to /users/push-tokens. The backend mounts its user router at /user, so the route it serves is /api/v1/user/push-tokens. Unless a proxy rewrites the path, registration returns 404 and no device receives pushes. The error is swallowed, so nothing is shown in the app. Confirm against the running API.
Not found
- Any route that matches no file shows "Page not found" with "The page you're looking for doesn't exist."
- "Go home" replaces the route with the user's home navigator, or
/(the splash) when nobody is signed in.
Modal
/modal is the unchanged Expo template screen ("This is a modal" with a "Go to home screen" link to /). Nothing in the app navigates to it.
States and edge cases
- Slow storage read. The splash stays up past 4 seconds until
sessionRestoredis true. It never routes on a half-read session. - Stored user but no access token. Treated as signed out; the user lands on Get Started.
- Expired access token at launch. The session is still restored and the user lands on their home screen. The first API call returns 401, the app refreshes the token silently and retries. If the refresh fails, the user is moved to
/(auth)/signin. - Offline at launch. Launch itself needs no network. Home screens then show their own loading or error states.
- Notification permission denied. No token is requested and no error is shown. The app does not ask again; the user has to enable notifications in system settings.
- Notification tapped while signed out. Ignored until the user is signed in and past the gated screens; the pending tap is then handled.
- Back gesture.
(onboarding),(auth),(tabs),tenantandagent-onboardingall disable the swipe-back gesture at the root, so a user cannot swipe from home back to the splash.
What happens next
- A signed-out user continues to Sign up and sign in.
- A signed-in tenant lands on Home and discovery, where the first-launch guided tour may start.
- The backend treats push-token registration as an upsert and moves a token away from any other account that used the same device (per the comments in
lib/push-notifications.ts).
Mobile App Overview
How the HomeLink Hub mobile app is structured, how roles map to navigators, and how it talks to the API and stores data on the device.
Sign Up and Sign In
Creating an account, confirming the email code, signing in with email, Google or Apple, how tokens are stored and refreshed, and signing out.
HomeLink Hub