Skip to Content
HomeLink Hub

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

ScreenRouteFileWho sees it
Root layout (providers, guards)all routesapp/_layout.tsxEveryone
Splash/app/(onboarding)/index.tsxEveryone, on every launch
Get Started/get-startedapp/(onboarding)/get-started.tsxSigned-out users
Onboarding stacknoneapp/(onboarding)/_layout.tsxEveryone
Not foundany unmatched routeapp/+not-found.tsxAnyone
Modal/modalapp/modal.tsxNobody 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

  1. RootLayout mounts ThemePreferenceProvider. It reads local:THEME_PREFERENCE from AsyncStorage and renders nothing until that read finishes.
  2. RootNavigator mounts the Redux Provider, the root Stack, the toast host, and three invisible helpers:
    • AuthSessionHydrator dispatches restoreSession() once.
    • AuthExpiryRedirect subscribes to session expiry. When it fires it dispatches clearAuth and replaces the route with /(auth)/signin.
    • PushNotificationsRegistrar runs the push hook described below.
  3. restoreSession (no network call) decides whether there is a session:
    • If local:REMEMBER_ME is exactly false, it deletes the stored tokens and user and returns no session.
    • Otherwise it reads local:USER and session:ACCESS_TOKEN. Both must exist; a user without a token is treated as signed out.
    • The result goes into Redux auth.user, and auth.sessionRestored becomes true whether or not a session was found.
  4. 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.
  5. When both the 4 second timer and sessionRestored are done, the splash calls router.replace:
    • Signed in: postAuthRouteForRole(user.role). That is /agent-onboarding for AGENT, /(tabs) for LANDLORD, LAWYER and DEVELOPER, and /tenant for TENANT or an unknown role.
    • Signed out: /get-started.

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

  1. The screen shows a three-column masonry wall of 13 bundled property photos under a dark gradient.
  2. 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".
  3. 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:

WhereFunctionNotes
SplashpostAuthRouteForRoleOn every launch with a stored session
After email, Google or Apple sign-inpostAuthRouteForRoleUses the role in the sign-in response
Not-found screen "Go home"homeRouteForRoleFalls back to / when signed out
Push notification taphomeRouteForRoleChooses 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.

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

  1. Registration runs once sessionRestored is true and a user is signed in, and again whenever the signed-in account id changes.
  2. 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 the default channel named "Notifications" with high importance.
  3. 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.
  4. With a token, the app calls POST /api/v1/users/push-tokens with token, platform and deviceName, then stores the token in local:PUSH_TOKEN. Failures are swallowed.
  5. A listener re-registers if Expo rotates the token.
  6. While the app is in the foreground, incoming notifications still show a banner and play a sound; the badge count is not changed.
  7. 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) or agent-onboarding:
    • eventType of new_chat_request or new_message with a meta.roomId opens the chat thread: /tenant/chats/[roomId] for tenants, /(tabs)/chats/[roomId] for professionals.
    • Anything else opens the role's notifications screen, /tenant/notifications or /(tabs)/notifications.
    • The handled response is cleared so the next launch does not replay it.
  8. On sign-out the app calls DELETE /api/v1/users/push-tokens with the stored token before the session is cleared, then removes local: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

  1. Any route that matches no file shows "Page not found" with "The page you're looking for doesn't exist."
  2. "Go home" replaces the route with the user's home navigator, or / (the splash) when nobody is signed in.

/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 sessionRestored is 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), tenant and agent-onboarding all 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).

On this page