Skip to main content

Mobile app navigation

This page describes how the mobile app (frontend/apps/mobile, React Native) moves between applications.

Goal​

The mobile app gives access to the member's catalog of applications, the same as the web portal: same applications, same labels, same families and same icons. An application without a native screen remains reachable in an authenticated web view, so the catalog grows without a new release of the app.

The stack:

  • React Native 0.85 and React 19;
  • React Navigation 7 (native-stack and bottom-tabs);
  • an experience (src/experiences/) that routes the member to a journey according to their directory profile (RootNavigator, then resolveExperience).

Registry, launcher and shell​

Navigation between applications rests on three parts, placed above the existing experiences.

The registry: src/apps/registry.ts​

The registry describes the applications that receive specific mobile handling: a native screen, visibility by profile, a dedicated label or icon. It does not bound the catalog: any other application granted to the member is discovered from the platform. Each entry is a declarative AppDescriptor:

interface AppDescriptor {
id: AppId;
label: string;
icon: string;
family: AppFamily; // family in the web portal, and section in the launcher
categories: AppCategory[]; // needs covered
capabilities: Capability[]; // notify | edit | consult | message
roles: RoleExperience[]; // visibility, used as the offline fallback
mount: 'native' | 'webview'; // progressive integration
route?: string; // fallback when the platform supplies no address
entMatch: string[]; // tokens used to match the platform catalog
comingSoon?: boolean; // "coming soon" tile until the app is wired
external?: boolean; // connector hosted elsewhere, with an absolute address
}

The mobile metadata (mount, family, categories, roles) are static. Actual visibility and route come from the platform.

Adding an entry serves to give an application a native screen, not to make it visible: an application unknown to the registry is shown anyway, in a web view, as soon as the platform grants it.

Helpers:

HelperReturns
appsForRole(role)Applications visible to a profile
appsByFamily(role)Applications grouped by family; the static fallback of the launcher
appsByCategory(role)Applications grouped by need
findApp(id)An application by identifier, for deep links and notifications

An application identifier is either a registry key ('blog') or ent:<technical key> for a discovered application ('ent:forum'). The same AppId type is used by navigation, the shell and deep links.

The launcher: src/apps/AppLauncherScreen.tsx​

The My apps screen shows the member's applications as a grid grouped by family, with the same sections, in the same order and with the same color marks as the web portal. It holds no hard-coded list: everything comes from useCatalogSections(role).

An application is opened through the onOpenApp(app) property. While an application is marked comingSoon, its tile shows a badge and a waiting message, which lets the full launcher ship before every application is wired.

The shell: src/apps/AppShell.tsx​

The shell is the common frame of an open application: a uniform header (back, title, switch button) and a body that is native or a web view according to app.mount. It is a screen of the root stack, parameterized by appId:

// RootNavigator (excerpt)
<Stack.Screen name="Main">{() => <Themed2d />}</Stack.Screen>
<Stack.Screen name="AppShell" component={AppShell} />

The launcher navigates to it directly: navigation.navigate('AppShell', { appId }).

The authenticated web view: src/apps/WebAppScreen.tsx​

For an application without a native screen, the shell renders a web view pointing at getBaseUrl() + app.route, the same origin as the API. An absolute address returned by the platform is brought back to the origin of the platform, except for an external connector, whose host is meaningful. The session is shared without handling any token:

  • Android: React Native networking writes cookies into the web view's CookieManager, so the session is already there;
  • iOS: sharedCookiesEnabled exposes the system cookie jar to the web view.

The screen shows a loading indicator, and an error state with a retry.

The switcher: src/apps/AppSwitcherScreen.tsx​

A sheet for switching quickly between applications without going back to the launcher. Opened from the header of the shell, it lists the applications opened during the session, highlights the current one, and replaces the shell with the chosen application (navigation.replace('AppShell', ...)), so that screens do not pile up. While only one application has been opened, it offers the member's catalog instead.

Open applications: src/apps/OpenAppsContext.tsx​

Since there is one shell, replaced on each switch, several live instances are not kept. OpenAppsProvider remembers the order of use of applications in memory, most recent first, up to a limit. The shell calls markOpened(appId) when it opens; the switcher reads recents. The list is reset at each launch.

Bridge with the platform catalog​

The static registry holds mobile metadata only. The list of applications the member can actually use, and their addresses, comes from the platform through /auth/oauth2/userinfo: the same apps list as the launcher of the web portal, already filtered by the member's rights.

FileRole
src/services/entApps.tsfetchEntApps() reads apps and authorizedActions. Best effort: returns null on failure.
src/apps/entCatalog.tsThe taxonomy of the web portal: labels, families with their order and colors, and exclusions (applications not displayed, system applications, and a shared deny list). A family supplied by the platform takes precedence when it is known.
src/apps/catalog.tsThe merge of registry and platform, as a pure function
src/apps/appIcons.tsThe portal icons rasterized as PNG, since React Native does not load SVG. Falls back to the initial of the label.
src/apps/CatalogContext.tsxLoads the catalog once after sign-in and exposes the hooks useCatalogSections, useResolvedApps and useResolvedApp

The merge works as follows:

  • Matching is tolerant: the entMatch tokens are compared with the name, address and prefix supplied by the platform, in a normalized form. Several aliases are accepted, since application names vary from one platform to another.
  • Web view applications of the registry: visibility is driven by the platform, the route is taken from the address supplied, and comingSoon is lifted.
  • Native applications: visibility comes from the static roles, and the internal route is kept.
  • Applications outside the registry: a descriptor is built on the fly, with the identifier ent:<key>, mount: 'webview', and the label, family and icon of the shared catalog. An application already in the registry is never duplicated.
  • No answer from the platform, while loading or offline: the static registry is used.

The result is that the mobile app shows exactly the catalog of the web portal, and enabling an application on the platform makes it appear without a new release.

Progressive integration with mount​

mountUse
webviewQuick wiring of an existing web application, with the session shared by cookie
nativeA dedicated React Native screen

An application is reachable as soon as it is granted, in a web view, and is rewritten as native over time, without changing the launcher or the navigation. A native screen improves ergonomics; it is never a condition of access.

The linking configuration (src/navigation/linking.ts) is derived from the registry: each application is reachable at openent://app/<id>, which pushes the shell with the right appId. It is attached to the NavigationContainer, together with a global navigation reference usable outside components:

<NavigationContainer ref={navigationRef} linking={buildLinking()}>

The push service (src/services/push.ts) routes the opening of a notification to the target application, in both cases:

  • app in the background: onNotificationOpenedApp, then openApp(appId);
  • cold start: getInitialNotification, then openApp(appId), with a short retry until navigation is ready.

Deriving the application from the notification​

The push service of the platform sends these fields:

FieldContentExample
typeType of notification, in upper caseBLOG, SCHOOLBOOK, RBS
event-typePrecise eventBLOG_POST_PUBLISH
paramsParameters of the notification, serialized as JSON{"resourceUri":"/forum#/view/42"}
resource, sender, sub-resourceRelated identifiers

src/services/pushRouting.ts resolves the application in this order: appId when a module sets it, then type, then the prefix of event-type, then the first segment of resourceUri. The comparison reuses the entMatch tokens of the registry: an application recognized in the catalog is recognized in notifications too, with no second table to maintain, and no module needs to add a field for its notifications to open the right screen. When nothing settles the question, no application is opened and the app stays on the home screen.

Shared screen parts and offline cache​

  • src/apps/ui/ holds the common palette, the screen states (loading, error, empty), tabs and the offline banner. Keeping them together prevents drift and gives one place to take care of accessibility.
  • src/services/cache.ts and src/hooks/useCachedData.ts keep the last known response and serve it when the network is unavailable, with an indication of its age. The network is always queried behind it: the cache speeds up display and does not replace the data. The cache key includes the platform, since one account can change platform.

Each screen applies the same order: cache shown at once, then the network response, which is authoritative; on failure, the cache flagged as offline; and an error only when there is nothing to show.

The offline fallback cannot be exercised in a debug build, because cutting the network of the emulator also cuts the bundler that serves the development bundle. It is covered by a unit test, with the network failing with and without cache, and the end-to-end journey runs against a release build.

Tests​

The pure logic is covered with Jest, with no native dependency: the integrity of the registry and its helpers, the shared taxonomy and its exclusions, the merge of registry and platform catalog, deep links, and notification routing.