Onboarding guide
26. Device Capability Abstraction Layer (Native Contracts, MAUI, Browser & Fallback Adapters)
What this chapter covers. One Blazor component library in MMCA.Common.UI renders on three very
different heads: Blazor Server (server-side prerender plus interactive Server circuits), Blazor
WebAssembly (the whole component tree running inside the browser), and MAUI Blazor Hybrid (the same
components inside a native shell on Android, iOS, Windows and macOS). Those heads have wildly
different access to the device. A phone can vibrate, scan a fingerprint, read a QR code with the
camera, drop a local notification and open the system share sheet; a server-rendered page can do none
of that; a browser page can do some of it through web APIs. This group is how one component library
talks to all of that hardware without ever naming a platform type. It is a set of small,
single-capability interface contracts (biometrics, geolocation and geocoding, speech, push
registration, media pick, barcode scanning, clipboard, screenshot, haptics, share, external links,
external OAuth, passkeys, local cache, local notifications, connectivity, battery, accessibility
announcements, app lifecycle, deep links) plus three families of adapters that implement each contract per host: MAUI-native,
browser-JS-interop, and inert fallback. The head chooses which family it resolves at DI composition
time. This is the [Rubric §18, UI Architecture] and [Rubric §22, Responsive/Cross-Browser] story
in miniature, and the design is
ADR-042
(Website/docs-src/adr/042-device-capability-abstraction.md).
The contract-per-capability shape. Every capability is its own narrow interface under the
MMCA.Common.UI.Services.Capabilities namespace, one sub-namespace per area (Auth, Geo, Interop,
DeviceStorage, Notifications and so on). The contracts are deliberately tiny and
transport-agnostic: they speak in booleans, strings, and framework-owned types, never in a MAUI or a
JS type. IBiometricAuthenticator
(MMCA.Common.UI/Services/Capabilities/Auth/IBiometricAuthenticator.cs:9) is the clearest example of the
house rule. Availability and outcome are both plain Task<bool>
(IBiometricAuthenticator.cs:12,19), and every failure mode (cancellation, lockout, error) collapses
to false, documented right on the member (IBiometricAuthenticator.cs:14-18), so a caller can only
fall back to the normal credential login, never to a weaker path. Where a capability must return
structured data it does so through a framework-owned type rather than a platform one:
GeoPoint (MMCA.Common.UI/Services/Capabilities/Geo/GeoPoint.cs:9) is a sealed record
latitude/longitude pair that even carries its own haversine DistanceKmTo helper
(GeoPoint.cs:17-29, over an EarthRadiusKm of 6371.0 at GeoPoint.cs:11) so shared components
never touch a platform location type. PickedMedia
(MMCA.Common.UI/Services/Capabilities/Media/IMediaPickerService.cs:29, deliberately a class rather than a
record because a record's generic IEquatable<T> is a generic WinRT interface that trips CsWinRT AOT
generation (CsWinRT1030) on the windows TFM, IMediaPickerService.cs:22-24),
PushDeviceToken
(MMCA.Common.UI/Services/Capabilities/Notifications/IPushDeviceTokenProvider.cs:19), and
LocalNotificationRequest
(MMCA.Common.UI/Services/Capabilities/Notifications/LocalNotificationRequest.cs:19) play the same role for their
capabilities. Keeping the contracts in the shared UI layer and the platform types out of them is the
[Rubric §1, SOLID] dependency-inversion move that makes the whole layer swappable per host.
Composition: safe defaults first, head overrides last. The wiring is a two-phase, last-wins
registration and it is the load-bearing mechanism of the group. AddUIShared (in the wider UI group)
calls AddDeviceCapabilityDefaults
(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:39), which TryAdd-registers a
neutral implementation for every contract, so any shared component can resolve any capability on
any head and get a well-defined no-op rather than a missing-service exception
(DependencyInjection.cs:41-97). That method is public for a second reason spelled out on it: a
consumer's bUnit test base registers the same set the production host gets instead of mirroring the
list by hand, because a hand-mirrored list rots the moment a new contract ships and the component
test fails with a DI resolution error rather than a useful one (DependencyInjection.cs:33-36,
[Rubric §14, Testability]). A head then calls its own registration after AddUIShared with
plain Add calls, and because the last single-service registration wins, those override the
defaults, a rule spelled out on both DI classes (DependencyInjection.cs:18-23,
MMCA.Common.UI.Maui/DependencyInjection.cs:29-34). Browser heads call
AddBrowserDeviceCapabilities (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:110);
native heads call AddMauiDeviceCapabilities (MMCA.Common.UI.Maui/DependencyInjection.cs:52), which
ships in the separate MAUI-TFM package MMCA.Common.UI.Maui, the one package built outside
MMCA.Common.slnx
(ADR-042). Both DI
classes use the C# extension(IServiceCollection) member idiom this codebase favors for
registration (DependencyInjection.cs:26, MMCA.Common.UI.Maui/DependencyInjection.cs:38; see the
primer). The lifetime choices are deliberate and
commented in place: the browser services are Scoped, so each Blazor circuit gets its own set over
one shared JS module import (DependencyInjection.cs:112-128), while the MAUI services are Singleton
because a native head is single-user and its stateful services (connectivity, battery) wrap
app-global platform events (MMCA.Common.UI.Maui/DependencyInjection.cs:61-87).
Three adapter families. Each contract has up to three implementations. The fallback family
sits beside each contract in its capability namespace and is the Null Object pattern applied wholesale ([Rubric §2, Design Patterns]):
NullBiometricAuthenticator
(MMCA.Common.UI/Services/Capabilities/Auth/NullBiometricAuthenticator.cs:4) simply returns
false from both members (NullBiometricAuthenticator.cs:7-12),
NullShareService, NullClipboardService and their
siblings do nothing, and
AlwaysOnlineConnectivityStatusService reports permanent
connectivity through an event whose add/remove accessors are deliberately empty because it is never
raised
(MMCA.Common.UI/Services/Capabilities/DeviceStatus/AlwaysOnlineConnectivityStatusService.cs:10-27),
which is the correct answer on Blazor Server, where a lost connection tears down the circuit itself
(MMCA.Common.UI/Services/Capabilities/DeviceStatus/IConnectivityStatusService.cs:3-9). These are what make it
safe for a shared component to call a capability unconditionally: the null implementation answers
"not available here" honestly and the component hides the corresponding affordance. The MAUI
family lives under MMCA.Common.UI.Maui.Capabilities and wraps the real platform APIs:
MauiExternalLinkService
(MMCA.Common.UI.Maui/Capabilities/Interop/MauiExternalLinkService.cs:11) opens http and https
in the system browser and hands the other allowed schemes to the OS launcher, so contact links work
inside the WebView (MauiExternalLinkService.cs:28-39), but first refuses any URI outside the
ExternalLinkScheme allow-list
(MMCA.Common.UI/Services/Capabilities/Interop/ExternalLinkScheme.cs:9): http, https, mailto,
tel, sms and otpauth, so a data-sourced intent:, file: or third-party app scheme is never
handed to the OS (ExternalLinkScheme.cs:3-8,11-24; MauiExternalLinkService.cs:21-26). The same
internal class's IsSafeHref decides whether a value may be rendered as an anchor at all: a relative
reference passes, and a scheme that does not parse is refused, so whitespace or control characters
inside a scheme cannot smuggle one past the check (ExternalLinkScheme.cs:26-46,
[Rubric §26, Front-End Security]). Its siblings drive MAUI Essentials, the MAUI Community Toolkit,
Plugin.LocalNotification, and ZXing.Net.MAUI. Assistive
technology is the tidiest illustration of all three families at once:
IAccessibilityAnnouncer
(MMCA.Common.UI/Services/Capabilities/Accessibility/IAccessibilityAnnouncer.cs:9) is a one-method contract for
speaking events a sighted user perceives visually, a live poll opening or the unread badge
incrementing (IAccessibilityAnnouncer.cs:3-8);
BrowserAccessibilityAnnouncer writes into a visually hidden
aria-live="polite" region created on first use by the shared JS module
(MMCA.Common.UI/Services/Capabilities/Accessibility/BrowserAccessibilityAnnouncer.cs:4-6,16-19),
MauiAccessibilityAnnouncer forwards to SemanticScreenReader.Default
and drops the announcement on any platform failure other than cancellation, a missing screen-reader
integration included (MMCA.Common.UI.Maui/Capabilities/Accessibility/MauiAccessibilityAnnouncer.cs:16-22), and
NullAccessibilityAnnouncer is the silent default
(MMCA.Common.UI/Services/Capabilities/Accessibility/NullAccessibilityAnnouncer.cs:4,7). One call site,
right behavior on all three heads, which is [Rubric §21, Accessibility] bought at the composition
layer instead of page by page.
The browser family and its prerender-safe contract. The browser family also sits beside each
contract in its capability namespace and reaches the device through JavaScript interop, but most of
it never calls IJSRuntime directly. Every module-backed browser service depends on
CapabilitiesJsModule
(MMCA.Common.UI/Services/Capabilities/CapabilitiesJsModule.cs:14), a lazy accessor built
over LazyJsModule for the single
./_content/MMCA.Common.UI/capabilities-interop.js module (CapabilitiesJsModule.cs:16,21)
registered once per circuit (DependencyInjection.cs:112-113). Its InvokeOrDefaultAsync<T>
(CapabilitiesJsModule.cs:28) is the degradation contract that makes browser capabilities usable
during server-side prerender: it wraps the import-and-invoke in a try filtered on the shared
JsInteropFailure.IsUnavailable set (an un-hydrated prerender, a torn-down circuit, a throwing
browser API, the host's JS interop timeout) and returns default, while a cancellation of the
caller's own token still propagates (CapabilitiesJsModule.cs:6-12,33-43); disposal delegates to the
same lazy module (CapabilitiesJsModule.cs:47). So BrowserShareService
(MMCA.Common.UI/Services/Capabilities/Interop/BrowserShareService.cs:10) invoking shareLink
against navigator.share reads the nullable result as shared == true
(BrowserShareService.cs:20-23) and degrades to "did not share" during prerender instead of
throwing, exactly as the null implementation would; file sharing has no browser primitive at all, so
it answers false outright (BrowserShareService.cs:27-28). Plain-text sharing (the in-app
diagnostics log, for instance) is a default interface member on
IShareService that answers false so the caller falls back to the clipboard
(MMCA.Common.UI/Services/Capabilities/Interop/IShareService.cs:22-28); only
MauiShareService overrides it with the native share sheet
(MMCA.Common.UI.Maui/Capabilities/Interop/MauiShareService.cs:53). Not every browser adapter needs the
module: BrowserMapNavigationService
(MMCA.Common.UI/Services/Capabilities/Geo/BrowserMapNavigationService.cs:10) composes over the
host's IExternalLinkService instead, because the web has no native maps
app, so it opens a Google Maps search URL in a new tab
(BrowserMapNavigationService.cs:5-9,15-16,19-24), registered Scoped with its browser siblings
(DependencyInjection.cs:122). That URL comes from MapLaunchUris
(MMCA.Common.UI/Services/Capabilities/Geo/MapLaunchUris.cs:12), an internal class both heads share
so the per-platform URI shapes are unit-tested in one place (MapLaunchUris.cs:3-7).
IMapNavigationService's OpenAddressAsync takes an optional place label
beside the address (MMCA.Common.UI/Services/Capabilities/Geo/IMapNavigationService.cs:10-16): it
becomes the pin name in an Android geo: query and in Apple Maps, is searched together with the
address on the web because the Maps URLs API has no label parameter, and is not applied to the
Windows bingmaps: address search; a blank label, or one the address already contains, is ignored
(MapLaunchUris.cs:21-30,32-53,55-61,63-69). MauiMapNavigationService
picks the shape by OperatingSystem and reports false on any launcher failure so the caller can
fall back (MMCA.Common.UI.Maui/Capabilities/Geo/MauiMapNavigationService.cs:19-30,33-46). The module is not browser-only either: a MAUI head registers the same
scoped CapabilitiesJsModule through
MauiCapabilitiesJsModuleRegistration
(MMCA.Common.UI.Maui/Capabilities/Interop/MauiCapabilitiesJsModuleRegistration.cs:23,28-31), called
at the end of AddMauiDeviceCapabilities (MMCA.Common.UI.Maui/DependencyInjection.cs:113-116),
because the sign-in-link, confirm-email and reset-password pages read their credential out of the URL
fragment through it and resolve it optionally, so a head without it silently read a null fragment and
reported every link as incomplete; BlazorWebView serves the RCL assets under _content/ like a
browser host, so the module works unchanged
(MauiCapabilitiesJsModuleRegistration.cs:11-17). It is an internal TryAddScoped, kept free of
MAUI APIs so the framework's plain net10.0/net11.0 test project can compile it as linked source
(MauiCapabilitiesJsModuleRegistration.cs:1-5,18-21). That is the
[Rubric §22, Responsive/Cross-Browser] and [Rubric §23, Front-End Performance] discipline which
lets the same component prerender on the server and hydrate in the browser with no capability check
at every call site.
Passkeys: a browser-only capability with its own module. WebAuthn sign-in
(ADR-139,
Website/docs-src/adr/139-passkeys-webauthn-opt-in-sign-in.md) is the newest contract and the one
capability that only the browser heads back. IPasskeyCapability
(MMCA.Common.UI/Services/Capabilities/Auth/IPasskeyCapability.cs:16) runs the browser half of a
ceremony: an IsAvailable flag, CreateAsync and GetAsync for navigator.credentials.create and
.get, and three members for autofill (conditional mediation), IsAutofillAvailableAsync,
StartAutofillAsync and CancelAutofillAsync (IPasskeyCapability.cs:19,25,31,40,50,54). Options
and credentials cross as JsonElement in the WebAuthn *JSON shapes, exactly what the API's passkey
endpoints take and return, so nothing in between has to understand them
(IPasskeyCapability.cs:11-15), and the autofill probe is asked before any sign-in options are
requested, so a browser without autofill never makes the server store a challenge
(IPasskeyCapability.cs:33-37). BrowserPasskeyCapability
(MMCA.Common.UI/Services/Capabilities/Auth/BrowserPasskeyCapability.cs:14) does not use the shared
capabilities module: it owns a LazyJsModule over
./_content/MMCA.Common.UI/passkeys.js (BrowserPasskeyCapability.cs:16,22,27). It reports
IsAvailable as always true on a browser head and leaves the per-browser WebAuthn check to the
module at ceremony time (BrowserPasskeyCapability.cs:29-34). Each ceremony runs under its own
five-minute CeremonyTimeout, linked to the caller's token, because the prompt waits on a person
finding a security key (BrowserPasskeyCapability.cs:18-20,104-107). Every interop call is guarded by
the shared JsInteropFailure.IsUnavailable filter, which matches InvalidOperationException
(prerender), JSDisconnectedException, JSException and OperationCanceledException (so also the
TaskCanceledException of an outlived timeout) (MMCA.Common.UI/Common/JsInteropFailure.cs:27-31):
the autofill probe and start answer false (BrowserPasskeyCapability.cs:52-56,71-74), and a ceremony
degrades to a null credential, with an extra condition on the ceremony filter that lets the caller's
own cancellation propagate (BrowserPasskeyCapability.cs:113-118).
Autofill needs a callback from JS into .NET: AutofillCallback, an internal
nested class whose [JSInvokable] OnAutofillCredential hands the picked assertion to the caller's
delegate (BrowserPasskeyCapability.cs:121-130), wrapped in a DotNetObjectReference that is
replaced on every StartAutofillAsync and released on dispose
(BrowserPasskeyCapability.cs:23,64-65,97-102); CancelAutofillAsync is a no-op when the module was
never imported (BrowserPasskeyCapability.cs:78-83). Holding that callback is why the registration
is Scoped, one per circuit (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:125-126).
Every other head, MAUI included, keeps the TryAdd default
UnavailablePasskeyCapability
(DependencyInjection.cs:59-61), which reports unavailable and answers null or false from every
member (MMCA.Common.UI/Services/Capabilities/Auth/UnavailablePasskeyCapability.cs:10,13-31), so the
shared Login page and
PasskeysPanel hide their passkey affordances there
(UnavailablePasskeyCapability.cs:5-9; MMCA.Common.UI/Pages/Auth/Login.razor.cs:202,
MMCA.Common.UI/Components/Auth/PasskeysPanel.razor.cs:41). [Rubric §11, Security] and
[Rubric §26, Front-End Security].
Camera scanning, the opt-in capability. Barcode and QR scanning is the one capability that even a
native head does not get by default, and it shows the composition rule taken one step further.
IBarcodeScannerService
(MMCA.Common.UI/Services/Capabilities/Media/IBarcodeScannerService.cs:16) is an IsSupported
flag, an EnsureCameraAccessAsync that requests the camera permission and answers false when it
is denied so the caller can explain why scanning did not start, a ScanAsync that returns the first
decoded payload or null, and a ScanContinuouslyAsync session for scanning code after code
(IBarcodeScannerService.cs:19,21-26,28-32,57). A denied permission, a cancelled scan, an
unsupported head, and a cancelled token all collapse to the same null (or, for a session, to a
session that simply ends); the one exception that escapes is the caller's own, thrown from its
onScanned callback and handed back after the camera surface closes, because swallowing it would
hide the caller's bug; and the contract states outright that the scanned payload is untrusted input
to validate before acting on it (IBarcodeScannerService.cs:3-14, [Rubric §26, Front-End Security]).
The session member exists for a check-in desk: each payload goes to the callback, which returns
outcome text to show the operator (for example "Checked in"), and the next scan waits for it
(IBarcodeScannerService.cs:34-48). It is a default interface member that loops ScanAsync until a
null, so an implementation with no continuous surface needs no change; it has nowhere to show the
outcome text, and it treats an OperationCanceledException after cancellation as the session ending
rather than a fault (IBarcodeScannerService.cs:51-56,63-84). Both the default and the MAUI session
skip repeats through RepeatScanFilter
(MMCA.Common.UI/Services/Capabilities/Media/RepeatScanFilter.cs:12), an internal class over an
injected TimeProvider: a camera decodes the code in its frame again and again, and without the
filter the check-in loop submitted the same code about once a second while the operator held it up
(RepeatScanFilter.cs:3-9). It remembers only the latest payload, compares ordinally, and restarts
the window on every sighting, so a code held in view is handled once and again only after it has
been out of view for the five-second RepeatWindow, a constant because it is a property of handheld
scanning rather than of an app (RepeatScanFilter.cs:14-20,31-41; used at
IBarcodeScannerService.cs:64,75). Browsers have no shared
camera-scanning primitive, so web heads keep NullBarcodeScannerService
(MMCA.Common.UI/Services/Capabilities/Media/NullBarcodeScannerService.cs:9) and hide the button
(NullBarcodeScannerService.cs:12). On MAUI the override is opt-in through UseCommonBarcodeScanner
rather than folded into the bundle, because a head that never scans should ship neither the ZXing
camera handler nor a camera permission declaration
(MMCA.Common.UI.Maui/HostingDependencyInjection.cs:92-97,114-125, and the default's own comment at
MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:77-80).
MauiBarcodeScannerService
(MMCA.Common.UI.Maui/Capabilities/Media/MauiBarcodeScannerService.cs:26) reports support on Android and
iOS only (MauiBarcodeScannerService.cs:48-55), requests the camera permission on the main thread
before any page opens, because a camera view opened without it stays black, so a denial or an
undeclared permission reads as null with no page shown
(MauiBarcodeScannerService.cs:10-13,58-75,78-83,153-163), then pushes
BarcodeScanPage modally over the current window page and pops it once, in a
finally (MauiBarcodeScannerService.cs:165-191,282-291). Its continuous session keeps one modal page
open for the whole session rather than one per code: on a decode the camera pauses, the callback runs
on the main thread with a token that is also cancelled when the operator ends the session, the text it
returns replaces the previous outcome over the camera view, and detection resumes after a 1.5-second
OutcomeDwell, which a repeat waits out too (MauiBarcodeScannerService.cs:102-116,151,198-242,249-280).
A callback exception is captured and rethrown with its original stack only after the page is popped,
while a denied camera or a missing window ends the session quietly
(MauiBarcodeScannerService.cs:123-142,267-272). The page itself is built in code rather than XAML so
the package ships no compiled resource dictionary, and it is partial only because CsWinRT1028
requires it on the windows TFM (MMCA.Common.UI.Maui/Capabilities/Media/BarcodeScanPage.cs:9-10,21-26).
It restricts decoding to two-dimensional formats to cut false positives on a shaky handheld frame
(BarcodeScanPage.cs:52-54) and detects only while the service waits on NextDecodeAsync: an
interlocked flag lets exactly one frame through per wait and the camera pauses on the hit
(BarcodeScanPage.cs:12-13,35-39,110-122,178-190). The outcome line sits over the bottom of the camera
view and is announced to a screen reader (BarcodeScanPage.cs:63-74,124-139), and Cancel ends the
session exactly once from any exit path (cancel button, a consumed back gesture so the service keeps
the single pop, disappearance, the caller's token)
(BarcodeScanPage.cs:15-18,141-167). The subtlest detail is
localization: the two page strings are passed as Func<string> delegates and invoked once per scan,
because the singleton service is constructed while the app is being built, which is before
MauiCultureInitializer restores the user's persisted language, so
resolving the text at construction would pin the modal to the device language forever
(MauiBarcodeScannerService.cs:18-24,87-90; the registration takes only the delegate form, so there
is no way to hand it fixed text, MMCA.Common.UI.Maui/HostingDependencyInjection.cs:99-104,114-123). That
is [Rubric §27, i18n] showing up inside a device capability.
Deep links: one funnel from native navigation into Blazor routing. The most involved runtime flow
in this group is the deep-link path
(ADR-043,
Website/docs-src/adr/043-mobile-deep-links-and-native-oauth-callback.md).
IDeepLinkDispatcher
(MMCA.Common.UI/Services/Capabilities/Navigation/IDeepLinkDispatcher.cs:10) is the single boundary between
native navigation sources (notification taps, home-screen app actions, app links, QR scans) and the
Blazor router. Native code calls Publish(route) with an app-relative route
(IDeepLinkDispatcher.cs:19); the shared DeepLinkListener component (in the UI-components group)
either receives it live via the RouteRequested event (IDeepLinkDispatcher.cs:13) or drains it
from a buffer after first render (IDeepLinkDispatcher.cs:22). The default
DeepLinkDispatcher
(MMCA.Common.UI/Services/Capabilities/Navigation/DeepLinkDispatcher.cs:22) is registered as a singleton
(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:91-93) because native callers publish
into it from outside any scope, and it does three jobs. First it validates the shape of the route:
Publish throws unless IsAppRelativeRoute passes, meaning exactly one leading slash followed by a
non-slash character, no backslash, no control character, and no scheme
(DeepLinkDispatcher.cs:113-136,228-237). That check is a security boundary, not tidiness: an exported
Android activity is reachable by an explicit intent from any app on the device, and an explicit
intent bypasses the manifest filter's scheme and host constraints, so a hostile caller can hand over
a path like //attacker.example/p that resolves protocol-relative against the WebView base and
leaves the app origin entirely (DeepLinkDispatcher.cs:97-105, SEC-Common-88 / SEC-ADC-65,
[Rubric §26, Front-End Security]). The check is deliberately on the shape and never on the
originating host, because a home-screen widget's host is a placeholder by design
(DeepLinkDispatcher.cs:106-111). A native head that receives a whole link calls TryComposeRoute
instead, which builds the route from the link's still-encoded path, query and fragment, drops scheme
and host, and also checks the path once percent-decoded (no control character, backslash,
protocol-relative opening or .. segment), because the router decodes before matching; answering
false lets the callback drop a hostile link silently rather than throw
(DeepLinkDispatcher.cs:138-175,181-196). Second it delivers each route once, to one listener: a
route goes only to the most recently attached listener, because a plain multicast event fanned one QR
scan out to every DeepLinkListener in the task and turned one scan into two posts, and the same
route published again within a two-second DuplicateWindow, measured on an injectable
TimeProvider, is dropped as the same delivery seen twice
(DeepLinkDispatcher.cs:10-20,25-28,37-46,48-81,252-256,267). Third it solves the cold-start race:
Publish makes the duplicate check, picks the listener and writes the single-entry, last-write-wins
buffer inside one Lock, because doing them as separate steps allowed an interleaving that dropped
the route entirely on a warm-boot deep link, where the native callback thread and the first render
are genuinely concurrent (DeepLinkDispatcher.cs:31,239-268); the listener drains it via
TryConsumePending under the same lock once it renders (DeepLinkDispatcher.cs:275-284), and the
chosen handler is invoked outside the lock so a listener that navigates on the callback never runs
under it (DeepLinkDispatcher.cs:270-271). The
event payload is DeepLinkRouteEventArgs, a one-property EventArgs
carrying the app-relative route (MMCA.Common.UI/Services/Capabilities/Navigation/DeepLinkRouteEventArgs.cs:4-10).
On MAUI the bridge is wired by DeviceCapabilitiesInitializer
(MMCA.Common.UI.Maui/DeviceCapabilitiesInitializer.cs:18), an IMauiInitializeService that hooks
LocalNotificationCenter.Current.NotificationActionTapped
(DeviceCapabilitiesInitializer.cs:33) and, skipping dismissals, hands the tapped notification's
ReturningData route to NotificationTapRoute
(DeviceCapabilitiesInitializer.cs:36-44). NotificationTapRoute
(MMCA.Common.UI.Maui/Capabilities/Notifications/NotificationTapRoute.cs:21) is an internal class
that applies the same TryComposeRoute rule every other native entry point uses
(NotificationTapRoute.cs:12-16,66-81), and it checks the route twice. Its TryPublish publishes a
safe route and drops one that is not, logging only the route's length, instead of throwing out of the
plugin's tap callback, where an escape would reach the process-wide unhandled-error handler
(NotificationTapRoute.cs:7-11,38-64,83-84). Its EnsureSchedulable runs at the other end of the
loop: MauiLocalNotificationService calls it before scheduling, so a
caller bug fails where it was written rather than when the user taps
(MMCA.Common.UI.Maui/Capabilities/Notifications/MauiLocalNotificationService.cs:41-50;
NotificationTapRoute.cs:23-36), then copies the
LocalNotificationRequest's DeepLinkRoute into the platform request's
ReturningData (MauiLocalNotificationService.cs:62). All of that wiring is
installed by UseMauiDeviceCapabilities on the MauiAppBuilder
(MMCA.Common.UI.Maui/HostingDependencyInjection.cs:40), which also calls UseLocalNotification()
and registers the native capability bundle (HostingDependencyInjection.cs:42-44).
Culture is applied through the same last-wins boundary. Switching language is host-specific too,
so it hides behind ICultureApplier: AddUIShared
TryAdds the web default that force-loads the server /culture/set endpoint, and UseMauiCulture()
(folded into UseMauiDeviceCapabilities at MMCA.Common.UI.Maui/HostingDependencyInjection.cs:51,
defined at HostingDependencyInjection.cs:138-143) replaces it with
MauiCultureApplier plus the MauiCultureInitializer
startup restore, because a hybrid head has no ASP.NET pipeline and would resolve that URL through the
Blazor router, matching no page and rendering not-found
(MMCA.Common.UI.Maui/Globalization/MauiCultureApplier.cs:8-12). The applier honors only the
allowlisted cultures (MauiCultureApplier.cs:32-35) and persists and activates the culture through
MauiCultureStore before it force-loads the WebView, an order the comment calls
load-bearing (MauiCultureApplier.cs:37-45); the store resolves the startup culture in the same
precedence order the web heads get from request localization, the stored explicit choice, then the
device locale matched by language, then the framework default
(MMCA.Common.UI.Maui/Globalization/MauiCultureStore.cs:31-44), and the initializer applies it
inside MauiAppBuilder.Build(), before any window exists, so the first render is already in the
right language (MMCA.Common.UI.Maui/Globalization/MauiCultureInitializer.cs:14,21-22). That is
ADR-027 and [Rubric §27, i18n]
meeting this group's composition rule.
The Day/Dark mode reaches the native chrome before the WebView paints. The theme preference
(ADR-028) lives in the WebView's
storage, which nothing native can read until Blazor has started, so without a native copy a cold dark
launch draws the page behind the WebView light first
(MMCA.Common.UI.Maui/Theme/MauiThemeStore.cs:3-13). MauiThemeStore
(MauiThemeStore.cs:15) is that copy: an internal static class over Preferences.Default under the
mmca.theme key, read synchronously for the same reason MauiCultureStore is
(MauiThemeStore.cs:11-12,21). Save writes "dark" or "light" (MauiThemeStore.cs:23-28),
ReadStoredIsDarkMode maps them back and answers null for a first launch or an unrecognized value
(MauiThemeStore.cs:37-42), and ApplyStoredTheme sets Application.UserAppTheme only when a mode
is stored, an application exists, and the theme actually differs, so a first launch keeps following
the OS exactly as the web preference does (MauiThemeStore.cs:44-65). Three callers close the loop.
The NativeThemeSync layout component, which a hybrid head renders through an IUIModule's
LayoutComponentTypes, mirrors every resolved or toggled mode into the store and onto
UserAppTheme (MMCA.Common.UI.Maui/Components/NativeThemeSync.razor:14-17,20,36-56);
MainPageBase applies the stored mode from its constructor, on the startup path ahead
of the first WebView frame (MMCA.Common.UI.Maui/MainPageBase.cs:23-28); and
MauiInitialThemeModeSource
(MMCA.Common.UI.Maui/Theme/MauiInitialThemeModeSource.cs:12) implements
IInitialThemeModeSource by reading the
store on every access rather than caching it, so MmcaThemeProviders renders its first frame in the
stored mode instead of light-then-dark and a value saved later in the session is never stale
(MauiInitialThemeModeSource.cs:5-11,15). The source is registered as a singleton in the native
bundle (MMCA.Common.UI.Maui/DependencyInjection.cs:89-91), so the shared theme components ask one
injected question and only the hybrid head answers it from native storage, the
[Rubric §18, UI Architecture] move this whole group is built on.
Wired-but-inert capabilities. A recurring, honest theme in this layer is capabilities that are
fully registered but deliberately do nothing yet, because their real backing requires credentials or
a later feature wave. Native push
(ADR-044,
Website/docs-src/adr/044-native-push-delivery.md) registers a real
IPushRegistrationService
(MMCA.Common.UI/Services/Capabilities/Notifications/IPushRegistrationService.cs:10) on MAUI heads
(MMCA.Common.UI.Maui/DependencyInjection.cs:101), and
MauiPushRegistrationService does the real orchestration, minting a
stable installation id into device preferences and PUTting the installation to the API's
Notifications/Devices endpoint over the authenticated client
(MMCA.Common.UI.Maui/Capabilities/Notifications/MauiPushRegistrationService.cs:24,85-87,113-116).
The interactive permission prompt runs first, outside any lock and with no time bound, so a user
still reading the dialog never holds up a sign-out (MauiPushRegistrationService.cs:45-48, :54).
The rest of registration is serialized behind a SemaphoreSlim, because a token callback on a
Firebase thread and the login pass on the renderer could otherwise both mint an id and leave two
server rows for one device (MauiPushRegistrationService.cs:26,39-43,55-63), and a 409 answer (the
id already belongs to another device, say from a restored backup) replaces the id and retries the
PUT once (MauiPushRegistrationService.cs:89-96). Sign-out waits at most five seconds for that
lock and sends the DELETE for the stored id even when the wait times out (:32, :137-153). What
keeps the pipeline inert is the token end: the IPushDeviceTokenProvider
default is NullPushDeviceTokenProvider, which asks for nothing and
always yields null
(MMCA.Common.UI/Services/Capabilities/Notifications/NullPushDeviceTokenProvider.cs:12-16), so a head
that does not opt in stays registered-but-tokenless
(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:64-68). The credentialed providers do
exist in the MAUI package behind TFM guards, FcmPushDeviceTokenProvider on Android and
ApnsPushDeviceTokenProvider on iOS/MacCatalyst, registered by AddMauiPushDeviceTokenProvider
(MMCA.Common.UI.Maui/DependencyInjection.cs:163-171), but both are configuration-gated
(Push:Fcm credentials, Push:Apns:Enabled), so a head with no push configuration stays inert even
after calling it (MMCA.Common.UI.Maui/Capabilities/Notifications/FcmPushDeviceTokenProvider.cs:14-16,
MMCA.Common.UI.Maui/Capabilities/Notifications/ApnsPushDeviceTokenProvider.cs:13-15). Each bounds
its platform token wait at ten seconds and yields null when it expires (FcmPushDeviceTokenProvider.cs:40,
:78-80; ApnsPushDeviceTokenProvider.cs:32). The
IExternalAuthBroker
(MMCA.Common.UI/Services/Capabilities/Auth/IExternalAuthBroker.cs:11) defaults to
UnavailableExternalAuthBroker so web heads keep their existing
anchor-href OAuth flow (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:57); its SignInAsync answers
ExternalSignInResult.Failed()
(MMCA.Common.UI/Services/Capabilities/Auth/UnavailableExternalAuthBroker.cs:13-14). The broker
returns ExternalSignInResult rather than a bare bool, and never throws for
a failed or dismissed flow (IExternalAuthBroker.cs:16-23): a sealed class with a private constructor, a shared Success instance
and a Failed(errorCode) factory, which carries the server's refusal code (for example
Auth.ExternalEmailNotVerified) so the Login page shows the same mapped refusal the web flow shows
instead of a generic "try again" for a sign-in that can never succeed
(MMCA.Common.UI/Services/Capabilities/Auth/ExternalSignInResult.cs:3-9,11-15,18,27,32). On MAUI the
callback's server error flows straight into that factory, and a received code ends in Success
(MMCA.Common.UI.Maui/Capabilities/Auth/MauiExternalAuthBroker.cs:142,154).
MauiExternalAuthBroker reports IsAvailable == false until the head
configures OAuth:MobileRedirectScheme
(MMCA.Common.UI.Maui/Capabilities/Auth/MauiExternalAuthBroker.cs:53,57), which is also why it is the one
Scoped registration in the native bundle: it navigates through the circuit's NavigationManager
after the system-browser round trip (MMCA.Common.UI.Maui/DependencyInjection.cs:108-111). Media
picking is the same shape read the other way: IMediaPickerService exposes
IsSupported (MMCA.Common.UI/Services/Capabilities/Media/IMediaPickerService.cs:12) so web heads render
a plain InputFile instead, "the affordance switch, not a degraded path"
(IMediaPickerService.cs:6-7,
ADR-045). Biometrics
are the same shape resolved: web heads keep NullBiometricAuthenticator,
which reports unavailable so the app-lock toggle stays hidden
(MMCA.Common.UI/Services/Capabilities/Auth/NullBiometricAuthenticator.cs:3-4), while native heads
register MauiBiometricAuthenticator
(MMCA.Common.UI.Maui/DependencyInjection.cs:86) and the feature stays behind the opt-in
DevicePreferenceKeys AppLockEnabled preference
(MMCA.Common.UI/Services/Capabilities/DeviceStorage/DevicePreferenceKeys.cs:9-10). This "contract present,
behavior inert" pattern is what lets shared components be written against the full capability surface
today while the platform work ships incrementally; each null default is a truthful
IsAvailable == false that hides its affordance rather than a stub that lies.
App lifecycle: the contract that re-arms the app lock.
IAppLifecycleNotifier
(MMCA.Common.UI/Services/Capabilities/DeviceStatus/IAppLifecycleNotifier.cs:13) reports the app
leaving the foreground and coming back: one Resumed event and the two signals a native host calls,
NotifyEnteredBackground and NotifyResumed (IAppLifecycleNotifier.cs:16,19,25). It exists because
a hybrid head keeps its Blazor render tree alive across a background/foreground cycle, so a gate that
engages only at first render stays open for whoever picks the device up next; web heads never raise
these events, which is the correct answer there because there is no app lock on the web
(IAppLifecycleNotifier.cs:6-11). The default AppLifecycleNotifier
(MMCA.Common.UI/Services/Capabilities/DeviceStatus/AppLifecycleNotifier.cs:9) is TryAdd-registered
as a singleton for the same reason the deep-link dispatcher is, the native callbacks run outside any
scope (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:95-97). It timestamps the
background entry under a Lock against an injectable TimeProvider that defaults to the system
clock, so the interval is testable rather than wall-clock bound (AppLifecycleNotifier.cs:9,11-12,20-26),
then raises Resumed with the elapsed time, falling back to TimeSpan.Zero for a resume with no
matching pause and clamping a negative interval to zero (AppLifecycleNotifier.cs:29-41). The payload
AppResumedEventArgs
(MMCA.Common.UI/Services/Capabilities/DeviceStatus/AppResumedEventArgs.cs:8) is one property,
BackgroundDuration (AppResumedEventArgs.cs:11). The native end is
WindowLifecycleExtensions
(MMCA.Common.UI.Maui/WindowLifecycleExtensions.cs:24), an extension(Window) member whose
AttachMmcaAppLifecycle forwards the MAUI window's Stopped and Resumed events into the notifier
(WindowLifecycleExtensions.cs:26,37,58-59); it resolves the notifier with GetService and skips
that forwarding when a head registered none, so calling it is safe on any host
(WindowLifecycleExtensions.cs:52-56), and the doc comment carries the one-call recipe for a head's
App.CreateWindow override (WindowLifecycleExtensions.cs:11-21). The same call keeps the window
out of the OS app-switcher snapshot while app lock is enabled, through
AppSnapshotProtection
(MMCA.Common.UI.Maui/Capabilities/Auth/AppSnapshotProtection.cs:18) wired to the window's
Activated and Deactivated events (WindowLifecycleExtensions.cs:28-34,42-50). On Android that
marks the activity window secure (FLAG_SECURE: blank recents thumbnail, no screenshots or screen
recording of the app); on iOS and Mac Catalyst it covers the window with an opaque view when it
resigns active and lifts it when it becomes active again; Windows has no switcher snapshot to protect,
and with app lock off nothing changes (AppSnapshotProtection.cs:5-10,56-65,66-105,107-134). The
enabled flag is read once from the AppLockEnabled preference at attach, never throwing
(AppSnapshotProtection.cs:30-44), and then kept current by
MauiDevicePreferences on every write or removal of that key, so turning app
lock on takes effect before the next trip to the background
(MMCA.Common.UI.Maui/Capabilities/DeviceStorage/MauiDevicePreferences.cs:45-49,60-63;
AppSnapshotProtection.cs:11-16). The consumer that closes the loop
is the shared BiometricGate component, which
subscribes on initialize and unsubscribes on dispose
(MMCA.Common.UI/Components/Capabilities/BiometricGate.razor:10,
MMCA.Common.UI/Components/Capabilities/BiometricGate.razor.cs:78,100,125) and re-locks only when the
app was away longer than its ReLockAfter threshold, 30 seconds by default
(BiometricGate.razor.cs:25,95-99). That threshold is why the event carries a duration at all: a
lock that fired on every task-switch flicker would train users to defeat it. [Rubric §26, Front-End Security] and [Rubric §11, Security].
Device preferences and the per-head lifetime split. IDevicePreferences
(MMCA.Common.UI/Services/Capabilities/DeviceStorage/IDevicePreferences.cs:11) stores per-device settings
(reminder lead time, haptics toggle, app-lock) that describe this device and never roam to the
server, which is why it is distinct from the server-side per-user preferences
(IDevicePreferences.cs:4-7). It is three members, a GetAsync that answers a caller-supplied
fallback when the value is absent or unreadable, a best-effort SetAsync, and RemoveAsync, over a
fixed set of supported value types (IDevicePreferences.cs:8-9,13-22). The three implementations show the
lifetime story clearly: MauiDevicePreferences persists JSON-encoded values
to native Preferences.Default under an mmca.devicePrefs. prefix
(MMCA.Common.UI.Maui/Capabilities/DeviceStorage/MauiDevicePreferences.cs:15,22),
BrowserDevicePreferences persists the same shape to localStorage
through the shared JS module
(MMCA.Common.UI/Services/Capabilities/DeviceStorage/BrowserDevicePreferences.cs:12,24-25), and
InMemoryDevicePreferences is registered Scoped
(DependencyInjection.cs:87-89) so the Blazor Server fallback holds per-circuit state in a
ConcurrentDictionary that lives for the scope only and does not survive a restart
(MMCA.Common.UI/Services/Capabilities/DeviceStorage/InMemoryDevicePreferences.cs:5-7,11). Never storing
secrets here is a documented rule, tokens belong in platform secure storage
(IDevicePreferences.cs:7), which ties this into [Rubric §26, Front-End Security] and
[Rubric §11, Security].
The offline cache and why sign-out has to wipe it. ILocalCacheStore
(MMCA.Common.UI/Services/Capabilities/DeviceStorage/ILocalCacheStore.cs:9) is the second storage
contract, a small JSON document cache holding last-known-good UI state for offline rendering
(an offline schedule snapshot, for instance) rather than secrets or query results
(ILocalCacheStore.cs:3-8). It is four members plus an IsAvailable flag: SetAsync, GetAsync,
RemoveAsync and ClearAsync (ILocalCacheStore.cs:12,16,20,23,36). ClearAsync carries the
security rule on its face and is what sign-out calls: snapshots are written in plaintext, survive
process restarts, and their keys identify a surface rather than a user, so leaving them in place
hands the next account on the device the previous account's rows the first time the network is
unavailable; it has no default body on purpose, because a store that forgot it would fail open and
keep the previous account's snapshots
(ILocalCacheStore.cs:25-36, [Rubric §26, Front-End Security]). All three adapters are here.
NullLocalCacheStore is the TryAdd default, unavailable with reads returning
default (MMCA.Common.UI/Services/Capabilities/DeviceStorage/NullLocalCacheStore.cs:4,7,14-15,
registered at MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:62), which is the right
answer on Blazor Server where SSR always has the live API. BrowserLocalCacheStore
puts the documents in localStorage under an mmca.localCache. prefix through the shared JS module
(MMCA.Common.UI/Services/Capabilities/DeviceStorage/BrowserLocalCacheStore.cs:10,12,29) and clears
by prefix rather than wiping the origin's storage (BrowserLocalCacheStore.cs:67-70), registered
Scoped for browser heads (DependencyInjection.cs:121). MauiLocalCacheStore
(MMCA.Common.UI.Maui/Capabilities/DeviceStorage/MauiLocalCacheStore.cs:47) writes one encrypted
JSON document per key into an mmca-cache folder (MauiLocalCacheStore.cs:10-14,50). Each document
is sealed with AES-256-GCM under a random key kept outside the folder, with the file name as
associated data so a document cannot be read back under another key's name, and when no key can be
kept nothing is written, so the cache never falls back to plaintext
(MauiLocalCacheStore.cs:15-23,55-61,103-116,235,250). Keys map to file names one to one: everything
outside lowercase ASCII letters, digits, - and . is escaped (_ and uppercase included), so two
keys never share a file, even on a case-insensitive file system (MauiLocalCacheStore.cs:39-42,194-223).
IO stays best-effort: a write goes to a sibling temp file renamed over the document, so a process kill
leaves the previous document rather than a torn one (which matters because the offline write queue
keeps every pending write in one document), and a missing, unreadable or unopenable document reads as
default, the unopenable one also deleted (MauiLocalCacheStore.cs:33-38,119-162,397,407).
Plaintext documents an earlier version left are moved, not dropped: before the first read or write of
a process each one is sealed into the new location, and the plaintext file is deleted only after its
sealed copy is in place (MauiLocalCacheStore.cs:24-32,505). ClearAsync deletes the key first, then
the folder and the earlier folder, so nothing written before sign-out can be opened again
(MauiLocalCacheStore.cs:173-192). The key sits behind ILocalCacheKeyStore
(MMCA.Common.UI.Maui/Capabilities/DeviceStorage/ILocalCacheKeyStore.cs:11), an internal
read/write/delete contract that uses no MAUI API, so the test project compiles it as source with the
store (ILocalCacheKeyStore.cs:3-10,15,20,23). In the app it is
MauiLocalCacheKeyStore
(MMCA.Common.UI.Maui/Capabilities/DeviceStorage/MauiLocalCacheKeyStore.cs:9) over SecureStorage
under mmca_local_cache_key, every call guarded the way
MauiSecureTokenStore guards the tokens, so an OS-invalidated key reads as no
key and the store starts over with a new key and an empty cache
(MauiLocalCacheKeyStore.cs:3-7,11,14-28). LocalCacheLocation
(MMCA.Common.UI.Maui/Capabilities/DeviceStorage/LocalCacheLocation.cs:11) picks a folder kept out of
device backups: Android's no-backup files folder; on iOS and Mac Catalyst a parent folder marked
excluded from backup (the parent, because sign-out deletes the cache folder itself and a recreated
folder would lose the mark); the app data folder on Windows. It also names the LegacyDirectory
earlier versions used (LocalCacheLocation.cs:3-10,14,18,20-49). The native bundle composes the
three into one singleton registration (MMCA.Common.UI.Maui/DependencyInjection.cs:77-85).
The native shell pieces that ship beside the contracts. Several members of this group are not
capability contracts at all but the MAUI-side plumbing that ships with them. The token pipeline is
split in two on purpose: MauiSecureTokenStore
(MMCA.Common.UI.Maui/Services/MauiSecureTokenStore.cs:22) is the raw
ISecureTokenStore, holding both tokens in
SecureStorage (Android Keystore, iOS Keychain, Windows DPAPI) with every call guarded so an
OS-invalidated keystore entry degrades to one clean re-login rather than an unhandled throw that
would brick the app on launch (MauiSecureTokenStore.cs:5-21); it writes the refresh token first and
drops both entries on a partial failure so storage is never a mismatched pair
(MauiSecureTokenStore.cs:34-53). The managed half above it is no longer MAUI code: the shared
SecureStoreTokenStorageService in
MMCA.Common.UI is the
ITokenStorageService that adds the expiry
check, the single-flight refresh and the end-of-session clear (MauiSecureTokenStore.cs:16-20).
Both halves are registered Scoped together by AddCommonMauiTokenStorage()
(MMCA.Common.UI.Maui/DependencyInjection.cs:137-141); the split is what keeps the graph acyclic,
since storage depends on the refresher and the refresher depends on the raw store rather than back on
storage, and the Scoped lifetime matches the browser siblings so component code depends on one
lifetime everywhere (MMCA.Common.UI.Maui/DependencyInjection.cs:128-134).
MauiDeviceMetadataReporter
(MMCA.Common.UI.Maui/Services/MauiDeviceMetadataReporter.cs:22) is the native
IDeviceMetadataReporter: it reads the
device's name, model, manufacturer, platform, idiom and physical-or-virtual type from DeviceInfo,
adds a per-install id, and PUTs that to auth/sessions/current/device over the authenticated
APIClient, whose bearer names the session the server records it on
(MauiDeviceMetadataReporter.cs:8-12,30-47). The id is a random GUID minted on first use and kept
under its own mmca.device.installationId key in IDevicePreferences, because
iOS exposes no stable device identifier, and it is deliberately not the push installation id, which
the push service replaces on a collision (MauiDeviceMetadataReporter.cs:14-17,27,68-79). The report
never throws: a rejected status or an exception is logged and answers false, so the refresh backfill
retries and the session keeps its user-agent description
(MauiDeviceMetadataReporter.cs:17-18,49-65,81-85). Web heads keep the TryAdd default
NullDeviceMetadataReporter, since their
sessions are described from the user agent
(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:70-72); the MAUI bundle registers the
reporter as a singleton because the once-per-process backfill is tracked per reporter instance, and it
is sent after each sign-in and, until one report succeeds, after a token refresh
(MMCA.Common.UI.Maui/DependencyInjection.cs:98-102). MauiAppUserAgentHandler
(MMCA.Common.UI.Maui/Services/MauiAppUserAgentHandler.cs:14) is the native head's identity on the
wire: an internal DelegatingHandler that replaces, rather than appends to, the platform's default
User-Agent on every APIClient request with one built once per process by
AppUserAgent from AppInfo and DeviceInfo
(MauiAppUserAgentHandler.cs:21-25,32-35), so the refresh session the server records at login,
register and refresh names the app and the signed-in devices list reads "{App} app on {Platform}"
rather than "Unrecognized device"; the browser heads get the visitor's own header through
BrowserOriginHandler instead
(MauiAppUserAgentHandler.cs:5-12). AddCommonMauiAppUserAgent() registers it transient and
appends it to the APIClient that AddUIShared already registered, so it is called after
AddUIShared (MMCA.Common.UI.Maui/DependencyInjection.cs:185-195). MainPageBase
(MMCA.Common.UI.Maui/MainPageBase.cs:21) is the ContentPage base a hybrid head's XAML points at:
its constructor applies the stored Day/Dark mode described above (MainPageBase.cs:28), it consumes
the platform back gesture (MainPageBase.cs:216-221), captures the renderer-scoped IJSRuntime out
of the BlazorWebView through a TaskCompletionSource (MainPageBase.cs:223-224,236-240,248), and
forwards the press to
MauiBackNavigationBridge
(MainPageBase.cs:255), quitting the app only when the WebView history is at its root, when the
dispatch or the runtime capture fails, or when the interop throws
(MainPageBase.cs:232-268). On Android it also hands the page native measurements before the first
load, hooked from OnHandlerChanging, the last moment before the web view initializes
(MainPageBase.cs:100-115): MmcaStatusBar/<css px> and MmcaNavigationBar/<css px> tokens appended
to the web view's user agent, because the Android web view reports env(safe-area-inset-top) as 0 on
a cold launch and an edge-to-edge app bar would draw under the status bar; theme-prepaint.js in
MMCA.Common.UI turns each token into a CSS fallback variable the head's spacer reads
(MainPageBase.cs:117-162). The same user-agent route carries an MmcaTheme/dark|light token from
MauiThemeStore on Android and, through WKWebView's application name, on iOS and
Mac Catalyst, so a relaunch right after a theme switch paints the mode saved natively rather than the
one the WebView last flushed to its own storage (MainPageBase.cs:138-141,165-212). A virtual
UseDarkStatusBarIcons (null by default) lets a head pick dark or light Android status bar icons,
applied through the window's insets controller when the handler attaches and again on every app theme
change (MainPageBase.cs:37-46,52-98).
MauiPublicLinkBuilder
(MMCA.Common.UI.Maui/Services/MauiPublicLinkBuilder.cs:14) overrides the
IPublicLinkBuilder so share, copy-link and QR
affordances emit the public web URL pinned in PublicSite:BaseUrl rather than the WebView's internal
origin, and it throws at construction when that key is missing
(MauiPublicLinkBuilder.cs:17,28-32). Finally MauiErrorHandlingInitializer
(MMCA.Common.UI.Maui/MauiErrorHandlingInitializer.cs:18), installed by UseMmcaMauiErrorHandling
(MMCA.Common.UI.Maui/HostingDependencyInjection.cs:86-90), hooks the two process-wide last-chance
handlers (AppDomain.UnhandledException and TaskScheduler.UnobservedTaskException) behind a static
guard so a head that calls the extension twice does not report every crash twice
(MauiErrorHandlingInitializer.cs:6-8,28-31). These are the [Rubric §11, Security],
[Rubric §25, Navigation & IA] and [Rubric §13, Observability & Operability] concerns that would
otherwise be hand-written in every native head.
Where this group sits. The capability contracts are consumed by the shared Blazor components and
pages (the UI-components group), by the connectivity, battery and accessibility surfaces, and by the
deep-link and notification paths. Nothing here references EF Core, the API, or a message broker
directly, apart from the push registration service's authenticated call to the Devices endpoint and
the device metadata reporter's call to the current-session endpoint: it is presentation-edge
adaptation, sitting alongside the rest of MMCA.Common.UI at the top of the
dependency flow. Read it as the codebase's answer to a specific hard problem, how to write
device-aware UI once and run it on a server, in a browser, and on a phone, with the platform
differences pushed entirely into injected adapters and the shared components none the wiser. The
governing decisions are
ADR-042 (the
abstraction itself, the separate MAUI-TFM package, and the opt-in camera scanner),
ADR-043
(deep links and the native OAuth callback),
ADR-044 (native push delivery),
ADR-045 (managed
file storage and avatars, the backing for the media-picker capability), and
ADR-139 (passkeys,
the browser-only WebAuthn capability).
ILocalCacheKeyStore
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.DeviceStorage·MMCA.Common.UI.Maui/Capabilities/DeviceStorage/ILocalCacheKeyStore.cs:11· Level 0 · interface (internal)
- What it is: the internal three-member contract for where MauiLocalCacheStore keeps the key it encrypts its documents with, outside the cache folder (
MMCA.Common.UI.Maui/Capabilities/DeviceStorage/ILocalCacheKeyStore.cs:3-11). - Depends on: nothing first-party; BCL
Taskandbyte[]only. - Concept introduced: key custody kept apart from the ciphertext. Encrypting a file buys nothing if the key sits next to it: a copy of the app folder or a device backup would carry both halves. This interface names the one place the key lives, and the MAUI registration backs it with the platform secure storage, so the key never touches the cache folder or a backup of it (
ILocalCacheKeyStore.cs:4-6).[Rubric §26, Front-End Security]§26 assesses what the client persists and how it is protected. The contract is what lets the offline cache be encrypted at rest without the store ever writing its own key to disk.[Rubric §14, Testability]§14 assesses whether behavior can be exercised without the real platform. The interface uses no MAUI API, so the test project compiles it as source alongside the store and supplies its own key store (ILocalCacheKeyStore.cs:7-9).
- Walkthrough
ReadAsync()(ILocalCacheKeyStore.cs:15): the stored key, ornullwhen none is stored or the stored one is unreadable (:13-14). Absent and unreadable collapse to one answer on purpose: either way the store has to start over with a new key.WriteAsync(byte[] key)(ILocalCacheKeyStore.cs:20): stores the key, replacing any previous one, and returnsfalsewhen the platform refused it (:17-19).DeleteAsync()(ILocalCacheKeyStore.cs:23): best effort, because a key that cannot be deleted is already unreadable (:22).
- Why it's built this way:
nullandfalseinstead of exceptions turn every platform failure into two answers the store can act on (create a new key, or skip the write), which keeps the cache best effort end to end. The type isinternal, so no head can swap the key custody; the one implementation is MauiLocalCacheKeyStore. - Where it's used: implemented by MauiLocalCacheKeyStore and consumed only by MauiLocalCacheStore: taken by its constructor (
MMCA.Common.UI.Maui/Capabilities/DeviceStorage/MauiLocalCacheStore.cs:86), read and, when needed, written inLoadKeyAsync(MauiLocalCacheStore.cs:460-474), and deleted first inClearAsync(MauiLocalCacheStore.cs:181). The store's two test classes,MauiLocalCacheStoreTestsandMauiLocalCacheStoreEncryptionTests, reference it (MMCA.Common/Tests/Presentation/MMCA.Common.UI.Tests/Services/Capabilities/DeviceStorage/).
MauiErrorHandlingInitializer
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui·MMCA.Common.UI.Maui/MauiErrorHandlingInitializer.cs:18· Level 0 · class (sealed partial)
- What it is: the startup hook that installs the two process-wide last-chance exception handlers for a MAUI head,
AppDomain.UnhandledExceptionandTaskScheduler.UnobservedTaskException, and reports whatever they catch to the app's logger plus an optional crash-reporter callback (MMCA.Common.UI.Maui/MauiErrorHandlingInitializer.cs:5-10,18). A head never constructs it directly: HostingDependencyInjection'sUseMmcaMauiErrorHandling(...)builds and registers it. - Depends on: no first-party types. Externals:
IMauiInitializeService(MAUI hosting) as the contract it implements (MauiErrorHandlingInitializer.cs:18),Microsoft.Extensions.LoggingforILoggerFactory/ILoggerand the[LoggerMessage]source generator (MauiErrorHandlingInitializer.cs:1,127-128), and the BCLSystem.Threading.Locktype plusAppDomainandTaskScheduler(MauiErrorHandlingInitializer.cs:30,70-71). - Concept introduced: the last-chance handler, and why it is an initializer rather than a builder call. Two managed failure modes escape every
trya component can write: an exception thrown on a thread nobody is awaiting (which reachesAppDomain.UnhandledExceptionimmediately before the process dies) and a faultedTasknobody observed (which the finalizer thread re-raises throughTaskScheduler.UnobservedTaskExceptionat the next collection). Hooking them needs anILogger, and the container that can supply one only exists once the MAUI app has been built, so the work cannot happen in the builder extension itself.IMauiInitializeService.Initializeis the first point where the app and its service provider are both available, which is the same reason DeviceCapabilitiesInitializer lives at this layer (MauiErrorHandlingInitializer.cs:11-16).[Rubric §13, Observability & Operability]§13 assesses whether failures become visible signals instead of silence. This turns two categories of otherwise-invisible crash into aCriticallog entry under a dedicated category,MMCA.Common.UI.Maui.UnhandledException(MauiErrorHandlingInitializer.cs:26,127), and gives an app one hook to forward the same event to a real crash reporter.[Rubric §29, Resilience & Business Continuity]§29 assesses graceful behavior at the edges. The unobserved-task path is not just reporting: callingSetObserved()is what keeps a faulted fire-and-forget task from escalating into a process kill at the next collection (MauiErrorHandlingInitializer.cs:100-103).[Rubric §29, Resilience, Reliability & Business Continuity]§29 assesses whether infrastructure concerns are composed once instead of scattered. One registration inMauiProgramcovers the whole process, and no component has to remember anything.
- Walkthrough: two public constants name the source tags handed to the callback,
AppDomainSource="AppDomain"andTaskSchedulerSource="TaskScheduler"(MauiErrorHandlingInitializer.cs:21,24), so a crash reporter can branch on which path fired without string-matching a message. The logger category is a private constant (MauiErrorHandlingInitializer.cs:26). The once-guard is deliberately static:HookSync(aLock) and the_hookedflag (MauiErrorHandlingInitializer.cs:30-31), because the events themselves are process-wide statics and a head that called the builder extension twice would otherwise report every crash twice (MauiErrorHandlingInitializer.cs:28-29). Instance state is only the optional callback_onUnhandled(MauiErrorHandlingInitializer.cs:33) and the resolved_logger(MauiErrorHandlingInitializer.cs:35). The constructor takes the callback and nothing else (MauiErrorHandlingInitializer.cs:42-43).Initialize(IServiceProvider)null-guards its argument, resolves the logger withGetService<ILoggerFactory>()?.CreateLogger(...)rather thanGetRequiredServiceso a head that configured no logging still gets the handlers and the callback (it just has nowhere to write), then callsHookOnce(this)(MauiErrorHandlingInitializer.cs:46-55).HookOncetakes the lock, returns immediately if already hooked, otherwise sets the flag and subscribes both handlers; the write lives in a static method precisely because the state it writes is static (S2696), and the first initializer instance to run owns the handlers for the life of the process (MauiErrorHandlingInitializer.cs:57-73).OnAppDomainUnhandledExceptionreadse.ExceptionObject, which is typed asobjectbecause the runtime can surface a throw that is not a CLR exception at all, and substitutes a stand-inInvalidOperationExceptionso the report shape stays uniform for every callback consumer (MauiErrorHandlingInitializer.cs:75-86).OnUnobservedTaskExceptioncallse.SetObserved()first, ahead of anything that can throw, then reportse.Exceptionor a stand-in (MauiErrorHandlingInitializer.cs:96-107). Both handler bodies wrap everything in a catch-all with CA1031 suppressed and the reason inline: on the last-chance path there is no outer handler left to tell, and the logger may be the very thing that just failed (MauiErrorHandlingInitializer.cs:87-93,108-114).Reportlogs when a logger exists and then invokes the callback (MauiErrorHandlingInitializer.cs:117-125), and the log itself is a source-generated[LoggerMessage]atLogLevel.Critical(MauiErrorHandlingInitializer.cs:127-128), so the hot-path allocation of a formatted message is avoided even here. - Why it's built this way: the ordering rules that govern the rest of this group do not apply to this one call, and the XML doc on
UseMmcaMauiErrorHandlingsays so: because the handlers are installed when the app is built, a logging provider registered after the call is still picked up (MMCA.Common.UI.Maui/HostingDependencyInjection.cs:72-76). The swallow-everything handler bodies are a deliberate trade: a crash reporter that throws on the last-chance path replaces one crash with a worse one (MauiErrorHandlingInitializer.cs:87,108-114). The static once-guard is the only correct shape given that the underlying events are process-wide. - Where it's used: registered as an
IMauiInitializeServicesingleton instance (not a type registration, because the callback has to be captured) byUseMmcaMauiErrorHandling(...)(MMCA.Common.UI.Maui/HostingDependencyInjection.cs:86-90). Both MAUI heads call it with no callback: ADC atMMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI/MauiProgram.cs:115and Store atMMCA.Store/Source/Hosts/UI/MMCA.Store.UI/MauiProgram.cs:74, each with an inline comment restating that the call is ordering-insensitive (MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI/MauiProgram.cs:110-114). - Caveats / not-in-source: this catches managed exceptions only. Anything that never becomes a CLR exception (a native crash such as SIGSEGV, an Objective-C
NSExceptionon iOS, an Android ANR, a stack overflow, or a fail-fast) tears the process down below the runtime and no managed handler runs, so a head needing full crash coverage still pairs this with a platform crash reporter (MMCA.Common.UI.Maui/HostingDependencyInjection.cs:64-68). Not determinable from source: whether any head actually supplies anonUnhandledcallback in a shipped configuration; both call sites read as parameterless today.
MauiLocalCacheKeyStore
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.DeviceStorage·MMCA.Common.UI.Maui/Capabilities/DeviceStorage/MauiLocalCacheKeyStore.cs:9· Level 1 · class (internal sealed)
- What it is: the MAUI ILocalCacheKeyStore, keeping the offline cache's document key Base64-encoded under one
SecureStorageentry (Android Keystore, iOS Keychain, Windows DPAPI) (MMCA.Common.UI.Maui/Capabilities/DeviceStorage/MauiLocalCacheKeyStore.cs:3-11). - Depends on: ILocalCacheKeyStore; MAUI Essentials
SecureStorage.Default; BCLConvertfor Base64. - Concept: the guarded secure-storage pattern MauiSecureTokenStore applies to the auth tokens, reused for one key. The OS invalidates secure entries on its own schedule and the raw API then throws a platform exception, so every call is guarded and an unreadable key reads as no key; the store then starts over with a new key and an empty cache (
MauiLocalCacheKeyStore.cs:5-7).[Rubric §29, Resilience & Business Continuity]§29 assesses graceful behavior when a dependency fails. An OS-invalidated keystore entry costs the user a cold cache, not a crash on launch.
- Walkthrough
StorageKey = "mmca_local_cache_key"(MauiLocalCacheKeyStore.cs:11): the single secure-storage entry name.ReadAsync()(MauiLocalCacheKeyStore.cs:14): reads the entry and Base64-decodes it, returningnullfor a missing or empty value (:18-19). Any exception removes the entry and returnsnull(:21-27); the catch-all carries a CA1031 suppression with the reason inline, that the platform exception type differs per OS and none of them are recoverable here (:21).WriteAsync(byte[] key)(MauiLocalCacheKeyStore.cs:31): null-guards the key (:33), stores the Base64 string and returnstrue(:37-38); any exception removes the entry and returnsfalse(:40-46), which the caller treats as "do not cache" (:40).DeleteAsync()(MauiLocalCacheKeyStore.cs:50) calls the privateRemove()(:56), itself wrapped in a catch-all, because an entry that can be neither read nor deleted is overwritten by the next write (:60-67).
- Why it's built this way: removing the entry after a failed read or write means the next write starts from a clean slot instead of hitting the same broken entry every launch. Base64 is there because the
SecureStoragecalls take and return strings (MauiLocalCacheKeyStore.cs:18,37). - Where it's used: constructed directly, not resolved, inside the
ILocalCacheStorefactory in DependencyInjection'sAddMauiDeviceCapabilities(MMCA.Common.UI.Maui/DependencyInjection.cs:81-85). It has no other consumer. - Caveats / not-in-source: no test references this class; the store's tests exercise the ILocalCacheKeyStore contract instead, so the
SecureStoragebehavior itself is untested here.
MauiLocalCacheStore
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.DeviceStorage·MMCA.Common.UI.Maui/Capabilities/DeviceStorage/MauiLocalCacheStore.cs:47· Level 1 · class (sealed)
- What it is: the MAUI adapter for ILocalCacheStore: one JSON document per key in a dedicated folder, each sealed with AES-256-GCM under a random key held in platform secure storage, with all IO best effort so a failed write or an unreadable file reads as
default(MMCA.Common.UI.Maui/Capabilities/DeviceStorage/MauiLocalCacheStore.cs:10-23,47). - Depends on: ILocalCacheStore and ILocalCacheKeyStore; BCL
System.IO,System.Security.Cryptography(AesGcm,RandomNumberGenerator) andSystem.Text.Json, plusMicrosoft.Extensions.Logging(MauiLocalCacheStore.cs:1-6). It uses no MAUI API, so the test project compiles the file as source (MauiLocalCacheStore.cs:43-45); the platform folder choice lives in LocalCacheLocation. - Concept introduced: on-device state that outlives the network, encrypted at rest. Unlike IDevicePreferences, which holds settings the user chose, this holds server data the app may need to redraw without a network, and the offline write queue keeps every pending write in ONE document here (
MauiLocalCacheStore.cs:33-37). Three mechanisms carry it. Authenticated encryption binds each document to its file name as associated data, so a document cannot be read back under another key's name (:16-19). A write goes to a sibling temp file that replaces the document in one rename, so a process kill or a cancelled token leaves the previous document intact instead of a torn queue (:33-37). And plaintext documents from earlier versions are sealed and moved, not dropped, because they include the user's pending work (:24-31).[Rubric §29, Resilience & Business Continuity]§29 assesses degradation under dependency failure. Paired with IConnectivityStatusService, the cache lets shared components render a snapshot when the API is unreachable, and the atomic rename keeps queued writes from being lost to a mid-write kill.[Rubric §26, Front-End Security]§26 assesses what the client persists and how it is protected. Cached server data and queued writes are unreadable without the secure-storage key, and when no key can be kept nothing is written: the cache never falls back to plaintext (:20-21).[Rubric §30, Compliance/Privacy]§30 assesses whether personal data is removed when it should be.ClearAsync, which sign-out calls, deletes the folder, the folder earlier versions used, and the key (:21-22), so nothing cached before it can be opened again.
- Walkthrough
- Constants (
MauiLocalCacheStore.cs:50-61): the publicFolderName = "mmca-cache"(:50), the.jsonand.tmpextensions (:52-53), and the sealed layout[format][nonce][tag][ciphertext]: a one-byteFormatVersion = 1, a 32-byte key, a 12-byte nonce and a 16-byte tag, so a 29-byte header (:55-61). The format byte is never the first byte of a JSON text, so an earlier plaintext document never passes for a sealed one (:55-56). - Fields (
MauiLocalCacheStore.cs:68-76): the folder, the optional legacy folder, the key store, an optional logger, aLock, and_keyLoad, the one key load every caller shares, reset byClearAsyncand retried after a load that could not keep a key (:74-76). - The
internalconstructor (MauiLocalCacheStore.cs:86) guards the folder and key store and drops the legacy folder when it is blank or the same folder as the target (:88-95, comparing full paths inIsSameFolderat:228-232). IsAvailable(MauiLocalCacheStore.cs:99):true.SetAsync<T>(string key, T value, CancellationToken = default)(MauiLocalCacheStore.cs:103): guards the key, awaits the document key and returns without writing when none could be kept (:107-112), otherwise serializes to UTF-8 and hands off toWriteSealedAsync(:114-115). A caller cancellation propagates and the previous document stays (:102).GetAsync<T>(string key, CancellationToken = default)(MauiLocalCacheStore.cs:119): returnsdefaultwithout a key (:123-127) or without a file (:133-136); otherwise reads the bytes, opens them, and deletes a document that will not open (a torn file or one sealed under another key,:138-146) before deserializing (:148).IOException,UnauthorizedAccessExceptionandJsonExceptioncollapse todefault(:150-161).RemoveAsync(string key, CancellationToken = default)(MauiLocalCacheStore.cs:165): deletes the key's file quietly (:169).ClearAsync(CancellationToken = default)(MauiLocalCacheStore.cs:178): deletes the key first, so a load racing it finds no key and starts over with a new one (:180-181), then the folder and the legacy folder (:182-186), then resets_keyLoadunder the lock (:188-191).ToFileName(string key)(MauiLocalCacheStore.cs:203): a one-to-one mapping. Lowercase ASCII letters, digits,-and.stay; every other character,_and uppercase included, becomes_plus two lowercase hex digits per UTF-8 byte (:194-200,205-222,IsKeptAsIsat:225-226). Escaping_makes it reversible, and escaping uppercase stops a case-insensitive file system from merging two keys.Seal(MauiLocalCacheStore.cs:235) fills a random nonce and encrypts withAesGcm, passing the UTF-8 file name as associated data (:237-246).Open(:250) rejects anything shorter than the header or with the wrong format byte (:252-255) and maps aCryptographicException(wrong key, altered bytes, another file name) tonull(:269-272).WriteSealedAsync(MauiLocalCacheStore.cs:397): seals, writes<file>.<guid>.tmp, thenFile.Move(tempPath, path, overwrite: true)(:399-407); an IO failure returnsfalseand keeps the previous document, and thefinallyalways deletes the temp file (:410-423).GetKeyAsync(MauiLocalCacheStore.cs:431): under_keySyncit reuses the shared load unless that faulted or was cancelled (:434-442), awaits it throughWaitAsyncwith the caller's token (:444), and clears it when it returnednullso the next call tries again (:445-455).LoadKeyAsync(MauiLocalCacheStore.cs:460): anything other than a stored 32-byte key is replaced by a fresh random one, and a refused write returnsnull, leaving plaintext documents where they are (:462-474). A newly created key means any sealed document already in the folder was sealed under a key the OS dropped, so those are deleted BEFORE anything is sealed under the new key (:476-481,DeleteSealedDocumentsat:351). It then moves plaintext documents from the legacy folder (removing that folder once empty) and from the store's own folder, and logs once how many non-JSON files it deleted, through aLoggerMessage.Definewarning (:483-494,:63-66).MovePlaintextDocumentsAsync(MauiLocalCacheStore.cs:505): deletes temp files a killed write left (:512-517), keeps sealed documents in the store's folder but deletes sealed ones found elsewhere (:533-543), deletes and counts plaintext that is not JSON (:545-550, parsed BOM-tolerant byReadPlaintextJsonat:276), and seals the rest. From another folder the plaintext file goes only after its sealed copy is in place; in the same folder the rename replaces it (:552-557).
- Constants (
- Why it's built this way: the folder now holds the user's pending writes, not only a redraw snapshot, so it is encrypted at rest under a key the OS keystore guards, yet it stays best effort: no key, a torn file, a wrong key and a refused write all read as
defaultor a skipped write, degrading to a live fetch rather than an error. File-per-key JSON keeps the store free of an embedded database to ship or migrate. The one-to-one file name mapping matches the browser store, which keeps keys verbatim, so two distinct keys never share a file (MauiLocalCacheStore.cs:39-41). ADR-144 (offline writes and delta reads) and ADR-136 (installable web app) both reference this store. - Where it's used: registered as the
ILocalCacheStoresingleton through a factory inAddMauiDeviceCapabilitiesthat passes the folder from LocalCacheLocation, a new MauiLocalCacheKeyStore, the legacy folder and an optionalILogger<MauiLocalCacheStore>(MMCA.Common.UI.Maui/DependencyInjection.cs:77-85). Siblings are BrowserLocalCacheStore and the permanently unavailable NullLocalCacheStore (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:62). Covered byMauiLocalCacheStoreTestsandMauiLocalCacheStoreEncryptionTests(MMCA.Common/Tests/Presentation/MMCA.Common.UI.Tests/Services/Capabilities/DeviceStorage/). - Caveats / not-in-source: a caller's token stops only that caller's wait, not the shared key load (
MauiLocalCacheStore.cs:444), and the plaintext move writes withCancellationToken.None(:554), so the first read or write of a process can take as long as the move does. Not determinable from source: how large an earlier plaintext cache gets in practice, and so how long that first call takes.
LocalCacheLocation
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.DeviceStorage·MMCA.Common.UI.Maui/Capabilities/DeviceStorage/LocalCacheLocation.cs:11· Level 2 · class (internal static)
- What it is: resolves where MauiLocalCacheStore keeps its documents, a folder the platform leaves out of device backups, and names the folder earlier versions kept plaintext documents in (
MMCA.Common.UI.Maui/Capabilities/DeviceStorage/LocalCacheLocation.cs:3-11). - Depends on: MauiLocalCacheStore for
FolderName; MAUIFileSystem.AppDataDirectory; AndroidApplication.Context.NoBackupFilesDir; AppleFoundation.NSUrlandNSNumber. - Concept: per-platform backup exclusion behind one compile-time switch. Android uses the app's no-backup files folder, which Auto Backup never copies; iOS and Mac Catalyst mark a parent folder excluded from iCloud and computer backups (the parent, because sign-out deletes the cache folder itself and a recreated folder would lose the mark); Windows keeps the app data folder (
LocalCacheLocation.cs:4-8).[Rubric §30, Compliance/Privacy]§30 assesses where personal data is allowed to travel. Keeping the cache out of device backups keeps cached server data and queued writes on the device that produced them.
- Walkthrough
LegacyDirectory(LocalCacheLocation.cs:14):mmca-cacheunderFileSystem.AppDataDirectory, the earlier plaintext location.Resolve()(LocalCacheLocation.cs:18):mmca-cacheunder the platform's no-backup root.- Android (
LocalCacheLocation.cs:20-22):NoBackupFilesDir?.AbsolutePath, falling back to the app data folder when it is null. - iOS and Mac Catalyst (
LocalCacheLocation.cs:23-46): anmmca-no-backupfolder under app data (:24,28), created and marked withNSUrl.IsExcludedFromBackupKey(:31-34).IOExceptionandUnauthorizedAccessExceptionare swallowed as best effort, because the documents are sealed under a key that is not backed up either (:36-43). - Every other target (
LocalCacheLocation.cs:47-48): the app data folder itself.
- Why it's built this way: keeping the platform calls here leaves MauiLocalCacheStore free of MAUI API so its tests compile it as source (
MauiLocalCacheStore.cs:43-45). On the fallback targetResolve()andLegacyDirectoryare the same folder, which the store's constructor recognizes and treats as no legacy folder (MauiLocalCacheStore.cs:92-94), so the plaintext move runs in place. - Where it's used: only the
ILocalCacheStorefactory in DependencyInjection'sAddMauiDeviceCapabilities(MMCA.Common.UI.Maui/DependencyInjection.cs:82,84). - Caveats / not-in-source: the result of
SetResourceand its error are discarded (LocalCacheLocation.cs:34), so an iOS folder the OS refused to mark is not reported. Not determinable from source: whether a given iOS version honors the mark for every backup path.
MainPageBase
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui·MMCA.Common.UI.Maui/MainPageBase.cs:21· Level 2 · class (abstract)
- What it is: the base
ContentPagefor a MAUI Blazor Hybrid head whose XAML hosts a singleBlazorWebView. It intercepts the platform back gesture (Android hardware back, iOS swipe) and forwards it into the WebView's own history stack, quitting the app only when the WebView has nowhere left to go (MMCA.Common.UI.Maui/MainPageBase.cs:8-12,21). - Depends on: first-party, MauiBackNavigationBridge and its BackNavigationResult return type, imported from
MMCA.Common.UI.Services.Navigation(MainPageBase.cs:4,255-256). Externals:ContentPage,MainThreadandApplication.Current(MAUI),Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebView(MainPageBase.cs:1), andMicrosoft.JSInterop.IJSRuntime(MainPageBase.cs:2). - Concept introduced: a native gesture routed into web history. A hybrid head has two navigation stacks that know nothing about each other: the native page stack and the WebView's
history. Without this base, Android's back button pops the native stack, and since a hybrid head has exactly one page, the app exits no matter how deep the Blazor router has navigated. This type turns the native gesture into a question asked of the web stack first, and treats "exit the app" as the answer of last resort.[Rubric §25, Navigation & IA]§25 assesses whether navigation intent is modeled coherently across every entry point. Funnelling the hardware gesture through the same history the Blazor router drives keeps one navigation model instead of two competing ones.[Rubric §18, UI Architecture]§18 assesses how much host-specific plumbing leaks into app code. Because the base owns the whole interception, a head adopts it in two edits: point the XAML root element at this type, and overrideHostWebViewto return thex:Named control (MainPageBase.cs:13-19).[Rubric §29, Resilience & Business Continuity]§29 assesses graceful behavior at edge states. Every failure path here (WebView not hydrated, dispatch refused, interop threw) ends in a clean quit rather than a swallowed gesture or an unhandled exception.
- Walkthrough: the protected constructor calls
MauiThemeStore.ApplyStoredTheme()first (MauiThemeStoreis MauiThemeStore,MainPageBase.cs:28), so the page behind theBlazorWebViewstarts in the persisted Day/Dark mode (ADR-028) instead of flashing the OS theme until Blazor's first render;NativeThemeSynckeeps it in sync afterwards (MainPageBase.cs:23-27).HostWebViewis an abstract protected property (MainPageBase.cs:35): the XAML-generatedx:Namefield is private to the derived partial class, so the base can only reach the control through an override (MainPageBase.cs:30-34).OnBackButtonPressed()startsHandleBackAsync()without awaiting it and returnstrue, which consumes the gesture immediately and moves the decision off the UI thread (MainPageBase.cs:216-221).HandleBackAsync()then bridges a synchronous API to async work:BlazorWebViewonly exposes theAction<IServiceProvider>dispatch overload, so the method creates aTaskCompletionSource<IJSRuntime?>(MainPageBase.cs:239), callsHostWebView.TryDispatchAsync(...)with the tinyCaptureJsRuntimecallback that resolves the renderer-scopedIJSRuntimeinto that source (MainPageBase.cs:223-224,240), and awaits the task outside the dispatch context (MainPageBase.cs:248). Two guards quit early: dispatch refused (MainPageBase.cs:242-246) and a nullIJSRuntime(MainPageBase.cs:249-253). Otherwise it delegates toMauiBackNavigationBridge.HandleBackPressedAsync(jsRuntime)and quits only when the returned result reportsAtRoot(MainPageBase.cs:255-259). Quitting is a two-hop helper:QuitApp()marshals back withMainThread.BeginInvokeOnMainThread(MainPageBase.cs:226-227) andQuitOnMainThread()callsApplication.Current?.Quit()(MainPageBase.cs:229-230). A deliberate catch-all wraps the whole body with CA1031 suppressed and the reason inline, that the interop failure modes differ per platform and none of them are recoverable here, degrading to a clean exit (MainPageBase.cs:261-267).UseDarkStatusBarIconsis a virtualbool?defaulting tonull(MainPageBase.cs:46):trueasks for dark Android status bar icons over a light app bar,falsefor light icons over a dark one, andnullleaves the platform theme in charge; other platforms ignore it (MainPageBase.cs:37-45). The rest of the native plumbing is platform-conditional. Under#if ANDROID(MainPageBase.cs:48-163),OnHandlerChangedapplies the icon appearance once the page's handler, and with it the activity window, exists, and subscribes once (guarded by_statusBarAppearanceHooked) toApplication.RequestedThemeChangedso every Day/Dark toggle re-applies it on the main thread (MainPageBase.cs:57-74).ApplyStatusBarIconAppearancedoes nothing for anullanswer or a missing window, and otherwise setsAppearanceLightStatusBarsthroughWindowCompat.GetInsetsController(MainPageBase.cs:81-98).OnHandlerChangingruns before the native web view exists, which is the first momentHostWebViewis usable and the last before the web view initializes, and subscribes once (guarded by_statusBarHookAttached) toBlazorWebViewInitialized(MainPageBase.cs:100-115). That handler concatenates three user agent tokens and appends them when any is non-empty (MainPageBase.cs:129-146):MmcaStatusBar/<css px>andMmcaNavigationBar/<css px>, each produced bySystemBarToken, which reads the named platform dimension, converts it to CSS pixels using the display density, and yields an empty string when the dimension id or a positive height is missing (MainPageBase.cs:148-162), plus the theme token below. The reason: an edge-to-edge head padsindex.htmlwithenv(safe-area-inset-top), which the Android web view reports as 0 on a cold launch, so the app bar drew under the status bar;theme-prepaint.js(MMCA.Common.UI) turns the tokens into--mmca-status-bar-fallbackand--mmca-navigation-bar-fallback, and the head sizes its spacer withmax(env(safe-area-inset-top), var(--mmca-status-bar-fallback, 0px)); the navigation bar height is resolved by the system for the active mode, three-button or gesture (MainPageBase.cs:117-128). Under#if IOS || MACCATALYST(MainPageBase.cs:165-198),OnHandlerChanginginstead subscribes once (guarded by_themeHookAttached) toBlazorWebViewInitializing, because WKWebView fixes its user agent when it is created (MainPageBase.cs:168-181). The handler appends the theme token to the configuration'sApplicationNameForUserAgent, the documented way to extend WKWebView's default user agent (MainPageBase.cs:184-196). On all three native platformsThemeToken()mapsMauiThemeStore.ReadStoredIsDarkMode()toMmcaTheme/dark,MmcaTheme/light, or an empty string on a first launch (MainPageBase.cs:200-213). The natively saved value wins over the WebView's own storage, which flushes lazily, so after a quick killtheme-prepaint.jspaints the relaunch's first frame from the mode saved last (MainPageBase.cs:201-205). - Why it's built this way: the bridge itself lives in
MMCA.Common.UIso the JS interop module ships with the shared UI package, and this page is the thin native adapter over it. The bridge reportsHandled/AtRootrather than navigating on its own, precisely so the native side decides what "no history left" means. Owning no XAML of its own keeps the base adoptable by any head regardless of what that head's page declares: the class doc spells out the two-edit adoption, anxmlns:mauiroot element swap plus theHostWebViewoverride (MainPageBase.cs:13-19). This is the same host-adapter shape as the rest of the group (ADR-042), applied to a navigation gesture rather than a device API. - Where it's used: both MAUI heads derive from it. ADC names the base in code-behind (
MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI/MainPage.xaml.cs:12,17), and Store's code-behind declares no base at all because the XAML root element supplies it, leaving theHostWebViewoverride plusUseDarkStatusBarIcons => truefor its light pink app bar (MMCA.Store/Source/Hosts/UI/MMCA.Store.UI/MainPage.xaml.cs:7,17,24). The status bar, navigation bar and theme token behavior is pinned byStatusBarIconAppearanceTests,NavigationBarFallbackTestsandNativeThemePrepaintTests(MMCA.Common/Tests/Presentation/MMCA.Common.UI.Tests/Layout/). - Caveats / not-in-source: whether a given gesture reaches
OnBackButtonPressedat all is platform behavior, not visible here (the class doc states Android hardware back and the iOS swipe,MainPageBase.cs:10-12). Not determinable from source in this unit: the JavaScript helper that actually inspects the history stack, which is a JS asset shipped with MMCA.Common.UI rather than C#.
MauiDevicePreferences
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.DeviceStorage·MMCA.Common.UI.Maui/Capabilities/DeviceStorage/MauiDevicePreferences.cs:13· Level 2 · class (sealed)
- What it is: the MAUI adapter for IDevicePreferences, a typed key/value store for per-device settings backed by
Preferences.Default(MMCA.Common.UI.Maui/Capabilities/DeviceStorage/MauiDevicePreferences.cs:7-13). It also keeps app-switcher snapshot protection in step with the app-lock setting. - Depends on: IDevicePreferences, DevicePreferenceKeys and AppSnapshotProtection (
MauiDevicePreferences.cs:2-3); MAUI EssentialsPreferences; BCLSystem.Text.Json. - Concept introduced: device-scoped client state, with keys drawn from DevicePreferenceKeys so the same setting resolves identically on every head.
[Rubric §19, State Management]§19 assesses whether each piece of state has a clear owner and lifetime. These values describe this device (haptics on, app lock enabled) and deliberately never roam with the account, which is why they live here rather than in a server-side profile.[Rubric §26, Front-End Security]§26 assesses what the client persists. The XML doc is explicit that secrets never belong here: those go toSecureStorage(MauiDevicePreferences.cs:10-11). The app-lock key additionally drives snapshot protection, so the app-switcher preview is hidden from the moment app lock is turned on.
- Walkthrough
KeyPrefix = "mmca.devicePrefs."(MauiDevicePreferences.cs:15): every key is namespaced under one prefix, mirroring the browser adapter so key/value semantics hold on every head.GetAsync<T>(string key, T fallback, CancellationToken = default)(MauiDevicePreferences.cs:18): guards the key withArgumentException.ThrowIfNullOrWhiteSpace(:20), reads the prefixed raw string and returnsfallbackwhen absent (:22-26), then JSON-deserializes, returningfallbackon a null result (:30-31) or onJsonException(:33-36).SetAsync<T>(string key, T value, CancellationToken = default)(MauiDevicePreferences.cs:40): guards the key, writesJsonSerializer.Serialize(value)under the prefixed key (:42-44), and when the key isDevicePreferenceKeys.AppLockEnabledcallsAppSnapshotProtection.SetEnabled(value is true), so snapshot protection follows app lock from this write on rather than from the next launch (:45-49).RemoveAsync(string key, CancellationToken = default)(MauiDevicePreferences.cs:55): guards the key and removes the prefixed entry (:57-59); removing the app-lock key turns snapshot protection off (:60-63).
- Why it's built this way: JSON-encoding every value under one prefix gives the same typed store across MAUI and browser heads with no per-type platform code, and a bad key is caught immediately while a corrupt value degrades to the caller's
fallbackrather than throwing into a render path. Hooking the app-lock key at the store means every screen that toggles app lock updates snapshot protection without knowing it exists. - Where it's used: registered as a singleton by
AddMauiDeviceCapabilities()(MMCA.Common.UI.Maui/DependencyInjection.cs:76); siblings are BrowserDevicePreferences and the volatile Blazor Server default InMemoryDevicePreferences, which is the one capability default registered scoped rather than singleton so a circuit's preferences never leak across users (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:87-89). Read and written by device-settings screens and the app-lock gate, and referenced by AppSnapshotProtection.
SensitiveFileStagingPurgeInitializer
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui·MMCA.Common.UI.Maui/SensitiveFileStagingPurgeInitializer.cs:11· Level 2 · class (sealed)
- What it is: a MAUI startup hook that empties the head's sensitive-file staging folder when the app is built, so a file a previous session staged for the share sheet (the personal-data export) does not outlive that session when no later export purged it (
MMCA.Common.UI.Maui/SensitiveFileStagingPurgeInitializer.cs:5-11). - Depends on: first-party, SensitiveFileStagingFolder from
MMCA.Common.UI.Maui.Capabilities.Files(SensitiveFileStagingPurgeInitializer.cs:1,18). Externals:IMauiInitializeService(MAUI hosting) as the contract it implements (SensitiveFileStagingPurgeInitializer.cs:11). - Concept introduced: purge at app start as the second half of a stage-then-share hand-off. The staging folder is emptied before each write, but a staged file is never deleted after the share, because Android's share request returns when the intent launches and a delete then would race the receiving app reading the file (
MMCA.Common.UI.Maui/Capabilities/Files/SensitiveFileStagingFolder.cs:11-17). An export that is never followed by another one would therefore stay on disk; this initializer closes that gap by purging the whole folder on the next launch, andSensitiveFileStagingTransitionParticipantpurges it again on every sign-in, sign-out or server-ended session, so the next account on the device never finds it (MMCA.Common.UI.Maui/Capabilities/Files/SensitiveFileStagingTransitionParticipant.cs:5-23). It uses the sameIMauiInitializeServicestartup point as DeviceCapabilitiesInitializer and MauiErrorHandlingInitializer.[Rubric §30, Compliance/Privacy]§30 assesses whether personal data is kept only as long as it is needed. A personal-data export copied to a temp folder for the share sheet is bounded to one app session and one signed-in account instead of lingering until the OS clears its temp directory.
- Walkthrough: the class is
sealedand has no state of its own (SensitiveFileStagingPurgeInitializer.cs:11).Initialize(IServiceProvider services)null-guards its argument (SensitiveFileStagingPurgeInitializer.cs:14-16), then resolves SensitiveFileStagingFolder withGetServiceand callsPurge()on it only when one is registered (SensitiveFileStagingPurgeInitializer.cs:18).Purge()deletes the folder recursively and swallowsDirectoryNotFoundException(nothing was staged),IOException(a file still in use) andUnauthorizedAccessException, leaving the folder for the next stage's own purge (MMCA.Common.UI.Maui/Capabilities/Files/SensitiveFileStagingFolder.cs:72-94). - Why it's built this way: the class doc calls the purge best effort, like the purge itself (
SensitiveFileStagingPurgeInitializer.cs:8-9): a failed startup purge is not an error worth stopping the app for, because every laterStageAsyncempties the folder again before it writes (MMCA.Common.UI.Maui/Capabilities/Files/SensitiveFileStagingFolder.cs:61-65). Resolving the folder withGetServicekeeps the hook a no-op on a container that registered no folder. - Where it's used: registered as an
IMauiInitializeServicesingleton by DependencyInjection'sAddMauiDeviceCapabilities(string sensitiveFileStagingFolderName), right after the folder and theISensitiveFileSaverit backs and before the identity-transition participant (MMCA.Common.UI.Maui/DependencyInjection.cs:60-64), and so reached through HostingDependencyInjection'sUseMauiDeviceCapabilities(...)(MMCA.Common.UI.Maui/HostingDependencyInjection.cs:29-33,43). - Caveats / not-in-source: both MAUI heads register it through
UseMauiDeviceCapabilitieswith their own folder name, ADC"mmca-exports"(MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI/MauiProgram.cs:108) and Store"mmca-store-exports"(MMCA.Store/Source/Hosts/UI/MMCA.Store.UI/MauiProgram.cs:77). No test in MMCA.Common exercises this type directly.
WindowLifecycleExtensions
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui·MMCA.Common.UI.Maui/WindowLifecycleExtensions.cs:24· Level 2 · class (static)
- What it is: a one-method extension over MAUI's
Windowthat forwards the window'sStoppedandResumedevents to the app's IAppLifecycleNotifier, which is what lets the shared app-lock overlay re-arm, and keeps the window out of the app-switcher snapshot while app lock is enabled (AndroidFLAG_SECURE; an opaque cover on iOS and Mac Catalyst between resign-active and become-active) (MMCA.Common.UI.Maui/WindowLifecycleExtensions.cs:7-9,28-33). - Depends on: IAppLifecycleNotifier, IDevicePreferences and AppSnapshotProtection (
WindowLifecycleExtensions.cs:1-3), the first two resolved from the supplied service provider (:44,52). Externals: MAUIWindowas the extended type, andIServiceProvider.GetService<T>(). - Concept introduced: an extension member over a MAUI platform type rather than over
IServiceCollection. Everywhere else in this groupextension(...)blocks targetIServiceCollectionorMauiAppBuilder(see DependencyInjection, HostingDependencyInjection); here the same C# preview syntax targetsWindowitself (WindowLifecycleExtensions.cs:26), because window lifecycle events are only reachable once aWindowinstance exists, which is later than either service registration point. The class doc states why it matters for security: a hybrid head keeps its Blazor render tree alive across a background/foreground cycle, so a gate that engages only at first render never engages again (WindowLifecycleExtensions.cs:10-13).[Rubric §1, SOLID]assesses dependency inversion. The window depends on the resolvedIAppLifecycleNotifierabstraction, never on a concrete notifier, so a head can supply any implementation or none.[Rubric §15, Best Practices & Code Quality]assesses ceremony a developer pays for correct adoption. Four event subscriptions collapse intowindow.AttachMmcaAppLifecycle(services), so a head cannot forward one lifecycle event and forget another.[Rubric §26, Front-End Security]§26 assesses what the client exposes outside the app. With app lock on, the OS app switcher shows no live screen content, and the lock re-arms on resume rather than only at cold start.
- Walkthrough:
AttachMmcaAppLifecycle(IServiceProvider services)(WindowLifecycleExtensions.cs:37) null-guards both the extendedwindowandservices(:39-40). It then wires snapshot protection: when IDevicePreferences resolves it startsAppSnapshotProtection.InitializeAsync(preferences)without awaiting it (:44-47), and it subscribeswindow.Activatedandwindow.DeactivatedtoAppSnapshotProtection.OnActivatedandOnDeactivated(:49-50). Next it resolvesIAppLifecycleNotifierwithGetServicerather thanGetRequiredService(:52) and returns the window when none is registered, so such a host gets only the snapshot protection (:53-56). When a notifier is present it subscribeswindow.Stoppedtonotifier.NotifyEnteredBackground()andwindow.Resumedtonotifier.NotifyResumed()(:58-59), then returns the same window for chaining (:61). - Why it's built this way: using
GetServiceinstead ofGetRequiredServicekeeps the extension safe to call unconditionally from every head's window-creation path, whether or not that head registered preferences or a notifier; the alternative would force every head to guard the call itself. The class doc gives the one call site a head needs, anApp.CreateWindowoverride (WindowLifecycleExtensions.cs:13-21). - Where it's used: both MAUI heads call it from
App.CreateWindow: ADC (MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI/App.xaml.cs:40) and Store (MMCA.Store/Source/Hosts/UI/MMCA.Store.UI/App.xaml.cs:36). - ADRs: ADR-042 (device capability abstraction) governs the layer this class ships in, and ADR-106 (extension members as the public DI surface) mentions it.
- Caveats / not-in-source:
InitializeAsyncis fire-and-forget (WindowLifecycleExtensions.cs:46), so the first activation can run before the stored app-lock value is read. Not determinable from source in this unit: whatAppSnapshotProtectiondoes in that window, covered with its own section in this group.
DeviceCapabilitiesInitializer
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui·MMCA.Common.UI.Maui/DeviceCapabilitiesInitializer.cs:18· Level 5 · class (sealed)
- What it is: a MAUI startup hook that bridges local-notification taps into Blazor routing. It implements
IMauiInitializeService, so itsInitializeruns while the MAUI app is being built, and it forwards the route carried by a tapped reminder to the shared IDeepLinkDispatcher, dropping and logging a route that is not safe to publish (MMCA.Common.UI.Maui/DeviceCapabilitiesInitializer.cs:10-18). - Depends on: first-party, IDeepLinkDispatcher from
MMCA.Common.UI.Services.Capabilities.Navigation(DeviceCapabilitiesInitializer.cs:4,25) and NotificationTapRoute fromMMCA.Common.UI.Maui.Capabilities.Notifications(DeviceCapabilitiesInitializer.cs:3,43). Externals:IMauiInitializeService(MAUI hosting),Plugin.LocalNotificationwith itsNotificationActionEventArgs(DeviceCapabilitiesInitializer.cs:5-6), andMicrosoft.Extensions.Loggingwith itsNullLogger(DeviceCapabilitiesInitializer.cs:1-2). - Concept introduced: cold-start deep-link buffering. This type is the native publisher end of the deep-link funnel; the receiver end is the shared
DeepLinkListenercomponent rendered in the layout. A tap that arrives while the app is running travels live through IDeepLinkDispatcher; a tap that cold-starts the process arrives before the Blazor router exists, so the dispatcher buffers the pending route until first render and the listener drains it (DeviceCapabilitiesInitializer.cs:10-16).[Rubric §25, Navigation & IA]§25 assesses how navigation intent flows through the app. Routing every native entry point through one dispatcher keeps the Blazor router the single source of truth for where the user lands.[Rubric §29, Resilience & Business Continuity]§29 assesses graceful handling of edge states. The cold-start buffer is what stops a tap that launched the process from being lost before there is anything to navigate, and a bad route is dropped rather than thrown out of the plugin's tap callback (DeviceCapabilitiesInitializer.cs:15-16).
- Walkthrough: the class is
sealed(DeviceCapabilitiesInitializer.cs:18).Initialize(IServiceProvider services)null-guards its argument (DeviceCapabilitiesInitializer.cs:21-23), then resolves IDeepLinkDispatcher withGetServicerather thanGetRequiredServiceand returns early when none is registered (DeviceCapabilitiesInitializer.cs:25-29), so a head without the dispatcher gets a no-op instead of a startup crash. It resolves a logger the same way, falling back toNullLogger.Instancewhen noILoggerFactoryis registered (DeviceCapabilitiesInitializer.cs:31-32), and subscribes toLocalNotificationCenter.Current.NotificationActionTappedwith a lambda closing over the dispatcher and logger (DeviceCapabilitiesInitializer.cs:33). The static handlerOnNotificationTapped(DeviceCapabilitiesInitializer.cs:36) ignores dismissals (DeviceCapabilitiesInitializer.cs:38-41) and handsargs.Request?.ReturningDatatoNotificationTapRoute.TryPublish(DeviceCapabilitiesInitializer.cs:43), which returns without publishing for a blank route, logs and drops a route that fails its publishability check, and otherwise publishes it (MMCA.Common.UI.Maui/Capabilities/Notifications/NotificationTapRoute.cs:46-64). - Why it's built this way: notification metadata is not routing. Translating the plugin's tap event into this codebase's own IDeepLinkDispatcher vocabulary here means the shared listener component never references
Plugin.LocalNotification, so the same component works on hosts that have no notification plugin at all (ADR-042). Wiring it as anIMauiInitializeServiceestablishes the subscription exactly once, at app build time, before any UI renders. The defensive early return is what makes the hook safe to register unconditionally, which is why HostingDependencyInjection can add it with no condition. Validating in NotificationTapRoute rather than here keeps the check next to the schedule-time guard that rejects the same bad routes when a reminder is created (NotificationTapRoute.cs:28-36); the drop log records the route length, never the route (NotificationTapRoute.cs:44,58). - Where it's used: registered by HostingDependencyInjection as an
IMauiInitializeServicesingleton insideUseMauiDeviceCapabilities()(MMCA.Common.UI.Maui/HostingDependencyInjection.cs:44); the routes it publishes are consumed through IDeepLinkDispatcher (implemented by DeepLinkDispatcher) by the sharedDeepLinkListenercomponent that ADC registers with its MAUI-only UI module (MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI/MauiProgram.cs:166-168). - Caveats / not-in-source: the route contract is entirely
ReturningDataon the scheduled notification, so a reminder created without an app-relative route in that field produces no navigation. Not determinable from source in this unit: theDeepLinkListenercomponent body and the scheduling code that populatesReturningData, both outside this unit.
DependencyInjection
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui·MMCA.Common.UI.Maui/DependencyInjection.cs:36· Level 6 · class (static)
- What it is: the service-level registration surface for the MAUI native device-capability layer (ADR-042). It binds every capability contract the framework backs natively to its MAUI implementation (
AddMauiDeviceCapabilities()), and adds four deliberately separate opt-ins: the secure-enclave token pipeline (AddCommonMauiTokenStorage()), the platform push-token provider (AddMauiPushDeviceTokenProvider()), the public-URL link builder (AddCommonMauiPublicLinkBuilder()), and an appUser-Agentfor the shared"APIClient"(AddCommonMauiAppUserAgent()). - Depends on: first-party, the capability contract set in the
MMCA.Common.UI.Services.Capabilities.*namespaces with theirMaui*bodies inMMCA.Common.UI.Maui.Capabilities.*, plusMMCA.Common.UI.Maui.Services,MMCA.Common.UI.Maui.Theme,MMCA.Common.UI.Services.Navigation,MMCA.Common.UI.Services.Auth.Devices,MMCA.Common.UI.Services.Auth.TokensandMMCA.Common.UI.Theme, which carry IPublicLinkBuilder, IDeviceMetadataReporter, ISecureTokenStore, ITokenStorageService, SecureStoreTokenStorageService and the theme-mode source (MMCA.Common.UI.Maui/DependencyInjection.cs:2-25). Externals:IServiceCollectionas the extended type, andMicrosoft.Extensions.Loggingfor theILogger<MauiLocalCacheStore>the cache factory resolves (DependencyInjection.cs:1,85). - Concept introduced:
extension(IServiceCollection)registration blocks, and lifetime choice as documented intent. The class isstatic(DependencyInjection.cs:36) and every member lives inside anextension(IServiceCollection services)block (DependencyInjection.cs:38), the C# preview extension-member syntax this codebase uses for DI registration everywhere (see the primer); the methods appear as instance methods onIServiceCollectionat the call site. Two lifetimes appear here and the code explains both: singleton for the capability services, because a MAUI head is single-user and the stateful ones (connectivity, battery) wrap app-global platform events (DependencyInjection.cs:61-62), and scoped for IExternalAuthBroker, which navigates through the circuit'sNavigationManagerafter a system-browser round trip (DependencyInjection.cs:108-110), and for the token pipeline so component code sees one lifetime across every head (DependencyInjection.cs:132-134).[Rubric §1, SOLID]§1 assesses dependency inversion in practice. Every consumer depends on a capability interface and never on a MAUI type, which is what makes the browser and fallback adapters in this group drop-in substitutes.[Rubric §29, Resilience, Reliability & Business Continuity]§29 assesses whether infrastructure concerns are composed in one place instead of scattered. A single extension method carries the entire native binding set, so a head'sMauiProgramstays short and no capability can be silently forgotten.[Rubric §11, Security]§11 assesses how credentials are stored and handled. The token half puts both tokens in the platform secure enclave and guards every read and write, so an OS-invalidated keystore entry degrades to one clean re-login rather than an unhandled throw on launch (DependencyInjection.cs:121-124).
- Walkthrough:
AddMauiDeviceCapabilities(string sensitiveFileStagingFolderName)(DependencyInjection.cs:54) takes the head's own temp sub-folder name for sensitive files handed to the share sheet; it is required, so no head is left on the browser-only default (DependencyInjection.cs:48-53). It first registers the sensitive file hand-off: aSensitiveFileStagingFoldersingleton built from that name (validated at composition rather than on the first export),MauiSensitiveFileSaverasISensitiveFileSaver, SensitiveFileStagingPurgeInitializer as anIMauiInitializeService, andSensitiveFileStagingTransitionParticipantas anIIdentityTransitionParticipant, so the folder is purged at app start and on every identity transition (DependencyInjection.cs:56-64). It then registers seventeen capability contracts as singletons in one block (DependencyInjection.cs:63-87): connectivity, battery, share, clipboard, haptics, map navigation, geolocation, geocoding, external links, text-to-speech, accessibility announcer, local notifications, screenshot, device preferences, local cache, biometrics, and speech-to-text. The local cache is the one entry built by a factory rather than mapped by type, because MauiLocalCacheStore's constructor isinternaland takes its folder, key store and legacy folder: the factory passes LocalCacheLocation'sResolve()andLegacyDirectory, a new MauiLocalCacheKeyStore, and an optionalILogger<MauiLocalCacheStore>, under a comment that the documents are encrypted at rest under a SecureStorage-held key in a folder kept out of device backups, that sign-out deletes both the documents and the key, and that plaintext documents an earlier version left are moved in, never dropped (DependencyInjection.cs:77-85). The same block then registers MauiInitialThemeModeSource asIInitialThemeModeSource, so the theme provider paints its first frame in the stored Day/Dark mode rather than light-then-dark (ADR-028,DependencyInjection.cs:89-91). Four further registrations carry conditions or contracts and are commented for it. IPushRegistrationService is bound to MauiPushRegistrationService but yields nothing until the app registers a credentialed IPushDeviceTokenProvider, so it is wired-but-inert out of the box (ADR-044,DependencyInjection.cs:93-96). IDeviceMetadataReporter is bound to MauiDeviceMetadataReporter, which sendsDeviceInfoplus a per-install id after each sign-in (AuthUIService) and, until one report succeeds, after a token refresh (SecureStoreTokenStorageService), so the signed-in devices list names this device; it is a singleton by contract, because the once-per-process backfill is tracked per reporter instance (DependencyInjection.cs:98-102). IMediaPickerService is bound to MauiMediaPickerService, whose capture path prompts for the camera permission the head must declare, AndroidCAMERAplus the iOS usage strings (ADR-045,DependencyInjection.cs:104-106). IExternalAuthBroker isAddScopedto MauiExternalAuthBroker and stays inert (IsAvailable == false) until the head configuresOAuth:MobileRedirectSchemeand registers the platform callback (DependencyInjection.cs:108-111). Last, it callsAddMauiCapabilitiesJsModule()(MauiCapabilitiesJsModuleRegistration) to register the capabilities JS module the credential-link pages (sign-in link, confirm email, reset password) read the URL fragment through; without it they resolvenulland report the link as incomplete on every MAUI head (DependencyInjection.cs:113-116). The method returnsservicesfor chaining (DependencyInjection.cs:117).AddCommonMauiTokenStorage()registers the pipeline in two scoped halves: MauiSecureTokenStore asISecureTokenStoreand SecureStoreTokenStorageService asITokenStorageServiceon top of it, the latter checking expiry and refreshing proactively instead of handing callers a stale bearer (DependencyInjection.cs:137-141). Both halves are required, and the split is what keeps the graph acyclic: storage depends on the refresher, and the refresher depends on the raw store rather than back on storage (DependencyInjection.cs:128-129).AddMauiPushDeviceTokenProvider()is the one compile-time-conditional member: under#if ANDROIDit registersFcmPushDeviceTokenProvider, underIOS || MACCATALYSTit registersApnsPushDeviceTokenProvider, and the windows TFM registers nothing at all so the pipeline stays inert there (DependencyInjection.cs:163-171). Both providers are additionally configuration-gated onPush:Fcmcredentials andPush:Apns:Enabled(DependencyInjection.cs:155-157).AddCommonMauiPublicLinkBuilder()binds MauiPublicLinkBuilder as the scopedIPublicLinkBuilder, so share, copy-link and QR affordances emit the public web URL fromPublicSite:BaseUrlinstead of the WebView's internal origin (DependencyInjection.cs:168-175).AddCommonMauiAppUserAgent()makes the head identify itself on every"APIClient"call: it registers MauiAppUserAgentHandler as transient and appends it to that named client's pipeline (DependencyInjection.cs:192-193). The request then carries the app'sUser-Agent(app name and version fromAppInfo, platform and OS version fromDeviceInfo, with theMmcaAppmarker), the server records it on the refresh session at login, register and refresh, and the signed-in devices list reads "{App} app on {Platform}" instead of "Unrecognized device" (DependencyInjection.cs:178-184). It must run afterAddUIShared, which registers the"APIClient"itself; this only adds a handler to that registration (DependencyInjection.cs:186-187). - Why it's built this way: the class doc is explicit that these are plain
Addcalls (notTryAdd) and must run afterAddUIShared, so the native bodies override the shared fallback defaults under last-registration-wins (DependencyInjection.cs:32-34). That is the whole selection mechanism of ADR-042: the shared package alwaysTryAdd-registers an inert default so the DI graph resolves on every host, and a native head simply overwrites the entries it can do better. Splitting token storage, push tokens, the link builder and app user agent into their own methods preserves that same override control per concern for a head that wants its own implementation. Token storage is scoped rather than singleton purely to match its browser siblings,AddCommonServerTokenStorage()in MMCA.Common.UI.Web and the WASM WasmTokenStorageService, so component code depends on one lifetime everywhere (DependencyInjection.cs:132-134). - Where it's used:
AddMauiDeviceCapabilities()is called by HostingDependencyInjection'sUseMauiDeviceCapabilities()(MMCA.Common.UI.Maui/HostingDependencyInjection.cs:43), the builder-level entry point the class doc steers heads toward (DependencyInjection.cs:30-32). The four opt-ins are called directly by each head: ADC calls all four, the app user agent, the push-token provider, the public link builder and token storage (MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI/MauiProgram.cs:97,131,152,172), and Store calls every opt-in except the push-token provider: the app user agent, the public link builder and token storage (MMCA.Store/Source/Hosts/UI/MMCA.Store.UI/MauiProgram.cs:69,117,129). - Caveats / not-in-source: "wired but inert" is a real runtime state for push registration, media capture, external auth, and the push-token providers. Registration does not imply the capability works without the extra host configuration each comment names. The platform wiring the push providers depend on stays app-side: the Android
POST_NOTIFICATIONSdeclaration and credentials, and on iOS theaps-environmententitlement plus the two AppDelegate callbacks that publish intoApnsTokenBridge(DependencyInjection.cs:152-155). Not determinable from source in this unit: the bodies of the individualMaui*Serviceimplementations, which the other units of this group cover.
HostingDependencyInjection
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui·MMCA.Common.UI.Maui/HostingDependencyInjection.cs:15· Level 4 · class (static)
- What it is: the
MauiAppBuilder-level entry point for the device-capability layer (ADR-042), the hybrid culture wiring (ADR-027), and the process-wide unhandled-exception hook. Four builder extensions:UseMauiDeviceCapabilities()composes the service registrations plus the platform hooks that need the builder itself,UseMmcaMauiErrorHandling(...)installs the last-chance handlers,UseCommonBarcodeScanner(...)is the opt-in camera-scanning add-on, andUseMauiCulture()is the separately callable culture half (MMCA.Common.UI.Maui/HostingDependencyInjection.cs:10-15). - Depends on: first-party, DependencyInjection's
AddMauiDeviceCapabilities(...)(HostingDependencyInjection.cs:43), DeviceCapabilitiesInitializer (HostingDependencyInjection.cs:44), MauiErrorHandlingInitializer (HostingDependencyInjection.cs:88), MauiBarcodeScannerService behind IBarcodeScannerService (HostingDependencyInjection.cs:122-123), and the globalization pair MauiCultureApplier / MauiCultureInitializer behind ICultureApplier (HostingDependencyInjection.cs:2,140-141). Externals:MauiAppBuilderas the extended type,Plugin.LocalNotification'sUseLocalNotification()(HostingDependencyInjection.cs:5,42), andZXing.Net.Maui.Controls'UseBarcodeReader()(HostingDependencyInjection.cs:6,121). - Concept introduced: builder-level versus service-level composition. This is the layered pairing that runs through MAUI hosting: DependencyInjection registers services on
IServiceCollection, while this class operates onMauiAppBuilderbecause some steps (the Plugin.LocalNotification lifecycle wiring, the ZXing handler registration, theIMauiInitializeServicehooks) need more than a service collection. It uses the sameextension(MauiAppBuilder builder)block syntax (HostingDependencyInjection.cs:17). The second concept, visible inUseCommonBarcodeScanner, is lazy text resolution: everything in this class runs while the app is being built, which is before MauiCultureInitializer restores the user's persisted language, so any string captured eagerly here would be pinned to the startup device language for the life of the process. TakingFunc<string>delegates instead, invoked once per scan when the page is built, is what makes the modal follow the in-app language switch (HostingDependencyInjection.cs:99-104).[Rubric §15, Best Practices & Code Quality]§15 assesses how hard the framework is to adopt correctly. Folding four easy-to-forget steps into one fluent call removes most of the ways a head can be left half-configured.[Rubric §33, Developer Experience]§33 assesses the ceremony a developer pays for a working host. One builder extension plus a small set of documented obligations is that ceremony, and the obligations the wrapper cannot absorb are spelled out in XML docs instead of failing silently.[Rubric §27, i18n]§27 assesses whether localization reaches every surface. TheFunc<string>parameters exist precisely so the scan page follows the in-app language switch rather than the startup device language, and the culture fold-in guarantees a hybrid head has a working applier at all.[Rubric §13, Observability & Operability]§13 assesses whether failures become visible.UseMmcaMauiErrorHandlingis the one line that makes a background-thread throw land in the app's logger atCriticalunder a dedicated category instead of vanishing (HostingDependencyInjection.cs:55-62).
- Walkthrough:
UseMauiDeviceCapabilities(string sensitiveFileStagingFolderName)(HostingDependencyInjection.cs:40) takes the head's temp sub-folder name for sensitive files handed to the share sheet (HostingDependencyInjection.cs:35-39) and does four things in order:builder.UseLocalNotification()initializes the notification plugin (:42);builder.Services.AddMauiDeviceCapabilities(sensitiveFileStagingFolderName)binds every native capability plus the sensitive file hand-off and its app-start purge (SensitiveFileStagingPurgeInitializer,:29-33,:43);AddSingleton<IMauiInitializeService, DeviceCapabilitiesInitializer>()registers the notification-tap deep-link bridge (:44); andbuilder.UseMauiCulture()folds in the hybrid culture wiring (:51). It returnsbuilderfor chaining (:52).UseMmcaMauiErrorHandling(Action<Exception, string>? onUnhandled = null)(HostingDependencyInjection.cs:86-90) is a single registration: anIMauiInitializeServicesingleton built from a constructed instance of MauiErrorHandlingInitializer, because the optional crash-reporter callback has to be captured (:88). Its doc carries the operational contract: call it once, a second call is ignored rather than doubling every report, and ordering does not matter because the handlers are installed when the app is built (HostingDependencyInjection.cs:72-76).UseCommonBarcodeScanner(Func<string> cancelText, Func<string> cameraDescription)(HostingDependencyInjection.cs:114-125) null-guards both delegates (:118-119), callsbuilder.UseBarcodeReader()to register the ZXing.Net.MAUI handlers (:121), and registers IBarcodeScannerService as a singleton built from a factory that hands both delegates to MauiBarcodeScannerService (:122-123), which invokes them once per scan.UseMauiCulture()(HostingDependencyInjection.cs:138-143) does two things:AddScoped<ICultureApplier, MauiCultureApplier>()replaces the web applier that round-trips a server/culture/setendpoint no hybrid head hosts (:140), andAddSingleton<IMauiInitializeService, MauiCultureInitializer>()restores the persisted culture at startup (:141). Calling it twice is harmless (:133). - Why it's built this way: the class doc pins the ordering constraint, call this after
AddUISharedinMauiProgram.CreateMauiApp(HostingDependencyInjection.cs:12-13), because DependencyInjection uses plainAddto override the shared TryAdd defaults. The culture fold-in is explained in an inline comment as a deliberate cross-ADR decision (HostingDependencyInjection.cs:46-50): culture belongs to ADR-027 rather than ADR-042, but a hybrid head that skips it ends up with a culture switcher that navigates to a server endpoint it does not host and renders the not-found page, so wiring it here means no head can be left half-configured, whileUseMauiCulture()stays public for a head that composes by hand. Barcode scanning is deliberately not folded in (HostingDependencyInjection.cs:95-97): a head that never scans should ship neither the camera handler nor a camera permission declaration, and the head still declares the platform permission itself, AndroidCAMERAand iOSNSCameraUsageDescription(HostingDependencyInjection.cs:107-108). One step the wrapper cannot take at all is the MauiCommunityToolkit registration: speech-to-text (MauiSpeechToTextService) depends on it, and the toolkit's MCT001 analyzer requires.UseMauiCommunityToolkit()to appear in the app's ownUseMauiApp<T>()chain, so the doc states the requirement rather than hiding it (HostingDependencyInjection.cs:24-27). - Where it's used: called per MAUI head in
MauiProgram.CreateMauiApp. ADC callsUseMauiDeviceCapabilities("mmca-exports")afterAddUIShared(MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI/MauiProgram.cs:91,108),UseMmcaMauiErrorHandling()with no callback (:115), and the barcode scanner with resource lookups, placed after the UI module that owns the check-in surface so the plainAddis the last registration to run (MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI/MauiProgram.cs:162-164). Store callsUseMauiDeviceCapabilities()(MMCA.Store/Source/Hosts/UI/MMCA.Store.UI/MauiProgram.cs:76) andUseMmcaMauiErrorHandling()(:84) but registers no scanner. Both heads chain.UseMauiCommunityToolkit()themselves (MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI/MauiProgram.cs:54,MMCA.Store/Source/Hosts/UI/MMCA.Store.UI/MauiProgram.cs:43). - Caveats / not-in-source: the head keeps obligations this wrapper cannot fulfill: chaining
.UseMauiCommunityToolkit(), declaring the camera permission when it scans, and supplying the per-capability configuration each inert service needs (push credentials,OAuth:MobileRedirectScheme). The error handler covers managed exceptions only; a native crash, a stack overflow or a fail-fast tears the process down below the runtime and no handler here runs (HostingDependencyInjection.cs:64-68). Not determinable from source in this unit: the scan page ZXing builds at runtime, covered with MauiBarcodeScannerService elsewhere in this group.
IAccessibilityAnnouncer
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Accessibility·MMCA.Common.UI/Services/Capabilities/Accessibility/IAccessibilityAnnouncer.cs:9· Level 0 · interface
- What it is: a one-method contract that pushes a spoken announcement to the platform screen reader for events a sighted user perceives only visually (a live poll opening, a question being answered, the unread badge incrementing).
- Depends on: BCL only (
System.Threading.Tasks.Task,System.Threading.CancellationToken). - Concept introduced, the per-capability contract with per-host adapters. This whole group is a
family of narrow interfaces in
MMCA.Common.UI, each wrapping one device capability so shared Blazor components can call it uniformly while three implementations (MAUI-native, browser-JS-interop, and an inert fallback) are chosen per host at DI composition time (ADR-042).[Rubric §1, SOLID](interface segregation and dependency inversion: components depend on the tiny abstraction, never a platform SDK) and[Rubric §2, Design Patterns](this is the Strategy/adapter plus Null-Object pairing repeated across the group).[Rubric §21, Accessibility]assesses whether non-visual users get equivalent information; this contract routes to MAUISemanticScreenReaderon native and anaria-liveregion in browsers (IAccessibilityAnnouncer.cs:4-7), and is a deliberate silent no-op when no assistive technology is active (IAccessibilityAnnouncer.cs:7). - Walkthrough:
AnnounceAsync(string message, CancellationToken = default)(IAccessibilityAnnouncer.cs:12): announces politely, that is, without interrupting speech already in progress (IAccessibilityAnnouncer.cs:11). - Why it's built this way: a spoken-announcement need has no cross-platform BCL surface, so the capability is inverted behind an interface and satisfied by whichever adapter the host registers; the fallback keeps call sites unconditional (they never branch on "is a screen reader present").
- Where it's used: the framework default is the inert
NullAccessibilityAnnouncer, TryAdd-registered as a singleton inAddDeviceCapabilityDefaults(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:51); web heads override it withBrowserAccessibilityAnnouncerinAddBrowserDeviceCapabilities(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:118), and the nativeMauiAccessibilityAnnouncerships in theMMCA.Common.UI.Mauipackage. Called by live-update components in the head apps.
BarcodeScanPage
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.Media·MMCA.Common.UI.Maui/Capabilities/Media/BarcodeScanPage.cs:26· Level 0 · class (internal sealed partial)
- What it is: the modal scan surface behind MauiBarcodeScannerService: a full-bleed ZXing camera reader with a cancel button underneath and, for a continuous session, an outcome line over the bottom of the camera view. It is built in C# rather than XAML so the package ships no compiled resource dictionary and the page stays an implementation detail of the service (
MMCA.Common.UI.Maui/Capabilities/Media/BarcodeScanPage.cs:6-10). - Depends on: no first-party types (it is
internal, and only its owning service constructs it). Externals:ZXing.Net.Maui/ZXing.Net.Maui.ControlsforCameraBarcodeReaderView,BarcodeReaderOptionsandBarcodeDetectionEventArgs(BarcodeScanPage.cs:1-2), MAUI'sContentPage,Grid,Label,Button,SemanticPropertiesandSemanticScreenReader, and BCLTaskCompletionSource<T>,VolatileandInterlocked. - Concept introduced: a session completion source separate from a per-wait decode source. The page owns two kinds of completion.
_endedis the session: it completes once, on whichever exit path comes first (the cancel button, the platform back gesture, the page disappearing, the caller's token, or the service closing it), and every one of those routes throughCancel(), whoseTrySetResultmakes the first exit win and the rest no-ops (BarcodeScanPage.cs:16-18,:142-151)._decodeis one wait: eachNextDecodeAsynccall replaces it and turns detection on, and the first decoded frame resolves it and pauses the camera, so each wait yields exactly one payload however many frames the camera decodes in the meantime (:12-13,:35-39). A single-scan caller asks for one decode; a continuous session asks again and again on the same page.[Rubric §2, Design Patterns]§2 assesses whether recognized patterns are applied deliberately rather than improvised. This is a promise/completion-source adapter over an event-driven control, the same mechanism MauiSpeechToTextService uses for the recognizer, applied here to a whole navigation surface, with anInterlocked.Exchangegate as the one-frame-per-wait latch (BarcodeScanPage.cs:181).[Rubric §21, Accessibility]§21 assesses whether every interactive surface is reachable and describable without sight. The reader and the cancel button get an explicitSemanticProperties.SetDescription(BarcodeScanPage.cs:61,:82), the pageTitleis the same camera description (:96), and an outcome shown over the camera is both described and announced throughSemanticScreenReader.Default.Announce, so a screen-reader user hears "Checked in" as a sighted operator sees it (:134-137).[Rubric §25, Navigation & IA]§25 assesses whether navigation state stays coherent.OnBackButtonPresseddeliberately consumes the gesture instead of letting the platform pop, because the service owns the singlePopModalAsyncand a double pop would remove whatever page came next (BarcodeScanPage.cs:154-160).
- Walkthrough
_ended(BarcodeScanPage.cs:28-29): the session'sTaskCompletionSource<string?>, constructed withTaskCreationOptions.RunContinuationsAsynchronously, so a continuation never runs inline on the thread that ends the session._reader,_outcome,_onEnded(BarcodeScanPage.cs:31-33): theCameraBarcodeReaderView, the outcomeLabel, and the optional callback run once when the session ends._decode/_wantDecode(BarcodeScanPage.cs:38-39): the current wait's completion source and a 0/1 flag that is 1 while a decode is wanted. The camera raisesBarcodesDetectedoff the main thread frame after frame, so the exchange on this flag lets exactly one frame through per wait (:35-37).- The constructor
BarcodeScanPage(string cancelText, string cameraDescription, Action? onEnded = null)(BarcodeScanPage.cs:45) storesonEnded(:47) and builds the reader withFormats = BarcodeFormats.TwoDimensional,AutoRotate = true,Multiple = falseandIsDetecting = false(:48-59): detection stays off until the firstNextDecodeAsync. Two-dimensional only is a deliberate accuracy choice: the affordance is a QR/DataMatrix scan, and admitting the 1D formats multiplies false positives on a shaky handheld frame (:52-53). It subscribesOnBarcodesDetected(:60), sets the reader's semantic description (:61), and builds the hidden outcomeLabel(white 20-point text, 16x12 padding, on a 75% black background, bottom-aligned) placed over the bottom of the camera view where the operator's eyes already are (:63-74). The cancelButtongets a 16-unit margin and its own semantic description (:76-82). AGridwith aGridLength.Starrow and aGridLength.Autorow holds the reader and the outcome line in the first row and the button in the second (:84-94).TitleandContentare assigned last (:96-97). Ended(BarcodeScanPage.cs:101) andHasEnded(:104): the session task and whether it has completed.NextDecodeAsync()(BarcodeScanPage.cs:110): returnsnullat once when the session has ended (:112-115); otherwise creates a fresh_decodesource, sets_wantDecodeto 1 withVolatile.Write, turns detection on, and returnsWaitForDecodeOrEndAsyncover the new task (:117-121). It is called on the main thread, one wait at a time (:107-108).ShowOutcome(string?)(BarcodeScanPage.cs:129): normalizes blank text tonull, sets the label's text, visibility and semantic description, and announces non-null text to the screen reader (:131-138). Passingnullhides the line.Cancel()(BarcodeScanPage.cs:142): returns early unless_ended.TrySetResult(null)succeeds (:144-147), so only the first call ends the session; that call stops detection and invokes_onEnded(:149-150).OnBackButtonPressed()(BarcodeScanPage.cs:154): cancels and returnstrueto consume the gesture (:158-159).OnDisappearing()(BarcodeScanPage.cs:163): cancels, then callsbase.OnDisappearing()(:165-166). This is the backstop that guarantees the camera is released even if the page leaves the stack by a route the class did not anticipate.WaitForDecodeOrEndAsync(...)(BarcodeScanPage.cs:169):Task.WhenAnyover the decode and the session, yielding the payload only when the decode won and the session has not ended, otherwisenull;ConfigureAwait(true)because the service reads the result on the main thread it awaits from (:171-173).OnCancelClicked(...)(BarcodeScanPage.cs:176): forwards toCancel().OnBarcodesDetected(...)(BarcodeScanPage.cs:178): takes the first result with a non-blankValue(:180) and returns unless there is one andInterlocked.Exchange(ref _wantDecode, 0)finds a decode wanted (:181-184). It then pauses the camera before resolving_decode(:188-189), because continued detection would keep raising the event while the caller handles the payload or while a single-scan modal animates away (:186-187).StopDetecting()(BarcodeScanPage.cs:192): clears_wantDecode, unsubscribes the handler and setsIsDetecting = false(:194-196).
- Why it's built this way:
partialis not stylistic here. It is required by CsWinRT1028 on the windows TFM because aContentPagecrosses the WinRT ABI, and the redundancy-style rules that object to it on the other TFMs are silenced project-wide in the csproj (BarcodeScanPage.cs:21-23). Splitting the session from the per-wait decode is what lets one modal page serve a whole check-in line: the camera pauses on each hit, the outcome stays visible, and the next wait reopens detection on the same page instead of pushing a new one. Keeping the typeinternalmeans the scan surface is never part of the package's public contract: heads consume the capability through IBarcodeScannerService and can never take a dependency on the page's layout. - Where it's used: constructed exclusively by MauiBarcodeScannerService on the main thread, pushed modally and popped by the same service, once per single scan (
MMCA.Common.UI.Maui/Capabilities/Media/MauiBarcodeScannerService.cs:176-189) and once per continuous session, where the service passes its linked token source'sCancelasonEnded(MauiBarcodeScannerService.cs:212-213,:239-240).
MauiThemeStore
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Theme·MMCA.Common.UI.Maui/Theme/MauiThemeStore.cs:15· Level 0 · class (internal static)
- What it is: the device-preference mirror of the user's Day/Dark choice for a MAUI head. It saves the resolved mode, reads it back synchronously, and applies it to the native
Application.UserAppTheme(ADR-028). The class doc namesNativeThemeSyncas the writer that mirrors every resolved or toggled value here (MauiThemeStore.cs:9). - Depends on: externals only, MAUI
Preferences.Default,Application.Current,AppTheme(MauiThemeStore.cs:28,37,49). It readsPreferencesdirectly and takes no injected service, so it is callable from a static context such as a page constructor. - Concept introduced: a synchronous cold-launch read for a theme that is otherwise decided asynchronously. The web preference resolves after Blazor's first render, which would flash the OS theme behind the
BlazorWebView. A tiny static store overPreferencescan be read in a page constructor, so the native theme is correct before the first frame.[Rubric §18, UI Architecture]§18 assesses whether host-specific plumbing is kept thin and in one place. The store is the only code that knows the preference key and its two string values (PreferenceKey"mmca.theme","dark","light",MauiThemeStore.cs:21,23,24).
- Walkthrough
Save(bool isDarkMode)(MauiThemeStore.cs:28): writes"dark"or"light"under the key.ReadStoredIsDarkMode()(MauiThemeStore.cs:37): returnstrue,false, ornullfor "nothing stored yet or an unrecognized value" (:37-42).ApplyStoredTheme()(MauiThemeStore.cs:49): maps the stored value toAppTheme.Dark,LightorUnspecified, and returns without touching anything when there is no application, no stored mode, or the theme is already that value (:59-62); otherwise it assignsUserAppTheme(:64).
- Why it's built this way: first launch (nothing stored) keeps following the OS, exactly as the web preference does (
MauiThemeStore.cs:45-48). The key's doc warns that renaming it silently drops every installed app back to the OS theme on its next cold launch (:18-20), so treat it as a persisted contract. Save is best-effort, mirroring the rest of the layer. - Where it's used: read by MauiInitialThemeModeSource (
MMCA.Common.UI.Maui/Theme/MauiInitialThemeModeSource.cs:15) and applied from the MainPageBase constructor (MMCA.Common.UI.Maui/MainPageBase.cs:28).
NullAccessibilityAnnouncer
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Accessibility·MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/Accessibility/NullAccessibilityAnnouncer.cs:4· Level 1 · class (sealed)
- What it is: the default
IAccessibilityAnnouncer: screen-reader announcements are accepted and dropped (NullAccessibilityAnnouncer.cs:3). - Depends on:
IAccessibilityAnnouncer; BCLTask. - Concept: the same neutral-default shape taught under
AlwaysOnlineConnectivityStatusService, in its smallest possible form. Note there is noIsSupportedprobe on this contract, so a component cannot branch on availability and does not need to: announcing is fire-and-forget by design.[Rubric §21, Accessibility]assesses whether non-visual users receive the information sighted users get. This default is the absence of that channel, which is why both real heads implement it:BrowserAccessibilityAnnouncerwrites into anaria-liveregion andMauiAccessibilityAnnouncerpushes to the OS screen reader. A head that keeps this default silently loses live-region announcements.
- Walkthrough: one member.
AnnounceAsync(string message, CancellationToken)(NullAccessibilityAnnouncer.cs:7) ignores both arguments and returnsTask.CompletedTask. - Why it's built this way: ADR-042. Call sites stay unconditional: a component announces a change without first checking whether an assistive channel exists, and the container decides whether that announcement goes anywhere.
- Where it's used:
TryAddSingletoninAddDeviceCapabilityDefaults()(DependencyInjection.cs:50); overridden on web heads (DependencyInjection.cs:125) and on native heads (MMCA.Common/Source/Presentation/MMCA.Common.UI.Maui/DependencyInjection.cs:73), so in practice only a head that calls neither override keeps it. Asserted non-throwing inCapabilityFallbackTests(CapabilityFallbackTests.cs:163).
MauiInitialThemeModeSource
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Theme·MMCA.Common.UI.Maui/Theme/MauiInitialThemeModeSource.cs:12· Level 1 · class (internal sealed)
- What it is: the MAUI implementation of
IInitialThemeModeSource(MMCA.Common.UI/Theme/IInitialThemeModeSource.cs:16). Its one property,IsDarkMode, returns whatever MauiThemeStore has stored, asbool?(MauiInitialThemeModeSource.cs:15). - Depends on: MauiThemeStore and the shared
IInitialThemeModeSourcecontract. - Concept introduced: a synchronous seed for the first paint. Reading the stored preference through the store lets the theme provider choose Day or Dark for its first frame rather than painting light then switching to dark (ADR-028).
nullmeans no stored choice, so the provider falls back to following the OS. - Walkthrough: a one-line expression-bodied property over
MauiThemeStore.ReadStoredIsDarkMode()(MauiInitialThemeModeSource.cs:15). - Where it's used: registered as a singleton by
AddMauiDeviceCapabilities()(MMCA.Common.UI.Maui/DependencyInjection.cs:89-91), with a comment that it exists soMmcaThemeProviderspaints its first frame in the stored mode. Not determinable from source in this unit: the consumer's behavior beyond that comment.
MauiSpeechToTextService
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.Media·MMCA.Common.UI.Maui/Capabilities/Media/MauiSpeechToTextService.cs:14· Level 1 · class (sealed)
- What it is: the MAUI adapter for ISpeechToTextService (ADR-042 Wave 4), driving CommunityToolkit.Maui's
SpeechToTextrecognizer and owning the microphone permission flow (MMCA.Common.UI.Maui/Capabilities/Media/MauiSpeechToTextService.cs:7-13). - Depends on: ISpeechToTextService;
CommunityToolkit.Maui.Media.SpeechToText(MauiSpeechToTextService.cs:2); BCLCultureInfo,IProgress<string>andTaskCompletionSource<T>. - Concept introduced: bridging an event-driven recognizer to a single awaitable call. The toolkit exposes start/stop plus "result updated" and "result completed" events; the contract wants one
ListenAsyncthat returns the final text. ATaskCompletionSource<string?>resolved from the completion handler is the idiomatic adapter, the same shape BarcodeScanPage uses for its four exit paths.[Rubric §21, Accessibility]and[Rubric §24, Forms/Validation/UX Safety]: dictation is an input affordance, so a permission denial or a recognizer failure must never wedge a form. Every negative outcome returnsnulland the affordance simply does nothing.
- Walkthrough
IsSupported(MauiSpeechToTextService.cs:17):true.ListenAsync(CultureInfo culture, IProgress<string>? partialResults, CancellationToken = default)(MauiSpeechToTextService.cs:20): null-guardsculture(:25); requests recognition permissions and returnsnullwhen denied (:29-32); creates the completion source withRunContinuationsAsynchronously(:34); declaresOnUpdatedto forward interim text topartialResults(:36-37) andOnCompletedto resolve the finalTextwhen the recognition result is successful andnullotherwise (:39-40); subscribes both (:42-43); buildsSpeechToTextOptionscarrying the culture andShouldReportPartialResultsset only when a progress sink was supplied (:46-50); starts listening throughMainThread.InvokeOnMainThreadAsync(:52-56); registers the caller's cancellation to resolvenull(:58-59); and awaits the completion (:60). Thefinallyunsubscribes both handlers and callsStopListenAsync(CancellationToken.None), again marshalled to the main thread (:62-68).OperationCanceledExceptionreturnsnull(:70-73), and so does every other exception, via the filterex is not OperationCanceledException(:74-79).
- Why it's built this way: the platform recognizer must be created and driven from the main thread (Android's
SpeechRecognizerrefuses any other), and the permission await above it resumes on the thread pool, hence the main-thread hops around start and stop (:52-54). The catch is deliberately broad: the contract promisesnull, and a throw would surface as an unhandled error in the dictating form (:76-77). The guaranteed unsubscribe-and-stop infinallyis what prevents a leaked recognizer session across dictations, and stopping withCancellationToken.Nonemeans a cancelled listen still shuts the microphone down rather than abandoning it. Reporting partial results only when the caller passed anIProgress<string>avoids paying for interim recognition events nobody consumes. - Where it's used: registered as a singleton by
AddMauiDeviceCapabilities()(MMCA.Common.UI.Maui/DependencyInjection.cs:87); the fallback is NullSpeechToTextService (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:56). Consumed by dictation affordances on text inputs. - Caveats / not-in-source: heads must chain
.UseMauiCommunityToolkit()onto their ownUseMauiApp<T>()call for this adapter to work; the toolkit's MCT001 analyzer requires that call to appear in the app's own builder chain, soUseMauiDeviceCapabilities()cannot make it on the head's behalf (MMCA.Common.UI.Maui/HostingDependencyInjection.cs:24-27).
MauiTextToSpeechService
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.Media·MMCA.Common.UI.Maui/Capabilities/Media/MauiTextToSpeechService.cs:14· Level 1 · class (sealed partial,IDisposable)
- What it is: the MAUI adapter for
ITextToSpeechService, speaking text overTextToSpeech.Defaultwith locale matching and a cancellable in-flight utterance. - Depends on:
ITextToSpeechService; MAUI EssentialsTextToSpeech,SpeechOptions,Locale; BCLLock,CancellationTokenSource,CultureInfo. - Concept: single-utterance serialization plus best-effort locale selection.
[Rubric §21, Accessibility]assesses assistive affordances; read-aloud is one, and it is offered as a first-class capability rather than a platform afterthought.[Rubric §27, i18n]assesses culture-awareness; the adapter picks a voice for the current UI culture and falls back to the platform default, so a device without anesvoice still speaks rather than throwing (MMCA.Common.UI.Maui/Capabilities/Media/MauiTextToSpeechService.cs:7-9). - Walkthrough
_gate(MauiTextToSpeechService.cs:16, aLock) and_activeUtterance(MauiTextToSpeechService.cs:17, a nullableCancellationTokenSource) track the one in-flight utterance.IsSupported(MauiTextToSpeechService.cs:20): a constanttrue.SpeakAsync(string text, CancellationToken = default)(MauiTextToSpeechService.cs:23): guardstextwithArgumentException.ThrowIfNullOrWhiteSpace(:25), callsStopAsyncfirst so a new utterance preempts the previous one (:27), links a fresh CTS to the caller's token and stores it under the lock (:29-33), then speaks withSpeechOptionswhoseLocalecomes fromMatchLocaleAsync(CultureInfo.CurrentUICulture)(:37-41).OperationCanceledExceptionis expected and swallowed (:43-46), and so is every other exception (catch (Exception ex) when (ex is not OperationCanceledException),:47-51): a missing speech engine, an unsupported platform or any synthesizer failure ends the utterance silently rather than faulting the caller's button. Thefinallyclears_activeUtteranceonly if it is still this utterance, then disposes the CTS (:52-63).StopAsync()(MauiTextToSpeechService.cs:67): reads the active CTS under the lock (:69-73), returns if there is none (:75-78), elseCancelAsync, swallowingObjectDisposedExceptionfor the case where the utterance completed concurrently (:80-87).Dispose()(MauiTextToSpeechService.cs:91): disposes and clears any active CTS under the lock.MatchLocaleAsync(CultureInfo culture)(MauiTextToSpeechService.cs:100): fetches the installed locales and returns the first whoseLanguagematches the culture's two-letter ISO code (:104-106), ornull(meaning "platform default voice") on no match or on any non-cancellation failure to list voices (:108-112).
- Why it's built this way: MAUI exposes no stop API, so
StopAsynccancels the in-flight utterance's token instead (MauiTextToSpeechService.cs:10). TheLock-guarded single-utterance state keeps overlappingSpeakAsynccalls from talking over each other, and returningnullfrom locale matching lets the platform choose a voice rather than failing the whole call. Reading aloud is a convenience, so both catch filters exclude onlyOperationCanceledExceptionand absorb everything else (MauiTextToSpeechService.cs:47-51,:108-112). The class summary also notes that calls are expected from the renderer dispatcher: two off-dispatcher callers racing a live utterance can orphan a token source (MauiTextToSpeechService.cs:11-12). The per-head selection itself is ADR-042. - Where it's used: registered as a singleton by
AddMauiDeviceCapabilities()(MMCA.Common.UI.Maui/DependencyInjection.cs:72), overriding theNullTextToSpeechServicedefault that the sharedDependencyInjectionTryAdds atMMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:50. Consumed by read-aloud affordances in shared components.
BrowserAccessibilityAnnouncer
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Accessibility·MMCA.Common.UI/Services/Capabilities/Accessibility/BrowserAccessibilityAnnouncer.cs:8· Level 2 · class (sealed)
- What it is: the web adapter for
IAccessibilityAnnouncer. Where the native head calls the OS screen-reader API directly, the browser has no such API, so this writes the message into a visually hiddenaria-live="polite"region that every screen reader already monitors. - Depends on:
IAccessibilityAnnouncerandCapabilitiesJsModule(constructor-injected,MMCA.Common.UI/Services/Capabilities/Accessibility/BrowserAccessibilityAnnouncer.cs:10,:13); theannounceexport ofcapabilities-interop.js(MMCA.Common.UI/wwwroot/capabilities-interop.js:73). - Concept introduced: the live region as the web's equivalent of a screen-reader announce call. The JS side (
MMCA.Common.UI/wwwroot/capabilities-interop.js:52-71) creates onedivon first use witharia-live="polite"androle="status"(:57-58), styled inline (absolute, 1px,clip-path: inset(50%),:59-67) so it is invisible but not hidden from assistive tech, and appended todocument.body(:68).announceclears the region's text before setting it after a 50 ms timeout (:77-80) so that repeating the same message is re-announced rather than ignored as an unchanged node.[Rubric §21, Accessibility]assesses whether non-visual users receive information a sighted user gets from a purely visual change; this is the single mechanism the whole web head uses for that.[Rubric §18, UI Architecture]applies because the live region is created by the capability layer rather than by each page's markup, so no component has to remember to render one. - Walkthrough: the constructor captures the shared module into
_module(MMCA.Common.UI/Services/Capabilities/Accessibility/BrowserAccessibilityAnnouncer.cs:10,:13).AnnounceAsync(string message, CancellationToken = default)(:16-19) is one awaitedInvokeOrDefaultAsync<bool?>("announce", [message], cancellationToken)whose result is discarded: the contract returnsTask, and there is no useful caller response to "the announcement did not land". - Why it's built this way: routing through
CapabilitiesJsModulemeans an announcement fired during prerender (before any DOM exists) is a silent no-op instead of an exception, which matters because announcements are typically triggered from lifecycle methods that also run server-side. Creating the region lazily in JS keeps the RCL free of any required markup or stylesheet (MMCA.Common.UI/wwwroot/capabilities-interop.js:47-48). - Where it's used: registered scoped as
IAccessibilityAnnouncerbyAddBrowserDeviceCapabilities()(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:118); siblings areMauiAccessibilityAnnouncerandNullAccessibilityAnnouncer. Consumed by components announcing live updates.
MauiBarcodeScannerService
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.Media·MMCA.Common.UI.Maui/Capabilities/Media/MauiBarcodeScannerService.cs:26· Level 2 · class (sealed)
- What it is: the MAUI camera scanner for IBarcodeScannerService, built on ZXing.Net.MAUI (ADR-042). It pushes BarcodeScanPage modally over the current window page, resolves on the first decoded payload (or, for a continuous session, keeps the page open until the session ends), and pops the page again on every exit path (
MMCA.Common.UI.Maui/Capabilities/Media/MauiBarcodeScannerService.cs:6-13). - Depends on: IBarcodeScannerService (the contract), BarcodeScanPage (the surface it drives) and RepeatScanFilter (drops a code still held in view during a continuous session). Externals: MAUI
Application,Page,MainThread,DeviceInfoandDevicePlatform; MAUI EssentialsPermissions.CameraandPermissionStatus; ZXing.Net.MAUI transitively through the page; BCLFunc<string>,CancellationToken.Register,CancellationTokenSource.CreateLinkedTokenSource,TimeProviderandExceptionDispatchInfo(MauiBarcodeScannerService.cs:1). - Concept introduced: lazily resolved localized text in a singleton. The service is constructed while the app is being built, which is before
MauiCultureInitializerrestores the user's persisted language (ADR-027). Capturing the cancel label and camera description as strings at that moment would pin them to the device language for the life of the process, and no later in-app language switch would ever reach them. The class therefore takesFunc<string>delegates only, and defers the resource lookup to the moment each scan page is built (MauiBarcodeScannerService.cs:18-24,:87-91,:131-133). This is a general trap worth internalizing: anything captured during host construction predates culture restoration.[Rubric §27, i18n]§27 assesses whether the app follows the user's language everywhere, not just on pages rendered after a switch. There is no string-valued constructor to get this wrong with: the only way to build the service is to hand it the resource lookups themselves, which the XML doc spells out with a() => Localizer["Cancel"]example (MauiBarcodeScannerService.cs:31-37).[Rubric §11, Security]and[Rubric §30, Compliance/Privacy]both bear on the camera permission. The head declares the permission (AndroidCAMERA, iOSNSCameraUsageDescription) and the service requests it before the page opens, because the camera view of a page opened without it stays black. A user who denies it, or a head that never declared it, therefore getsnullwith no page shown, never an exception (MauiBarcodeScannerService.cs:10-13). The request is also exposed on its own asEnsureCameraAccessAsync, so a caller can ask up front and show its own message on a denial: ADC's check-in scan page does exactly that before opening a continuous session (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/CheckIns/CheckInScan.razor.cs:215,:221).[Rubric §32, Dependency & Supply-Chain]§32 assesses whether dependencies are carried only where needed. This service is registered byUseCommonBarcodeScanner()alone and is deliberately not folded intoUseMauiDeviceCapabilities(), so a head that never scans ships neither the ZXing camera handler nor a camera permission declaration (MauiBarcodeScannerService.cs:14-17,MMCA.Common.UI.Maui/HostingDependencyInjection.cs:95-97).[Rubric §21, Accessibility]§21 assesses whether outcomes reach every user. In a continuous session the text the caller returns for each code is shown over the camera view and announced to a screen reader, and it stays until the next new code is decoded, so the operator actually sees (or hears) "Checked in" before the camera looks again (MauiBarcodeScannerService.cs:102-110).
- Walkthrough
_cancelText/_cameraDescription(MauiBarcodeScannerService.cs:28-29): the two deferred text resolvers.- The single constructor
MauiBarcodeScannerService(Func<string>, Func<string>)(MauiBarcodeScannerService.cs:38) null-guards both delegates and stores them (:40-44). IsSupported(MauiBarcodeScannerService.cs:53-55):DeviceInfo.Current.Platformequal toDevicePlatform.AndroidorDevicePlatform.iOS. Mac Catalyst and Windows have cameras, but the scan affordance there is a desktop paste field in every head that uses this, and the ZXing camera view is not a supported surface on those targets (:48-52).EnsureCameraAccessAsync(CancellationToken = default)(MauiBarcodeScannerService.cs:58): returnsfalsewhen unsupported or already cancelled (:60-63), otherwise runsRequestCameraAsyncon the main thread (:67). A catch-all with a CA1031 suppression turns any throw intofalse, the justification being that a head that never declared the permission throws here and that must read as "no camera access" (:69-74).ScanAsync(CancellationToken = default)(MauiBarcodeScannerService.cs:78): returnsnullunlessEnsureCameraAccessAsyncgranted access (:80-83), otherwise marshals to the main thread and invokes both delegates there, once per scan (:87-91). The scan sits under its owncatch-all with an explicit CA1031 suppression whose justification is that scanning is best-effort: a missing window, a denied camera and a handler-less platform must all read as "no scan" (:93-98).ScanContinuouslyAsync(Func<string, CancellationToken, Task<string?>> onScanned, CancellationToken = default)(MauiBarcodeScannerService.cs:117): null-guardsonScanned(:121), returns quietly unless camera access is granted (:123-126), then runsRunSessionOnMainThreadAsyncon the main thread with both delegates invoked there (:128-133). A CA1031 catch-all makes a missing window, a denied camera or a handler-less platform read as "the session ended" (:135-140). A callback exception is not swallowed: the session returns it as anExceptionDispatchInfoand it is rethrown with its original stack only after the page is popped (:142,:113-114).OutcomeDwell(MauiBarcodeScannerService.cs:151):TimeSpan.FromMilliseconds(1500), how long a continuous session holds detection after a decode so the outcome is read before the camera looks again. It is a constant, like RepeatScanFilter'sRepeatWindow(5 seconds,MMCA.Common.UI/Services/Capabilities/Media/RepeatScanFilter.cs:20), because it is a property of handheld scanning rather than of an app (:145-150).RequestCameraAsync()(MauiBarcodeScannerService.cs:153): checksPermissions.Cameraand prompts only when the status is not alreadyGranted(:156-160), returning whether it ends up granted (:162). Both awaits useConfigureAwait(true)because the platform prompt must be raised from the main thread (:155).ScanOnMainThreadAsync(...)(MauiBarcodeScannerService.cs:165): resolves the host page and returnsnullif there is none (:170-174), constructs the page (:176), pushes it modally (:180), registers the caller's cancellation token againstscanPage.Cancel(:183), awaits oneNextDecodeAsync(:184), and in afinallyends the page's session and pops the modal so the page leaves the stack on every path (:186-190). Every await here usesConfigureAwait(true)on purpose: modal navigation and the camera view are main-thread bound and this method is already on that thread (:178-179).RunSessionOnMainThreadAsync(...)(MauiBarcodeScannerService.cs:198): resolves the host page or returns (:204-208), creates a token source linked to the caller's token and passes itsCancelto the page asonEnded, so a lookup still in flight when the operator taps Cancel is told to stop (:210-213). It pushes the page (:215), registers the caller's token againstscanPage.Cancel(:218), and loops onNextDecodeAsyncwith aRepeatScanFilteroverTimeProvider.System(:219-220): a new payload goes toHandleDecodeAsync, and a captured callback failure ends the loop and is returned (:222-226). After every decode, repeat or not, it waitsOutcomeDwellor the session's end, whichever comes first, so a code held in view is not decoded at the camera's frame rate (:228-230). Thefinallyends the session before the token source is disposed and makes the single pop (:235-241).HandleDecodeAsync(...)(MauiBarcodeScannerService.cs:249): clears the previous outcome first (:255), awaitsonScanned(payload, sessionToken)(:260), treats anOperationCanceledExceptionraised after the session token was cancelled as "nothing left to show" (:262-266), captures any other exception under a CA1031 suppression (:267-272), and shows the returned text only while the session is still open (:274-277).CurrentPage(MauiBarcodeScannerService.cs:282): readsApplication.Current?.Windowsand returnswindows[0].Pagewhen the collection is non-empty (:288-289).Application.MainPageis obsolete on the .NET 10 MAUI train, so the window'sPageis the supported way to reach the active navigation stack (:286-287).
- Why it's built this way: the single
PopModalAsyncliving in each main-thread method'sfinally, paired with the page consuming the hardware back gesture, means exactly one pop happens per scan or per session no matter how it ended. Running a continuous session on one modal page, rather than callingScanAsyncin a loop, is what keeps the outcome on screen: a loop pushing a fresh page per code would reopen the camera the moment the outcome rendered, so the operator would never see it (MauiBarcodeScannerService.cs:104-108). Returning the callback's exception instead of throwing it inside the session lets the page close before the caller sees the failure. - Where it's used: registered as a singleton
IBarcodeScannerServicebyUseCommonBarcodeScanner(Func<string>, Func<string>), through a factory that closes over the two delegates (MMCA.Common.UI.Maui/HostingDependencyInjection.cs:114-125). That plainAddSingletononly beats theTryAddSingletondefault of NullBarcodeScannerService (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:80) because the head calls it afterAddUIShared(HostingDependencyInjection.cs:108-109). ADC's MAUI head calls it with resource-lookup delegates for badge check-in QR scanning (MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI/MauiProgram.cs:162-164), and ADC's check-in page drives it throughScanContinuouslyAsync(MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/CheckIns/CheckInScan.razor.cs:221).
MauiMediaPickerService
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.Media·MMCA.Common.UI.Maui/Capabilities/Media/MauiMediaPickerService.cs:12· Level 2 · class (sealed)
- What it is: the MAUI adapter for
IMediaPickerService: it opens the platform photo library or camera for avatar upload, has the platform downscale and recompress the photo on the device, and returns the result as aPickedMedia, ornull(MauiMediaPickerService.cs:6-10). - Depends on:
IMediaPickerServiceandPickedMedia; MAUI EssentialsMediaPicker,MediaPickerOptions,DeviceInfo,FileResult. - Concept introduced, stream-ownership-safe cancellation. The single most instructive detail in this class is where the cancellation check sits, and the code explains itself in a four-line comment (
MauiMediaPickerService.cs:63-66; the check itself is:67). The token is checked after the file is picked but before the stream is opened. If it were checked afterOpenReadAsync, throwing would leak the file handle, because at that instant nothing downstream owns anything disposable yet: thePickedMediathat takes ownership of the stream has not been constructed. A cancellation that lands duringOpenReadAsynctherefore just returns the picked media, which the caller disposes as usual. This is a good model for placing a cancellation check in any acquire-then-wrap sequence.[Rubric §12, Performance & Scalability]assesses resource handling. The ownership boundary here is explicit: either no stream is opened, or aPickedMediaexists to dispose it.[Rubric §15, Best Practices & Code Quality]assesses disciplined suppressions. The one#pragma warning disableblock is narrowly scoped and carries an inline justification:CS0618becausePickPhotoAsyncis obsolete only in favor of a multi-select API and an avatar is exactly one photo (:22-24). The best-effort catch needs no suppression at all, because it is an exception filter rather than a bare catch (:72).[Rubric §30, Compliance/Privacy]assesses whether personal data leaves the device only when it must. The upload options drop the photo's metadata, which also keeps the capture's location off the upload (:38-43,:50).
- Walkthrough
MaxPhotoDimension = 1024andPhotoQuality = 85(MauiMediaPickerService.cs:14-15): the resize bound and compression quality, because a full-size camera capture is several megabytes and an avatar upload is capped well below that (:9-10).IsSupported(MauiMediaPickerService.cs:18): the one non-constantIsSupportedamong the native adapters in this unit,MediaPicker.Default.IsCaptureSupported || DeviceInfo.Current.Platform != DevicePlatform.WinUI. In words: any non-WinUI platform is supported, and WinUI is supported only if the platform reports camera capture.PickPhotoAsync(CancellationToken = default)(MauiMediaPickerService.cs:21): delegates straight to the shared core withMediaPicker.Default.PickPhotoAsync(UploadOptions())as the picking function (:23).CapturePhotoAsync(CancellationToken = default)(MauiMediaPickerService.cs:31): runs the same core with a picking function that probesMediaPicker.Default.IsCaptureSupportedinside the guarded pick, callsCapturePhotoAsync(UploadOptions())when it holds, and yields a nullFileResulton a device with no camera (:32-36). The probe sits inside the guard so a platform fault while resolving the camera intent also becomesnullrather than a throw (:27-30).UploadOptions()(MauiMediaPickerService.cs:44): a freshMediaPickerOptionswithMaximumWidthandMaximumHeightatMaxPhotoDimension,CompressionQualityatPhotoQuality,RotateImage = trueandPreserveMetaData = false(:44-51). Rotation is applied to the pixels because the metadata that records the orientation is dropped. The platform returns the original file when it cannot process one, so a caller with a size limit still has to check it (:38-43).PickCoreAsync(Func<Task<FileResult?>> pick, CancellationToken)(MauiMediaPickerService.cs:53): the shared body. It invokes the supplied picker (:57), returnsnullwhen the user cancelled the sheet (:58-61), performs the ownership-safe cancellation check (:67), opens the stream (:69), and wraps it in aPickedMediawith the file name and a content type defaulted toapplication/octet-streamwhen the platform reports none (:70).- A single catch with the filter
ex is not OperationCanceledException(:72): the caller's own cancellation still propagates, and a denied permission, an unresolvable camera or any other platform failure becomesnull(:74-77).
- Why it's built this way: ADR-045 for avatars and managed file storage, ADR-042 for the layer. Web heads do not need a native picker at all (they render an
InputFile), so the entire native flow, including its permission prompts, lives here behind the capability contract and never reaches the shared component. - Where it's used: registered as a singleton by
AddMauiDeviceCapabilities()(MMCA.Common.UI.Maui/DependencyInjection.cs:106), overridingNullMediaPickerService(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:75). The registration comment records the out-of-code prerequisite: the head must declare the camera permission itself, AndroidCAMERAplus the iOS usage strings (MMCA.Common.UI.Maui/DependencyInjection.cs:104-105). - Caveats / not-in-source:
MediaPickerowns the platform permission prompts (MauiMediaPickerService.cs:6-7), so no permission code appears in this class; a denied permission is one of the failures the filtered catch turns intonull. Whether the platform actually honors the resize options on a given device is platform behavior: the class only states that the original file comes back when it cannot (MauiMediaPickerService.cs:40-43).
IBiometricAuthenticator
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Auth·MMCA.Common.UI/Services/Capabilities/Auth/IBiometricAuthenticator.cs:9· Level 0 · interface
- What it is: prompts for platform biometric or device-credential authentication (fingerprint, Face ID, Windows Hello) to gate stored-token auto-login behind an opt-in app lock.
- Depends on: BCL only.
- Concept introduced, fail-closed boolean auth gating.
[Rubric §11, Security]and[Rubric §26, Front-End Security]assess whether client-side auth degrades safely. The contract is deliberately all-booleans (IBiometricAuthenticator.cs:5-7): availability and outcome are bothboolso that on any failure the caller falls back to the normal credential login, never to a weaker path. The app-lock gated by this service is toggled throughDevicePreferenceKeys.AppLockEnabled(ADR-042 Wave 4). - Walkthrough
IsAvailableAsync(CancellationToken = default)(IBiometricAuthenticator.cs:12): whether a biometric or device-credential prompt can be presented right now.AuthenticateAsync(string reason, CancellationToken = default)(IBiometricAuthenticator.cs:19): shows the platform prompt with a localizedreason(IBiometricAuthenticator.cs:15); returnstrueonly on positive verification, and cancellation, lockout, and errors all collapse tofalse(IBiometricAuthenticator.cs:16-17).
- Why it's built this way: folding cancellation, lockout, and error into a single
falsekeeps the call site's decision binary (verified or not) and forbids a partial-success path; the localizedreasonis required because the platform surfaces it in the system prompt. - Where it's used: implemented by
MauiBiometricAuthenticatorand the inertNullBiometricAuthenticator, the TryAdd default (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:55); consumed by the auto-login app-lock gate, and faked in component tests byFakeBiometricAuthenticator. - Caveats / not-in-source: the actual token store and auto-login flow live in the head apps and the Identity layer; this contract only decides "is the user present".
AutofillCallback
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Auth·MMCA.Common.UI/Services/Capabilities/Auth/BrowserPasskeyCapability.cs:123· Level 0 · class (internal sealed, nested)
- What it is: the .NET object that
passkeys.jscalls back into when the user picks a passkey from the browser's autofill suggestions (BrowserPasskeyCapability.cs:121-122). It is nested insideBrowserPasskeyCapabilityand is not public. - Depends on: BCL
Func<JsonElement, Task>andSystem.Text.Json.JsonElement; the Blazor[JSInvokable]attribute. - Concept: a JS-to-.NET callback target. Every other capability in this group calls JS and awaits
an answer; autofill inverts the direction, because the browser answers later, whenever the user
picks a suggestion. The capability wraps the caller's delegate in this object and hands a
DotNetObjectReferenceto JS (BrowserPasskeyCapability.cs:64-65); JS invokes it by method name (MMCA.Common.UI/wwwroot/passkeys.js:164).[Rubric §18, UI Architecture]assesses how UI code crosses the JS interop boundary; this keeps the interop-visible surface to one internal method rather than exposing a component. - Walkthrough: primary constructor capturing
onCredential(BrowserPasskeyCapability.cs:123).OnAutofillCredential(JsonElement credential)(BrowserPasskeyCapability.cs:128-129), marked[JSInvokable], forwards the assertion (theAuthenticationResponseJSONshape,BrowserPasskeyCapability.cs:126) to the delegate and returns its task. - Why it's built this way: the reference is owned by the capability, which disposes the previous one
before creating a new one (
BrowserPasskeyCapability.cs:64) and disposes it again inDisposeAsync(BrowserPasskeyCapability.cs:99), so a restarted autofill never leaks a pinned .NET object. - Where it's used: created only by
BrowserPasskeyCapability.StartAutofillAsync(BrowserPasskeyCapability.cs:65); no usage outside the defining file.
ExternalSignInResult
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Auth·MMCA.Common.UI/Services/Capabilities/Auth/ExternalSignInResult.cs:9· Level 0 · class (sealed)
- What it is: how a brokered external sign-in ended: whether the user ended up authenticated and,
when the server refused the sign-in, the server's error code (for example
Auth.ExternalEmailNotVerified), so the Login page can show the same mapped refusal the web flow shows instead of a generic "try again" (ExternalSignInResult.cs:3-8). - Depends on: BCL only.
- Concept: a small closed result type with a private constructor and two named ways in. It is not
the framework
Result<T>(taught in the primer): this lives inMMCA.Common.UI, carries no error list, and models one outcome a UI decision needs.[Rubric §11, Security]assesses authentication design; separating "the server refused you, here is why" from "dismissed or cancelled" keeps a sign-in that can never succeed from looking retryable. - Walkthrough
- Private constructor
(bool succeeded, string? errorCode)(ExternalSignInResult.cs:11-15). Success(ExternalSignInResult.cs:18): a static shared instance, the result of a sign-in that handed off to the completion page, withErrorCodenull.Succeeded(ExternalSignInResult.cs:21) andErrorCode(ExternalSignInResult.cs:27): the error code is null on success and on any failure without one (dismissed, cancelled, unsupported, an unreadable callback,ExternalSignInResult.cs:23-26).Failed(string? errorCode = null)(ExternalSignInResult.cs:32): the failed result, with or without a server code.
- Private constructor
- Why it's built this way: a bare
boolcould not carry the server's reason, and the private constructor means a result is always one of the two shapes, neverSucceeded = truewith an error code. - Where it's used: returned by
IExternalAuthBroker.SignInAsync(MMCA.Common.UI/Services/Capabilities/Auth/IExternalAuthBroker.cs:23).MauiExternalAuthBrokerreturnsFailed()on each local exit,Failed(serverError)when the callback carries a server error, andSuccesswhen a code was received (MMCA.Common.UI.Maui/Capabilities/Auth/MauiExternalAuthBroker.cs:69,142,154);UnavailableExternalAuthBrokeralways returnsFailed(). The Login page mapsErrorCodeto a message and falls back to the generic failure text (MMCA.Common.UI/Pages/Auth/Login.razor:339-342); covered byLoginBrokerRefusalTests(MMCA.Common/Tests/Presentation/MMCA.Common.UI.Tests/Pages/Auth/Broker/LoginBrokerRefusalTests.cs).
IPasskeyCapability
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Auth·MMCA.Common.UI/Services/Capabilities/Auth/IPasskeyCapability.cs:16· Level 0 · interface
- What it is: the head's WebAuthn capability: it runs the browser half of a passkey ceremony
(
IPasskeyCapability.cs:5-10). Browser heads registerBrowserPasskeyCapability; every other head keepsUnavailablePasskeyCapability, so a MAUI head hides passkey affordances instead of offering a ceremony it cannot run. - Depends on: BCL
System.Text.Json.JsonElement,Task,CancellationToken. - Concept: opaque JSON across the capability boundary. Options and credentials cross as
JsonElementin the WebAuthn*JSONshapes (binary members base64url-encoded), exactly what the API's passkey endpoints take and return, so nothing between the endpoint and the browser has to understand them (IPasskeyCapability.cs:11-15). It follows the same per-host contract shape taught atIAccessibilityAnnouncer(ADR-042), with anIsAvailableprobe likeIExternalAuthBroker.[Rubric §11, Security]assesses authentication design; the client never inspects or builds a credential, so the server stays the only party that verifies one (ADR-139). - Walkthrough
IsAvailable(IPasskeyCapability.cs:19): whether this head can run a ceremony at all.CreateAsync(JsonElement options, CancellationToken = default)(IPasskeyCapability.cs:25):navigator.credentials.createfor options fromauth/passkeys/register/options; null when the user cancelled or the browser cannot (IPasskeyCapability.cs:21-24).GetAsync(JsonElement options, CancellationToken = default)(IPasskeyCapability.cs:31):navigator.credentials.getwith the browser's own prompt, for options fromauth/passkeys/signin/options; null on cancel or no support.IsAutofillAvailableAsync(CancellationToken = default)(IPasskeyCapability.cs:40): whether the browser supports conditional mediation. It is asked BEFORE any sign-in options are requested for autofill, so a browser without it stores no server challenge (IPasskeyCapability.cs:33-37).StartAutofillAsync(JsonElement options, Func<JsonElement, Task> onCredential, CancellationToken = default)(IPasskeyCapability.cs:50): starts autofill; the browser offers passkeys in the email field's suggestions andonCredentialruns if one is picked. Returns true only when it started.CancelAutofillAsync()(IPasskeyCapability.cs:54): stops a pending autofill so a modal request can run.
- Why it's built this way: ADR-139 makes passkeys opt-in, and ADR-042 selects the capability per head. Every member answers null or false rather than throwing on cancel or no support, so a component treats "no credential" as one case.
- Where it's used: TryAdd default
UnavailablePasskeyCapability(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:61), overridden on browser heads (DependencyInjection.cs:126). The Login page offers passkeys only whenSignIn:OfferPasskeysis on and the resolved capability reportsIsAvailable(MMCA.Common.UI/Pages/Auth/Login.razor.cs:200-203). Injected byPasskeySignInButton(MMCA.Common.UI/Components/Auth/PasskeySignInButton.razor.cs:42) andPasskeysPanel(MMCA.Common.UI/Components/Auth/PasskeysPanel.razor.cs:41).
BrowserPasskeyCapability
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Auth·MMCA.Common.UI/Services/Capabilities/Auth/BrowserPasskeyCapability.cs:14· Level 1 · class (sealed)
- What it is: the browser adapter for
IPasskeyCapability: it runs the WebAuthn ceremony throughnavigator.credentialsvia the RCL'spasskeys.jsmodule. - Depends on:
IPasskeyCapability, the nestedAutofillCallback,LazyJsModule, the internalJsInteropFailureclassifier, and Blazor'sIJSRuntimeandDotNetObjectReference; implementsIAsyncDisposable. - Concept: a ceremony that waits on a person. The browser prompt can sit for minutes while the user
finds a security key or reads a phone, so the call carries its own limit,
CeremonyTimeoutof 5 minutes (BrowserPasskeyCapability.cs:18-20), instead of the circuit's default interop timeout. Every interop failure (prerender, a torn-down circuit, a browser that throws, a timeout) folds into the same null or false answer a cancelled prompt gives (BrowserPasskeyCapability.cs:113-118).[Rubric §18, UI Architecture]assesses JS interop discipline; the module is imported lazily and once. - Walkthrough
ModulePathis./_content/MMCA.Common.UI/passkeys.js(BrowserPasskeyCapability.cs:16); the constructor wraps it in aLazyJsModuleover the host'sIJSRuntime(BrowserPasskeyCapability.cs:27).IsAvailable => true(BrowserPasskeyCapability.cs:34): always true on a browser head; whether this browser supports WebAuthn is checked by the module at ceremony time, which then answers null (BrowserPasskeyCapability.cs:30-33).CreateAsync/GetAsync(BrowserPasskeyCapability.cs:37-42) both go throughInvokeCeremonyAsync(BrowserPasskeyCapability.cs:104-119), which links the caller's token to aCancelAfter(CeremonyTimeout)source and returns null on an interop failure unless the CALLER cancelled, in which case the cancellation propagates (BrowserPasskeyCapability.cs:113).IsAutofillAvailableAsync(BrowserPasskeyCapability.cs:45-57) invokesisAutofillAvailable, false on failure.StartAutofillAsync(BrowserPasskeyCapability.cs:60-75) disposes any previous callback, creates aDotNetObjectReference<AutofillCallback>and passes it with the options tostartAutofill.CancelAutofillAsync(BrowserPasskeyCapability.cs:78-94) is a no-op until the module was imported, then callscancelAutofilland swallows interop failures.DisposeAsync(BrowserPasskeyCapability.cs:97-102) disposes the callback and the module.- Every catch filter (
BrowserPasskeyCapability.cs:52,71,90,113) calls the sharedJsInteropFailure.IsUnavailable(MMCA.Common.UI/Common/JsInteropFailure.cs:27-31), the one definition of an interop failure used by every best-effort interop call in the framework:InvalidOperationException,JSDisconnectedException,JSExceptionorOperationCanceledException(which covers theTaskCanceledExceptionof an interop timeout). - The JS exports it calls are
create,get,isAutofillAvailable,startAutofillandcancelAutofill(MMCA.Common.UI/wwwroot/passkeys.js:97,104,120,139,149).
- Why it's built this way: ADR-139 passkey sign-in on browser heads, selected per head under ADR-042. Collapsing failures to null keeps callers from branching on interop exception types.
- Where it's used: registered scoped as
IPasskeyCapabilitybyAddBrowserDeviceCapabilities()(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:126); covered byBrowserPasskeyCapabilityTests(MMCA.Common/Tests/Presentation/MMCA.Common.UI.Tests/Services/Capabilities/Auth/BrowserPasskeyCapabilityTests.cs).
IExternalAuthBroker
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Auth·MMCA.Common.UI/Services/Capabilities/Auth/IExternalAuthBroker.cs:11· Level 1 · interface
- What it is: runs an external OAuth sign-in (Google/GitHub) through the platform's system-browser authenticator instead of a web redirect, because the identity providers reject embedded WebViews.
- Depends on:
ExternalSignInResult; otherwise BCL only. - Concept, native OAuth callback capture.
[Rubric §11, Security]and[Rubric §26, Front-End Security]. The default broker is unavailable, which preserves the existing anchor-href redirect flow on web heads; the MAUI implementation drivesWebAuthenticatoragainst the API's OAuth endpoints and hands the single-use completion code to the shared/auth/oauth-completepage, which owns the code exchange and the token storage (IExternalAuthBroker.cs:4-9). This is the client half of the native deep-link OAuth callback design (ADR-043), where the server redirects a single-use completion code to an allow-listed custom scheme soWebAuthenticatorcan capture it (never tokens over the wire). - Walkthrough
IsAvailable(IExternalAuthBroker.cs:14): whether a native brokered sign-in exists on this host (false on web heads).SignInAsync(string provider, CancellationToken = default)(IExternalAuthBroker.cs:23): starts the brokered flow for a provider (google,github): system-browser challenge and callback capture, then the hand-off of the single-use code to the completion page. It returns anExternalSignInResult: whether the code was handed off and, when the server refused the sign-in, its error code. It never throws for a failed or dismissed flow: every such outcome is a failed result (IExternalAuthBroker.cs:16-22). The MAUI broker does the hand-off as a navigation to/auth/oauth-complete?code=...(MMCA.Common.UI.Maui/Capabilities/Auth/MauiExternalAuthBroker.cs:152-153).
- Why it's built this way: an unavailable default means a component can attempt native brokering
and cleanly fall back to the web anchor flow when
IsAvailableis false, so one login page serves every head (ADR-043). Leaving the exchange and token storage to the shared completion page means native and web sign-ins finish through one code path. Returning the server's error code lets the native path show the same refusal text as the web flow, while a dismissal keeps the generic retry message (MMCA.Common.UI/Pages/Auth/Login.razor:335-342). - Where it's used: implemented by
MauiExternalAuthBroker(native,MMCA.Common.UI.Maui/DependencyInjection.cs:111) and the fallbackUnavailableExternalAuthBroker, which is the TryAdd default (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:57); consumed by the login page's external-provider buttons (MMCA.Common.UI/Pages/Auth/Login.razor:339).
NullBiometricAuthenticator
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Auth·MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/Auth/NullBiometricAuthenticator.cs:4· Level 1 · class (sealed)
- What it is: the default
IBiometricAuthenticator: biometrics unavailable, so hosts hide the app-lock toggle (NullBiometricAuthenticator.cs:3). - Depends on:
IBiometricAuthenticator; BCLTask. - Concept: fail closed. Most defaults in this unit degrade toward "nothing happens", which is safe because nothing was being protected. This one degrades toward "authentication did not succeed", which is the only safe direction for a security gate:
AuthenticateAsyncreturnsfalse, nevertrue, so a caller that skips the availability probe and treats the result as a grant still cannot unlock anything.[Rubric §11, Security]assesses whether security decisions default to denial. Both members returnfalse, so an absent capability can never be mistaken for a passed check.[Rubric §1, SOLID]assesses substitutability. The distinction matters here: a Null Object must preserve the semantics of the contract, and for an authenticator that means denial, not a convenient success.
- Walkthrough
IsAvailableAsync(CancellationToken)(NullBiometricAuthenticator.cs:7-8):Task.FromResult(false); the UI hides the app-lock setting.AuthenticateAsync(string reason, CancellationToken)(NullBiometricAuthenticator.cs:11-12):Task.FromResult(false), ignoring the reason string that a real prompt would display.
- Why it's built this way: ADR-042. App lock is a native-only affordance, and web heads already sit behind the normal auth pipeline, so the framework does not simulate a biometric prompt in a browser.
- Where it's used:
TryAddSingletoninAddDeviceCapabilityDefaults()(DependencyInjection.cs:54);MauiBiometricAuthenticatoris the only override (MMCA.Common/Source/Presentation/MMCA.Common.UI.Maui/DependencyInjection.cs:86). Both members are asserted false inCapabilityFallbackTests(CapabilityFallbackTests.cs:151-152).
UnavailablePasskeyCapability
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Auth·MMCA.Common.UI/Services/Capabilities/Auth/UnavailablePasskeyCapability.cs:10· Level 1 · class (sealed)
- What it is: the default
IPasskeyCapability: no WebAuthn on this head. Every non-browser head keeps it (the MAUI head included, which has no native passkey support yet), so the shared sign-in page and passkeys panel hide their passkey affordances there (UnavailablePasskeyCapability.cs:5-9). - Depends on: implements
IPasskeyCapability; BCLTaskandJsonElement. - Concept: the same Null Object default as
UnavailableExternalAuthBroker, and named the same way because the contract probesIsAvailable.[Rubric §11, Security]assesses whether an absent capability fails closed: every ceremony answers "no credential", never a fabricated one. - Walkthrough:
IsAvailable => false(UnavailablePasskeyCapability.cs:13);CreateAsyncandGetAsyncreturn a completed null (UnavailablePasskeyCapability.cs:16-21);IsAutofillAvailableAsyncandStartAutofillAsyncreturn false (UnavailablePasskeyCapability.cs:24-28);CancelAutofillAsyncreturnsTask.CompletedTask(UnavailablePasskeyCapability.cs:31). - Why it's built this way: ADR-139. Passkeys are opt-in and browser-only today, so the zero-configuration answer is "not on this head", and a head gains passkeys by registering the browser adapter.
- Where it's used:
TryAddSingletoninAddDeviceCapabilityDefaults()(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:59-61); replaced on browser heads byBrowserPasskeyCapability(DependencyInjection.cs:126). With it resolved, the Login page does not offer passkeys (MMCA.Common.UI/Pages/Auth/Login.razor.cs:200-203). Used as the head stand-in byPasskeysPanelTests,LoginPasskeyTestsand the ADCProfilePasskeysTests.
UnavailableExternalAuthBroker
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Auth·MMCA.Common.UI/Services/Capabilities/Auth/UnavailableExternalAuthBroker.cs:7· Level 2 · class (sealed)
- What it is - the default
IExternalAuthBroker: there is no native sign-in broker on this head. It reports itself unavailable and refuses to run a brokered flow, which keeps the shared Login page on its ordinary anchor-href OAuth redirect (UnavailableExternalAuthBroker.cs:3-6). - Depends on - implements
IExternalAuthBroker; returnsExternalSignInResult; BCLTaskotherwise. NoNavigationManager, no configuration, no HTTP, no state. - Concept introduced - the fallback that is the correct behavior, not a degraded one. The other defaults in this unit stand in for a capability that simply is not there (no geocoder, no camera). This one is different, and the class doc is explicit about it (
UnavailableExternalAuthBroker.cs:4-5): for a web head, "no native broker" is not a shortfall, it is the right answer, because the browser already has a perfectly good OAuth flow, the redirect. Identity providers reject embedded WebViews, which is the whole reason a native broker exists at all (MMCA.Common.UI/Services/Capabilities/Auth/IExternalAuthBroker.cs:4-8); a browser has no WebView problem to solve. SoIsAvailable == falsehere means "use the flow you already have," and the login page's provider buttons take the anchor path unchanged.- Note the naming signal too. It is
Unavailable..., notNull..., matching this contract'sIsAvailableprobe (IExternalAuthBroker.cs:12-13) rather than theIsSupportedprobe most other contracts use;UnavailablePasskeyCapabilityfollows the same convention for the same reason. - [Rubric §11 - Security] §11 assesses authentication design. Making the absence of native brokering the default means no build accidentally routes an OAuth flow through an unconfigured broker; a head opts in to brokering by registering a real one.
- [Rubric §26 - Front-End Security] §26 assesses browser-side security posture. The default keeps every web head on the provider-sanctioned redirect flow rather than any in-app substitute.
- [Rubric §2 - Design Patterns] §2 assesses pattern fit; structurally this is the same Null Object shape taught at
NullGeocodingService, here applied to a two-member contract.
- Note the naming signal too. It is
- Walkthrough -
sealed classimplementing the interface (UnavailableExternalAuthBroker.cs:7).IsAvailable => false(UnavailableExternalAuthBroker.cs:10) is the probe the login page reads to decide whether to draw a brokered button at all.SignInAsync(string provider, CancellationToken cancellationToken = default)(UnavailableExternalAuthBroker.cs:13-14) ignores both arguments and returnsTask.FromResult(ExternalSignInResult.Failed()), an already-completed task, so a caller that skips the probe and calls anyway gets a clean "not authenticated" answer with no server error code instead of an exception (MMCA.Common.UI/Services/Capabilities/Auth/IExternalAuthBroker.cs:16-23). - Why it's built this way - ADR-043 (mobile deep links and native OAuth callback) governs the native path, and ADR-042 governs the per-head selection. One Login page has to serve three heads; giving it a resolved broker with an availability probe means it never needs to know which head it is on, and this default makes the web behavior the zero-configuration one.
- Where it's used -
TryAdd-registered as a singleton byAddDeviceCapabilityDefaults(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:57), and resolved by the shared Login page, which injects the broker (MMCA.Common.UI/Pages/Auth/Login.razor:22), gates each brokered provider button (Apple, Google, GitHub) onExternalAuthBroker.IsAvailable(Login.razor:194,216,238), routes a provider click to the broker or the redirect on the same probe (MMCA.Common.UI/Pages/Auth/Login.razor.cs:265), and callsSignInAsync(provider)fromSignInWithBrokerAsync(Login.razor:331,339). With this default resolved, the brokered buttons stay hidden and the anchor-href path is the only one rendered. The MAUI head overrides it withMauiExternalAuthBroker, registeredAddScoped(MMCA.Common.UI.Maui/DependencyInjection.cs:111); web and Server heads keep this default, sinceAddBrowserDeviceCapabilitiescontains no broker override (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:110-129). The framework's own bUnit base registers this exact pair by hand so shared-page tests exercise the production web default (MMCA.Common/Tests/Presentation/MMCA.Common.UI.Tests/BunitTestBase.cs:37), andCapabilityFallbackTestscovers it.
AppResumedEventArgs
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.DeviceStatus·MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/DeviceStatus/AppResumedEventArgs.cs:8· Level 0 · class (sealed)
- What it is: the event args for
IAppLifecycleNotifier'sResumedevent, carrying how long the app was in the background before it came back to the foreground (AppResumedEventArgs.cs:8-12). - Depends on: BCL only (
System.EventArgs,System.TimeSpan). - Concept, a primary-constructor event-args type. The whole class is a primary constructor and one readonly property; there is no logic here, only a data carrier for the resume signal.
- Walkthrough
BackgroundDuration(AppResumedEventArgs.cs:11): set once from the constructor argument and never mutated.
- Why it's built this way: a primary constructor keeps a pure data-carrier args type to a single line, matching the shape .NET event args normally take.
- Where it's used: raised by
AppLifecycleNotifier.NotifyResumed()(MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/DeviceStatus/AppLifecycleNotifier.cs:41); read byBiometricGate'sOnResumedhandler, which re-locks the app when the background gap meets or exceeds its re-lock threshold (MMCA.Common/Source/Presentation/MMCA.Common.UI/Components/Capabilities/BiometricGate.razor.cs:125-131).
IBatteryStatusService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.DeviceStatus·MMCA.Common.UI/Services/Capabilities/DeviceStatus/IBatteryStatusService.cs:8· Level 0 · interface
- What it is: exposes the platform energy-saver state (plus a change event) so live features can throttle themselves on a draining battery.
- Depends on: BCL only (
System.EventHandler). - Concept, the property plus change-event capability shape. This is the first of several
read-a-state, react-to-changes contracts (compare
IConnectivityStatusService): a bool property plus anEventHandlerthat fires after it changes, with handlers re-reading the property.[Rubric §12, Performance & Scalability]and[Rubric §23, Front-End Performance]assess whether the client adapts work to device constraints; here a component can drop a SignalR channel auto-join when the OS reports low-power mode (IBatteryStatusService.cs:4-5). Web and null fallbacks always reportfalseand never raise the event (IBatteryStatusService.cs:5-6), so a non-native head simply behaves as "never energy-saving". - Walkthrough
EnergySaverChanged(IBatteryStatusService.cs:11): raised afterIsEnergySaverOnchanges; handlers read the new value from the property rather than from event args (IBatteryStatusService.cs:10).IsEnergySaverOn(IBatteryStatusService.cs:14): whether OS energy saver or low-power mode is active right now.
- Why it's built this way: the property-plus-event shape lets a component both read the current state on render and subscribe for later transitions without polling; the always-false fallback keeps the throttling logic branch-free on non-native heads.
- Where it's used: implemented by
MauiBatteryStatusServiceand the fallbackNullBatteryStatusService, which is the TryAdd default (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:54); consumed by live and real-time components deciding whether to auto-join channels.
IConnectivityStatusService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.DeviceStatus·MMCA.Common.UI/Services/Capabilities/DeviceStatus/IConnectivityStatusService.cs:10· Level 0 · interface
- What it is: reports whether the device currently has network access (with a change event and an explicit initialize step), so shared components can show an offline banner and skip doomed API calls.
- Depends on: BCL only (
System.EventHandler,System.Threading.Tasks.ValueTask). - Concept, offline-awareness at the UI edge.
[Rubric §29, Resilience & Business Continuity]assesses graceful degradation; this contract lets the UI stay usable offline rather than hang on dead requests. The doc comment records the three host behaviors (IConnectivityStatusService.cs:4-8): MAUI wrapsConnectivity.Current, WebAssembly watchesnavigator.onLine, and Blazor Server is always online (a dead circuit takes the whole UI down and the reconnect overlay already covers it). It extends the property-plus-event shape ofIBatteryStatusServicewith anInitializeAsyncbecause the browser adapter needs explicit JS listener setup. - Walkthrough
ConnectivityChanged(IConnectivityStatusService.cs:13): raised afterIsOnlinechanges; handlers read the new value from the property (IConnectivityStatusService.cs:12).IsOnline(IConnectivityStatusService.cs:16): defaults totrueuntil known (IConnectivityStatusService.cs:15), so the UI starts optimistic rather than flashing an offline banner on first render.InitializeAsync(CancellationToken = default)(IConnectivityStatusService.cs:22): starts change monitoring where that needs explicit setup (browser JS listeners); called fromOnAfterRenderAsync, a no-op and safe to call repeatedly on every implementation (IConnectivityStatusService.cs:19-20).
- Why it's built this way:
ValueTask InitializeAsynckeeps the always-ready implementations allocation-free while giving the browser adapter a place to attach listeners after the first render (JS interop is unavailable during prerender). - Where it's used: implemented by
MauiConnectivityStatusService,BrowserConnectivityStatusService(the scoped browser override,MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:119), and the framework defaultAlwaysOnlineConnectivityStatusService(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:42); consumed by the offline banner and request-skipping guards, and faked in component tests byFakeConnectivityService.
IHapticFeedbackService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.DeviceStatus·MMCA.Common.UI/Services/Capabilities/DeviceStatus/IHapticFeedbackService.cs:8· Level 0 · interface
- What it is: fires tactile feedback on interactions (bookmark toggles, poll votes). Native-only: the web fallback is a hidden no-op.
- Depends on: BCL only (
System.TimeSpan). - Concept, decoration-not-behavior capability.
[Rubric §18, UI Architecture]. The methods are fire-and-forgetvoid(notTask) and failures are swallowed because "haptics are decoration, never behavior" (IHapticFeedbackService.cs:6), so a missing or throwing vibrator can never affect what the app does.IsSupportedisfalseon the web fallback (IHapticFeedbackService.cs:4-5). - Walkthrough
IsSupported(IHapticFeedbackService.cs:11): whether the platform can produce haptics.Click()(IHapticFeedbackService.cs:14): short feedback for taps and toggles.LongPress()(IHapticFeedbackService.cs:17): stronger feedback for long-press interactions.Vibrate(TimeSpan duration)(IHapticFeedbackService.cs:20): raw vibration for attention-level cues (for example a notification arriving while the app is foregrounded).
- Why it's built this way: synchronous
voidmatches the fire-and-forget nature of a UI micro-cue (no caller waits on a buzz), and the swallow-failures rule keeps a decorative effect out of the correctness path. - Where it's used: implemented by
MauiHapticFeedbackServiceand the no-opNullHapticFeedbackService, the TryAdd default (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:45); consumed by interactive components.
AlwaysOnlineConnectivityStatusService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.DeviceStatus·MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/DeviceStatus/AlwaysOnlineConnectivityStatusService.cs:7· Level 1 · class (sealed)
- What it is: the default
IConnectivityStatusServicefor any head with no better answer: it reports the device permanently online and never raises a change event. The class summary states the reasoning directly, that this is the correct behavior for Blazor Server, where a lost connection tears down the circuit itself (AlwaysOnlineConnectivityStatusService.cs:3-6). - Depends on:
IConnectivityStatusServiceonly. Externals: BCLEventHandlerandValueTask. - Concept introduced, the neutral capability default. This is the first of the sixteen fallback implementations in this unit, so the shared shape is worth teaching once. Every device capability in this group is a narrow interface that shared Blazor components inject directly, and a component cannot ask "am I on MAUI or in a browser" without becoming host-aware. So the framework guarantees that every contract always resolves:
AddDeviceCapabilityDefaults()TryAdd-registers one of these fallbacks for each interface (MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:39, block:39-100), and a head that can do better calls a plainAddafterwards, so last-registration-wins swaps in the real implementation with no component change (DependencyInjection.cs:17-22). Note the vocabulary distinction this class draws: most siblings are Null Objects (they report the capability absent), but this one is a neutral default that asserts a genuinely true value on its target host, which is why it is namedAlwaysOnline...rather thanNull....- Also worth reading closely: the
ConnectivityChangedevent is declared with explicit emptyadd/removeaccessors (AlwaysOnlineConnectivityStatusService.cs:10-21) rather than as a field-like event. Subscribing therefore compiles and costs nothing, but the instance never stores a delegate, so this process-lifetime singleton can never root a subscriber component. A field-like event would have kept every disposed component alive until it unsubscribed. [Rubric §2, Design Patterns]assesses whether classic patterns are used where they earn their keep. Null Object plus Adapter is the pairing that runs through this whole capability family: one inert default, one platform adapter per head.[Rubric §1, SOLID]assesses SOLID adherence. Liskov substitutability is the entire mechanism here, since a component holds only the interface and cannot tell which implementation it received.[Rubric §22, Responsive / Cross-Browser]assesses graceful behavior across heads and browsers. One shared component tree runs unchanged on Blazor Server, WebAssembly and MAUI precisely because the container, not the component, answers the "what can this device do" question.
- Also worth reading closely: the
- Walkthrough
ConnectivityChanged(AlwaysOnlineConnectivityStatusService.cs:10-21): accessor-only event, both bodies documented no-ops ("Never raised: connectivity is constant on this host").IsOnline(AlwaysOnlineConnectivityStatusService.cs:24): a constanttrue.InitializeAsync(CancellationToken)(AlwaysOnlineConnectivityStatusService.cs:27): returnsValueTask.CompletedTask. The contract asks callers to invoke this fromOnAfterRenderAsyncand promises it is a safe repeat call on every implementation (MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/DeviceStatus/IConnectivityStatusService.cs:18-22); here there is nothing to start.
- Why it's built this way: ADR-042. On Blazor Server the render tree lives on the server, so "the device went offline" is not a state the UI can render: the circuit drops and the framework reconnect overlay takes over. Reporting a fabricated offline state would double up on that overlay, so the honest answer for this host is a constant
true. - Where it's used:
TryAddSingletoninAddDeviceCapabilityDefaults()(DependencyInjection.cs:41); overridden byBrowserConnectivityStatusServiceinAddBrowserDeviceCapabilities()(DependencyInjection.cs:126) and byMauiConnectivityStatusServiceon native heads (MMCA.Common/Source/Presentation/MMCA.Common.UI.Maui/DependencyInjection.cs:63). The visible consumer is the sharedOfflineBannercomponent, which renders nothing whileIsOnlineis true (MMCA.Common/Source/Presentation/MMCA.Common.UI/Components/Capabilities/OfflineBanner.razor:12-17,:27-28). MMCA.Common's bUnit base registers it explicitly so component tests get a deterministic online state (MMCA.Common/Tests/Presentation/MMCA.Common.UI.Tests/BunitTestBase.cs:38), ADC's Conference bUnit base gets it throughAddDeviceCapabilityDefaults()instead of a hand-mirrored list (MMCA.ADC/Tests/Modules/Conference/MMCA.ADC.Conference.UI.Tests/BunitTestBase.cs:31), andCapabilityFallbackTestsassertsIsOnlinestays true acrossInitializeAsync(MMCA.Common/Tests/Presentation/MMCA.Common.UI.Tests/Services/Capabilities/CapabilityFallbackTests.cs:69-77).
IAppLifecycleNotifier
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.DeviceStatus·MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/DeviceStatus/IAppLifecycleNotifier.cs:13· Level 1 · interface
- What it is: the contract the native host calls to record when the app leaves and returns to the
foreground, and the event shared components subscribe to for the return
(
IAppLifecycleNotifier.cs:13-26). - Depends on:
AppResumedEventArgs(IAppLifecycleNotifier.cs:17); BCLEventHandler<T>. - Concept, a two-call background/foreground protocol. Unlike the property-plus-event contracts
elsewhere in this group (
IBatteryStatusService,IConnectivityStatusService), this contract has no state to read: it is purely a pair of notification methods plus the event the second one raises. The host owns calling both methods; nothing in the interface can be polled. - Walkthrough
Resumed(IAppLifecycleNotifier.cs:16): raised when the app returns to the foreground, carrying anAppResumedEventArgs.NotifyEnteredBackground()(IAppLifecycleNotifier.cs:19): called by the native host when the app leaves the foreground; records the timestamp.NotifyResumed()(IAppLifecycleNotifier.cs:25): called by the native host on return to the foreground; computes the elapsed background time and raisesResumed.
- Why it's built this way: splitting "entered background" and "resumed" into two host-driven calls (rather than a single toggle) lets the implementation compute an accurate elapsed duration instead of the host having to track and pass a timestamp itself.
- Where it's used: implemented by
AppLifecycleNotifier, registered as a singleton inAddDeviceCapabilities()(MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs); driven byWindowLifecycleExtensions, which wires the MAUIWindow.Resumed/Deactivatedevents toNotifyResumed()/NotifyEnteredBackground()(MMCA.Common/Source/Presentation/MMCA.Common.UI.Maui/WindowLifecycleExtensions.cs), and set up from ADC'sApp.xaml.cs(MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI/App.xaml.cs); consumed byBiometricGateto re-lock after a long enough absence. - ADRs: ADR-042.
NullBatteryStatusService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.DeviceStatus·MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/DeviceStatus/NullBatteryStatusService.cs:4· Level 1 · class (sealed)
- What it is: the default
IBatteryStatusService: energy saver is never reported active (NullBatteryStatusService.cs:3). - Depends on:
IBatteryStatusService; BCLEventHandler. - Concept: the property-plus-change-event capability shape, reduced to its inert form. It uses the same accessor-only event trick introduced under
AlwaysOnlineConnectivityStatusService: subscription compiles, no delegate is retained, nothing is ever raised, and therefore this singleton cannot leak subscribers.[Rubric §12, Performance & Scalability]assesses whether work adapts to constraints. Answeringfalsemeans "do not throttle", which is the right default on a desktop browser or a server-rendered circuit where there is no battery to conserve.
- Walkthrough
EnergySaverChanged(NullBatteryStatusService.cs:7-18): explicit emptyadd/remove, documented as never raised because there is no battery state on this host.IsEnergySaverOn(NullBatteryStatusService.cs:21): constantfalse.
- Why it's built this way: ADR-042. A live feature asks this before deciding to poll or auto-join a real-time channel; on a host with no power constraint the honest answer is "not conserving", so the feature runs at full fidelity.
- Where it's used:
TryAddSingletoninAddDeviceCapabilityDefaults()(DependencyInjection.cs:53);MauiBatteryStatusServiceis the native override (MMCA.Common/Source/Presentation/MMCA.Common.UI.Maui/DependencyInjection.cs:64), andAddBrowserDeviceCapabilities()registers no battery implementation (DependencyInjection.cs:117-136), so web heads keep this default. Covered inCapabilityFallbackTests(CapabilityFallbackTests.cs:156).
NullHapticFeedbackService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.DeviceStatus·MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/DeviceStatus/NullHapticFeedbackService.cs:4· Level 1 · class (sealed)
- What it is: the default
IHapticFeedbackService: no haptics hardware, so every call is a no-op (NullHapticFeedbackService.cs:3). - Depends on:
IHapticFeedbackService; BCLTimeSpan. - Concept: the one synchronous capability contract in this unit. Its members return
void, notTask, because a haptic tick is a fire-and-forget hardware pulse that no caller ever waits on. That shape lets a component callClick()inline in an event handler without anawait, and this default makes doing so free everywhere.[Rubric §18, UI Architecture]assesses separation of presentation concerns. Feedback intent ("this was a click", "this was a long press") lives in the component; how, or whether, the device expresses it lives behind the interface.
- Walkthrough
IsSupported(NullHapticFeedbackService.cs:7): constantfalse, so a settings page can hide a haptics toggle.Click()(NullHapticFeedbackService.cs:10-13),LongPress()(:16-19) andVibrate(TimeSpan duration)(:22-25): three empty bodies, each carrying the explanatory comment "No haptics on this host" so the emptiness reads as deliberate rather than unfinished.
- Why it's built this way: ADR-042. Haptics are pure enhancement, never the carrier of information, so silently doing nothing is a complete implementation of the contract on a host without a vibrator.
- Where it's used:
TryAddSingletoninAddDeviceCapabilityDefaults()(DependencyInjection.cs:44);MauiHapticFeedbackServiceis the native override (MMCA.Common/Source/Presentation/MMCA.Common.UI.Maui/DependencyInjection.cs:67) andAddBrowserDeviceCapabilities()registers no haptics implementation (DependencyInjection.cs:117-136), so web heads keep this. ADC registers it explicitly in a bUnit test so the live-channel page renders without hardware (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.UI.Tests/Pages/LiveChannelJoinTests.cs:60-61), andCapabilityFallbackTestsasserts all three calls are silent and non-throwing (CapabilityFallbackTests.cs:36-49).
AppLifecycleNotifier
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.DeviceStatus·MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/DeviceStatus/AppLifecycleNotifier.cs:9· Level 2 · class (sealed)
- What it is: the sole implementation of
IAppLifecycleNotifier. It tracks the timestamp an app entered the background and computes the elapsed away-time when it resumes, raisingResumedwith that duration (AppLifecycleNotifier.cs:9-43). - Depends on:
IAppLifecycleNotifier,AppResumedEventArgs;System.Threading.TimeProvider(optional constructor parameter, defaults toTimeProvider.System) andSystem.Threading.Lock. - Concept,
TimeProviderfor testable elapsed-time math. The constructor accepts an optionalTimeProvider(AppLifecycleNotifier.cs:9) instead of callingDateTimeOffset.UtcNowdirectly, so tests can inject a fake clock and assert an exactBackgroundDurationwithout a real sleep. ALock(AppLifecycleNotifier.cs:12) guards the single mutable field,_backgroundedAt, because the host can callNotifyEnteredBackground()/NotifyResumed()from platform lifecycle callbacks that are not guaranteed to run on one thread. - Walkthrough
NotifyEnteredBackground()(AppLifecycleNotifier.cs:20-26): stamps_backgroundedAtwith_timeProvider.GetUtcNow()under the lock.NotifyResumed()(AppLifecycleNotifier.cs:29-42): computesawayas now minus_backgroundedAtif a value was recorded, elseTimeSpan.Zero(:35-37); clears_backgroundedAtback tonull(:38); then raisesResumedoutside the lock with a duration clamped to never go negative (:41).
- Why it's built this way: computing the elapsed time inside
NotifyResumed()(rather than making the host pass a duration) keeps the host's job to two parameterless calls; clamping a negativeawayto zero guards against aTimeProviderthat is not monotonic. - Where it's used: registered as the
IAppLifecycleNotifiersingleton inAddDeviceCapabilities()(MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs); exercised with a fakeTimeProviderinBiometricGateTests(MMCA.Common/Tests/Presentation/MMCA.Common.UI.Tests/Components/Capabilities/BiometricGateTests.cs).
BrowserConnectivityStatusService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.DeviceStatus·MMCA.Common.UI/Services/Capabilities/DeviceStatus/BrowserConnectivityStatusService.cs:11· Level 2 · class (sealed,IAsyncDisposable)
- What it is: the web adapter for
IConnectivityStatusService, reportingnavigator.onLineand raising the contract's change event from the windowonline/offlinelisteners. It is the most involved browser adapter in this group because the browser pushes events back into .NET rather than being polled. - Depends on:
IConnectivityStatusService,CapabilitiesJsModule(MMCA.Common.UI/Services/Capabilities/DeviceStatus/BrowserConnectivityStatusService.cs:13,:18), andDotNetObjectReference<T>plus[JSInvokable](Microsoft.JSInterop,:1); thewatchOnline/unwatchOnlineexports (MMCA.Common.UI/wwwroot/capabilities-interop.js:92,:112). - Concept introduced, JS-to-.NET callbacks and their lifetime. Everything else in this group calls one way, from .NET into the browser. Here the browser must notify .NET when the network state flips, which means handing JS a
DotNetObjectReferencewrapping this instance, exposing a[JSInvokable]method for it to call, and disposing that reference when the scope ends or it leaks the object for the life of the circuit. It also introduces the group's deferred initialization shape: the adapter cannot subscribe during prerender, so it starts optimistic and subscribes later.[Rubric §29, Resilience & Business Continuity]assesses graceful degradation under a partial outage; the offline banner and request-skipping guards read from here.[Rubric §19, State Management]assesses ownership of client state;IsOnlinehas a private setter and one mutation path, so no consumer can desynchronize it. - Walkthrough
- Fields (
MMCA.Common.UI/Services/Capabilities/DeviceStatus/BrowserConnectivityStatusService.cs:13-15): the shared module, a nullable_selfReference(theDotNetObjectReferencehanded to JS), and a_watchingflag. ConnectivityChanged(:21) andIsOnline { get; private set; } = true(:24): the contract members. Thetrueinitializer is the deliberate optimistic default the class doc calls out (:7-9): beforeInitializeAsyncruns there is no way to ask the browser, and assuming offline would flash a false banner on every first render.InitializeAsync(CancellationToken = default)(:27-47): returns immediately when already_watching(:29-32), lazily creates_selfReferencewith??=(:34), and invokeswatchOnlinepassing that reference (:35-37). The return value is the tri-state:nullmeans JS was unavailable (prerender), so the method returns without setting_watching, leaving the subscription to be retried on a later call (:39-43). Otherwise it latches_watching = trueand applies the reported state (:45-46).OnBrowserConnectivityChanged(bool isOnline)(:50-51): the[JSInvokable]callback target, documented as not for app code (:49). On the JS side both theonlineandofflinewindow listeners call the samenotifyclosure, which readsnavigator.onLinefresh and swallows a rejected invoke when the component is gone (MMCA.Common.UI/wwwroot/capabilities-interop.js:95-103).DisposeAsync()(:54-63): callsunwatchOnlineonly when it actually subscribed, withCancellationToken.None(teardown must not be cancelled,:58), then disposes and nulls_selfReference(:61-62).UpdateStatus(bool isOnline)(:65-74): the single mutation path. It returns early when the value is unchanged (:67-70), so the event fires only on a real transition, then setsIsOnlineand raisesConnectivityChanged(:72-73).
- Fields (
- Why it's built this way: the class doc instructs callers to invoke
InitializeAsyncfromOnAfterRenderAsync(MMCA.Common.UI/Services/Capabilities/DeviceStatus/BrowserConnectivityStatusService.cs:8-9), which is the first lifecycle point where JS is guaranteed available; thenull-means-retry path is what makes a call from a too-early lifecycle method harmless rather than permanently broken.watchOnlineitself callsunwatchOnlinefirst (MMCA.Common.UI/wwwroot/capabilities-interop.js:93), so a double subscribe cannot stack listeners. The change-only event contract keeps the offline banner from re-rendering on every duplicate browser event. - Where it's used: registered scoped as
IConnectivityStatusServicebyAddBrowserDeviceCapabilities()(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:119); siblings areMauiConnectivityStatusServiceand the Server defaultAlwaysOnlineConnectivityStatusService. - Caveats / not-in-source:
navigator.onLinereports link-layer connectivity, not gateway reachability, so a captive-portal network reads as online here. Note also that the JScatcharm returnstrue(MMCA.Common.UI/wwwroot/capabilities-interop.js:105-109), so a browser that refusesaddEventListenerstill latches_watchingand reports online without ever pushing a change.
DevicePreferenceKeys
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.DeviceStorage·MMCA.Common.UI/Services/Capabilities/DeviceStorage/DevicePreferenceKeys.cs:7· Level 0 · class (static)
- What it is: a static constants holder for the string keys used with
IDevicePreferences, so the framework's device-settings surfaces and the gates that read them agree on one spelling. - Depends on: nothing first-party at the type level; the doc comment names
IDevicePreferencesas the store these keys are used against (DevicePreferenceKeys.cs:5). - Concept introduced, per-device (non-roaming) preference keys.
[Rubric §19, State Management]assesses whether client state has a clear owner and scope; these keys are explicitly device state (they "describe THIS device and never roam",DevicePreferenceKeys.cs:5), distinct from the server-side per-user preferences that follow a signed-in account across devices. Centralizing the key strings is the small[Rubric §15, Best Practices & Code Quality]discipline that keeps a writer and a reader from drifting apart on a literal. - Walkthrough: one member today:
AppLockEnabled = "applock.enabled"(DevicePreferenceKeys.cs:10), whether the biometric app-lock guards stored-token auto-login. The doc comment ties it to the biometric app-lock feature (ADR-042 Wave 4,DevicePreferenceKeys.cs:9). - Why it's built this way: a
public const stringis compile-time inlined and usable in attribute and switch positions; a single owner for the key means the gate that reads it (IBiometricAuthenticatorconsumers) and the settings UI that writes it cannot disagree. - Where it's used: read and written through
IDevicePreferencesby the app-lock gate and device-settings screens in the head apps (ADR-042).
IDevicePreferences
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.DeviceStorage·MMCA.Common.UI/Services/Capabilities/DeviceStorage/IDevicePreferences.cs:11· Level 0 · interface
- What it is: a small typed key/value store for per-device settings (reminder lead time, haptics toggle, app-lock), distinct from the server-side per-user preferences that roam with an account.
- Depends on: BCL only; keys come from
DevicePreferenceKeys. - Concept introduced, device-scoped client state.
[Rubric §19, State Management]assesses whether state has a clear owner and lifetime. Device preferences "describe THIS device and never roam" (IDevicePreferences.cs:5-6), the counterpart to the server-sideIUserPreferenceWriter(culture, theme). The doc comment sets two hard rules: never store secrets here, tokens belong in platform secure storage (IDevicePreferences.cs:7), and the supported value types are exactlystring,bool,int,long,double,DateTimeOffset(IDevicePreferences.cs:8-9).[Rubric §26, Front-End Security]: the secrets prohibition keeps sensitive material off unencrypted preference storage. - Walkthrough: the contract is three methods and no properties (
IDevicePreferences.cs:11-23).GetAsync<T>(string key, T fallback, CancellationToken = default)(IDevicePreferences.cs:15): reads a value, returningfallbackwhen absent or unreadable (IDevicePreferences.cs:13).SetAsync<T>(string key, T value, CancellationToken = default)(IDevicePreferences.cs:19): best-effort write, storage failures are swallowed (IDevicePreferences.cs:17).RemoveAsync(string key, CancellationToken = default)(IDevicePreferences.cs:22): removes a value; unknown keys are ignored (IDevicePreferences.cs:21).
- Why it's built this way: the fallback-taking read and the swallow-on-failure writes keep a cosmetic preference from ever throwing into a render path. The contract carries no persistence flag, so a caller cannot ask whether values survive a restart; that depends on which implementation the head registered (the in-memory default does not persist).
- Where it's used: implemented by
MauiDevicePreferences,BrowserDevicePreferences(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:120), and theInMemoryDevicePreferencesfallback. This is the one capability whose default is registeredTryAddScopedrather thanTryAddSingleton(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:89), because the in-memory Blazor Server fallback must hold per-circuit (per-user) state and never cross-user state (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:87-88). Read and written by device-settings screens and the app-lock gate, and faked in component tests byFakeDevicePreferences.
ILocalCacheStore
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.DeviceStorage·MMCA.Common.UI/Services/Capabilities/DeviceStorage/ILocalCacheStore.cs:9· Level 0 · interface
- What it is: a small on-device JSON document cache for offline UI state (an offline schedule snapshot), explicitly not a query cache and not for secrets.
- Depends on: BCL only (generic serialization happens in the implementations).
- Concept, last-known-good UI state for offline rendering.
[Rubric §29, Resilience & Business Continuity]and[Rubric §19, State Management]. MAUI persists to the app data directory, the browser heads (Blazor Server and WebAssembly) tolocalStorage, and the defaultNullLocalCacheStoreis unavailable (ILocalCacheStore.cs:4-6). The doc comment draws the boundary sharply: this is last-known-good UI state for offline rendering, not a general query cache and not a secret store (ILocalCacheStore.cs:6-7). - Walkthrough
IsAvailable(ILocalCacheStore.cs:12): whether cached values survive restarts on this host.SetAsync<T>(string key, T value, CancellationToken = default)(ILocalCacheStore.cs:16): serializes and stores a JSON-serializable document, best-effort (ILocalCacheStore.cs:14-15).GetAsync<T>(string key, CancellationToken = default)(ILocalCacheStore.cs:20): reads and deserializes, or returnsdefault(ILocalCacheStore.cs:18).RemoveAsync(string key, CancellationToken = default)(ILocalCacheStore.cs:23): removes an entry; unknown keys are ignored (ILocalCacheStore.cs:22).ClearAsync(CancellationToken = default)(ILocalCacheStore.cs:36): removes every entry the store holds. The doc comment marks it SECURITY because this is what sign-out calls (ILocalCacheStore.cs:26-28): snapshots are plaintext and keyed by surface rather than by user, so leaving them in place on sign-out hands the next account on the device the previous account's rows the first time the network is unavailable (ILocalCacheStore.cs:28-31).
- Why it's built this way: a generic serialize/deserialize contract keeps callers from touching
platform storage APIs, and
IsAvailablelets a component skip offline-snapshot writes entirely on a head where nothing would be kept.ClearAsynchas no default body on purpose: every implementation must write one, because a store that forgot it would fail open and keep the previous account's snapshots (ILocalCacheStore.cs:31-32). - Where it's used: implemented by
MauiLocalCacheStore,BrowserLocalCacheStore(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:121), and the unavailableNullLocalCacheStoredefault (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:62); consumed by offline-schedule components.
ISensitiveFileSaver
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Files·MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/Files/ISensitiveFileSaver.cs:20· Level 0 · interface
- What it is: the capability contract for handing the user a sensitive file the caller already holds in memory, such as the personal-data export, in whatever way the current head can receive one (
ISensitiveFileSaver.cs:3-5). - Depends on: BCL only. The contract names
SafeFileNameas the rule itsfileNamegoes through (ISensitiveFileSaver.cs:26). - Concept introduced, one hand-off contract with three head-specific meanings. The doc comment spells out each head (
ISensitiveFileSaver.cs:6-18). A browser head saves throughfile-download.jsas a temporary object URL, and the reason this is a capability at all is stated there: an endpoint that needs the caller's bearer token cannot be a plain download link, so the caller fetches the bytes through its authenticated client and passes them in (ISensitiveFileSaver.cs:7-10). A MAUI head cannot download through the WebView, so it stages the file in the head's own temp folder and opens the share sheet, purging that folder before each write and at app start, and never deleting the staged copy after the share because Android's share request returns when the intent launches (ISensitiveFileSaver.cs:11-16). The default presents nothing (ISensitiveFileSaver.cs:17).[Rubric §30, Compliance/Privacy/Data Governance]assesses how personal data is handled at rest and in transit. The contract exists for the data-subject export, and it keeps that payload out of a plain link and, on native heads, confined to one purged folder.[Rubric §26, Front-End Security]assesses client-side handling of credentials. Fetching through the authenticated client and handing over bytes keeps the bearer token out of any URL.
- Walkthrough
SaveAsync(string fileName, string contentType, byte[] content, string shareTitle, CancellationToken = default)(ISensitiveFileSaver.cs:41-46):fileNameis reduced withSafeFileName.Reduce, and a value with nothing usable left throwsArgumentException, so a caller holding a server-suggested name reduces it first and supplies its own fallback (ISensitiveFileSaver.cs:25-28,:40).contentTypeis what the native share sheet uses to pick target apps (:30);shareTitleis shown on the native share sheet and unused by browser heads (:32).- Return value:
truewhen a save or share surface was presented,falsewhen none was (no share sheet accepted the file, the browser circuit is gone, or the head offers no way to save), so the caller can tell the user; a failed staging write or a failed browser save throws (ISensitiveFileSaver.cs:34-39).
- Why it's built this way: ADR-042. The
boolseparates "this head has nothing to present" (an expected capability gap the UI reports) from a genuine failure (an exception), the same split the rest of this family draws. - Where it's used: defaulted to
NullSensitiveFileSaverbyTryAddSingletoninAddDeviceCapabilityDefaults()(MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:85), overridden byBrowserSensitiveFileSaverinAddBrowserDeviceCapabilities()(DependencyInjection.cs:130) and byMauiSensitiveFileSaveron native heads (MMCA.Common/Source/Presentation/MMCA.Common.UI.Maui/DependencyInjection.cs:58), whichUseMauiDeviceCapabilities(string sensitiveFileStagingFolderName)wires together with the app-start staging purge (MMCA.Common/Source/Presentation/MMCA.Common.UI.Maui/HostingDependencyInjection.cs:30-32,:40). - Caveats / not-in-source: the MAUI hosting doc comment describes it as used by the personal-data download (
HostingDependencyInjection.cs:30-31), but no component in the Common, ADC or Store source trees injectsISensitiveFileSaverat these commits;ApiFileDownloadButtoninvokesfile-download.js'ssaveFileitself (MMCA.Common/Source/Presentation/MMCA.Common.UI/Components/Forms/ApiFileDownloadButton.razor.cs:326).
SafeFileName
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Files·MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/Files/SafeFileName.cs:14· Level 0 · class (static)
- What it is: a one-method helper that reduces a caller- or server-supplied name to a bare file name before anything is written under it, so the value cannot steer a write out of the folder it is meant for (
SafeFileName.cs:3-5). - Depends on: BCL
Path.GetFileNameandStringComparison.Ordinal. - Concept introduced, a file name is untrusted input. The remarks give the mechanism:
Path.Combinediscards the root outright when its second argument is rooted, and..segments walk out of it, so a name built from entity data or taken from a response header would otherwise decide where a staging delete and write land on a native head's filesystem (SafeFileName.cs:8-11).Path.GetFileNamestrips separators and directory segments; the two relative-directory names it leaves intact are rejected explicitly (SafeFileName.cs:11-12).[Rubric §11, Security]assesses input validation at trust boundaries. This is path-traversal defense applied at the point a name turns into a path, rather than trusted because it came from the framework's own server.
- Walkthrough:
Reduce(string? fileName)(SafeFileName.cs:23) trims and takesPath.GetFileName(:25), then returnsnullwhen the result is empty,.or..(ordinal comparison), else the bare name (:27-31). A value that ends in a separator reduces to empty and so also yieldsnull(:17-19). - Why it's built this way: returning
nullinstead of throwing lets each caller pick its own policy:BrowserSensitiveFileSaverthrowsArgumentException(BrowserSensitiveFileSaver.cs:30-31),ApiFileDownloadButtonreduces both itsFileNameand itsStagingFolderName(ApiFileDownloadButton.razor.cs:298,:242), andSensitiveFileStagingFolderrequires its folder name to come back unchanged (MMCA.Common/Source/Presentation/MMCA.Common.UI.Maui/Capabilities/Files/SensitiveFileStagingFolder.cs:30) and reduces each file name (SensitiveFileStagingFolder.cs:57). - Where it's used: the callers above; pinned by
SafeFileNameTests(SafeFileNameTests.cs:17,:21,:31).
InMemoryDevicePreferences
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.DeviceStorage·MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/DeviceStorage/InMemoryDevicePreferences.cs:9· Level 1 · class (sealed)
- What it is: the default
IDevicePreferences, a working key/value store that keeps its values in a dictionary and loses them when the scope ends, so values do not survive a restart (InMemoryDevicePreferences.cs:5-8). - Depends on:
IDevicePreferences. Externals: BCLConcurrentDictionary<TKey, TValue>(InMemoryDevicePreferences.cs:1),StringComparer.Ordinal,ArgumentException.ThrowIfNullOrWhiteSpace. - Concept introduced, the fallback that carries state, and the one scoped registration. Every other default in this unit is stateless and registered as a singleton. This one holds a dictionary, and that single difference changes its lifetime:
AddDeviceCapabilityDefaults()registers it withTryAddScoped, with the reason spelled out at the call site, so the Blazor Server fallback holds per-circuit (per-user) state and never cross-user state (DependencyInjection.cs:87-89). A singleton here would be a real defect: one user's reminder lead time or haptics toggle would become everyone's. The second idea worth taking away is the difference between a capability failure and a programming error. This family never throws when the device cannot do something, but a blank preference key is a caller bug, so all three methods guard it withArgumentException.ThrowIfNullOrWhiteSpaceand do throw (InMemoryDevicePreferences.cs:16,:26,:35).[Rubric §19, State Management]assesses where client state lives and how long it survives. This class states its volatility in its doc comment (InMemoryDevicePreferences.cs:6-7) but exposes no flag for it: the contract has no persistence property (IDevicePreferences.cs:11-23), so a feature cannot ask at runtime whether a setting will survive a restart.[Rubric §11, Security]assesses handling of sensitive data. Scoping to the circuit is the isolation boundary, and the contract reinforces the rule that secrets never belong here: tokens go to platform secure storage (MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/DeviceStorage/IDevicePreferences.cs:5-7).[Rubric §14, Testability]assesses how easily behavior can be exercised without infrastructure. Because it is a real, dependency-free implementation rather than a no-op, downstream tests use it directly as a preferences double.
- Walkthrough
_values(InMemoryDevicePreferences.cs:11): aConcurrentDictionary<string, object?>built withStringComparer.Ordinal. Ordinal comparison means preference keys are exact byte-for-byte matches, never culture-folded.GetAsync<T>(string key, T fallback, CancellationToken)(InMemoryDevicePreferences.cs:14): guards the key (:16), then returns the stored value only when the entry exists and the boxed value pattern-matchesT(stored is T typed,:18); anything else yieldsfallback(:18-20). That type test is what implements the contract's "returns fallback when absent or unreadable" rule (IDevicePreferences.cs:13).SetAsync<T>(string key, T value, CancellationToken)(InMemoryDevicePreferences.cs:24): guards the key, assigns through the indexer (an upsert), and returnsTask.CompletedTask(:26-29).RemoveAsync(string key, CancellationToken)(InMemoryDevicePreferences.cs:33): guards the key and callsTryRemovewith a discard, so an unknown key is silently ignored as the contract requires (:35-38).- Every method is synchronous under an async signature: the interface is
Task-shaped because the persistent implementations do real I/O, and this one satisfies it with already-completed tasks rather than an offloaded call.
- Why it's built this way: ADR-042. Device preferences describe this device and deliberately never roam, which is why they are separate from the server-side per-user preferences (
IDevicePreferences.cs:4-6). A Blazor Server circuit is not a device and has no durable per-device store, so the truthful default is a volatile one that still honors the whole contract (InMemoryDevicePreferences.cs:5-8). - Where it's used:
TryAddScopedinAddDeviceCapabilityDefaults()(DependencyInjection.cs:89); overridden byBrowserDevicePreferences(localStorage) inAddBrowserDeviceCapabilities()(DependencyInjection.cs:120) and byMauiDevicePreferenceson native heads (MMCA.Common/Source/Presentation/MMCA.Common.UI.Maui/DependencyInjection.cs:76). ADC's Engagement UI tests instantiate it as the preferences double forSessionReminderCoordinatorandSessionBookmarkUIService(MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.UI.Tests/Services/HappeningNow/SessionReminderCoordinatorTests.cs:27,.../SessionBookmarkUIServiceTests.cs:188,.../Helpers/BookmarkOfflineHarness.cs:121), Common'sMauiPushRegistrationServiceTestsuses it the same way (MauiPushRegistrationServiceTests.cs:24), andCapabilityFallbackTestscovers the fallback, set and remove round trip (CapabilityFallbackTests.cs:95-107). - Caveats / not-in-source: values are stored boxed as
object?, so aGetAsync<int>against a key written asstringreturns the fallback rather than reporting a type mismatch (InMemoryDevicePreferences.cs:18). The interface enumerates the supported value types (IDevicePreferences.cs:8-9); nothing in this class enforces that list.
NullLocalCacheStore
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.DeviceStorage·MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/DeviceStorage/NullLocalCacheStore.cs:4· Level 1 · class (sealed)
- What it is: the default
ILocalCacheStore: nothing is cached and reads returndefault(NullLocalCacheStore.cs:3). - Depends on:
ILocalCacheStore; BCLTask. - Concept: the write-succeeds, read-misses fallback.
SetAsynccompletes normally whileGetAsyncstill answersnull, which is deliberately not a contradiction: a cache write is advisory, and every caller must already handle a miss because a real cache can evict at any moment. Treating a completed write as a promise of a later hit would be a bug against any cache implementation, not just this one.[Rubric §29, Resilience & Business Continuity]assesses degradation when a dependency is absent. Offline-first features stay compilable and runnable on a host with no local storage; they just never serve a cached document.[Rubric §12, Performance & Scalability]assesses avoidable work.IsAvailablelets a feature skip building and serializing a cache payload it knows will be discarded.
- Walkthrough
IsAvailable(NullLocalCacheStore.cs:7): constantfalse.SetAsync<T>(string key, T value, CancellationToken)(NullLocalCacheStore.cs:10-11): returnsTask.CompletedTask, discarding the value.GetAsync<T>(string key, CancellationToken)(NullLocalCacheStore.cs:14-15): returnsTask.FromResult<T?>(default), so reference types read back asnulland value types as zero.RemoveAsync(string key, CancellationToken)(NullLocalCacheStore.cs:18):Task.CompletedTask.ClearAsync(CancellationToken)(NullLocalCacheStore.cs:21-22):Task.CompletedTask, an explicit override rather than relying on the interface's default no-op.
- Why it's built this way: ADR-042. Offline caching is a per-head capability (browser
localStorage, native file or preference storage), and a Blazor Server circuit has no client-side store it can reach without JavaScript, so the default is the empty cache. - Where it's used:
TryAddSingletoninAddDeviceCapabilityDefaults()(DependencyInjection.cs:61); overridden byBrowserLocalCacheStore(DependencyInjection.cs:128) andMauiLocalCacheStore(MMCA.Common/Source/Presentation/MMCA.Common.UI.Maui/DependencyInjection.cs:78).CapabilityFallbackTestswrites then reads backnullto pin the behavior (CapabilityFallbackTests.cs:109-117).
BrowserSensitiveFileSaver
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Files·MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/Files/BrowserSensitiveFileSaver.cs:10· Level 1 · class (sealed)
- What it is: the browser
ISensitiveFileSaver: it hands the bytes to MMCA.Common.UI'sfile-download.jsas a stream, which saves them through a temporary object URL under the given name; nothing is staged on a server or device filesystem (BrowserSensitiveFileSaver.cs:5-8). - Depends on:
ISensitiveFileSaver,SafeFileName. Externals:Microsoft.JSInterop(IJSRuntime,IJSObjectReference,DotNetStreamReference,JSDisconnectedException,BrowserSensitiveFileSaver.cs:1) and thesaveFileexport (MMCA.Common/Source/Presentation/MMCA.Common.UI/wwwroot/file-download.js:6), which wraps the bytes in aBlobobject URL (file-download.js:8) and revokes it afterwards (file-download.js:20). - Concept: the per-head hand-off
ISensitiveFileSaverintroduces, in its browser form. - Walkthrough
SaveFileModulePath = "./_content/MMCA.Common.UI/file-download.js"(BrowserSensitiveFileSaver.cs:13); the constructor takes the circuit's or WebAssembly app'sIJSRuntime(:19).SaveAsync(...)(:22-54): null-guardscontent(:29), reduces the name throughSafeFileName.Reduceand throwsArgumentExceptionwhen nothing usable is left (:30-31), wraps the bytes in aDotNetStreamReferenceover aMemoryStreamthat the reference owns and disposes (:33-34), imports the module and disposes the module reference when done (:37-40), invokessaveFile(safeName, contentType, stream)(:42-44) and returnstrue(:47).shareTitleis not used.JSDisconnectedExceptionmaps tofalse(:49-53): with the circuit gone there is no browser left to save into, so nothing was presented (:51).
- Why it's built this way: streaming the bytes rather than passing a URL keeps an authenticated download off a plain link (
ISensitiveFileSaver.cs:8-10), and mapping only the disconnect tofalsekeeps a genuine JS failure visible as an exception, as the contract requires (ISensitiveFileSaver.cs:38). - Where it's used: registered scoped as
ISensitiveFileSaverbyAddBrowserDeviceCapabilities()(MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:123); covered byBrowserSensitiveFileSaverTests(BrowserSensitiveFileSaverTests.cs:23,:39,:55,:69). Native sibling:MauiSensitiveFileSaver.
NullSensitiveFileSaver
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Files·MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/Files/NullSensitiveFileSaver.cs:9· Level 1 · class (sealed)
- What it is: the default
ISensitiveFileSaver: no way to save, so every call reportsfalseand writes nothing, while still applying the contract's file-name check; browser and MAUI heads override it (NullSensitiveFileSaver.cs:3-7). - Depends on:
ISensitiveFileSaver,SafeFileName; BCLTask,ArgumentNullException,ArgumentException. - Concept: the report-don't-throw default introduced by
NullLocalCacheStore; here thefalseis the contract's "no save surface was presented" answer, which lets the caller tell the user. The line it draws is the capability-versus-programming-error split: a missing save surface is reported, but a caller bug (null content, a name with nothing usable left) throws here exactly as it does on the browser and MAUI heads (NullSensitiveFileSaver.cs:5-7). - Walkthrough:
SaveAsync(...)(NullSensitiveFileSaver.cs:12-24) null-guardscontent(:19), reducesfileNamethroughSafeFileName.Reduceand throwsArgumentExceptionwhen nothing usable is left, discarding the reduced name (:20-21), then returnsTask.FromResult(false)(:23).contentTypeandshareTitleare not used. - Why it's built this way: ADR-042. A head with no save or share primitive still resolves the contract, so shared components compile and run on every head; applying the same name check keeps a caller bug from hiding behind a plain "nothing presented" on a head or test that runs on the default (
BrowserSensitiveFileSaverTests.cs:68-71). - Where it's used:
TryAddSingletoninAddDeviceCapabilityDefaults()(MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:85);BrowserSensitiveFileSaverTestspins thefalseresult, the throw for"",..andexports/, and the default-then-browser-override registration (BrowserSensitiveFileSaverTests.cs:64,:76,:81).
BrowserDevicePreferences
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.DeviceStorage·MMCA.Common.UI/Services/Capabilities/DeviceStorage/BrowserDevicePreferences.cs:10· Level 2 · class (sealed)
- What it is: the web adapter for
IDevicePreferences, a typed key/value store for per-device settings backed bylocalStoragewith JSON-encoded values under themmca.devicePrefs.prefix. - Depends on:
IDevicePreferencesandCapabilitiesJsModule(MMCA.Common.UI/Services/Capabilities/DeviceStorage/BrowserDevicePreferences.cs:14,:17); BCLSystem.Text.Json(:1); thestorageGet/storageSet/storageRemoveexports (MMCA.Common.UI/wwwroot/capabilities-interop.js:136,:144,:153). - Concept introduced, cross-head storage parity by convention. This adapter and
MauiDevicePreferencesindependently agree on the same key prefix and the same encoding (one JSON document per value), so a setting written by a component behaves identically on either head with no per-type platform code.[Rubric §19, State Management]assesses whether state has a clear owner and lifetime; these values describe one device or browser profile and never roam to the server.[Rubric §26, Front-End Security]applies by exclusion:localStorageis readable by any script on the origin, which is why tokens live inITokenStorageServiceinstead. - Walkthrough
KeyPrefix = "mmca.devicePrefs."(MMCA.Common.UI/Services/Capabilities/DeviceStorage/BrowserDevicePreferences.cs:12) and the injected module (:14,:17).- Values persist across sessions on the same browser profile (
:7-8); the class exposes no flag saying so, since the contract has none. GetAsync<T>(string key, T fallback, CancellationToken = default)(:20-41): guards the key (:22), reads the prefixed raw string (:24-26), returnsfallbackwhen it isnull(which covers both "absent" and "JS unavailable",:27-30), thenJsonSerializer.Deserialize<T>inside atry, returningfallbackon a null result or aJsonException(:32-40).SetAsync<T>(string key, T value, CancellationToken = default)(:44-52): guards the key (:46), serializes to JSON (:48), and invokesstorageSetwith the prefixed key (:49-51); thebool?result is discarded.RemoveAsync(string key, CancellationToken = default)(:55-62): guards (:57) and invokesstorageRemove(:59-61).
- Why it's built this way:
ArgumentException.ThrowIfNullOrWhiteSpace(key)is the one place this class does throw, because an empty key is a programming error, not an environment condition. Everything environmental (Safari Private Browsing, an iframe with storage disabled, a corrupt value) degrades to the caller'sfallback, so a preferences read can never break a render path (:5-8). Discarding the write result is consistent: there is no useful UI response to "the browser refused to persist your preference". - Where it's used: registered scoped as
IDevicePreferencesbyAddBrowserDeviceCapabilities()(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:120); siblings areMauiDevicePreferencesand the in-memory Server defaultInMemoryDevicePreferences, which isTryAddScopedprecisely so a Blazor Server circuit holds per-user rather than cross-user state (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:87-89). Keys come fromDevicePreferenceKeys.
BrowserLocalCacheStore
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.DeviceStorage·MMCA.Common.UI/Services/Capabilities/DeviceStorage/BrowserLocalCacheStore.cs:10· Level 2 · class (sealed)
- What it is: the web adapter for
ILocalCacheStore, holding last-known-good JSON snapshots inlocalStorageunder themmca.localCache.prefix so a page can still render something when the API is unreachable. - Depends on:
ILocalCacheStoreandCapabilitiesJsModule(MMCA.Common.UI/Services/Capabilities/DeviceStorage/BrowserLocalCacheStore.cs:14,:17); BCLSystem.Text.Json(:1); the same threestorage*exportsBrowserDevicePreferencesuses. - Concept introduced: nothing new mechanically (it is the storage shape
BrowserDevicePreferencesintroduces), but the separation of the two stores under different prefixes is the point: preferences are the user's settings and should never be evicted to make room for a stale snapshot, while cache entries are disposable. The class doc records the practical ceiling: browsers caplocalStoragearound 5 MB, so callers keep documents lean (:7-8).[Rubric §29, Resilience & Business Continuity]assesses whether the client degrades usefully when a dependency is down; this store is what an offline view renders from.[Rubric §23, Front-End Performance]applies because a warm snapshot removes a blocking fetch from first paint. - Walkthrough
KeyPrefix = "mmca.localCache."(MMCA.Common.UI/Services/Capabilities/DeviceStorage/BrowserLocalCacheStore.cs:12);IsAvailable => true(:20), since a browser head always haslocalStorageto attempt (a refusal degrades per call rather than being predicted here).SetAsync<T>(...)(:23-31): guards the key (:25),JsonSerializer.Serialize(:27), invokesstorageSet(:28-30), discards the result. A failed write only means a colder next visit.GetAsync<T>(...)(:34-54): guards the key (:36), reads the raw string (:38-40), returnsdefaultwhen it isnull(:41-44), and deserializes inside atrythat mapsJsonExceptiontodefault(:46-53). TheJsonExceptionarm is what makes a schema change survivable: a document written by an older version of the app that no longer deserializes is treated as a cache miss, not an error.RemoveAsync(...)(:57-64): guards (:59) and invokesstorageRemove(:61-63).ClearAsync(CancellationToken = default)(:66-69): invokesstorageClearPrefixwithKeyPrefix, removing everymmca.localCache.*entry in one call rather than the caller tracking and removing keys one at a time.
- Why it's built this way:
defaulton every failure means a cache miss and a corrupt entry are the same event to the caller: fetch live. Storing pre-serialized strings from C# (the JS helpers deliberately treat values as opaque raw strings,MMCA.Common.UI/wwwroot/capabilities-interop.js:127-128) keeps all typing on the .NET side, so the sameTround-trips identically on every head.ClearAsyncis the store's half of sign-out cleanup: a prefix-scoped wipe leavesmmca.devicePrefs.*untouched so device preferences survive across accounts on a shared device while cached snapshots do not. - Where it's used: registered scoped as
ILocalCacheStorebyAddBrowserDeviceCapabilities()(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:121); siblings areMauiLocalCacheStore(file-per-key on disk) and the unavailableNullLocalCacheStore. - Caveats / not-in-source: nothing here evicts or expires entries, and
IsAvailableis a constant rather than a probe, so a quota-exhausted profile still reports available and simply fails each write.
GeoPoint
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Geo·MMCA.Common.UI/Services/Capabilities/Geo/GeoPoint.cs:9· Level 0 · record (sealed)
- What it is: a transport-agnostic latitude/longitude pair returned by
IGeolocationService, with a helper to measure great-circle distance to another point. - Depends on: BCL only (
System.Math,System.ArgumentNullException). - Concept introduced, a platform-free geo primitive.
[Rubric §18, UI Architecture]assesses whether shared UI code stays decoupled from platform types;GeoPointexists so shared components "never touch platform location types" (GeoPoint.cs:5): the MAUILocationor browser Geolocation result is mapped into this record at the adapter boundary. Being arecordgives it value equality and immutability for free (the Value Object idea, see primer §2), though it lives in the UI layer rather than the domain. - Walkthrough
- Positional parameters
Latitude/Longitudein decimal degrees (GeoPoint.cs:9, documented atGeoPoint.cs:7-8). EarthRadiusKm = 6371.0(GeoPoint.cs:11): the mean Earth radius constant the distance formula uses.DistanceKmTo(GeoPoint other)(GeoPoint.cs:17): null-guardsotherwithArgumentNullException.ThrowIfNull(GeoPoint.cs:19), then computes the haversine great-circle distance in kilometers (GeoPoint.cs:21-28). The doc comment scopes it honestly: good enough for "how far is the venue" hints, not for navigation (GeoPoint.cs:15).ToRadians(double degrees)(GeoPoint.cs:31): a private static degree-to-radian conversion, an expression-bodied member.
- Positional parameters
- Why it's built this way: keeping the math on the value type (rather than in a service) means any caller holding two points can compute a distance without a service dependency; the sealed record keeps it cheap and comparable.
- Where it's used: produced by
IGeolocationServiceimplementations (MauiGeolocationService,NullGeolocationService) and consumed by proximity hints in the head apps.
IMapNavigationService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Geo·MMCA.Common.UI/Services/Capabilities/Geo/IMapNavigationService.cs:8· Level 0 · interface
- What it is: opens the platform maps experience for a street address (native maps app on MAUI, a maps website in a new tab in browsers).
- Depends on: BCL only.
- Concept, address-only navigation.
[Rubric §18, UI Architecture]. Deliberately address-based, not coordinate-based, because the domain model carries no geo-coordinates (IMapNavigationService.cs:4-6). That keeps the capability aligned with what the data actually holds. - Walkthrough:
OpenAddressAsync(string address, string? label, CancellationToken = default)(IMapNavigationService.cs:16): opens maps pointed ataddressand returns whether a maps UI was opened. The contract spells out whatlabelmeans per platform (IMapNavigationService.cs:11-14): the pin name on Android and Apple Maps, searched together with the address on the web, and not applied by the Windows address search. A blank label, or one the address already contains, is ignored. The per-platform URI shapes that honor this live once inMapLaunchUris. - Why it's built this way: returning a
boollets a "Directions" affordance stay hidden or degrade when no maps UI opened; taking a string address (not aGeoPoint) matches the address-shaped domain data and avoids a geocoding round-trip. - Where it's used: implemented by
MauiMapNavigationService(MMCA.Common/Source/Presentation/MMCA.Common.UI.Maui/DependencyInjection.cs:68),BrowserMapNavigationService(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:122), and the defaultNullMapNavigationService(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:46). ADC's public pages call it with the venue address and a place label, and show a "directions failed" toast when it returnsfalse: the event detail page passes the event name (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.UI/Pages/Public/Events/PublicEventDetail.razor.cs:218-222), the activity list passes the venue name, falling back to the activity name (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.UI/Pages/Public/Activities/PublicActivityList.razor.cs:136-144).
MapLaunchUris
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Geo·MMCA.Common.UI/Services/Capabilities/Geo/MapLaunchUris.cs:12· Level 0 · class (internal static)
- What it is: the one place that builds the maps URI each head opens for
IMapNavigationService.OpenAddressAsync, with the place label applied where the target supports one (MapLaunchUris.cs:3-7). Both the browser adapter and the MAUI head call it, so the per-platform URI shapes are unit-tested in one place. - Depends on: BCL only (
Uri,Uri.EscapeDataString,string.ContainswithStringComparison.OrdinalIgnoreCase). - Concept, one pure builder behind several adapters. The adapters around it
(
BrowserMapNavigationService,MauiMapNavigationService) do platform work that is hard to unit-test (a JS window open, a MAUILaunchercall). Pulling the URI construction out into static pure functions leaves those adapters as thin dispatchers and puts the logic that can actually be wrong (escaping, label placement, the redundant-label rule) where a plain unit test reaches it. The class isinternal;MMCA.Common.UI.MauiandMMCA.Common.UI.Testssee it throughInternalsVisibleTo(MMCA.Common/Source/Presentation/MMCA.Common.UI/MMCA.Common.UI.csproj:22,25).[Rubric §18, UI Architecture]assesses whether shared UI logic is factored away from host specifics; here every head's maps handoff is derived from one tested source rather than re-built per head.[Rubric §22, Responsive/Cross-Browser]assesses consistent behavior across device classes; the same address and label produce the right shape for the web, Android, Apple platforms and Windows. - Walkthrough
- Constants (
MapLaunchUris.cs:15-18): the Google Maps search prefix,https://maps.apple.com/, the Androidgeo:0,0?q=intent prefix and the Windowsbingmaps:?q=prefix, inside a scoped#pragma warning disable S1075(:14,:19). The remarks state why: these URIs ARE the vendor integration points, not environment-dependent paths (:8-10). ForBrowser(address, label)(:29-30): the Maps URLs API has no label parameter, so a useful label is searched together with the address as"label, address", which names the place on the result card (:21-25); without one the query is the address alone. The whole query is escaped.ForAndroid(address, label)(:39-40):geo:0,0?q=plus the escaped"address (label)", the form the platform maps app shows as the pin name (:32-35).ForApple(address, label)(:50-53): with a useful label,?address=carries the address and&q=the label, which Apple Maps uses as the pin label when the location is given explicitly; without one the address is the?q=query (:42-46). Used for iOS and Mac Catalyst.ForWindows(address)(:61):bingmaps:?q=plus the escaped address only. It takes no label, because a titled Bing pin needs coordinates the address-only contract does not carry (:55-57).UsefulLabel(address, label)(:63-69): trims the label and returnsnullwhen it is blank or the address already contains it, case-insensitively (:66), so a label is never repeated in the query.
- Constants (
- Why it's built this way: label support differs by vendor, and the contract on
IMapNavigationServicepromises a specific per-platform outcome; one builder keeps that promise in one file instead of in each head (ADR-042). - Where it's used:
ForBrowserbyBrowserMapNavigationService(MMCA.Common.UI/Services/Capabilities/Geo/BrowserMapNavigationService.cs:23);ForAndroid,ForAppleandForWindowsbyMauiMapNavigationService, which picks one byOperatingSystemcheck and treats every non-Android, non-Apple platform as Windows (MMCA.Common/Source/Presentation/MMCA.Common.UI.Maui/Capabilities/Geo/MauiMapNavigationService.cs:33-46). Pinned byMapLaunchUrisTests, including the blank, whitespace and already-contained label cases and the trim-and-escape case (MMCA.Common/Tests/Presentation/MMCA.Common.UI.Tests/Services/Capabilities/Geo/MapLaunchUrisTests.cs:35-51).
IGeocodingService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Geo·MMCA.Common.UI/Services/Capabilities/Geo/IGeocodingService.cs:9· Level 1 · interface
- What it is: resolves a street address to coordinates for proximity hints such as "~3 km from the venue" (
IGeocodingService.cs:3-8). It is the address-to-coordinate half of the location story; IGeolocationService is the device-position half. - Depends on: GeoPoint, its return shape;
System.Threading.CancellationTokenotherwise. - Concept introduced: the best-effort-by-contract capability. Unsupported hosts and failed lookups both return
nulland callers simply omit the hint (IGeocodingService.cs:5-7), so a location feature never becomes a hard dependency on a platform geocoder. The doc comment also records a real domain fact: the model deliberately carries addresses only and no coordinates, so this service is the single place coordinates ever exist.[Rubric §29, Resilience & Business Continuity]§29 assesses graceful degradation. The null-on-failure, hint-is-optional contract means a geocoder outage degrades to "no proximity hint", never to a broken page.
- Walkthrough: two members.
IsSupported(IGeocodingService.cs:12): whether the platform can geocode at all; web and null fallbacks reportfalse.GeocodeAsync(string, CancellationToken)(IGeocodingService.cs:15): returns the first coordinate match for the address, ornull.
- Why it's built this way: geocoding is a native and optional concern, so it hides behind a platform-free interface with a null default and a native override selected per host (ADR-042).
- Where it's used: registered with the NullGeocodingService default (
MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:48), overridden on native heads by MauiGeocodingService; consumed by venue-proximity UI.
IGeolocationService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Geo·MMCA.Common.UI/Services/Capabilities/Geo/IGeolocationService.cs:8· Level 1 · interface
- What it is: a soft, one-shot device location read for the same proximity hints, the device-position sibling of IGeocodingService (
IGeolocationService.cs:3-7). - Depends on: GeoPoint, its return shape;
System.Threading.CancellationToken. - Concept introduced: nothing new, it applies the same best-effort contract. Its distinct behavioral note is the at-most-once permission prompt: it returns the last-known position when that is fresh enough, otherwise a single current-position read, triggering the platform permission prompt at most once and returning
nullon denial, timeout, or any platform failure (IGeolocationService.cs:13-18).[Rubric §26, Front-End Security]§26 assesses handling of sensitive capabilities. Location is permission-gated, prompted at most once, and never blocks a feature, so the app can neither nag nor hard-depend on a sensitive grant.
- Walkthrough: two members.
IsSupported(IGeolocationService.cs:11): whether the platform can provide a location at all.GetCurrentOrLastKnownAsync(CancellationToken)(IGeolocationService.cs:18): the fresh-last-known-or-single-read behavior described above.
- Why it's built this way: same per-host swappable design as its geocoding sibling, a platform-free contract with an inert default (ADR-042).
- Where it's used: registered with the NullGeolocationService default (
MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:47), overridden by MauiGeolocationService; consumed alongside geocoding for proximity hints, whose distance math lives on GeoPoint.
BrowserMapNavigationService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Geo·MMCA.Common.UI/Services/Capabilities/Geo/BrowserMapNavigationService.cs:10· Level 1 · class (sealed)
- What it is: the web adapter for
IMapNavigationService. There is no maps app to launch in a browser, so it takes a Google Maps search URL for the address (with the label searched alongside it, since the web endpoint has no label parameter) and hands it toIExternalLinkServiceto open in a new tab (MMCA.Common.UI/Services/Capabilities/Geo/BrowserMapNavigationService.cs:6-8). - Depends on:
IMapNavigationService(the contract it implements,MMCA.Common.UI/Services/Capabilities/Geo/BrowserMapNavigationService.cs:10),IExternalLinkService(constructor-injected,:12,:15-16) andMapLaunchUris(the URL builder). Unlike every other browser adapter in this group it takes noCapabilitiesJsModule: it composes over a sibling capability instead of calling JS itself. - Concept introduced, capability composition. Most adapters in this group sit directly on one platform API; this one is built entirely out of another capability, which is why it lands at Level 1 while its JS-backed siblings sit at Level 2. The payoff is that the "open something outside the app" policy (a new tab on the web, the system browser on native) is decided once in
IExternalLinkServiceand every consumer inherits it.[Rubric §2, Design Patterns]assesses whether patterns are applied with intent rather than by habit; adapter-over-adapter here avoids a second copy of the window-open rules.[Rubric §22, Responsive/Cross-Browser]assesses whether the app spans device classes gracefully; the sameOpenAddressAsynccall site produces a native maps intent on a phone and a maps tab in a desktop browser. - Walkthrough
- The constructor (
MMCA.Common.UI/Services/Capabilities/Geo/BrowserMapNavigationService.cs:15-16) is an expression body capturing the injectedIExternalLinkServiceinto_externalLinkService(:12). OpenAddressAsync(string address, string? label, CancellationToken = default)(:19): guards withArgumentException.ThrowIfNullOrWhiteSpace(address)(:21), then returns theTask<bool>from_externalLinkService.OpenAsync(MapLaunchUris.ForBrowser(address, label), cancellationToken)directly (:23), withoutasync/await, so the caller sees whatever the link opener reported. The method is notasync, so the guard on:21throws synchronously rather than faulting a returned task. The URL itself (the escaped"label, address"search, or the address alone when the label is blank or already part of the address) comes fromMapLaunchUris.ForBrowser(MMCA.Common.UI/Services/Capabilities/Geo/MapLaunchUris.cs:29-30).
- The constructor (
- Why it's built this way: the web has no address-to-map handoff of its own, so a search URL is the honest equivalent; escaping the query is what keeps a street name containing
&or#from truncating it, and searching the label with the address is the closest the label-less Maps URLs API gets to naming the place. Building the URL inMapLaunchUriskeeps it unit-tested beside the native shapes, and delegating the open (rather than callingwindow.opendirectly) keeps thenoopener,noreferrerhardening in one place (ADR-042). - Where it's used: registered scoped as
IMapNavigationServicebyAddBrowserDeviceCapabilities()(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:122); its siblings areMauiMapNavigationServiceandNullMapNavigationService. On web heads it serves ADC's public event detail and activity list "Directions" actions (seeIMapNavigationService). Covered byBrowserMapNavigationServiceTests(MMCA.Common/Tests/Presentation/MMCA.Common.UI.Tests/Services/Capabilities/Geo/BrowserMapNavigationServiceTests.cs). - Caveats / not-in-source: the returned
boolis only as precise as the opener beneath it.IExternalLinkService.OpenAsyncreturnsTask<bool>(MMCA.Common.UI/Services/Capabilities/Interop/IExternalLinkService.cs:23), andBrowserExternalLinkServiceyieldsfalsewhen JS interop is unavailable (prerender, a torn-down circuit) (MMCA.Common.UI/Services/Capabilities/Interop/BrowserExternalLinkService.cs:23-27). But the JSopenExternalreturnstrueunlesswindow.openthrew (MMCA.Common.UI/wwwroot/capabilities-interop.js:39-45): withnoopenerthe spec makeswindow.openreturnnulleven on success, so a popup blocked by the browser still reportstrue. ADC's callers do branch on thebool(a "directions failed" toast onfalse), so on the web that toast appears only when interop is unavailable, never for a blocked popup.
NullMapNavigationService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Geo·MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/Geo/NullMapNavigationService.cs:7· Level 1 · class (sealed)
- What it is: the default
IMapNavigationService: no maps integration, so opening an address reports failure (NullMapNavigationService.cs:3). - Depends on:
IMapNavigationService; BCLTask. - Concept: an outcome-returning fallback in the same shape as
NullClipboardService, with noIsSupportedprobe. Afalseanswer is the component's cue to leave the address as plain text rather than a tappable "open in maps" affordance. - Walkthrough: one member.
OpenAddressAsync(string address, string? label, CancellationToken)(NullMapNavigationService.cs:10-11) returnsTask.FromResult(false), ignoring both the address and the optional pin label. - Why it's built this way: ADR-042. Launching a map is a platform handoff (a native maps app, or a maps URL in a new tab), and a head that has neither should not fabricate one.
- Where it's used:
TryAddSingletoninAddDeviceCapabilityDefaults()(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:46); overridden byBrowserMapNavigationService(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:122) andMauiMapNavigationService(MMCA.Common/Source/Presentation/MMCA.Common.UI.Maui/DependencyInjection.cs:68). Covered inCapabilityFallbackTests(CapabilityFallbackTests.cs:150).
NullGeocodingService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Geo·MMCA.Common.UI/Services/Capabilities/Geo/NullGeocodingService.cs:4· Level 2 · class (sealed)
- What it is - the inert default for
IGeocodingService: a geocoder that geocodes nothing. It reports itself unsupported and hands backnullfor every address, which is exactly the "no coordinate hint available" state the contract is designed around (NullGeocodingService.cs:3). - Depends on - implements
IGeocodingService; returnsGeoPoint?. No other first-party or external dependency beyondSystem.Threading.Tasks(Task.FromResult). - Concept introduced - the null-object capability fallback. This is the first of five inert
Null...defaults in this unit, so the shape is worth teaching once here. Every device capability in this group is an interface (geocoding, geolocation, notifications, media picking, push, and so on), and shared Blazor components resolve those interfaces directly by injection. But a plain web head has no native geocoder, and a prerendering circuit has no JavaScript yet, so something must be in the container or resolution throws. The framework fills the container with a Null Object implementation for every contract: a real, substitutable instance whose methods do nothing observable, rather than anullreference the caller has to check for. The two moving parts are theIsSupportedflag (a component reads it and hides the affordance) and the operation itself (a component that ignoresIsSupportedand calls anyway still gets a safe answer, never an exception).AddDeviceCapabilityDefaultsTryAdd-registers this class as a singleton (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:48), and a native or richer head later overrides it with a plainAdd, so last-registration-wins swaps the real implementation in without the shared component knowing (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:17-22). Every other fallback in this chapter, including the stateless siblings such asNullShareService, follows this same shape.- [Rubric §2 - Design Patterns] §2 assesses whether classic patterns are applied where they earn their keep; this is a textbook Null Object, a do-nothing implementation that removes null-checks and host-detection branches from every caller.
- [Rubric §1 - SOLID] §1 assesses SOLID adherence; the substitutability here is Liskov and Dependency Inversion in practice, components depend on the abstraction and any implementation (null or native) satisfies it interchangeably.
- [Rubric §22 - Responsive / Cross-Browser] §22 assesses graceful behavior across heads and browsers; the null default is what lets one shared component tree run unchanged on web, where geocoding does not exist.
- Walkthrough -
sealed classimplementing the interface (NullGeocodingService.cs:4).IsSupported => false(NullGeocodingService.cs:7) tells callers to omit the proximity hint entirely.GeocodeAsync(NullGeocodingService.cs:10-11) ignores itsaddressandcancellationTokenarguments and returnsTask.FromResult<GeoPoint?>(null), an already-completed task, so there is no async state machine and no thread hop. - Why it's built this way - ADR-042 (device capability abstraction). The domain model deliberately carries addresses and no coordinates, so geocoding is a pure presentation-time convenience and this contract is "the only place they ever exist" (
MMCA.Common.UI/Services/Capabilities/Geo/IGeocodingService.cs:3-8). Making the unsupported case a first-classnull(rather than an exception or a feature flag the caller must invent) keeps proximity hints optional everywhere. - Where it's used - registered by
AddDeviceCapabilityDefaults(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:48) and resolved by any component that shows a distance-from-venue hint, for example ADC's public event detail page, which injects both location contracts and bails out of the hint when either reports unsupported (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.UI/Pages/Public/Events/PublicEventDetail.razor.cs:26-27,232). The MAUI head replaces it withMauiGeocodingService(MMCA.Common.UI.Maui/DependencyInjection.cs:70); there is no browser override, so web and Server heads keep this null default.
NullGeolocationService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Geo·MMCA.Common.UI/Services/Capabilities/Geo/NullGeolocationService.cs:4· Level 2 · class (sealed)
- What it is - the inert default for
IGeolocationService: no location source. It reports unsupported and returnsnullfor the current position, so a caller simply omits any proximity hint (NullGeolocationService.cs:3). - Depends on - implements
IGeolocationService; returnsGeoPoint?. Same null-object shape asNullGeocodingService; see there for the pattern. - Concept introduced - none new. This is the sibling of
NullGeocodingServicefor the "where is this device" half of the location story (geocoding turns an address into a point, geolocation reads the device's own point). The same [Rubric §1 - SOLID], [Rubric §2 - Design Patterns], and [Rubric §22 - Responsive / Cross-Browser] notes apply. - Walkthrough -
sealed class(NullGeolocationService.cs:4).IsSupported => false(NullGeolocationService.cs:7).GetCurrentOrLastKnownAsyncreturnsTask.FromResult<GeoPoint?>(null)(NullGeolocationService.cs:10-11); because it never touches the platform it also never fires the OS permission prompt the real contract warns about (MMCA.Common.UI/Services/Capabilities/Geo/IGeolocationService.cs:13-18), which is the desired behavior on a head that could not honor a grant anyway. - Why it's built this way - ADR-042. Location is soft and best-effort by contract: permission denial, timeout, or any platform failure already yields
null(MMCA.Common.UI/Services/Capabilities/Geo/IGeolocationService.cs:3-6,14-16), so a head with no location provider is just the permanent version of that same "no fix" outcome, and no caller needs a second code path for it. - Where it's used - registered by
AddDeviceCapabilityDefaults(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:47); consumed alongside the geocoder by ADC's public event detail page (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.UI/Pages/Public/Events/PublicEventDetail.razor.cs:26,232). The MAUI head overrides it withMauiGeolocationService(MMCA.Common.UI.Maui/DependencyInjection.cs:69); web and Server heads keep this default, sinceAddBrowserDeviceCapabilitiesregisters no geolocation implementation (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:110-129).
ExternalLinkScheme
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Interop·MMCA.Common.UI/Services/Capabilities/Interop/ExternalLinkScheme.cs:9· Level 0 · class (internal, static)
- What it is: the scheme allow-list for external links:
http,https,mailto,tel,smsandotpauth(the two-factor "open in authenticator app" link). Anything else, such asjavascript:,data:,file:,intent:or a third-party app scheme taken from stored data, is neither rendered as a link nor handed to the OS (ExternalLinkScheme.cs:3-8). - Depends on: BCL only (
System.Uri,HashSet<string>,StringComparer.OrdinalIgnoreCase). It isinternal, reached from the MAUI package throughInternalsVisibleTo(MMCA.Common.UI/MMCA.Common.UI.csproj:25). - Concept introduced, an allow-list in front of every outbound link. A link target that comes from stored data (a speaker's website, an imported URL) is untrusted input. Deny-listing
javascript:is not enough, because the dangerous set is open-ended (app schemes,intent:on Android,file:), so the class names the six schemes that may leave the app and refuses everything else. It answers two different questions with two methods: "may this URI be launched" and "may this string be rendered as an anchor".[Rubric §26, Front-End Security]assesses whether the client refuses to turn untrusted data into executable or privileged actions. Here one allow-list guards both the renderedhref(script-scheme XSS) and the native launcher (a storedintent:or app scheme that would otherwise reach the OS).[Rubric §25, Navigation & IA]assesses whether navigation stays coherent across surfaces. A refused target still renders its content as plain text rather than disappearing, so the page reads the same on every head.
- Walkthrough
AllowedSchemes(ExternalLinkScheme.cs:11-19): aHashSet<string>built with the C# collection-expressionwith(StringComparer.OrdinalIgnoreCase)argument, soHTTPS:matches likehttps:; the first three entries reuse the BCLUri.UriScheme*constants.IsAllowed(Uri uri)(ExternalLinkScheme.cs:24):trueonly when the URI is absolute and its scheme is in the set. A relativeUriis never allowed to launch.IsSafeHref(string? href)(ExternalLinkScheme.cs:34-46): the rendering check. A null or empty value is safe (:36-39). Otherwise it decides whether the string carries a scheme at all: a colon that appears before the first/,?or#(or with no such delimiter) means a scheme is present (:41-43). No scheme means a relative reference (/privacy,#section:2,/search?q=a:b) and is safe; a scheme must parse as an absolute URI and passIsAllowed(:45). Because a scheme that does not parse is refused, whitespace or control characters inside a scheme (which browsers strip, sojava\tscript:would otherwise execute) cannot smuggle one past the check (:26-31).
- Why it's built this way: the WebView link problem is already solved once in the
ExternalLinkcomponent andMauiExternalLinkService(ADR-042), so those two choke points are where the allow-list sits. Keeping the list in one internal class means the rendered anchor and the native launch cannot disagree about which schemes are safe. - Where it's used: the shared
ExternalLinkcomponent renders itsMudLinkonly whenExternalLinkScheme.IsSafeHref(Href)holds and falls back to a plain<span>otherwise (MMCA.Common.UI/Components/Capabilities/ExternalLink.razor:14-26);MauiExternalLinkServicereturnsfalsewithout launching anything whenIsAllowedfails (MMCA.Common.UI.Maui/Capabilities/Interop/MauiExternalLinkService.cs:23-26).ExternalLinkSchemeTestscovers the allowed set, refused schemes (javascript:,data:,file:,intent:,vbscript:, an app scheme), obfuscated schemes with a tab or newline, and relative references (MMCA.Common/Tests/Presentation/MMCA.Common.UI.Tests/Services/Capabilities/Interop/ExternalLinkSchemeTests.cs:13-61). - Caveats / not-in-source:
BrowserExternalLinkServiceapplies the same allow-list to its programmaticOpenAsync, returningfalsebefore the script is reached (MMCA.Common.UI/Services/Capabilities/Interop/BrowserExternalLinkService.cs:24-27), so on the web head both the rendered anchor and the programmatic open are guarded.
IClipboardService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Interop·MMCA.Common.UI/Services/Capabilities/Interop/IClipboardService.cs:7· Level 0 · interface
- What it is: writes text to the system clipboard, returning success so a caller can confirm with a snackbar.
- Depends on: BCL only.
- Concept, best-effort capability with a success return.
[Rubric §18, UI Architecture]. A single method wraps MAUIClipboard.Defaultand browsernavigator.clipboard(IClipboardService.cs:4-5); returningbool(rather thanvoid) lets the UI acknowledge only when the write actually landed, which matters because browser clipboard writes can be denied by permission. - Walkthrough:
SetTextAsync(string text, CancellationToken = default)(IClipboardService.cs:10): copiestext, returns whether the write succeeded. - Why it's built this way: the boolean result is the fallback signal for
IShareServicecallers: when a native share sheet is unavailable, they copy the link instead and confirm from this return. - Where it's used: implemented by
MauiClipboardService,BrowserClipboardService(registered per scope inAddBrowserDeviceCapabilities,MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:116), and the defaultNullClipboardService(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:44); it is the copy-link fallback path ofIShareService.
IExternalLinkService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Interop·MMCA.Common.UI/Services/Capabilities/Interop/IExternalLinkService.cs:9· Level 0 · interface
- What it is: opens URLs outside the current UI surface (a new browser tab, or the system browser from inside a BlazorWebView).
- Depends on: BCL only (
System.Uri). - Concept, the WebView dead-link workaround.
[Rubric §18, UI Architecture]and[Rubric §25, Navigation & IA]. A rawtarget="_blank"silently dead-ends inside a WKWebView, so shared components must route external links through this service (via theExternalLinkcomponent) rather than raw anchor targets (IExternalLinkService.cs:4-7). TheInterceptsLinksflag lets the component pick the cheapest correct rendering per host. - Walkthrough
InterceptsLinks(IExternalLinkService.cs:16): whether links must be intercepted and opened viaOpenAsync(truein native WebView hosts); whenfalse, components may render a plain anchor withtarget="_blank"(IExternalLinkService.cs:12-14).OpenAsync(Uri uri, CancellationToken = default)(IExternalLinkService.cs:23): opens the URI in the system browser or a new tab, best-effort (IExternalLinkService.cs:18), and returnsTask<bool>:truewhen the platform reported the URL was opened,falsewhen nothing was opened (no handler, JS interop unavailable, or a host that does not open links) (IExternalLinkService.cs:21-22).BrowserMapNavigationServicepasses that result straight through as its own outcome (MMCA.Common.UI/Services/Capabilities/Geo/BrowserMapNavigationService.cs:23), while theExternalLinkcomponent awaits it and ignores the value (MMCA.Common.UI/Components/Capabilities/ExternalLink.razor:41).
- Why it's built this way: exposing
InterceptsLinksmeans the browser head keeps native anchor semantics (middle-click, open-in-new-tab) while only WebView heads pay the interop cost (ADR-042). - Where it's used: implemented by
MauiExternalLinkService,BrowserExternalLinkService(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:117), and the defaultNullExternalLinkService(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:49); consumed by theExternalLinkcomponent (its fake counterpartFakeExternalLinkServicebacks the component tests) and composed over byBrowserMapNavigationService.
IScreenshotService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Interop·MMCA.Common.UI/Services/Capabilities/Interop/IScreenshotService.cs:8· Level 0 · interface
- What it is: captures the current app screen to a temporary image file, for pairing with a share action ("share my schedule as image").
- Depends on: BCL only; pairs with
IShareService.ShareFileAsync, which the doc comment names directly (IScreenshotService.cs:5). - Concept, permissionless temp-file capture.
[Rubric §26, Front-End Security]and[Rubric §30, Compliance/Privacy/Data Governance]. Captured files land in the platform cache directory, never the photo library, so no storage permissions are needed (IScreenshotService.cs:5-6), a deliberate minimization that avoids prompting for (and holding) a broad permission for a one-off share. - Walkthrough
IsSupported(IScreenshotService.cs:11): whether screen capture is available (web and null fallbacks reportfalse).CaptureToFileAsync(CancellationToken = default)(IScreenshotService.cs:14): captures the screen to a temp PNG and returns its path, ornullon failure.
- Why it's built this way: writing to the cache directory (not the gallery) keeps the feature permission-free; returning a nullable path lets the share flow abort quietly when capture is unsupported or fails.
- Where it's used: implemented by
MauiScreenshotServiceand the unsupportedNullScreenshotService, the TryAdd default (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:53); its output is handed toIShareService.ShareFileAsync.
IShareService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Interop·MMCA.Common.UI/Services/Capabilities/Interop/IShareService.cs:8· Level 0 · interface
- What it is: opens the platform share affordance (a native share sheet on MAUI,
navigator.sharein browsers) for a link, a local file, or plain text (IShareService.cs:3-7,:22-26). - Depends on: nothing first-party in its signature;
System.UriandSystem.Threading.CancellationTokenfrom the BCL. Its documented fallback partner is IClipboardService. - Concept introduced: share with a copy-link fallback. All three methods return
boolrather thanvoid, and the contract says the boolean means "was a share UI presented" (IShareService.cs:10-13,:16-19,:22-26). That is what makes a Share button safe to render everywhere: when the answer isfalsethe caller copies the link through IClipboardService and confirms with a toast instead. "Presented" is meant literally: a sheet the user opened and then dismissed still counts astrueon every head, so a cancel does not trigger an unwanted copy-link right after it (IShareService.cs:11-12). It is also what makes theboolreturn on the clipboard contract useful, the two capabilities are designed as a pair.[Rubric §18, UI Architecture]§18 assesses whether the shared component tree stays host-agnostic. OneIShareServicecall site produces a native sheet, a browser share dialog, or a clipboard copy, with no host branching in markup.[Rubric §22, Responsive / Cross-Browser]§22 assesses graceful behavior across the host matrix.navigator.shareis absent on most desktop browsers, and the boolean return turns that absence into a designed path rather than a caught exception.
- Walkthrough: three members.
ShareLinkAsync(string title, Uri uri, CancellationToken = default)(IShareService.cs:14): shares a link with an accompanying title; returns whether a share UI was presented, with a dismissed sheet counting as presented (IShareService.cs:10-13). On the web theshareLinkexport honors this by returningtruefor anAbortError(the user closed the sheet) andfalseforNotAllowedErroror any other failure, where nothing was shown (MMCA.Common.UI/wwwroot/capabilities-interop.js:19-24).ShareFileAsync(string title, string filePath, string contentType, CancellationToken = default)(IShareService.cs:20): shares a local file (a screenshot, for example); browser implementations reportfalsebecause they have no local file access (IShareService.cs:16-19).ShareTextAsync(string title, string text, CancellationToken = default)(IShareService.cs:27-28): shares plain text, such as the in-app diagnostics log. It is a default interface member that returnsTask.FromResult(false), so an implementation that does not override it reports "unavailable" and the caller falls back to IClipboardService (IShareService.cs:22-26). Only MauiShareService overrides it, opening the native share sheet (MMCA.Common.UI.Maui/Capabilities/Interop/MauiShareService.cs:53); the sharedInAppDiagnosticsLogcomponent tries it first and copies the log when it returnsfalse(MMCA.Common.UI/Components/Diagnostics/InAppDiagnosticsLog.razor:113-119).
- Why it's built this way: sharing is the capability with the widest spread between heads (full sheet, partial web support, none at all), so the contract encodes the failure as a return value instead of an exception and lets one shared component degrade deterministically (ADR-042).
- Where it's used: registered with the NullShareService default in
AddDeviceCapabilityDefaults(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:43), overridden by BrowserShareService on web heads (DependencyInjection.cs:115) and by MauiShareService on native ones. It consumes IScreenshotService output for image sharing and pairs with IClipboardService as its fallback.
NullClipboardService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Interop·MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/Interop/NullClipboardService.cs:4· Level 1 · class (sealed)
- What it is: the default
IClipboardService: the clipboard is unavailable, and the call reports failure rather than pretending success (NullClipboardService.cs:3). - Depends on:
IClipboardService; BCLTask. - Concept: the boolean outcome return, as opposed to the boolean
IsSupportedprobe used by most siblings. This contract has no probe: a copy either worked or it did not, and the caller reacts to the answer it gets. Returningfalseis what lets a component show "copy failed, select the text manually" instead of a misleading "copied" toast.[Rubric §24, Forms / Validation / UX Safety]assesses whether the UI tells the truth about what happened. Reporting the failure keeps the user informed rather than silently discarding their action.
- Walkthrough: one member.
SetTextAsync(string text, CancellationToken)(NullClipboardService.cs:7-8) returnsTask.FromResult(false). - Why it's built this way: ADR-042. Clipboard write is permission-gated and can fail on real hosts too (a non-secure browser context, for example), so the contract already has a failure path and the null default simply takes it always.
- Where it's used:
TryAddSingletoninAddDeviceCapabilityDefaults()(DependencyInjection.cs:43); overridden byBrowserClipboardService(DependencyInjection.cs:123) andMauiClipboardService(MMCA.Common/Source/Presentation/MMCA.Common.UI.Maui/DependencyInjection.cs:66). Covered inCapabilityFallbackTests(CapabilityFallbackTests.cs:32-34).
NullExternalLinkService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Interop·MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/Interop/NullExternalLinkService.cs:7· Level 1 · class (sealed)
- What it is: the default
IExternalLinkService: no link interception, so components render plain anchors withtarget="_blank", which the class summary notes is the correct behavior on web heads even without JavaScript (NullExternalLinkService.cs:3-6). - Depends on:
IExternalLinkService; BCLUriandTask. - Concept introduced, the flag that is a routing switch rather than a capability probe.
InterceptsLinksdoes not mean "I can open links"; it means "route clicks through me instead of letting the browser handle them" (MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/Interop/IExternalLinkService.cs:11-16). The sharedExternalLinkcomponent reads it and builds anEventCallbackonly when it is true, otherwise leaving the click handler asdefaultso the plainMudLinkwithtarget="_blank"andrel="noopener noreferrer"handles the navigation natively (MMCA.Common/Source/Presentation/MMCA.Common.UI/Components/Capabilities/ExternalLink.razor:11-16,:32-35). With this default in place,OpenAsyncis therefore never called from the component, which is why its inert body is harmless.[Rubric §25, Navigation & IA]assesses whether navigation stays coherent across surfaces. This flag exists becausetarget="_blank"silently dead-ends inside a WebView, so the native head must intercept while the web head must not (IExternalLinkService.cs:3-8).[Rubric §26, Front-End Security]assesses outbound-link hygiene. Therel="noopener noreferrer"that protects the opener lives in the component, not here, and it is exactly the path this default leaves in charge (ExternalLink.razor:15).
- Walkthrough
InterceptsLinks(NullExternalLinkService.cs:10): constantfalse, the "let the anchor do its job" answer.OpenAsync(Uri uri, CancellationToken)(NullExternalLinkService.cs:13): returnsTask.FromResult(false), dropping the URI and reporting truthfully that nothing was opened. Reached only if a caller ignoresInterceptsLinksand calls it anyway, and a caller that forwards the result (such asBrowserMapNavigationService,MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/Geo/BrowserMapNavigationService.cs:23) then sees a failure rather than a false success.
- Why it's built this way: ADR-042. The framework routes every external link through one component so the WebView problem is solved once; on hosts without that problem the cheapest correct behavior is the browser's own.
- Where it's used:
TryAddSingletoninAddDeviceCapabilityDefaults()(DependencyInjection.cs:48); overridden byBrowserExternalLinkService(DependencyInjection.cs:124) and byMauiExternalLinkService(MMCA.Common/Source/Presentation/MMCA.Common.UI.Maui/DependencyInjection.cs:71), which is the implementation that actually setsInterceptsLinksto true.CapabilityFallbackTestsasserts the flag is false andOpenAsyncdoes not throw (CapabilityFallbackTests.cs:158,:162).
NullScreenshotService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Interop·MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/Interop/NullScreenshotService.cs:4· Level 1 · class (sealed)
- What it is: the default
IScreenshotService: screen capture unavailable (NullScreenshotService.cs:3). - Depends on:
IScreenshotService; BCLTask. - Concept: probe-plus-nullable-result, the same pairing as
NullBarcodeScannerService:IsSupportedsteers the UI and the operation still answers safely for a caller that ignores it. The returnedstring?is a file path, sonullmeans "no file was written" and there is nothing for the caller to clean up. - Walkthrough
IsSupported(NullScreenshotService.cs:7): constantfalse.CaptureToFileAsync(CancellationToken)(NullScreenshotService.cs:10-11): returnsTask.FromResult<string?>(null).
- Why it's built this way: ADR-042. Capturing the screen is a native-only operation with privacy weight, and there is no browser equivalent the framework wires, so this default is what every web head runs.
- Where it's used:
TryAddSingletoninAddDeviceCapabilityDefaults()(DependencyInjection.cs:52);MauiScreenshotServiceis the only override (MMCA.Common/Source/Presentation/MMCA.Common.UI.Maui/DependencyInjection.cs:75). Covered inCapabilityFallbackTests(CapabilityFallbackTests.cs:153).
NullShareService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Interop·MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/Interop/NullShareService.cs:4· Level 1 · class (sealed)
- What it is: the default
IShareService: the platform share sheet is unavailable, and the summary names the intended consequence, callers fall back to copy-link (NullShareService.cs:3). - Depends on:
IShareService; BCLUriandTask. - Concept: a fallback whose
falsereturn is a hand-off signal between two capabilities. A share button that getsfalsefromShareLinkAsyncis expected to copy the URL throughIClipboardServiceinstead, so the two contracts compose into one user-visible affordance that behaves sensibly wherever it lands, including on a host where both are null (there the copy also reports failure and the UI says so).[Rubric §18, UI Architecture]assesses how presentation decisions are layered. The share-or-copy choice lives in the component, driven by a returned outcome rather than by host detection.
- Walkthrough
ShareLinkAsync(string title, Uri uri, CancellationToken)(NullShareService.cs:7-8):Task.FromResult(false).ShareFileAsync(string title, string filePath, string contentType, CancellationToken)(NullShareService.cs:11-12):Task.FromResult(false). Note it takes a path plus a MIME type rather than a stream, so the null implementation owns no resource and has nothing to dispose.
- Why it's built this way: ADR-042.
navigator.shareis not universally available even in browsers, so the contract already had to model "sharing did not happen" as an ordinary outcome; the null default is that outcome, always. - Where it's used:
TryAddSingletoninAddDeviceCapabilityDefaults()(DependencyInjection.cs:42); overridden byBrowserShareService(DependencyInjection.cs:122) andMauiShareService(MMCA.Common/Source/Presentation/MMCA.Common.UI.Maui/DependencyInjection.cs:65). Both members are asserted false inCapabilityFallbackTests(CapabilityFallbackTests.cs:20-27).
BrowserClipboardService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Interop·MMCA.Common.UI/Services/Capabilities/Interop/BrowserClipboardService.cs:4· Level 2 · class (sealed)
- What it is: the web adapter for
IClipboardService, writing text to the system clipboard throughnavigator.clipboard.writeText. - Depends on:
IClipboardServiceandCapabilitiesJsModule(MMCA.Common.UI/Services/Capabilities/Interop/BrowserClipboardService.cs:6,:9); thecopyTextexport (MMCA.Common.UI/wwwroot/capabilities-interop.js:25). - Concept introduced: the group's tri-state to bool collapse, worth stating once because several adapters repeat it.
CapabilitiesJsModulereturnsbool?:true(the browser did it),false(the browser refused), ornull(JS never ran). Adapters whose contract returnsboolcollapse the last two with== true, so "not attempted" and "attempted and failed" are equally honest answers to "did the copy land".[Rubric §18, UI Architecture]assesses whether the UI can tell the user the truth about what happened; the boolean is what lets a caller show a "copied" snackbar only on a real success. - Walkthrough: the constructor captures the module (
MMCA.Common.UI/Services/Capabilities/Interop/BrowserClipboardService.cs:9).SetTextAsync(string text, CancellationToken = default)(:12-18) invokescopyTextwith the text (:14-16) and returnscopied == true(:17). On the JS side,copyTextreturnsfalseup front whennavigator.clipboardis absent (an insecure context or an older browser) and catches a rejectedwriteText(a denied permission) tofalse(MMCA.Common.UI/wwwroot/capabilities-interop.js:26-34). - Why it's built this way: the Clipboard API is permission-gated and unavailable over plain HTTP, so a
boolreturn rather than a throw lets the copy-link affordance simply do nothing visible where it is unsupported. - Where it's used: registered scoped as
IClipboardServicebyAddBrowserDeviceCapabilities()(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:116); siblings areMauiClipboardServiceandNullClipboardService. It is the copy-link fallback forIShareServicecallers, usually paired withIPublicLinkBuilderto produce the URL.
BrowserExternalLinkService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Interop·MMCA.Common.UI/Services/Capabilities/Interop/BrowserExternalLinkService.cs:10· Level 2 · class (sealed)
- What it is: the web adapter for
IExternalLinkService. On the web an anchor already works, so it reportsInterceptsLinks => falseand only handles programmatic opens (the maps fallback) throughwindow.open, refusing any URI theExternalLinkSchemeallow-list does not admit (BrowserExternalLinkService.cs:6-8). - Depends on:
IExternalLinkService,ExternalLinkSchemeandCapabilitiesJsModule(MMCA.Common.UI/Services/Capabilities/Interop/BrowserExternalLinkService.cs:10,:12,:24); theopenExternalexport (MMCA.Common.UI/wwwroot/capabilities-interop.js:40); BCLUri. - Concept introduced: the
InterceptsLinkscapability flag, the group's answer to "should the component render a plain anchor or route through the service". A native head inside aBlazorWebViewmust intercept, becausetarget="_blank"dead-ends there; a browser head must not, because intercepting would replace working native anchor behavior (middle-click, open-in-new-tab, the browser's own popup policy) with a worse imitation (:3-6).[Rubric §25, Navigation & IA]assesses whether navigation is coherent and predictable across the app; one flag lets a single shared link component be correct on both heads.[Rubric §26, Front-End Security]applies to the JS side:window.open(url, '_blank', 'noopener,noreferrer')(MMCA.Common.UI/wwwroot/capabilities-interop.js:42) prevents the opened page from reaching back throughwindow.openerand strips the referrer. - Walkthrough: the constructor captures the module (
MMCA.Common.UI/Services/Capabilities/Interop/BrowserExternalLinkService.cs:15).InterceptsLinks => false(:18).OpenAsync(Uri uri, CancellationToken = default)(:21-34) null-guardsuri(:23), returnsfalsewithout touching the script whenExternalLinkScheme.IsAllowed(uri)fails, so ajavascript:ordata:URI never reacheswindow.open(:24-27), invokesopenExternalwithuri.ToString()throughInvokeOrDefaultAsync<bool?>(:30-32), and returnsopened ?? false(:33): the JS boolean when the call ran,falsewhen interop was unavailable (prerender, a torn-down circuit) and nothing was opened (:29). - Why it's built this way: leaving anchors alone on the web is the cheaper and more correct default; the programmatic path exists only for callers like
BrowserMapNavigationServicethat have no anchor to click. - Where it's used: registered scoped as
IExternalLinkServicebyAddBrowserDeviceCapabilities()(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:117); siblings areMauiExternalLinkServiceandNullExternalLinkService. Consumed by the shared external-link component and byBrowserMapNavigationService. - Caveats / not-in-source:
truemeans only thatwindow.opendid not throw. The JS reportstrueunless it catches a throw (MMCA.Common.UI/wwwroot/capabilities-interop.js:41-46), and its comment states why it cannot do better: with thenoopenerfeature the HTML spec makeswindow.openreturnnulleven when the tab opened, so a blocked popup cannot be told apart from an opened one (capabilities-interop.js:37-39). A popup silently blocked by the browser is therefore still reported as opened.
BrowserShareService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Interop·MMCA.Common.UI/Services/Capabilities/Interop/BrowserShareService.cs:10· Level 2 · class (sealed)
- What it is: the web adapter for
IShareService, opening the browser's native share sheet through the Web Share API for links, and declining file sharing outright. - Depends on:
IShareServiceandCapabilitiesJsModule(MMCA.Common.UI/Services/Capabilities/Interop/BrowserShareService.cs:12,:13); theshareLinkexport (MMCA.Common.UI/wwwroot/capabilities-interop.js:12); BCLUri. - Concept introduced, partial capability implementation, the third posture in this group alongside "real" and "inert". Web Share exists but covers only part of the contract, so one method is genuinely implemented and the other returns a hard
falserather than pretending. That honestfalseis what lets a Share button on desktop Firefox fall back to copy-link instead of appearing to work and doing nothing.[Rubric §22, Responsive/Cross-Browser]assesses behavior across browsers that do not agree on a feature; the class doc names the exact gaps (desktop Firefox, insecure contexts,:4-6).[Rubric §18, UI Architecture]applies because the boolean return is the contract that makes a fallback affordance possible at all. - Walkthrough
- The constructor captures the module (
MMCA.Common.UI/Services/Capabilities/Interop/BrowserShareService.cs:15). ShareLinkAsync(string title, Uri uri, CancellationToken = default)(:16-24): null-guardsuri(:18), invokesshareLinkwith the title and the URI string (:20-22), and returnsshared == true(:23). On the JS side,shareLinkreturnsfalsewhennavigator.shareis absent and catches the dismissal and permission rejections (AbortError,NotAllowedError) tofalse(MMCA.Common.UI/wwwroot/capabilities-interop.js:13-22), so a user who closes the share sheet is reported as "not shared".ShareFileAsync(string title, string filePath, string contentType, CancellationToken = default)(:27-28):Task.FromResult(false), unconditionally. A browser has no local file path to share.
- The constructor captures the module (
- Why it's built this way: collapsing "user dismissed" into
falsealongside "unsupported" is the same simplification the clipboard adapter makes, and it is right here because both outcomes mean the link was not shared. Returning a constantfalsefor files, rather than throwingNotSupportedException, keeps the contract uniform so callers branch on a value instead of catching. - Where it's used: registered scoped as
IShareServicebyAddBrowserDeviceCapabilities()(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:115); siblings areMauiShareServiceandNullShareService, withIClipboardServiceas the fallback path andIPublicLinkBuildersupplying the URL.
ISpeechToTextService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Media·MMCA.Common.UI/Services/Capabilities/Media/ISpeechToTextService.cs:10· Level 0 · interface
- What it is: the capability contract for dictating speech into text fields (feedback forms, live Q&A questions) through the platform recognizer (
ISpeechToTextService.cs:5-9). Like every contract in this group it is a tiny, platform-free interface that the shared component tree depends on instead of naming a MAUI or browser recognizer type. - Depends on: nothing first-party. It speaks in
System.Globalization.CultureInfo,System.IProgress<string>,System.Threading.CancellationToken, andTask<string?>only, soMMCA.Common.UIcarries no dependency on any platform recognizer. - Concept introduced: the contract-per-capability shape and the two-phase last-wins registration are established by this chapter's overview; this type reuses them for speech input. The house rule worth naming here is the
IsSupportedgate as an affordance switch, not a degraded path: web and null fallbacks reportIsSupportedfalse(ISpeechToTextService.cs:7-8) and shared components hide the microphone button entirely rather than offering one that silently fails.[Rubric §22, Responsive / Cross-Browser]§22 assesses whether the app adapts across the device and host matrix. Speech input is native-only here, and the interface makes that variance a single injected boolean instead of a compile-time switch in component markup.[Rubric §21, Accessibility]§21 assesses inclusive input and output paths. Dictation is an accessibility affordance for text entry, offered where the platform supports it and cleanly hidden where it does not.
- Walkthrough: two members.
IsSupported(ISpeechToTextService.cs:13): whether speech recognition is available on this platform.ListenAsync(CultureInfo, IProgress<string>?, CancellationToken)(ISpeechToTextService.cs:20-23): listens until the recognizer finalizes or the token cancels, streaming partial hypotheses through thepartialResultsprogress sink, and returns the final transcript, ornullon permission denial, cancellation, or recognizer failure (ISpeechToTextService.cs:16-19). The null-on-failure contract is the never-throw discipline the whole layer follows: a caller can only fall back to typing, never to a broken path.
- Why it's built this way: keeping recognition behind an interface that names no platform type lets the MAUI head supply a real recognizer while browser and null heads register an inert one, all selected at DI composition time (ADR-042,
Website/docs-src/adr/042-device-capability-abstraction.md). - Where it's used: registered as a singleton with the NullSpeechToTextService default in
AddDeviceCapabilityDefaults(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:56); the native override is MauiSpeechToTextService in theMMCA.Common.UI.Mauipackage. Consumed by shared components that offer voice input on feedback and Q&A forms.
ITextToSpeechService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Media·MMCA.Common.UI/Services/Capabilities/Media/ITextToSpeechService.cs:9· Level 0 · interface
- What it is: the output counterpart to ISpeechToTextService, reading text aloud (session descriptions, announcements) through the platform speech synthesizer and matching the active UI culture's voice when one is installed (
ITextToSpeechService.cs:3-8). - Depends on: nothing first-party;
System.Threading.CancellationTokenandTaskonly. - Concept introduced: nothing new. It applies the same
IsSupportedaffordance switch and never-throw contract as its dictation sibling: web and null fallbacks reportIsSupportedfalseand components hide the affordance (ITextToSpeechService.cs:6-8).[Rubric §21, Accessibility]§21 assesses inclusive output. Read-aloud is an accessibility affordance offered wherever the platform can synthesize speech.[Rubric §27, i18n]§27 assesses localization depth. The contract documents culture-matched voice selection with an explicit fall back to the default voice when no voice matches the current culture (ITextToSpeechService.cs:14-18).
- Walkthrough: three members.
IsSupported(ITextToSpeechService.cs:12): whether synthesis is available.SpeakAsync(string, CancellationToken)(ITextToSpeechService.cs:19): speaks the text and completes when playback ends; cancel the token or callStopAsyncto interrupt.StopAsync()(ITextToSpeechService.cs:22): stops any in-progress speech.
- Why it's built this way: same rationale as the dictation contract, one narrow capability behind a platform-free interface, real on MAUI and inert elsewhere (ADR-042).
- Where it's used: registered with the NullTextToSpeechService default (
MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:50); MauiTextToSpeechService overrides it on native heads. Consumed by components that read session and announcement text aloud.
PickedMedia
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Media·MMCA.Common.UI/Services/Capabilities/Media/IMediaPickerService.cs:29· Level 0 · class
- What it is: the framework-owned result of a photo pick or capture: a stream plus its file name and MIME type, returned by IMediaPickerService (
IMediaPickerService.cs:21-28). - Depends on: nothing first-party;
System.IO.StreamandSystem.IDisposable. - Concept introduced: this is the one capability payload in the layer that is deliberately a class, not a record, and the reason is a concrete AOT constraint worth knowing. A record's compiler-generated
IEquatable<T>is a generic WinRT interface, which trips CsWinRT AOT generation (CsWinRT1030) on the windows TFM ofUI.Maui(IMediaPickerService.cs:22-25). So where every other payload here is arecord, this one is asealed classwith get-only properties.[Rubric §15, Best Practices & Code Quality]§15 assesses idiomatic, toolchain-aware code. The deviation from the record convention is documented in place with the exact analyzer id, so the next reader does not "fix" it back into a record and break the MAUI windows build.[Rubric §12, Performance & Scalability]§12 assesses resource handling. The type owns aStreamand implementsIDisposable, so callers dispose after upload rather than holding image bytes open.
- Walkthrough: a primary-constructor
sealed classimplementingIDisposable(IMediaPickerService.cs:29).Content(:32): the photo bytes, positioned at the start.FileName(:35) andContentType(:38): the original or generated file name and the platform-reported MIME type.Dispose()(:41): disposes the underlying stream.
- Why it's built this way: keeping the picked-photo shape as a framework type (rather than a MAUI
FileResult) lets a shared avatar-upload component consume it identically on every head, while the class-over-record choice keeps the native windows AOT build green (ADR-045 for media picking, ADR-042 for the layer). - Where it's used: the return type of
IMediaPickerService.PickPhotoAsync/CapturePhotoAsync(MMCA.Common.UI/Services/Capabilities/Media/IMediaPickerService.cs:15,:18), produced on native heads by MauiMediaPickerService; shared avatar-upload UI consumes the stream and disposes it.
RepeatScanFilter
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Media·MMCA.Common.UI/Services/Capabilities/Media/RepeatScanFilter.cs:12· Level 0 · class (internal sealed)
- What it is: the small stateful guard a continuous scan session asks "is this decode the code I just handled, still in view?" A camera decodes the code in its frame again and again; without this filter the ADC check-in loop submitted the same code about once a second while the operator held it up (
RepeatScanFilter.cs:3-9). - Depends on: BCL
System.TimeProvideronly, taken as a primary-constructor parameter (RepeatScanFilter.cs:11-12);IBarcodeScannerServiceappears only in its doc comment. - Concept introduced, a sliding repeat window over the last payload only. The filter remembers exactly one payload and the timestamp of its last sighting (
RepeatScanFilter.cs:22-23), and every sighting of that payload restarts the window. So a code held in view is handled once and handled again only after it has been out of view forRepeatWindow, not merelyRepeatWindowafter its first sighting (RepeatScanFilter.cs:7-9). A different code is handled at once and replaces the remembered one, so the filter never grows and two attendees scanned back to back are both checked in.[Rubric §29, Resilience & Business Continuity]assesses whether the system behaves predictably under real-world input. A camera's frame-rate decode stream is noisy input by nature; collapsing it to one submission per presented code keeps a scan loop from hammering the check-in command with duplicates.[Rubric §15, Best Practices & Code Quality]assesses idiomatic, testable code. The clock is an injectedTimeProvider(TimeProvider.Systemoutside tests,RepeatScanFilter.cs:11), and elapsed time is measured withGetTimestamp/GetElapsedTime(RepeatScanFilter.cs:33,36) rather than wall-clockDateTime, so the window is immune to clock changes and the tests drive it with aFakeTimeProvider(MMCA.Common/Tests/Presentation/MMCA.Common.UI.Tests/Services/Capabilities/Media/RepeatScanFilterTests.cs:14).
- Walkthrough
RepeatWindow(RepeatScanFilter.cs:20):internal static readonly TimeSpanof 5 seconds. The comment explains the size: long enough to outlast an operator lowering a badge after the outcome shows (about a second plus the outcome dwell), short enough that a deliberate second scan of the same code goes through. It is a constant rather than an option because "it is a property of handheld scanning, not of an app" (RepeatScanFilter.cs:14-19).IsRepeat(string payload)(RepeatScanFilter.cs:31): reads the current timestamp, reports a repeat only when a payload was remembered, the new one is equal underStringComparison.Ordinal, and less thanRepeatWindowhas elapsed since its last sighting (RepeatScanFilter.cs:33-36). It then records the payload and timestamp unconditionally (RepeatScanFilter.cs:38-39), which is what makes the window slide.truemeans skip,falsemeans handle (RepeatScanFilter.cs:30). The ordinal comparison makes codes that differ only in case different codes, pinned byCodesDifferingOnlyInCase_AreDifferentCodes(RepeatScanFilterTests.cs:72).
- Why it's built this way: the dedupe lives in one internal type so both continuous-scan paths share it: the default interface method on
IBarcodeScannerServiceand the MAUI session inMauiBarcodeScannerService. It isinternaland reaches the MAUI package throughInternalsVisibleTo(MMCA.Common/Source/Presentation/MMCA.Common.UI/MMCA.Common.UI.csproj:25), so it adds nothing to the public API. It holds plain fields and no lock: each session creates its own instance and calls it from one loop. The layer's governing decision is ADR-042. - Where it's used: constructed once per session by the
ScanContinuouslyAsyncdefault (MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/Media/IBarcodeScannerService.cs:64, consulted at:75) and by the MAUI session loop (MMCA.Common/Source/Presentation/MMCA.Common.UI.Maui/Capabilities/Media/MauiBarcodeScannerService.cs:219, consulted at:222), whoseOutcomeDwellcomment citesRepeatWindowas the same kind of constant (MauiBarcodeScannerService.cs:145-151). Covered byRepeatScanFilterTests(RepeatScanFilterTests.cs:17-72, six cases including a code held in view staying a repeat past the window from its first sighting at:49).
IBarcodeScannerService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Media·MMCA.Common.UI/Services/Capabilities/Media/IBarcodeScannerService.cs:16· Level 1 · interface
- What it is: opens the device camera to scan a QR code or barcode.
ScanAsynchands back the first decoded payload, ornullwhen the scan did not produce one;ScanContinuouslyAsyncruns a session that hands each new code to a caller callback until the user or the token ends it. - Depends on:
RepeatScanFilter, used by the continuous-scan default method (IBarcodeScannerService.cs:64); otherwise BCL only (Task,CancellationToken,Func<string, CancellationToken, Task<string?>>,TimeProvider). - Concept introduced, the affordance switch (as opposed to a degraded path). Most contracts in this
group have a plausible web story, so their browser adapter does a lesser version of the same thing.
Camera scanning has none: there is no browser primitive the framework wraps, so web heads keep the
inert default and the UI hides the scan affordance entirely rather than offering a control that
cannot work. The doc comment names this distinction explicitly, "the affordance switch, not a degraded
path" (
IBarcodeScannerService.cs:11-13), andIsSupportedis the switch components read.[Rubric §18, UI Architecture]assesses whether shared components can serve several hosts without branching on host type; a capability boolean plus a hidden affordance is that branch expressed as data instead of#ifor host sniffing.[Rubric §26, Front-End Security]assesses how untrusted client-side input is handled. The contract states the rule in the contract itself: "the scanned payload is untrusted input: validate it before acting on it" (IBarcodeScannerService.cs:14). A camera can decode any code that is pointed at it, so the decoded string is attacker-supplied by construction.[Rubric §29, Resilience & Business Continuity]assesses graceful degradation. The implementations "never throw": a denied camera permission, a cancelled scan, an unsupported head, and a cancelled token all collapse to onenullfrom the scan, or, for a continuous session, to a session that simply ends (IBarcodeScannerService.cs:6-8). The one stated exception is an exception thrown by the caller's ownonScannedcallback, which the session hands back after closing the camera surface: "it is the caller's failure, not the scanner's, and swallowing it would hide the bug" (IBarcodeScannerService.cs:8-11). The permission is requested before any camera surface opens (IBarcodeScannerService.cs:4-5), and that request is its own member returning a plainbool, so a caller that needs to explain why scanning did not start asks first instead of trying to read a reason out of the scan'snull.
- Walkthrough
IsSupported(IBarcodeScannerService.cs:19): whether camera scanning is available on this head. False on web heads and on any native head that did not opt in (see below).EnsureCameraAccessAsync(CancellationToken = default)(IBarcodeScannerService.cs:26): requests the camera permission, prompting if the user has not decided yet, and returnsfalsewhen denied or unavailable, "so the caller can explain why scanning did not start, which anullfromScanAsynccannot" (IBarcodeScannerService.cs:21-25). It is still a never-throw member: the answer is a boolean, not an exception.ScanAsync(CancellationToken = default)(IBarcodeScannerService.cs:32): opens the camera scanner and returns the first decoded payload, ornullwhen cancelled, denied, or unavailable (IBarcodeScannerService.cs:28-31). One call, one payload: the modal "scan one thing" operation.ScanContinuouslyAsync(Func<string, CancellationToken, Task<string?>> onScanned, CancellationToken = default)(IBarcodeScannerService.cs:57-59): scans code after code, handing each payload toonScannedand awaiting it before the next scan; a payload equal to the one just handed over, seen again within a few seconds, is not handed over again, so a code held in view is submitted once (IBarcodeScannerService.cs:34-40). The callback returns the outcome text to show the operator over the camera surface (for example "Checked in") ornullfor nothing (IBarcodeScannerService.cs:41-45). It is a default interface method: the body loopsScanAsyncuntil it returnsnull, skips repeats through aRepeatScanFilteroverTimeProvider.System, and awaitsonScannedfor each new payload (IBarcodeScannerService.cs:61-79). So an implementation without a continuous surface (the null default included) needs no change, but it also has nowhere to show the outcome text, so a caller that needs the outcome seen keeps rendering it itself (IBarcodeScannerService.cs:51-56). The default deliberately omitsConfigureAwait(false)soonScannedruns on the caller's context, where a Blazor component can update its state (IBarcodeScannerService.cs:63,:44-45). An exception fromonScannedends the session and is rethrown, except anOperationCanceledExceptiononce the token is cancelled, which is swallowed as the session ending (IBarcodeScannerService.cs:46-48,:81-84). Anullcallback throwsArgumentNullException(IBarcodeScannerService.cs:61).
- Why it's built this way: ADR-042 puts every device capability behind an interface, and
ADR-071 covers scanning and QR display. The registration for this one is doubly conservative. The framework default is the inert
NullBarcodeScannerService, registered withTryAddSingleton(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:80), and the comment above it records that even a MAUI head keeps that default "until it asks for the camera" (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:77-79). The native adapter arrives only through the opt-inUseCommonBarcodeScanner(...)builder extension (MMCA.Common.UI.Maui/HostingDependencyInjection.cs:114-125), which registers the ZXing.Net.MAUI handlers withUseBarcodeReader()and overrides the registration with a factory that buildsMauiBarcodeScannerService(MMCA.Common.UI.Maui/HostingDependencyInjection.cs:121-123). It is deliberately not folded intoUseMauiDeviceCapabilitiesso that "a head that never scans should ship neither the camera handler nor a camera permission declaration" (MMCA.Common.UI.Maui/HostingDependencyInjection.cs:96-97), a privacy and store-review consideration as much as a size one. The opt-in takes the scan page's cancel and camera-description text as twoFunc<string>delegates (MMCA.Common.UI.Maui/HostingDependencyInjection.cs:114-116), invoked once per scan when the page is built so the modal follows the user's in-app language choice rather than the device language that was active at startup (MMCA.Common.UI.Maui/HostingDependencyInjection.cs:99-104). The head still declares the platform permission itself (Android CAMERA, iOS NSCameraUsageDescription) and must call the opt-in afterAddUISharedso the plain Add beats the TryAdd default (MMCA.Common.UI.Maui/HostingDependencyInjection.cs:107-109). The continuous-scan member is a default method rather than an abstract one so "an implementation without a continuous surface needs no change" (IBarcodeScannerService.cs:54-55), while the MAUI adapter overrides it to keep one camera page open for the whole session and show the outcome text there (IBarcodeScannerService.cs:54-56;MMCA.Common.UI.Maui/Capabilities/Media/MauiBarcodeScannerService.cs:117-143). - Where it's used: implemented by
MauiBarcodeScannerService(which drivesBarcodeScanPageand overridesScanContinuouslyAsync) and the inertNullBarcodeScannerService; consumed by ADC's QR check-in scan page (CheckInScan), which readsIsSupportedto show the camera affordance (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/CheckIns/CheckInScan.razor.cs:46), callsEnsureCameraAccessAsyncbefore starting a session (CheckInScan.razor.cs:215), and then runs oneScanContinuouslyAsyncsession with its own callback (CheckInScan.razor.cs:221). The default method is pinned byContinuousScanDefaultTests(MMCA.Common/Tests/Presentation/MMCA.Common.UI.Tests/Services/Capabilities/Media/ContinuousScanDefaultTests.cs:17-78: loop untilnull, a repeat handed over once, a callback exception reaching the caller, cancellation during the callback ending quietly, and anullcallback throwing).
IMediaPickerService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Media·MMCA.Common.UI/Services/Capabilities/Media/IMediaPickerService.cs:9· Level 1 · interface
- What it is: picks or captures a photo on native heads (avatar upload), returning PickedMedia or
null(IMediaPickerService.cs:3-8). Implementations own the photo-library and camera permission flow and never throw. - Depends on: PickedMedia, its result type;
System.Threading.CancellationToken. - Concept introduced: the clearest statement of the layer's affordance switch, not degraded path idea. Web heads keep the null default and render a plain
InputFileinstead, and the doc comment names this "the affordance switch, not a degraded path" (IMediaPickerService.cs:6-7): the browser does not attempt a broken native picker, it presents a different control that works.[Rubric §18, UI Architecture]§18 assesses host-agnostic componentization. A shared avatar component branches onIsSupportedbetween the native picker andInputFile, keeping one component tree across heads.
- Walkthrough: three members.
IsSupported(IMediaPickerService.cs:12): whether native photo picking is available on this head.PickPhotoAsync(CancellationToken)(:15): opens the photo picker; returnsnullwhen cancelled or unavailable.CapturePhotoAsync(CancellationToken)(:18): opens the camera; returnsnullwhen cancelled, denied, or unavailable.
- Why it's built this way: media picking is native-only, so it hides behind a platform-free contract with an inert default and a MAUI override (ADR-045 for media picking, ADR-042 for the layer).
- Where it's used: registered with the NullMediaPickerService default (
MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:75), overridden by MauiMediaPickerService; consumed by the shared avatar-upload UI, which disposes the returned PickedMedia stream after upload.
NullSpeechToTextService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Media·MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/Media/NullSpeechToTextService.cs:6· Level 1 · class (sealed)
- What it is: the default
ISpeechToTextService: no recognizer, so components hide the microphone (NullSpeechToTextService.cs:5). - Depends on:
ISpeechToTextService; externalsSystem.Globalization.CultureInfo(NullSpeechToTextService.cs:1) and BCLIProgress<T>. - Concept: the fallback for a streaming contract.
ListenAsynctakes anIProgress<string>?for interim transcripts alongside the final text it returns. The null implementation simply never invokes the progress reporter and returnsnull, so a caller bound to partial results receives nothing at all rather than an empty-string flicker, and the finalnullreads as "nothing was recognized".[Rubric §21, Accessibility]assesses alternative input paths. Voice entry is an accessibility affordance, and this default is where it is absent, which is whyIsSupportedexists to hide the microphone rather than leaving a dead button on the form.
- Walkthrough
IsSupported(NullSpeechToTextService.cs:9): constantfalse.ListenAsync(CultureInfo culture, IProgress<string>? partialResults, CancellationToken)(NullSpeechToTextService.cs:12-16): returnsTask.FromResult<string?>(null), ignoring the requested recognition culture and never calling back intopartialResults.
- Why it's built this way: ADR-042. Speech recognition is a platform service with a microphone permission attached, so an unavailable recognizer must be an ordinary, prompt-free
nullrather than an exception a form has to handle. - Where it's used:
TryAddSingletoninAddDeviceCapabilityDefaults()(DependencyInjection.cs:55);MauiSpeechToTextServiceis the native override (MMCA.Common/Source/Presentation/MMCA.Common.UI.Maui/DependencyInjection.cs:87). ADC registers it explicitly in a bUnit test so the live-channel page renders without a recognizer (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.UI.Tests/Pages/LiveChannelJoinTests.cs:62-63), andCapabilityFallbackTestspins thenullresult (CapabilityFallbackTests.cs:154-155).
NullTextToSpeechService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Media·MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/Media/NullTextToSpeechService.cs:4· Level 1 · class (sealed)
- What it is: the default
ITextToSpeechService: no synthesizer, so components hide the affordance (NullTextToSpeechService.cs:3). - Depends on:
ITextToSpeechService; BCLTask. - Concept: the read-aloud counterpart to
NullSpeechToTextService, and the one place in this unit where a stop operation has to stay safe.StopAsynccompletes normally even though nothing was ever speaking, because the caller's teardown path (a component disposing while audio might be playing) must not need to know whether playback ever started.[Rubric §21, Accessibility]assesses alternative output paths. Read-aloud is distinct from the screen-reader channel behindIAccessibilityAnnouncer: this one is user-invoked content playback, and it is simply absent on hosts that keep this default.
- Walkthrough
IsSupported(NullTextToSpeechService.cs:7): constantfalse.SpeakAsync(string text, CancellationToken)(NullTextToSpeechService.cs:10):Task.CompletedTask, discarding the text.StopAsync()(NullTextToSpeechService.cs:13):Task.CompletedTask. It takes no cancellation token, matching the contract: stopping is itself the cancellation.
- Why it's built this way: ADR-042. Synthesis is a platform service with no framework-wired browser equivalent, and the affordance is an enhancement, so the inert default costs the feature nothing but the button.
- Where it's used:
TryAddSingletoninAddDeviceCapabilityDefaults()(DependencyInjection.cs:49);MauiTextToSpeechServiceis the native override (MMCA.Common/Source/Presentation/MMCA.Common.UI.Maui/DependencyInjection.cs:72).CapabilityFallbackTestsassertsIsSupportedis false and that both calls are non-throwing (CapabilityFallbackTests.cs:157,:153-154).
NullBarcodeScannerService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Media·MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/Media/NullBarcodeScannerService.cs:9· Level 1 · class (sealed)
- What it is: the no-op camera scanner for
IBarcodeScannerService. Browsers have no shared camera-scanning primitive the framework can rely on, so web heads keep this default and simply hide the scan button, and the native override ships inMMCA.Common.UI.Mauias an opt-in (NullBarcodeScannerService.cs:3-8). - Depends on:
IBarcodeScannerService; BCLTask. - Concept introduced, the default that survives even on the capable host. Most fallbacks in this unit are replaced automatically on the head that can do the job. This one is not:
UseMauiDeviceCapabilities()deliberately leaves it alone (noIBarcodeScannerServiceregistration appears inMMCA.Common/Source/Presentation/MMCA.Common.UI.Maui/DependencyInjection.cs:52-118), and a MAUI head keeps this null scanner until it separately callsUseCommonBarcodeScanner()(MMCA.Common/Source/Presentation/MMCA.Common.UI.Maui/HostingDependencyInjection.cs:114-123), because pulling in the camera adapter also means shipping a camera permission declaration (HostingDependencyInjection.cs:96-97). "Unsupported" here therefore encodes two different situations behind one flag: the platform cannot scan, or the app chose not to.[Rubric §22, Responsive / Cross-Browser]assesses graceful degradation across heads. TheIsSupportedflag is what lets one shared page render a scan button on a phone and omit it in a browser without host detection.[Rubric §11, Security]assesses least-privilege posture. Keeping the camera adapter opt-in means an app that never scans requests no camera permission at all.
- Walkthrough
IsSupported(NullBarcodeScannerService.cs:12): constantfalse; components hide the affordance.EnsureCameraAccessAsync(CancellationToken)(NullBarcodeScannerService.cs:15-16): returnsTask.FromResult(false)without prompting, so a caller that asks for access before scanning gets the same "no camera" answer as one that checkedIsSupported.ScanAsync(CancellationToken)(NullBarcodeScannerService.cs:19-20): returnsTask.FromResult<string?>(null), ignoring the token. That is deliberate and pinned by a test: even a pre-cancelled token must come back as a plainnullrather than anOperationCanceledException, because the contract is that the scan affordance is simply absent, not that a scan was interrupted (CapabilityFallbackTests.cs:139-144).
- Why it's built this way: ADR-042. A cancelled-token exception would force every caller into a
try/catchfor a case that is not an error, so the null result carries both "no camera" and "no scan happened" uniformly. - Where it's used:
TryAddSingletoninAddDeviceCapabilityDefaults()(MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:80), under its own explanatory comment (DependencyInjection.cs:77-79); the opt-in native override isMauiBarcodeScannerService. Covered inCapabilityFallbackTests, which pins all three members:IsSupportedfalse,EnsureCameraAccessAsyncfalse, andScanAsyncnull even on a cancelled token (CapabilityFallbackTests.cs:130-145).
NullMediaPickerService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Media·MMCA.Common.UI/Services/Capabilities/Media/NullMediaPickerService.cs:7· Level 2 · class (sealed)
- What it is - the no-op default for
IMediaPickerService(avatar photo pick and capture). It reports the native picker unavailable and returnsnullfrom both operations, which for web heads means "render a plainInputFileinstead," not a degraded experience (NullMediaPickerService.cs:3-6). - Depends on - implements
IMediaPickerService; returnsPickedMedia?. Same null-object shape as the siblings above. - Concept introduced - the affordance switch, not a degraded path. Unlike geocoding, which simply vanishes when unsupported, media picking has a full web alternative: the browser's own file input. So
IsSupported == falsehere does not mean "you cannot upload a photo," it means "do not draw the native picker button; draw the standard file input instead." The contract itself says so in as many words (MMCA.Common.UI/Services/Capabilities/Media/IMediaPickerService.cs:6-7), and the null default's only job is to signal that switch. Same [Rubric §2 - Design Patterns] and [Rubric §1 - SOLID] framing asNullGeocodingService; additionally [Rubric §18 - UI Architecture], which assesses how cleanly presentation concerns are separated, is visible here because the choice between native picker and file input is driven by a resolved capability rather than by host-detection code inside the component. - Walkthrough -
sealed class(NullMediaPickerService.cs:7).IsSupported => false(NullMediaPickerService.cs:10).PickPhotoAsync(NullMediaPickerService.cs:13-14) andCapturePhotoAsync(NullMediaPickerService.cs:17-18) both returnTask.FromResult<PickedMedia?>(null). Returningnullrather than an emptyPickedMediamatters for ownership:PickedMediaisIDisposableand owns aStreamthe caller must dispose after upload (MMCA.Common.UI/Services/Capabilities/Media/IMediaPickerService.cs:21-22,29,41), so a fallback that handed back an instance would be handing back a disposal obligation for nothing. - Why it's built this way - ADR-045 (managed file storage and avatars), cited directly in the class summary (
NullMediaPickerService.cs:4). Web avatar upload rides on the browser file input, so the native picker abstraction exists only to give MAUI heads a camera and photo-library flow; making the default inert keeps the shared avatar surface host-agnostic. - Where it's used - registered by
AddDeviceCapabilityDefaults(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:75); overridden byMauiMediaPickerServiceon native heads (MMCA.Common.UI.Maui/DependencyInjection.cs:106). ADC's profile page is the worked consumer: it injects the contract (MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.UI/Pages/Users/Profile/Profile.razor.cs:25), routes its pick and capture actions through it (Profile.razor.cs:109,111), and gates the native buttons onMediaPicker.IsSupported, falling through to anInputFileelement when the default is resolved (MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.UI/Pages/Users/Profile/Profile.razor:23,47,60). Web and Server heads keep this default.
LocalNotificationRequest
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Notifications·MMCA.Common.UI/Services/Capabilities/Notifications/LocalNotificationRequest.cs:19· Level 0 · record
- What it is: the framework-owned value type describing one scheduled local (on-device) notification, the payload passed to ILocalNotificationService (
LocalNotificationRequest.cs:5-8). It plays the same role for notifications that GeoPoint, PickedMedia, and PushDeviceToken play for their capabilities: it keeps a platform type out of the shared contract. - Depends on: nothing first-party; positional parameters of
int,string, andSystem.DateTimeOffsetonly. - Concept introduced: the stable-id-as-idempotency-key convention for on-device scheduling. The
Idmust be stable per logical subject (a hash of a session id, for example) so that rescheduling replaces rather than duplicates the pending entry (LocalNotificationRequest.cs:6-7,:7). It is the local, offline analogue of the server-side idempotency key.[Rubric §9, API & Contract Design]§9 assesses well-shaped contracts. This is a small, documentedsealed recordwhose XML comments pin the meaning of every field: id stability, past-dated delivery being ignored, the optional deep-link route.
- Walkthrough: a single positional
sealed record(LocalNotificationRequest.cs:19-24) with five members.Id(:16, documented at:7): the stable platform notification id; scheduling the same id replaces the pending entry.Title/Body(:17-18, documented at:8-9): already localized by the caller, the record does no i18n itself.DeliverAt(:19, documented at:10): absolute delivery time; requests in the past are ignored.DeepLinkRoute(:20, documented at:11-14): an optional app-relative route (for example/conference/sessions/42) published to IDeepLinkDispatcher when the user taps the notification, which is how a reminder wires back into Blazor routing.
- Why it's built this way: a
recordgives value equality and immutability for free, and keeping it in the shared UI layer means the notification-scheduling contract never references a platform notification builder (ADR-042). - Where it's used: the parameter of
ILocalNotificationService.ScheduleAsync(MMCA.Common.UI/Services/Capabilities/Notifications/ILocalNotificationService.cs:22); MauiLocalNotificationService translates it into a native scheduled notification. - Caveats / not-in-source: the record documents that past-dated requests are ignored, but that enforcement lives in the platform implementation, not in this record. On MAUI it is an early return in
ScheduleAsyncfor anyDeliverAtat or before now (MMCA.Common.UI.Maui/Capabilities/Notifications/MauiLocalNotificationService.cs:52-55).
PushDeviceToken
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Notifications·MMCA.Common.UI/Services/Capabilities/Notifications/IPushDeviceTokenProvider.cs:19· Level 0 · record
- What it is: a platform push handle, the wire platform value plus the device token, returned by IPushDeviceTokenProvider (
IPushDeviceTokenProvider.cs:16-19). It is the framework-owned value type that keeps FCM and APNs specifics out of the shared registration pipeline. - Depends on: nothing first-party; two
stringpositional parameters. - Concept introduced: nothing new structurally, it is one more shared-UI value record like GeoPoint and LocalNotificationRequest. What is worth noting is the deliberately narrow wire vocabulary:
Platformis documented as one offcmv1orapns(IPushDeviceTokenProvider.cs:17), so the whole push path speaks two stable string values rather than a platform enum that would have to be versioned across the wire.[Rubric §9, API & Contract Design]§9 assesses contract clarity. The record pins the two-field push handle shape and documents the exact meaning of each field.
- Walkthrough: a two-field
sealed record(IPushDeviceTokenProvider.cs:19).Platform(documented at:17): the wire platform value,fcmv1orapns.Token(documented at:18): the FCM registration token or the APNs device token.
- Why it's built this way: modeling the handle as a shared record means the registration pipeline (IPushRegistrationService and the notification module) never references a Firebase or APNs type; the credentialed provider lives at the app edge (ADR-044).
- Where it's used: the return type of
IPushDeviceTokenProvider.GetTokenAsync(MMCA.Common.UI/Services/Capabilities/Notifications/IPushDeviceTokenProvider.cs:13); MauiPushRegistrationService forwards it to the backend.
IPushRegistrationService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Notifications·MMCA.Common.UI/Services/Capabilities/Notifications/IPushRegistrationService.cs:10· Level 0 · interface
- What it is: client-side orchestration of native push device registration: obtains the platform
token from
IPushDeviceTokenProviderand syncs it to the server's Devices endpoint. - Depends on:
IPushDeviceTokenProvider(named by the doc comment as the token source the implementations wrap,IPushRegistrationService.cs:4-5). - Concept, native push registration lifecycle.
[Rubric §6, CQRS & Event-Driven](the push channel is a delivery leg for notifications) and[Rubric §18, UI Architecture]. This is the client leg of native push delivery (ADR-044): hosts callRegisterAsyncafter sign-in and on resume, andUnregisterAsyncbefore sign-out clears the tokens, because the delete call is authenticated (IPushRegistrationService.cs:6-8). The default implementation is a no-op on web heads (IPushRegistrationService.cs:8). - Walkthrough
IsSupported(IPushRegistrationService.cs:13): whether this head can register for native push at all (native heads only).RegisterAsync(CancellationToken = default)(IPushRegistrationService.cs:20): registers or refreshes this device's installation; best-effort and safe to call repeatedly; returnsfalsewhen no platform token is available (unsupported head, missing credentials, permission denied) or the sync failed (IPushRegistrationService.cs:16-18).UnregisterAsync(CancellationToken = default)(IPushRegistrationService.cs:23): removes the installation, best-effort, called while still authenticated (IPushRegistrationService.cs:22).
- Why it's built this way: ordering
UnregisterAsyncbefore token clearing is load-bearing: the server delete call is authenticated, so it must run while the credentials still exist; the idempotent, safe-to-repeatRegisterAsynctolerates the resume-driven re-calls (ADR-044). - Where it's used: implemented by
MauiPushRegistrationService(overIPushDeviceTokenProvider) and the no-opNullPushRegistrationService. Both this contract and its token provider default to inert (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:67-68), and the comment above them records the split:MMCA.Common.UI.Mauioverrides the registration service while the app overrides the token provider once real FCM/APNs credentials exist, so until then even native heads stay registered-but-tokenless (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:64-66). Driven by the head apps' sign-in and sign-out lifecycle and syncing to the server's Devices endpoint (ADR-044).
AppSnapshotProtection
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.Auth·MMCA.Common.UI.Maui/Capabilities/Auth/AppSnapshotProtection.cs:18· Level 1 · class (internal, static)
- What it is: the MAUI head's app-switcher snapshot guard. While app lock is enabled (the
AppLockEnabledkey on DevicePreferenceKeys), Android marks the activity window secure (FLAG_SECURE: a blank recents thumbnail and no screenshots or screen recording of the app), iOS and Mac Catalyst cover the window with an opaque view when it resigns active and remove it when it becomes active again, and Windows does nothing because it has no switcher snapshot to protect. With app lock off nothing is changed (MMCA.Common.UI.Maui/Capabilities/Auth/AppSnapshotProtection.cs:5-10). - Depends on: IDevicePreferences and DevicePreferenceKeys for the stored opt-in; MAUI
Window,MainThreadandPlatform.CurrentActivity; per-platform SDKs behind compilation symbols (AndroidActivityandWindowManagerFlags.Secure; UIKitUIWindow,UIViewandUIColor). - Concept introduced: the app lock reaches the OS snapshot. The biometric gate (MauiBiometricAuthenticator) protects the live session, but the OS pictures the last screen when the app leaves the foreground and shows that picture in the app switcher without asking the app. This class closes that channel for the users who opted into a lock, with one process-wide flag and two window lifecycle hooks, partitioned by
#ifthe same way the authenticator is.[Rubric §11, Security]and[Rubric §26, Front-End Security]assess whether sensitive client-side content leaks through channels outside the app's own UI. The switcher snapshot is such a channel, and the guard follows the user's own app lock opt-in rather than a build-time switch.
- Walkthrough
- State (
AppSnapshotProtection.cs:25-28): avolatile bool _enabledbehind the read-onlyIsEnabled, the value as last read or written. On iOS and Mac Catalyst aCoverTagconstant (:22) identifies the cover view among the window's subviews. InitializeAsync(IDevicePreferences)(AppSnapshotProtection.cs:32): readsAppLockEnabledonce with afalsedefault and passes it toSetEnabled(:36). Any exception is swallowed and the state left as it was (:38-43), the same reading the biometric gate applies: an unreadable preference means nothing says app lock is on.SetEnabled(bool)(AppSnapshotProtection.cs:48): stores the flag (:50) and, on Android only, re-applies the secure flag to the current activity on the main thread (:51-53).- Android
OnActivatedandOnDeactivated(AppSnapshotProtection.cs:59-65): both re-apply the flag to the window's activity, falling back toPlatform.CurrentActivity.ApplySecureFlag(:108-124) addsWindowManagerFlags.Securewhen enabled and clears it otherwise (:116-123), so turning the lock off also lifts the screenshot restriction. - iOS and Mac Catalyst (
AppSnapshotProtection.cs:66-96):OnActivatedremoves the cover (:69-75).OnDeactivatedreturns early when the lock is off or the platform view is not aUIWindow(:81-84), removes any stale cover (:86), then adds a full-bounds, opaqueUIViewtaggedCoverTag, paintedSystemBackgroundand auto-resizing with the window (:88-94).RemoveCover(:126-133) loops onViewWithTagso every cover is detached and disposed. - Every other head, Windows included (
AppSnapshotProtection.cs:97-104): both hooks only null-guard the window.
- State (
- Why it's built this way: the OS takes its snapshot right after the window resigns active, so the cover and the flag must already hold at
Deactivated(AppSnapshotProtection.cs:62,:77). Re-applying the Android flag on both transitions and on every preference write keeps the window in step with the stored setting without a restart. Keeping the state in one static class lets the preference store and the window hookup share a single value without either depending on the other. - Where it's used:
AttachMmcaAppLifecycleon WindowLifecycleExtensions startsInitializeAsyncwithout awaiting it when an IDevicePreferences is registered, then wiresWindow.ActivatedandWindow.Deactivatedto the two hooks (MMCA.Common.UI.Maui/WindowLifecycleExtensions.cs:42-50). MauiDevicePreferences callsSetEnabledwhenever theAppLockEnabledkey is written (MMCA.Common.UI.Maui/Capabilities/DeviceStorage/MauiDevicePreferences.cs:45-49) or removed (:60-63), so turning app lock on takes effect before the next trip to the background (AppSnapshotProtection.cs:11-15). - Caveats / not-in-source: the class is
internal, so a head reaches it only throughAttachMmcaAppLifecycleand the preference store, never directly. How each OS version times its snapshot, and which capture paths honorFLAG_SECURE, are platform behavior and not determinable from source.
ILocalNotificationService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Notifications·MMCA.Common.UI/Services/Capabilities/Notifications/ILocalNotificationService.cs:10· Level 1 · interface
- What it is: schedules on-device notifications (session reminders) with no backend involvement (
ILocalNotificationService.cs:3-9). It consumes LocalNotificationRequest and is a native-only capability. - Depends on: LocalNotificationRequest, its schedule payload;
System.Threading.CancellationTokenandIReadOnlyCollection<int>otherwise. - Concept introduced: the own-the-permission-flow, never-throw-on-denial discipline, made explicit here. Implementations own the platform permission flow (Android 13+
POST_NOTIFICATIONS, iOS notification authorization) and never throw on denial: scheduling simply becomes a no-op until permission is granted (ILocalNotificationService.cs:6-9,:21). This is distinct from the pureIsSupportedgate, because a supported platform can still be un-permissioned, and the contract makes that state safe.[Rubric §26, Front-End Security]§26 assesses permission-gated features. Notification permission is requested explicitly and its absence degrades to a silent no-op.[Rubric §24, Forms / Validation / UX Safety]§24 assesses safe state transitions. Rescheduling by stable id (replace, not duplicate) prevents notification spam from repeated schedules.
- Walkthrough: five members.
IsSupported(ILocalNotificationService.cs:13): whether this platform can schedule local notifications.RequestPermissionAsync(CancellationToken)(:19): ensures permission, prompting if the platform requires consent and it is undecided, and returns whether notifications are currently permitted.ScheduleAsync(LocalNotificationRequest, CancellationToken)(:22): schedules, or replaces by id, a pending notification; a no-op without permission.CancelAsync(IReadOnlyCollection<int>, CancellationToken)(:25): cancels pending notifications by id; unknown ids are ignored.CancelAllAsync(CancellationToken)(:28): cancels every pending notification scheduled by this app.
- Why it's built this way: on-device reminders need no server, so they are a pure native capability behind a platform-free interface with an inert default for web and server heads (ADR-042).
- Where it's used: registered with the NullLocalNotificationService default (
MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:51); MauiLocalNotificationService implements real scheduling. The route from a tapped notification flows into IDeepLinkDispatcher via the request'sDeepLinkRoute, published by the package bootstrap rather than by the service itself (MMCA.Common.UI.Maui/Capabilities/Notifications/MauiLocalNotificationService.cs:13).
IPushDeviceTokenProvider
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Notifications·MMCA.Common.UI/Services/Capabilities/Notifications/IPushDeviceTokenProvider.cs:15· Level 1 · interface
- What it is: supplies the platform push handle for this device, returning PushDeviceToken or
null, and asks for the notification permission that handle needs (IPushDeviceTokenProvider.cs:3-14). Apps plug in their credentialed implementation: a Firebase messaging token on Android, an APNs device token on iOS. - Depends on: PushDeviceToken, its return shape;
System.Threading.CancellationToken. - Concept introduced: the inert-until-credentialed default. The out-of-box default returns
null, which keeps the whole registration pipeline inert until real push credentials exist (IPushDeviceTokenProvider.cs:5-7). Even a native MAUI head stays registered-but-tokenless until the app supplies a credentialed provider, which is stated again at the registration site (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:64-66), so no half-wired push path ships by accident.[Rubric §26, Front-End Security]§26 assesses credential handling. Push credentials are an app-owned edge concern; the framework contract carries no keys and stays inert without them.
- Walkthrough: two members, split so the registration lock never waits on a person (
IPushDeviceTokenProvider.cs:9-12). Implementations never throw (:7).RequestPermissionAsync(CancellationToken)(IPushDeviceTokenProvider.cs:22): shows the platform's notification-permission prompt when the provider is enabled and needs it. It is interactive, so it is deliberately not time-bounded, and a denial does not block registration (:17-21). The registration service calls it outside its lock.GetTokenAsync(CancellationToken)(IPushDeviceTokenProvider.cs:28): the current platform token, ornullwhen unavailable. It is non-interactive and bounded: an implementation that waits on the platform gives up after its own timeout (:24-27).
- Why it's built this way: separating the token provider (app-owned, credentialed) from the registration service (framework-owned) means the framework ships a complete push pipeline that stays dormant until an app drops in real FCM or APNs credentials (ADR-044).
- Where it's used: registered with the NullPushDeviceTokenProvider default (
MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:68); theMMCA.Common.UI.Mauipackage ships FCM and APNs providers an app can opt into, and IPushRegistrationService forwards the token to the backend.
MauiAccessibilityAnnouncer
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.Accessibility·MMCA.Common.UI.Maui/Capabilities/Accessibility/MauiAccessibilityAnnouncer.cs:9· Level 1 · class (sealed)
- What it is: the MAUI-native adapter for IAccessibilityAnnouncer, pushing a spoken announcement to the platform screen reader (TalkBack, VoiceOver, Narrator) through
SemanticScreenReader.Default(MMCA.Common.UI.Maui/Capabilities/Accessibility/MauiAccessibilityAnnouncer.cs:5-8). - Depends on: IAccessibilityAnnouncer (the contract it implements); MAUI Essentials
SemanticScreenReader; BCLTaskandOperationCanceledException. - Concept introduced: this is the first of the fifteen MAUI adapters in this unit, so the shared shape is worth stating once. Each class implements exactly one narrow capability interface (defined in
MMCA.Common.UI.Services.Capabilities, so shared components can depend on it from any head), wraps exactly one platform API, and is selected at DI composition time for the native head only. The adapter never branches on "which host am I": the container already answered that question.[Rubric §21, Accessibility]§21 assesses whether non-visual users receive the same information sighted users get. This adapter routes announcements through the OS assistive layer rather than a visual-only toast, and is a deliberate silent no-op when no screen-reader integration exists.[Rubric §2, Design Patterns]§2 assesses deliberate pattern use. Adapter plus Null Object is the pairing repeated across this entire capability family: a real platform adapter on the native head, an inert sibling everywhere else.
- Walkthrough: one member.
AnnounceAsync(string message, CancellationToken cancellationToken = default)(MauiAccessibilityAnnouncer.cs:12) calls the synchronousSemanticScreenReader.Default.Announce(message)(:16), catches every exception exceptOperationCanceledExceptionand drops the announcement, whether the platform has no screen-reader integration or faults some other way (:18-22), and returnsTask.CompletedTask(:24). The platform API is fire-and-forget and synchronous, so the async signature is satisfied with an already-completed task rather than an offloaded call. - Why it's built this way: swallowing every platform failure keeps call sites unconditional, so no component ever has to ask whether a screen reader is present before describing a change. Returning a completed task avoids a needless thread hop for what is a synchronous OS call.
- Where it's used: registered as a singleton
IAccessibilityAnnouncerbyAddMauiDeviceCapabilities()(MMCA.Common.UI.Maui/DependencyInjection.cs:58), which the head reaches throughUseMauiDeviceCapabilities()(MMCA.Common.UI.Maui/HostingDependencyInjection.cs:30-43). Its siblings on the other heads are BrowserAccessibilityAnnouncer and the TryAdd default NullAccessibilityAnnouncer (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:50); consumers are live-update components announcing changes a sighted user perceives only visually.
MauiBatteryStatusService
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.DeviceStatus·MMCA.Common.UI.Maui/Capabilities/DeviceStatus/MauiBatteryStatusService.cs:9· Level 1 · class (sealed partial,IDisposable)
- What it is: the MAUI adapter for IBatteryStatusService, reporting the OS energy-saver state and re-raising the platform's change event over
Battery.Default(MMCA.Common.UI.Maui/Capabilities/DeviceStatus/MauiBatteryStatusService.cs:5-7). - Depends on: IBatteryStatusService; MAUI Essentials
Battery,EnergySaverStatusandEnergySaverStatusChangedEventArgs; BCLIDisposableandEventHandler. - Concept introduced: the property-plus-change-event capability shape meets a subscription-lifetime concern. This is a singleton that hooks a static platform event in its constructor, so it must unhook in
Disposeor it pins itself for the life of the process.[Rubric §12, Performance & Scalability]and[Rubric §23, Front-End Performance]both assess whether the client adapts its workload to device constraints. Exposing the energy-saver flag lets live features throttle polling or decline to auto-join real-time channels when the OS says the device is conserving power.
- Walkthrough
- The constructor (
MauiBatteryStatusService.cs:12-13) subscribesOnEnergySaverStatusChangedtoBattery.Default.EnergySaverStatusChanged, so the instance observes transitions for its whole lifetime. EnergySaverChanged(MauiBatteryStatusService.cs:16): the contract's argument-free event, re-raised from the platform handler.IsEnergySaverOn(MauiBatteryStatusService.cs:19): readsBattery.Default.EnergySaverStatus == EnergySaverStatus.Onon every access, so subscribers re-read the live value instead of trusting stale event args.Dispose()(MauiBatteryStatusService.cs:22): unsubscribes from the platform event.OnEnergySaverStatusChanged(...)(MauiBatteryStatusService.cs:24-25): forwards the platform notification asEnergySaverChangedwithEventArgs.Empty.
- The constructor (
- Why it's built this way: subscribe-in-constructor and unsubscribe-in-
Disposeis the correct lifetime for a DI singleton holding a handler on a process-lifetime static. Re-reading the property rather than caching the args keeps one source of truth for the current state, which matters because a subscriber may handle the event after another transition has already occurred. - Where it's used: registered as a singleton by
AddMauiDeviceCapabilities()(MMCA.Common.UI.Maui/DependencyInjection.cs:64); its fallback sibling is NullBatteryStatusService (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:54). Consumed by live and real-time components deciding whether to auto-join channels.
MauiBiometricAuthenticator
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.Auth·MMCA.Common.UI.Maui/Capabilities/Auth/MauiBiometricAuthenticator.cs:13· Level 1 · class (sealed)
- What it is: the platform-direct adapter for IBiometricAuthenticator (ADR-042 Wave 4), driving the AndroidX
BiometricPrompton Android (a STRONG-class biometric or the device credential),LAContexton iOS and Mac Catalyst, and reporting unavailable on Windows (MMCA.Common.UI.Maui/Capabilities/Auth/MauiBiometricAuthenticator.cs:5-12). - Depends on: IBiometricAuthenticator; per-platform SDKs behind compilation symbols (AndroidX
BiometricManager,BiometricPromptandFragmentActivity;LocalAuthentication.LAContext); BCLTaskCompletionSource<T>and MAUIMainThread. - Concept introduced: fail-closed boolean auth gating implemented with
#ifpartitioning. Unlike every other adapter here, this class is not one implementation over a cross-platform Essentials API: the body is split three ways so each head compiles only its own SDK. The contract stays two methods regardless.[Rubric §11, Security]and[Rubric §26, Front-End Security]assess whether client-side auth degrades safely. Every negative outcome (cancel, lockout, error, a platform fault, an unsupported head) collapses tofalse, so callers fall back to credential login and never to a weaker path; the adapter never throws (MauiBiometricAuthenticator.cs:40-44,:61-66,:122-126,:145-149).[Rubric §22, Responsive/Cross-Browser]in its device-platform sense: the compile-time partition is what keeps a Windows build from referencing AndroidX types at all.
- Walkthrough
- Android (
MauiBiometricAuthenticator.cs:15-111):StrongBiometricis theBiometricStrong(Class 3) authenticator andStrongBiometricOrDeviceCredentialaddsDeviceCredentialto it (:16-19).AllowedAuthenticators(:26-29) returns the combination everywhere except Android 9 and 10 (API 28 and 29), which cannot combine the strong class with the device credential in one prompt and so get the strong class alone (:21-25). A Class 2 sensor (most camera face unlock) never unlocks, while a device PIN or pattern satisfies the prompt on the other versions.IsAvailableAsync(:32) mapsBiometricManager.CanAuthenticateagainst those authenticators toBiometricSuccess(:36-38) and fails closed, answeringfalseon any platform fault other than cancellation (:40-44).AuthenticateAsync(:48) requires the current activity to be aFragmentActivityand returnsfalseotherwise (:50-53), builds aTaskCompletionSource<bool>withRunContinuationsAsynchronously(:55), and awaits the privateShowPromptAsync(:59,:72-99), returningfalsewhen the prompt could not be shown, so a platform fault is a declined unlock rather than an unhandled error on the lock screen (:61-66).ShowPromptAsyncruns on the main thread (:76), resolves the main executor, resolvingfalseif it is null (:78-83), then builds aBiometricPrompttitled withreasonand restricted to the same authenticators (:85-89). When only the strong class is allowed, the builder gets the platform "Cancel" string as its negative button, because without the device credential the prompt needs its own way out (the builder throws otherwise) and dismissing it is a declined unlock (:90-95); the prompt is then shown (:97-98). Cancellation is registered to resolvefalse(:68) before awaiting the completion (:69). The nestedAuthenticationCallback(:101-111) setstrueon success (:104-105) andfalseon error (:107-108), and deliberately does not complete onOnAuthenticationFailed, because a single bad attempt leaves the prompt up (:110). - iOS and Mac Catalyst (
MauiBiometricAuthenticator.cs:112-150): both methods create ausingLAContextand work againstLAPolicy.DeviceOwnerAuthentication(Face ID or Touch ID with passcode fallback).IsAvailableAsyncreturnsCanEvaluatePolicy(:114-121);AuthenticateAsync(:130) re-checks it, returnsfalsewhen it fails (:135-138), and otherwise returns thesuccesshalf of the policy evaluation tuple (:140-143). Both fail closed: any platform fault other than cancellation answersfalse(:122-126,:145-149). - Every other head, Windows included (
MauiBiometricAuthenticator.cs:151-158): both methods returnTask.FromResult(false), because the unpackaged WinUI head cannot presentUserConsentVerifier(:9-10).
- Android (
- Why it's built this way: folding every non-success into
falseforbids a partial-success path at the call site. Accepting only the Class 3 biometric class keeps a weaker Class 2 sensor from opening the app lock, and allowing the device credential beside it means a user with no strong biometric enrolled can still pass the lock instead of being locked out of the feature (except on Android 9 and 10, where the platform cannot offer both in one prompt). Not completing on a single failed attempt matches the platform prompt's own retry loop, which stays on screen until the user succeeds, cancels, or is locked out. - Where it's used: registered as a singleton by
AddMauiDeviceCapabilities()(MMCA.Common.UI.Maui/DependencyInjection.cs:86); the inert fallback is NullBiometricAuthenticator (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:55). Consumed by the stored-token auto-login app-lock gate, whose opt-in is persisted under a key from DevicePreferenceKeys; the same opt-in drives AppSnapshotProtection. - Caveats / not-in-source: the token store and the auto-login flow live in the head apps and the Identity layer. This class only answers "is the enrolled device owner present right now".
MauiConnectivityStatusService
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.DeviceStatus·MMCA.Common.UI.Maui/Capabilities/DeviceStatus/MauiConnectivityStatusService.cs:11· Level 1 · class (sealed partial,IDisposable)
- What it is: the MAUI adapter for IConnectivityStatusService, reporting network access and re-raising the change event over
Connectivity.Current(MMCA.Common.UI.Maui/Capabilities/DeviceStatus/MauiConnectivityStatusService.cs:5-10). - Depends on: IConnectivityStatusService; MAUI Essentials
Connectivity,NetworkAccessandConnectivityChangedEventArgs; BCLIDisposableandValueTask. - Concept introduced: offline-awareness at the UI edge, with the same singleton subscription lifetime MauiBatteryStatusService established.
[Rubric §29, Resilience & Business Continuity]§29 assesses graceful degradation when a dependency is unreachable. The offline banner and the request-skipping guards both read from this one flag, so degradation is decided in one place rather than per call site.
- Walkthrough
- The constructor (
MauiConnectivityStatusService.cs:14-15) subscribesOnPlatformConnectivityChangedtoConnectivity.Current.ConnectivityChanged. ConnectivityChanged(MauiConnectivityStatusService.cs:18): the contract event.IsOnline(MauiConnectivityStatusService.cs:21):Connectivity.Current.NetworkAccess == NetworkAccess.Internet. This is the load-bearing detail: captive-portal ("constrained") access counts as offline, because the API gateway is unreachable there, which is exactly what the offline banner should say (:6-9).InitializeAsync(CancellationToken = default)(MauiConnectivityStatusService.cs:24): returnsValueTask.CompletedTask. The native adapter subscribes in its constructor and needs no post-render listener setup, unlike the browser adapter that the contract's initialize method exists for.Dispose()(MauiConnectivityStatusService.cs:27): unsubscribes.OnPlatformConnectivityChanged(:29-30) forwards the event.
- The constructor (
- Why it's built this way: mapping only full
Internetaccess to online (rather than "some network exists") makes the banner honest about gateway reachability. The no-opInitializeAsynckeeps the always-ready native adapter allocation-free while still satisfying a contract shaped by the browser's needs. - Where it's used: registered as a singleton by
AddMauiDeviceCapabilities()(MMCA.Common.UI.Maui/DependencyInjection.cs:63); siblings are BrowserConnectivityStatusService and the shared default AlwaysOnlineConnectivityStatusService (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:42). Consumed by the offline banner and request-skipping guards.
MauiHapticFeedbackService
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.DeviceStatus·MMCA.Common.UI.Maui/Capabilities/DeviceStatus/MauiHapticFeedbackService.cs:11· Level 1 · class (sealed)
- What it is: the MAUI adapter for IHapticFeedbackService, firing tactile feedback over
HapticFeedback.DefaultandVibration.Default(MMCA.Common.UI.Maui/Capabilities/DeviceStatus/MauiHapticFeedbackService.cs:5-10). - Depends on: IHapticFeedbackService; MAUI Essentials
HapticFeedback,HapticFeedbackTypeandVibration; BCLTimeSpanandOperatingSystem. - Concept introduced: decoration, not behavior. This is the one capability whose methods are synchronous and
void: nobody awaits a buzz, and nothing downstream depends on whether it happened.[Rubric §18, UI Architecture]§18 assesses whether presentation concerns stay off the correctness path. Every failure here is swallowed precisely so that a missing motor or a blocked permission can never change what the app does.
- Walkthrough
IsSupported(MauiHapticFeedbackService.cs:14):!OperatingSystem.IsWindows(), since Windows has no haptics.Click()andLongPress()(MauiHapticFeedbackService.cs:17,:20): route to the privatePerformwith the matchingHapticFeedbackType.Vibrate(TimeSpan duration)(MauiHapticFeedbackService.cs:23): callsVibration.Default.Vibrate(duration)(:27), catching every exception exceptOperationCanceledException: no vibration motor,VIBRATEmissing from the host manifest, or any other platform fault (:29-33).Perform(HapticFeedbackType type)(MauiHapticFeedbackService.cs:36): callsHapticFeedback.Default.Perform(type)(:40), catching the same way (:42-46).
- Why it's built this way: synchronous
voidmethods match the fire-and-forget nature of a UI micro-cue, and swallowing every platform failure means a head that forgot a manifest entry, or a device that faults in a way nobody listed, gets a silently plainer experience rather than an exception on a button click (MauiHapticFeedbackService.cs:7-8). - Where it's used: registered as a singleton by
AddMauiDeviceCapabilities()(MMCA.Common.UI.Maui/DependencyInjection.cs:67); the no-op fallback is NullHapticFeedbackService (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:45). Consumed by interactive components such as bookmark toggles and poll votes.
NullPushRegistrationService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Notifications·MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/Notifications/NullPushRegistrationService.cs:7· Level 1 · class (sealed)
- What it is: the no-op push registration for
IPushRegistrationService. Its summary explains why that is sufficient rather than a gap: web heads receive real-time notifications over the SignalR hub while the page is open and have no OS-level installation to manage (NullPushRegistrationService.cs:3-6). - Depends on:
IPushRegistrationService; BCLTask. - Concept: the two-half capability. Native push needs both a registration service and a token provider, and the framework defaults both to inert but replaces them at different times:
MMCA.Common.UI.Mauioverrides this registration service (MMCA.Common/Source/Presentation/MMCA.Common.UI.Maui/DependencyInjection.cs:96), while the token provider staysNullPushDeviceTokenProvideruntil the app opts in with real FCM or APNs credentials through a separate call (MMCA.Common/Source/Presentation/MMCA.Common.UI.Maui/DependencyInjection.cs:158-164), so even a native head is registered-but-tokenless out of the box (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:64-68). Reading those two defaults together is what makes the push pipeline's staged activation legible.[Rubric §22, Responsive / Cross-Browser]assesses per-head behavior. Web heads are not degraded here, they use a different delivery channel entirely (the SignalR hub), soIsSupportedfalse means "no OS registration to do", not "no notifications".
- Walkthrough
IsSupported(NullPushRegistrationService.cs:10): constantfalse; the notification-settings UI hides the native-push toggle.RegisterAsync(CancellationToken)(NullPushRegistrationService.cs:13):Task.FromResult(false), reporting that no registration was established.UnregisterAsync(CancellationToken)(NullPushRegistrationService.cs:16):Task.CompletedTask. Unregistering something that was never registered is a success, not a failure, which is why the two members differ in return shape.
- Why it's built this way: ADR-044, cited in the class summary (
NullPushRegistrationService.cs:4). Native push delivery is an additional channel layered on the existing hub, so the absence of a device registration must never be treated as the absence of notifications. - Where it's used:
TryAddSingletoninAddDeviceCapabilityDefaults()(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:67), directly beside its token-provider counterpart (:68);MauiPushRegistrationServiceis the native override. - Caveats / not-in-source: unlike its siblings this class has no case in
CapabilityFallbackTests; its behavior is covered only through the DI defaults and the native override's own tests.
NullLocalNotificationService
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Notifications·MMCA.Common.UI/Services/Capabilities/Notifications/NullLocalNotificationService.cs:4· Level 2 · class (sealed)
- What it is - the inert default for
ILocalNotificationService: on-device notification scheduling is unavailable. It denies permission and swallows every schedule and cancel call, and hosts readIsSupportedto hide reminder settings entirely (NullLocalNotificationService.cs:3). - Depends on - implements
ILocalNotificationService; acceptsLocalNotificationRequestandIReadOnlyCollection<int>ids. Null-object shape shared with the geo siblings above. - Concept introduced - none new, but note the two-signal contract this default has to satisfy cleanly. Scheduling notifications is native-only (there is no browser equivalent the framework wires), so the default has to make both the capability probe and the actions safe:
IsSupported == falsesteers the UI, and the action methods are no-ops so a caller that skips the probe still cannot crash. Same [Rubric §2 - Design Patterns] and [Rubric §22 - Responsive / Cross-Browser] framing asNullGeocodingService. - Walkthrough -
sealed class(NullLocalNotificationService.cs:4).IsSupported => false(NullLocalNotificationService.cs:7).RequestPermissionAsyncreturnsTask.FromResult(false)(NullLocalNotificationService.cs:10-11), reporting permission as not granted so a caller never proceeds to schedule.ScheduleAsync(NullLocalNotificationService.cs:14-15),CancelAsync(NullLocalNotificationService.cs:18-19), andCancelAllAsync(NullLocalNotificationService.cs:22) each returnTask.CompletedTask, doing nothing with their arguments;CancelAsyncin particular is already contractually allowed to ignore unknown ids (MMCA.Common.UI/Services/Capabilities/Notifications/ILocalNotificationService.cs:24-25), so ignoring all of them is a consistent extreme of the same rule. - Why it's built this way - ADR-042. The real contract already specifies that scheduling without permission is a no-op and that implementations never throw on denial (
MMCA.Common.UI/Services/Capabilities/Notifications/ILocalNotificationService.cs:6-8,21), so the null default is that rule taken to its limit: permission is never granted, therefore nothing is ever scheduled. Reminder features degrade to nothing on web without a single conditional in the feature code. - Where it's used - registered by
AddDeviceCapabilityDefaults(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:51); overridden byMauiLocalNotificationServiceon native heads (MMCA.Common.UI.Maui/DependencyInjection.cs:59). ADC'sSessionReminderCoordinatoris the shaped consumer: it takes the contract by constructor injection, re-exposesIsSupportedfor the UI to bind against, and short-circuits its schedule and cancel entry points when the capability reports unsupported (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/HappeningNow/SessionReminderCoordinator.cs:31,57,77,112). Web and Server heads keep this default.
NullPushDeviceTokenProvider
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Notifications·MMCA.Common.UI/Services/Capabilities/Notifications/NullPushDeviceTokenProvider.cs:9· Level 2 · class (sealed)
- What it is - a push token provider that never produces a token:
IPushDeviceTokenProviderimplemented to always returnnull. It is the default everywhere, native heads included, until a head opts in to a credentialed provider (NullPushDeviceTokenProvider.cs:3-8). - Depends on - implements
IPushDeviceTokenProvider; returnsPushDeviceToken?. Null-object shape shared with the siblings above, but note the different default reach (see below). - Concept introduced - inert-but-wired, distinct from unsupported. The earlier nulls in this unit mean "this head cannot do X." This one is subtler: it stays the resolved default even on a native head that can receive push, because push also needs external credentials (an FCM key, an APNs entitlement) that a plain build does not carry. Returning
nullleaves the entire registration pipeline present and correctly ordered but dormant, which the class doc calls out as "exactly the state a build without push credentials should be in" (NullPushDeviceTokenProvider.cs:6-7). Note there is noIsSupportedprobe on this contract at all (MMCA.Common.UI/Services/Capabilities/Notifications/IPushDeviceTokenProvider.cs:15-29): token presence is the signal, and the consuming registration service treats anulltoken as "nothing to register" rather than as a failure. Same [Rubric §2 - Design Patterns] framing asNullGeocodingService.- [Rubric §32 - Dependency & Supply-Chain] §32 assesses how external dependencies enter a build. Keeping the token source behind a swappable contract means push credentials and their SDKs are a per-head opt-in rather than something every consumer of the UI package inherits.
- [Rubric §29 - Resilience & Business Continuity] §29 assesses graceful behavior at edge states. A tokenless build is a first-class, non-throwing state here, not an error path.
- Walkthrough -
sealed class(NullPushDeviceTokenProvider.cs:9).RequestPermissionAsync(NullPushDeviceTokenProvider.cs:12) returnsTask.CompletedTask, so no prompt is ever shown, andGetTokenAsync(NullPushDeviceTokenProvider.cs:15-16) returnsTask.FromResult<PushDeviceToken?>(null). There is deliberately noIsSupportedmember, because the contract declares none. - Why it's built this way - ADR-044 (native push delivery), cited in the class summary (
NullPushDeviceTokenProvider.cs:4). The registration path is split into two independently overridable pieces on purpose:MMCA.Common.UI.Mauioverrides the registration service as part of its standard capability block, while the token provider is a separate opt-in, so a MAUI head that never calls the opt-in stays registered-but-tokenless. The shared registration comment states that pairing directly (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:63-67). - Where it's used -
TryAdd-registered as a singleton byAddDeviceCapabilityDefaultsalongsideNullPushRegistrationService(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:66-67). It is consumed byMauiPushRegistrationService, which asks for a token first and returnsfalsewithout any HTTP call when it getsnull(MMCA.Common.UI.Maui/Capabilities/Notifications/MauiPushRegistrationService.cs:19,79-83). A native head displaces this default by callingAddMauiPushDeviceTokenProvider()(MMCA.Common.UI.Maui/DependencyInjection.cs:163-171), which registersFcmPushDeviceTokenProvideron the Android TFM (:166) andApnsPushDeviceTokenProvideron iOS/MacCatalyst (:168) and registers nothing on the windows TFM, leaving this default in place there (MMCA.Common.UI.Maui/DependencyInjection.cs:150-152). ADC's MAUI head makes that call (MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI/MauiProgram.cs:131); Store's does not, so Store keeps this default on every TFM. - Caveats / not-in-source - opting in is not the same as activating. Both credentialed providers are configuration-gated (
Push:Fcmcredentials,Push:Apns:Enabled) and depend on app-side platform wiring the framework cannot supply, so a head that callsAddMauiPushDeviceTokenProvider()without that configuration behaves the same as this null default (MMCA.Common.UI.Maui/DependencyInjection.cs:154-160). Whether any given build actually carries those credentials is deployment configuration and is not determinable from source.
MauiExternalAuthBroker
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.Auth·MMCA.Common.UI.Maui/Capabilities/Auth/MauiExternalAuthBroker.cs:31· Level 3 · class (sealed, partial)
- What it is: the MAUI adapter for
IExternalAuthBroker(ADR-043), running an external OAuth sign-in through the platformWebAuthenticatorin the system browser, binding each attempt to a proof-key (PKCE, S256) verifier kept on the device, and handing the captured completion code, plus a round-tripped anti-CSRF state value, to the shared/auth/oauth-completepage. It reports the outcome as anExternalSignInResultand logs each attempt's start and exit with the elapsed time. - Depends on:
IExternalAuthBroker;ExternalSignInResult;NavigationManager,IOptions<T>overApiSettings,OAuthFlowStateStore,IConfiguration, andILogger<T>; MAUI EssentialsWebAuthenticator; BCLRandomNumberGenerator,SHA256,Base64UrlandEncodingfor the proof key. This is the only type in the unit that composes over app configuration and navigation rather than a single platform static, which is also why it is the only one registered scoped rather than singleton (see below). - Concept: native OAuth callback capture, introduced at
IExternalAuthBroker.[Rubric §11, Security]assesses how credentials and identity flows are handled: identity providers reject embedded WebViews, so the flow runs in the system browser and only a single-use code (never a token) returns over the app's custom scheme; a per-attempt state value fromOAuthFlowStateStoreis round-tripped through the authorize URL and back so the completion page can reject a code that was not started on this device (MauiExternalAuthBroker.cs:82-84). Because another app can register the same custom scheme and receive the completion redirect, code included, each attempt also sends only the S256 challenge of a verifier that stays on the device, so the server redeems the code only for the holder of that verifier (MauiExternalAuthBroker.cs:86-89). The diagnostic logging follows the same rule: its lines carry fixed exit names and a shape-checked server error code only, never the callback's code, state, or exception text (MauiExternalAuthBroker.cs:24-28).[Rubric §26, Front-End Security]assesses the browser-side half of the same concern: the shared completion page owns the code-to-token exchange and token storage, so the sensitive step exists in exactly one place across all heads (ADR-043). - Walkthrough
- Five readonly fields (
MauiExternalAuthBroker.cs:33-37): theNavigationManager, theIOptions<ApiSettings>, theOAuthFlowStateStore, theILogger<MauiExternalAuthBroker>, and the nullable callback scheme. - The constructor (
MauiExternalAuthBroker.cs:40) null-guardsconfiguration(:47), stores the other four dependencies, and reads the callback scheme fromconfiguration["OAuth:MobileRedirectScheme"](:53). IsAvailable(MauiExternalAuthBroker.cs:57): true only when the callback scheme is a non-blank string, so an unconfigured head keeps the web anchor flow.SignInAsync(string provider, CancellationToken = default)returningTask<ExternalSignInResult>(MauiExternalAuthBroker.cs:60): guardsprovider(:62); takes aStopwatchtimestamp and logs the start (:64-65); exitsNoCallbackSchemewhen unavailable (:67-70) orNoApiEndpointwhen the configured API endpoint is missing (:72-76), both withExternalSignInResult.Failed(); builds{scheme}://oauth-completeas the callback (:78). Everything after that runs inside thetry(:80): it creates a fresh code verifier (:90), starts a flow via_flowState.BeginWithCodeVerifierAsync, which keeps the verifier with the flow state on this device (:91,MMCA.Common.UI/Services/Auth/OAuth/OAuthFlowStateStore.cs:70), appends the returned state as&state=...only when non-empty (:92-94), appends&code_challenge=...&code_challenge_method=S256(:95), and builds{apiBase}/auth/oauth/{provider}?returnUrl=...{stateQuery}{challengeQuery}as the authorize URL, URL-escaping the provider and the return URL (:96-97); it then callsWebAuthenticator.Default.AuthenticateAsyncwith those two URLs and the caller's token and hands the result toCompleteSignIn(:99-107). ATaskCanceledExceptionexitsCancelledByCallerwhen the caller's token was cancelled andCancelledWithoutCallbackotherwise (the user dismissed the browser, a newer attempt replaced this one, or the launch activity resumed with no callback) (:109-116);FeatureNotSupportedExceptionexitsNotSupported(:117-120). Any other exception that is not anOperationCanceledException(a flow-state store failure, a redirect the platform could not complete) is a failed sign-in rather than a fault: it exits under the exception's type name withExternalSignInResult.Failed(), because the only caller is the Login click handler, which shows the generic retry message and has no catch of its own (:121-129).CompleteSignIn(MauiExternalAuthBroker.cs:132): exitsCallbackWithoutResultwhen the result carries no properties (:134-137); when no non-blankcodecomes back, exitsServerError:{code}withExternalSignInResult.Failed(serverError)if the callback carried a recognized server error, elseCallbackWithoutCode(:139-143); otherwise reads back thestateproperty (:145), reappends it as&state=...to the completion URL when non-empty, navigates to/auth/oauth-complete?code=...(:149-153), and exitsCodeReceivedwithExternalSignInResult.Success(:154).ServerErrorCode(MauiExternalAuthBroker.cs:165): returns the callback'serrorproperty only when it is 1 to 80 characters of ASCII letters, digits,.,_, or-(:166-170), elsenull, because a custom-scheme callback can be sent by another app (:157-164).CreateCodeVerifier(MauiExternalAuthBroker.cs:172-173): a fresh RFC 7636 verifier, 32 bytes fromRandomNumberGeneratorencoded as base64url without padding (43 characters).CreateCodeChallenge(:175-177): the base64url SHA-256 of the verifier's ASCII bytes, without padding.Exit(MauiExternalAuthBroker.cs:179-184) computes the elapsed milliseconds, logs them with the provider and exit name, and returns the result unchanged. The catch-all exit passes only the exception's type name, because its message can quote the callback URI, code included (:126-128). Both log lines are source-generated[LoggerMessage]methods atInformationlevel (:186-190).
- Five readonly fields (
- Why it's built this way: an unavailable default when the scheme is unset lets a single login page attempt native brokering and cleanly fall back to the web anchor flow. Delegating the exchange to the existing
/auth/oauth-completepage means the single-use-code contract, token storage, and auth-state refresh live in one place for every head. The state round-trip throughOAuthFlowStateStoreexists because a deep link carrying someone else's authorization code would otherwise sign the app in as them; starting a flow on this device and requiring its value to come back closes that gap (MauiExternalAuthBroker.cs:82-84, ADR-043). The proof key closes a second gap: another app can register the same custom scheme and receive the completion redirect, code included, so the verifier stays on this device, only its S256 challenge goes out, and the server redeems the code only for the holder of the verifier (MauiExternalAuthBroker.cs:86-89). The per-exit logging exists because the login page shows the same message for every failed attempt, so the named exit and the elapsed time are what separate one cause from another, for example a browser sheet the user closed from one that never appeared (MauiExternalAuthBroker.cs:111-113). - Where it's used: registered scoped, not singleton, by
AddMauiDeviceCapabilities()(MMCA.Common.UI.Maui/DependencyInjection.cs:111) because it navigates through the circuit'sNavigationManagerafter the system-browser round trip (MMCA.Common.UI.Maui/DependencyInjection.cs:108-110). The default it overrides is the singletonUnavailableExternalAuthBroker(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:57). Consumed by the login page's external-provider buttons, which map a returned server error code to words and never show it raw (MauiExternalAuthBroker.cs:157-164). - Caveats / not-in-source: the code-to-token exchange, token storage, and auth-state refresh are not in this class; they live in the shared
/auth/oauth-completepage it navigates to, which is also where the returnedstateis validated against the valueOAuthFlowStateStorerecorded and where the stored code verifier is presented at the exchange (MauiExternalAuthBroker.cs:86-89). The server-side check of the challenge against that verifier is not in this class either. The class doc also records two out-of-code prerequisites: a server-side allow-list entry (OAuth:AllowedReturnUrlSchemes) and the platform callback registrations (MauiExternalAuthBroker.cs:20-22).
MauiCultureStore
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Globalization·MMCA.Common.UI.Maui/Globalization/MauiCultureStore.cs:19· Level 1 · class (internal static)
- What it is: the one place a MAUI Blazor Hybrid head stores, resolves, and activates the UI culture (ADR-027). It is three static methods over
Preferences.Defaultand theCultureInfothread defaults, shared byMauiCultureApplier(the user switching language) andMauiCultureInitializer(the startup restore). - Depends on:
SupportedCultures(MMCA.Common.Shared.Globalization,MMCA.Common.UI.Maui/Globalization/MauiCultureStore.cs:2); MAUI EssentialsPreferences.Default; BCLSystem.Globalization.CultureInfo(:1). - Concept introduced, culture as process state instead of request state, and the
AsyncLocaltrap that comes with it. On a web head the culture is per request: a cookie is written,CookieRequestCultureProviderreads it, and ASP.NET sets the culture inside that request's own execution context. A hybrid head has no request pipeline at all, so there is exactly one process and one ambient culture (:6-11). The type doc also records why this class bypassesIDevicePreferenceseven though that contract exists in the same package (:12-17):IDevicePreferencesis async-only and the startup restore runs from the synchronousIMauiInitializeService.Initializehook, so routing one side through the async store would give a single value two storage paths.[Rubric §27, i18n]assesses whether the app can genuinely operate in more than one language, including persistence of the user's choice; this is where the hybrid head's choice survives a restart.[Rubric §19, State Management]assesses whether state has one owner and one lifetime; the whole point of this class is that the culture has exactly one. - Walkthrough
PreferenceKey = "mmca.culture"(MMCA.Common.UI.Maui/Globalization/MauiCultureStore.cs:25): deliberately outside themmca.devicePrefs.prefix thatMauiDevicePreferencesuses, because this value never goes through that store. The doc warns that changing the key silently resets every installed app to the device locale (:21-24).Save(string culture)(:29): a one-linePreferences.Default.Set, best-effort like the rest of the layer.Resolve()(:37-44): reproduces the web heads' precedence order without a request. It reads the stored value (:39), returns it whenSupportedCultures.IsSupported(stored)(the cookie's analogue,:41-42), and otherwise falls back toSupportedCultures.ResolveClosest(CultureInfo.CurrentUICulture.Name), which is theAccept-Languageanalogue: anes-MXdevice lands ones(:43). A non-matching device locale falls through to the framework default insideResolveClosest.ApplyToProcess(string culture)(:68-74): constructs theCultureInfo(:70) and assigns onlyCultureInfo.DefaultThreadCurrentCultureandDefaultThreadCurrentUICulture(:72-73).
- Why it's built this way: the
ApplyToProcessdoc (:46-66) carries the single most load-bearing explanation in this group. AssigningCultureInfo.CurrentCulture/CurrentUICulturewrites to anAsyncLocal, so the value flows with theExecutionContextand is restored every time that context is re-entered, outranking the thread defaults. The startup restore runs before any window exists, so the context it would write to is the ancestor of every later dispatch including the Blazor renderer's; a later switch could then set the defaults toesand still re-render forever in the launch language. Setting only the thread defaults means no thread ever materializes a culture of its own, so one switch takes effect everywhere at once. A web head never meets this because request localization sets the culture inside each request's own context. - Where it's used: called by
MauiCultureApplier(SavethenApplyToProcess) and byMauiCultureInitializer(ApplyToProcess(Resolve())). It isinternal(:19), so nothing outside theMMCA.Common.UI.Mauipackage can reach it.
MauiClipboardService
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.Interop·MMCA.Common.UI.Maui/Capabilities/Interop/MauiClipboardService.cs:6· Level 1 · class (sealed)
- What it is: the MAUI adapter for IClipboardService, writing text to the system clipboard over
Clipboard.Default(MMCA.Common.UI.Maui/Capabilities/Interop/MauiClipboardService.cs:5). - Depends on: IClipboardService; MAUI Essentials
Clipboard; BCLOperationCanceledException. - Concept introduced: best-effort capability with a reported outcome. Several adapters in this family swallow failure silently; this one converts it into a
boolinstead.[Rubric §18, UI Architecture]§18 assesses whether the presentation layer gives components what they need to render honestly. Theboolresult is what lets a caller show a "copied" confirmation only when the write actually landed, rather than lying on a head with no clipboard.
- Walkthrough: one member.
SetTextAsync(string text, CancellationToken cancellationToken = default)(MauiClipboardService.cs:9) awaitsClipboard.Default.SetTextAsync(text)and returnstrue(:13-14), or returnsfalseon any exception other thanOperationCanceledException: an unsupported feature, clipboard contention or a background restriction all mean the write did not land (:16-22). - Why it's built this way: reporting success rather than returning
voidmakes this adapter the copy-link fallback signal for IShareService callers on heads where a native share sheet is unavailable. - Where it's used: registered as a singleton by
AddMauiDeviceCapabilities()(MMCA.Common.UI.Maui/DependencyInjection.cs:66), next to BrowserClipboardService and the TryAdd default NullClipboardService (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:44) on the other heads. Consumed by the copy-link fallback path of IShareService.
MauiExternalLinkService
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.Interop·MMCA.Common.UI.Maui/Capabilities/Interop/MauiExternalLinkService.cs:11· Level 1 · class (sealed)
- What it is: the MAUI adapter for IExternalLinkService, opening external URLs in the system browser or the OS handler, because
target="_blank"dead-ends inside a BlazorWebView, and refusing any URI whose scheme is not on the external-link allow-list (MMCA.Common.UI.Maui/Capabilities/Interop/MauiExternalLinkService.cs:5-10). - Depends on: IExternalLinkService; ExternalLinkScheme (the internal allow-list in MMCA.Common.UI); MAUI Essentials
Browser,BrowserLaunchModeandLauncher; BCLUri. - Concept introduced: the WebView dead-link workaround. A hybrid head renders web markup inside a native shell that has no notion of a second browser tab, so an anchor that would open a new tab on the web simply does nothing. The capability lets shared components emit one markup shape and have the host decide whether to intercept.
[Rubric §25, Navigation & IA]§25 assesses whether the user always ends up somewhere coherent. Without interception, an external link inside the WebView is a dead click; with it, the link leaves the app the way the platform expects.[Rubric §18, UI Architecture]the branch lives once, in the adapter, not in every component that renders a link.
- Walkthrough
InterceptsLinks(MauiExternalLinkService.cs:14):true, telling shared components to route throughOpenAsyncrather than render a raw anchor.Task<bool> OpenAsync(Uri uri, CancellationToken = default)(MauiExternalLinkService.cs:17): null-guardsuri(:19); returnsfalsewithout touching the OS whenExternalLinkScheme.IsAllowed(uri)rejects it (:21-26), the allow-list being absolute URIs withhttp,https,mailto,tel,smsorotpauth(MMCA.Common.UI/Services/Capabilities/Interop/ExternalLinkScheme.cs:11-24); forhttpandhttps(compared withUri.UriSchemeHttp/HttpsunderOrdinalIgnoreCase) it usesBrowser.Default.OpenAsync(uri, BrowserLaunchMode.SystemPreferred)and returnstrue(MauiExternalLinkService.cs:30-35); the other allowed schemes (mailto:,tel:,sms:,otpauth:) go toLauncher.Default.TryOpenAsync, whose ownboolis returned as the result (:39), becauseBrowser.Defaultonly accepts http(s) (:37-38). Any exception other thanOperationCanceledExceptionis caught and reported asfalse: the link is a convenience, not a workflow (:41-46). Theboolhonours the contract's "the platform reported the URL was opened" meaning (MMCA.Common.UI/Services/Capabilities/Interop/IExternalLinkService.cs:21-22), so a caller can tell a refused or unhandled scheme from a successful launch.
- Why it's built this way: splitting web schemes (system browser) from contact schemes (OS launcher) is what makes
mailto:andtel:links work from inside the WebView, where a plain anchor would silently do nothing and the browser API would reject the scheme outright. The allow-list check runs first so a data-sourcedintent:,file:or third-party app scheme is refused rather than launched (MauiExternalLinkService.cs:21-22), and the exception filter lets cancellation still propagate while any platform failure becomes the contract'sfalse. - Where it's used: registered as a singleton by
AddMauiDeviceCapabilities()(MMCA.Common.UI.Maui/DependencyInjection.cs:71); siblings are BrowserExternalLinkService and the TryAdd default NullExternalLinkService (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:49). Consumed by the shared external-link component.
MauiMapNavigationService
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.Geo·MMCA.Common.UI.Maui/Capabilities/Geo/MauiMapNavigationService.cs:12· Level 1 · class (sealed)
- What it is: the MAUI adapter for IMapNavigationService, launching the platform maps app for a street address through
LauncherURIs, labeled where the platform supports it (MMCA.Common.UI.Maui/Capabilities/Geo/MauiMapNavigationService.cs:5-11). - Depends on: IMapNavigationService; MapLaunchUris (the internal per-platform URI builder in MMCA.Common.UI); MAUI Essentials
Launcher; BCLUriandOperatingSystem. - Concept introduced: address-only navigation. The capability takes a postal address, not coordinates, because the domain model carries no geo-coordinates and the OS maps app can geocode far better than the app could.
[Rubric §18, UI Architecture]and[Rubric §30, Compliance/Privacy]: handing the address to the OS means the app never requests a location permission and never sees where the user is, which is the cheapest possible privacy posture for a "get directions" button.
- Walkthrough
OpenAddressAsync(string address, string? label, CancellationToken = default)(MauiMapNavigationService.cs:15): guards the address (:17), builds the platform URI from the address and label (:19), and returns the result ofLauncher.Default.TryOpenAsync(uri)(:23), orfalseon any exception other thanOperationCanceledException, so the caller can fall back (:25-30).BuildPlatformUri(string address, string? label)(MauiMapNavigationService.cs:33): delegates to MapLaunchUris:ForAndroidon Android (:35-38),ForAppleon iOS and Mac Catalyst (:40-43), andForWindowseverywhere else (:45). The builder escapes the address and applies the label where the target supports one: ageo:0,0?q=address (label)intent on Android (MMCA.Common.UI/Services/Capabilities/Geo/MapLaunchUris.cs:39-40), an Apple Maps URL with the address inaddressand the label inq(MapLaunchUris.cs:50-53), and a label-freebingmaps:?q=URI on Windows, whose address search takes no label (MapLaunchUris.cs:55-61). The SonarAnalyzerS1075suppression around the hard-coded URI constants lives in the builder now (MapLaunchUris.cs:14-19).
- Why it's built this way: routing through the OS launcher instead of an in-app map control needs no location permission, no map SDK and no geocoding round-trip. Hard-coding the scheme per platform is correct here because these are OS contracts; keeping the shapes in the shared
MapLaunchUrislets the browser service and the MAUI head use one unit-tested builder (MapLaunchUris.cs:3-7). The class doc notes Android hosts must declare ageointent in the manifest<queries>block for the launcher to resolve it (MauiMapNavigationService.cs:10). - Where it's used: registered as a singleton by
AddMauiDeviceCapabilities()(MMCA.Common.UI.Maui/DependencyInjection.cs:68); siblings are BrowserMapNavigationService and NullMapNavigationService (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:46). Consumed by venue and location components.
MauiScreenshotService
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.Interop·MMCA.Common.UI.Maui/Capabilities/Interop/MauiScreenshotService.cs:10· Level 1 · class (sealed)
- What it is: the MAUI adapter for IScreenshotService, capturing the current screen to a temporary PNG through
Screenshot.Default(MMCA.Common.UI.Maui/Capabilities/Interop/MauiScreenshotService.cs:5-9). - Depends on: IScreenshotService; MAUI Essentials
Screenshot,ScreenshotFormatandFileSystem; BCLSystem.IOandGuid. - Concept introduced: permissionless temp-file capture. Where the file lands is the whole design.
[Rubric §30, Compliance/Privacy]and[Rubric §26, Front-End Security]: captures go to the platform cache directory and never the photo library, so no storage permission is prompted or held, and the OS is free to reclaim the files when it needs space.
- Walkthrough
IsSupported(MauiScreenshotService.cs:13):Screenshot.Default.IsCaptureSupported.CaptureToFileAsync(CancellationToken = default)(MauiScreenshotService.cs:16): re-checks capture support and returnsnullearly when it is unavailable (:18-21); otherwise captures (:25), builds a path ofmmca-screenshot-{guid:N}.pngunderFileSystem.CacheDirectory(:26), opens the capture as a PNG stream and copies it to a created file through nestedawait usingblocks that dispose both streams deterministically (:28-36), and returns the path (:38). Any exception other thanOperationCanceledExceptionreturnsnull(catch (Exception ex) when (ex is not OperationCanceledException),:40-45), covering an unsupported capture, an IO or access fault on the cache file, or any other platform error; cancellation still propagates.
- Why it's built this way: writing to the cache directory keeps the feature permission-free, and the nullable path return lets the share flow abort quietly when capture is unsupported or the write fails, rather than forcing every caller into a try/catch.
- Where it's used: registered as a singleton by
AddMauiDeviceCapabilities()(MMCA.Common.UI.Maui/DependencyInjection.cs:75); the unsupported fallback is NullScreenshotService (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:53). Its output path is handed straight to IShareService for image sharing.
MauiShareService
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.Interop·MMCA.Common.UI.Maui/Capabilities/Interop/MauiShareService.cs:6· Level 1 · class (sealed)
- What it is: the MAUI adapter for IShareService, opening the native share sheet for a link, a local file or plain text over
Share.Default(MMCA.Common.UI.Maui/Capabilities/Interop/MauiShareService.cs:5). - Depends on: IShareService; MAUI Essentials
Share,ShareTextRequest,ShareFileRequestandShareFile; BCLUriandOperationCanceledException. - Concept introduced: share with a copy-link fallback. The interface was shaped around the fact that not every head has a share sheet, so every method answers
boolrather thanvoid.ShareTextAsyncis a default interface method that reportsfalse(MMCA.Common.UI/Services/Capabilities/Interop/IShareService.cs:27-28), so only a head that overrides it, as this adapter does, presents a share UI for text.[Rubric §18, UI Architecture]: those boolean returns are exactly what make an IClipboardService copy-link a viable second choice, keeping a Share button useful on every head.
- Walkthrough
ShareLinkAsync(string title, Uri uri, CancellationToken = default)(MauiShareService.cs:9): null-guardsuri(:11), requests aShareTextRequestcarryingTitleand the URI string (:15-19), and returnstrue(:20), orfalseon any exception exceptOperationCanceledException(:22-27), so any platform failure, not only an unsupported feature, tells the caller to fall back to copy-link.ShareFileAsync(string title, string filePath, string contentType, CancellationToken = default)(MauiShareService.cs:31): guardsfilePathwithArgumentException.ThrowIfNullOrWhiteSpace(:33), requests aShareFileRequestwrappingnew ShareFile(filePath, contentType)(:37-41), and returnstrue(:42), orfalseunder the samewhen (ex is not OperationCanceledException)filter (:44-49), so an unsupported feature, an unreadable file or any other platform failure reportsfalserather than throwing.ShareTextAsync(string title, string text, CancellationToken = default)(MauiShareService.cs:53): null-guardstext(:55), requests aShareTextRequestcarryingTitleandText(:60-64), and returnstrue(:65), orfalseunder the same filter (:67-72) so the caller falls back to the clipboard. The comment at:59records why this is text rather than a file: the diagnostics log is never written to disk to be shared.
- Why it's built this way: presenting the OS share sheet reuses the platform's own target picker, so the app never has to enumerate or authenticate against individual destinations. Reporting failure as
falselets the calling component degrade to copy-link instead of showing an error. - Where it's used: registered as a singleton by
AddMauiDeviceCapabilities()(MMCA.Common.UI.Maui/DependencyInjection.cs:65); siblings are BrowserShareService and NullShareService (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:43). Consumes IScreenshotService output for image sharing and falls back to IClipboardService.ShareTextAsyncis called by the in-app diagnostics log component (MMCA.Common.UI/Components/Diagnostics/InAppDiagnosticsLog.razor:113).
SensitiveFileStagingFolder
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.Files·MMCA.Common.UI.Maui/Capabilities/Files/SensitiveFileStagingFolder.cs:20· Level 1 · class (sealed)
- What it is: the dedicated temp sub-folder a MAUI head stages sensitive files in (the personal-data export) before handing them to the share sheet (
MMCA.Common.UI.Maui/Capabilities/Files/SensitiveFileStagingFolder.cs:5-9). The folder name is the head's own, supplied toUseMauiDeviceCapabilities, so a head that already staged files under a given name keeps purging them (:7-9). - Depends on: SafeFileName (
MMCA.Common.UI.Services.Capabilities.Files,:1); BCLSystem.IO(Path,Directory,File). - Concept introduced: a folder that exists only to be emptied. Because nothing else lives in it, it can be cleared wholesale: of every file before each write, and entirely at app start and on every identity transition, so an export never followed by another one outlives neither the app session nor the signed-in account (
:10-15). The class doc also records why a staged file is never deleted right after the share: Android's share request returns when the intent launches, so a delete then would race the receiving app reading the file (:15-17).[Rubric §30, Compliance/Privacy]: a personal-data export is the most sensitive file the app hands out, and the purge-before-write, purge-at-start and purge-on-identity-transition trio bounds how long a copy stays on the device and keeps it from the next account.[Rubric §26, Front-End Security]: both the folder name and every staged file name pass throughSafeFileName.Reduce, whose purpose is that a supplied name cannot steer a write out of the folder it is meant for (MMCA.Common.UI/Services/Capabilities/Files/SafeFileName.cs:4-5).
- Walkthrough
SensitiveFileStagingFolder(string folderName)(SensitiveFileStagingFolder.cs:28): guards withArgumentException.ThrowIfNullOrWhiteSpace(:30), then throwsArgumentExceptionfor any valueSafeFileName.Reducewould change, so the name must be a single folder name, never a path (:31-34, doc:23-26). It setsFolderNameandFolderPath = Path.Combine(Path.GetTempPath(), folderName)(:36-37).FolderName(:41) andFolderPath(:44): get-only.StageAsync(string fileName, byte[] content, CancellationToken = default)(:55): null-guardscontent(:57), reducesfileNameand throwsArgumentExceptionwhen nothing usable is left (:58-59), creates the folder (:61), deletes every file already in it (:62-65), writes the bytes withFile.WriteAllBytesAsync(:67-68), and returns the full path (:69).Purge()(:76):Directory.Delete(FolderPath, recursive: true)(:80), swallowingDirectoryNotFoundException(nothing was staged),IOExceptionandUnauthorizedAccessException(:82-93), because a purge that fails leaves the folder for the next stage's own purge (:73-74).
- Why it's built this way: validating the name in the constructor makes a bad name fail at composition rather than on the first export, which is why
AddMauiDeviceCapabilitiesconstructs the instance eagerly (MMCA.Common.UI.Maui/DependencyInjection.cs:56-60). Purging by folder rather than by tracked file is also what lets a head clear files a previous app version staged under the same name (MMCA.Common.UI.Maui/HostingDependencyInjection.cs:36-38). - Where it's used: registered as a singleton instance by
AddMauiDeviceCapabilities(string sensitiveFileStagingFolderName)(MMCA.Common.UI.Maui/DependencyInjection.cs:54,:60), reached fromUseMauiDeviceCapabilities(string)(MMCA.Common.UI.Maui/HostingDependencyInjection.cs:40,:43). Consumed by MauiSensitiveFileSaver forStageAsync, by SensitiveFileStagingPurgeInitializer, which callsPurge()when the app is built (MMCA.Common.UI.Maui/SensitiveFileStagingPurgeInitializer.cs:18), and bySensitiveFileStagingTransitionParticipant, anIIdentityTransitionParticipantregistered next to it that callsPurge()on every identity transition (MMCA.Common.UI.Maui/Capabilities/Files/SensitiveFileStagingTransitionParticipant.cs:14-22;MMCA.Common.UI.Maui/DependencyInjection.cs:63-64). Covered byMauiSensitiveFileSaverTests(MMCA.Common/Tests/Presentation/MMCA.Common.UI.Tests/Services/Capabilities/Files/MauiSensitiveFileSaverTests.cs:20). - Caveats / not-in-source: each head names its own folder, ADC
mmca-exports(MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI/MauiProgram.cs:108) and Storemmca-store-exports(MMCA.Store/Source/Hosts/UI/MMCA.Store.UI/MauiProgram.cs:77).
MauiCapabilitiesJsModuleRegistration
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.Interop·MMCA.Common.UI.Maui/Capabilities/Interop/MauiCapabilitiesJsModuleRegistration.cs:23· Level 2 · class (internal static)
- What it is: a one-method registration helper that adds the shared CapabilitiesJsModule to a MAUI Blazor Hybrid head's container (
MMCA.Common.UI.Maui/Capabilities/Interop/MauiCapabilitiesJsModuleRegistration.cs:11-22). - Depends on: CapabilitiesJsModule (
MMCA.Common.UI.Services.Capabilities,:7);Microsoft.Extensions.DependencyInjection.ExtensionsforTryAddScoped(:6). - Concept introduced: an optional dependency that fails silently is a registration bug, not a runtime one. The sign-in-link, confirm-email and reset-password pages read their credential out of the URL fragment through the module's
locationHashTake, and resolve the module optionally, so a head that never registered it read a null fragment and showed "This link is incomplete." (:12-15). BecauseBlazorWebViewserves the RCL static assets under_content/exactly like a browser host, the same JS module works unchanged inside the hybrid head (:15-17).[Rubric §18, UI Architecture]: the credential-link pages stay head-agnostic; the head-specific part is only which registration call puts the module in the container.
- Walkthrough: one member.
AddMauiCapabilitiesJsModule(this IServiceCollection services)(MauiCapabilitiesJsModuleRegistration.cs:28) callsservices.TryAddScoped<CapabilitiesJsModule>()(:30) and returns the same collection for chaining (:31). - Why it's built this way:
TryAddkeeps exactly one registration when a hybrid head also callsAddBrowserDeviceCapabilities(:20). The class is kept free of MAUI APIs so the framework's net10.0/net11.0 test project can compile it as linked source (:19), which is also why theMicrosoft.Extensions.DependencyInjectionusing is conditional on a non-MAUI TFM (:1-5). - Where it's used: called at the end of
AddMauiDeviceCapabilities()(MMCA.Common.UI.Maui/DependencyInjection.cs:116), whose comment names the credential-link pages that need it (:106-108). Covered byMauiCapabilitiesJsModuleRegistrationTests(MMCA.Common/Tests/Presentation/MMCA.Common.UI.Tests/Services/Capabilities/Interop/MauiCapabilitiesJsModuleRegistrationTests.cs).
MauiCultureApplier
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Globalization·MMCA.Common.UI.Maui/Globalization/MauiCultureApplier.cs:22· Level 2 · class (sealed)
- What it is: the hybrid-head implementation of
ICultureApplier(ADR-027). When the user picks a language, it persists and activates the choice in process and force-reloads theBlazorWebViewso every component re-renders under the new culture. - Depends on:
ICultureApplier(the contract,MMCA.Common.UI.Maui/Globalization/MauiCultureApplier.cs:3,:22),MauiCultureStore(persistence plus activation,:41-42),SupportedCultures(the allowlist,:2,:32), andNavigationManager(primary-constructor parameter,:1,:22). - Concept introduced, force-load as a re-render mechanism. The class doc (
:13-19) explains the reasoning: resource strings are resolved fromCultureInfo.CurrentUICultureat render time, and Blazor exposes no API to re-render an entire component tree in place, so a full reload is the only way to make the switch visible everywhere at once. Inside aBlazorWebViewthis is cheap in a way it is not on the web: the force-load re-boots the Blazor app inside the WebView while the .NET process (and therefore the culture just set) stays alive. It also introduces the head-specific replacement of a shared default: the web defaultEndpointCultureAppliernavigates to the server/culture/setendpoint, which on a hybrid head is resolved by the BlazorRouter, matches no page, and renders the not-found page (:8-12).[Rubric §27, i18n]assesses whether language is a first-class, switchable concern; this is the switch.[Rubric §18, UI Architecture]applies because one language-switcher component works on every head purely by resolving a differentICultureApplier. - Walkthrough:
ApplyAsync(string culture, string returnPath, CancellationToken = default)(MMCA.Common.UI.Maui/Globalization/MauiCultureApplier.cs:25-48) guards the culture string (:27), then checksSupportedCultures.IsSupported(culture)and returns a completed task unchanged when it fails (:32-35), which is exact parity with the web endpoint's allowlist behavior. The comment at:29-31records that the pseudo locale is unreachable here: the switcher only offers it whenIHostEnvironmentreports Development, and a MAUI head registers no such service. It then callsMauiCultureStore.Save(culture)andMauiCultureStore.ApplyToProcess(culture)(:41-42), resolves the target asreturnPathor/when blank (:44), callsnavigation.NavigateTo(target, forceLoad: true)(:45), and returnsTask.CompletedTask(:47). - Why it's built this way: the ordering comment (
:37-40) is the load-bearing part: persist and activate BEFORE the reload, so the new culture is already the process default when the tree re-renders. Doing it the other way would reload under the old culture. The comment also points atMauiCultureStore'sApplyToProcessremarks for why assigningCurrentUICulturehere would pin the app to its startup language for the rest of the session. - Where it's used: registered scoped as
ICultureApplierbyUseMauiCulture()(MMCA.Common.UI.Maui/HostingDependencyInjection.cs:140), which is itself already called byUseMauiDeviceCapabilities()(:51, folded in deliberately so no head can be left half-configured,:46-50) and must run afterAddUISharedso the plainAddoverrides thatTryAdddefault (:134-135). Consumed by the shared language-switcher UI.
MauiCultureInitializer
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Globalization·MMCA.Common.UI.Maui/Globalization/MauiCultureInitializer.cs:14· Level 2 · class (sealed)
- What it is: the startup half of hybrid-head localization (ADR-027): an
IMauiInitializeServicethat restores the persisted culture while the app is being built, before any window or page exists. - Depends on:
MauiCultureStore(ResolveplusApplyToProcess,MMCA.Common.UI.Maui/Globalization/MauiCultureInitializer.cs:22) and the MAUIIMauiInitializeServicehook (:14). - Concept introduced: the pre-window initialization hook.
IMauiInitializeService.Initializeruns insideMauiAppBuilder.Build(), so it is the earliest point at which app code can set process state, and the class doc names the two consequences that make it the right place (:5-8): the very first Blazor render already happens under the correct culture (no flash of the wrong language), and the user does not have to re-pick their language on every launch. It is the hybrid counterpart to the WASM head'sMmcaCultureBootstrap.[Rubric §27, i18n]assesses end-to-end language support including startup; without this, a hybrid head has no culture state of its own and always starts at the device locale, which is why persisting the choice inMauiCultureApplieralone is not enough (:9-12). - Walkthrough: one member.
Initialize(IServiceProvider services)(MMCA.Common.UI.Maui/Globalization/MauiCultureInitializer.cs:21-22) is an expression body callingMauiCultureStore.ApplyToProcess(MauiCultureStore.Resolve()). Theservicesparameter is unused, and the remarks say why (:17-20): the culture lives in device preferences and process state, both reachable without DI, so the parameter belongs to the interface rather than to this restore. - Why it's built this way: running before the container is meaningfully usable is exactly what forces
MauiCultureStoreto readPreferences.Defaultdirectly rather than through the asyncIDevicePreferencescontract; the two constraints (a synchronous hook and pre-window timing) are what shape the whole storage design. This same timing is why other singletons built during app construction must resolve their localized strings lazily rather than at construction:MauiBarcodeScannerService's doc records the identical hazard (MMCA.Common.UI.Maui/Capabilities/Media/MauiBarcodeScannerService.cs:19-23). - Where it's used: registered as a singleton
IMauiInitializeServicebyUseMauiCulture()(MMCA.Common.UI.Maui/HostingDependencyInjection.cs:141), alongsideMauiCultureApplier(:140). MAUI invokes it duringMauiAppBuilder.Build(); nothing in app code calls it directly.
MauiGeocodingService
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.Geo·MMCA.Common.UI.Maui/Capabilities/Geo/MauiGeocodingService.cs:10· Level 2 · class (sealed)
- What it is: the MAUI adapter for
IGeocodingService: it turns a street address into aGeoPointusingGeocoding.Default, and returnsnullwhenever that cannot be done. - Depends on:
IGeocodingServiceandGeoPoint; MAUI EssentialsGeocoding; BCLFirstOrDefault. - Concept: no new contract idea here; this is the native half of the best-effort shape taught at
IGeocodingService. What is worth reading closely is the shape of the catch, because it is the house pattern for every native adapter in this group: catch every platform failure except the caller's own cancellation and translate it into the contract's neutral value, so an adapter answers and never throws.[Rubric §29, Resilience & Business Continuity]assesses graceful degradation. A geocoder that is offline, times out, or is absent from the device produces "no proximity hint", never a failed render.[Rubric §15, Best Practices & Code Quality]assesses idiomatic error handling. The catch is filtered withex is not OperationCanceledException(MauiGeocodingService.cs:26), so cancellation still propagates while every platform failure, including an Android geocoder network failure raised asJava.IO.IOExceptionoutside theSystem.IOfamily, becomesnull(:28-30).
- Walkthrough
sealed class MauiGeocodingService : IGeocodingService(MauiGeocodingService.cs:10).IsSupported(MauiGeocodingService.cs:13): a constanttrue. Note the contrast with the geolocation sibling: geocoding needs no permission at all, because it is a network lookup rather than a device-location read (MauiGeocodingService.cs:6-7).GeocodeAsync(string address, CancellationToken = default)(MauiGeocodingService.cs:16): guards the address withArgumentException.ThrowIfNullOrWhiteSpace(:18), so a caller bug is still an exception; callsGeocoding.Default.GetLocationsAsync(address)(:22), takes the first result (:23), and projects itsLatitude/Longitudeinto aGeoPoint, ornullwhen there is no match (:24).- One filtered catch translates platform failure into the contract's
null: an unsupported device, an offline geocoder or any other platform fault (:26-32). - The
cancellationTokenparameter is accepted but not forwarded:Geocoding.Default.GetLocationsAsynctakes no token.
- Why it's built this way: ADR-042. The domain model stores addresses and no coordinates, so geocoding exists purely to compute a presentation-time proximity hint; making every failure mode collapse to
nullkeeps that hint strictly optional and keeps the adapter free of any policy decision. - Where it's used: registered as a singleton by
AddMauiDeviceCapabilities()(MMCA.Common.UI.Maui/DependencyInjection.cs:70), overriding theNullGeocodingServicedefault (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:48). There is no browser implementation, so web heads keep the null default. - Caveats / not-in-source: which geocoding backend
Geocoding.Defaultresolves to (and therefore whether a lookup is billed or rate-limited) is a platform detail, not visible here.
MauiGeolocationService
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.Geo·MMCA.Common.UI.Maui/Capabilities/Geo/MauiGeolocationService.cs:11· Level 2 · class (sealed)
- What it is: the MAUI adapter for
IGeolocationService: a soft, one-shot device-position read that prefers a fresh last-known fix, falls back to a timed current-position request, and yieldsnullon any refusal or failure. - Depends on:
IGeolocationServiceandGeoPoint; MAUI EssentialsGeolocation,Permissions,MainThread,GeolocationRequest,Location; on Android only,Android.Manifest.Permission. - Concept introduced, the two-tier freshness read and the partial-grant permission flow. This is the most behaviorally interesting native adapter in the unit, and it carries three mechanics the others do not.
- Freshness tiering. Asking the GPS for a current fix is slow and battery-expensive, so the adapter first takes the platform's last-known location and uses it only if it is younger than five minutes (
MauiGeolocationService.cs:13,:51-55,:69-70). Only when there is no fresh cached fix does it pay for a real read, and even then it caps the wait at ten seconds at medium accuracy (:14,:57), which is the right tier for a "roughly 3 km from the venue" hint. - Main-thread permission prompt, asked at most once per decided state. A platform permission dialog must be raised on the UI thread, so the prompt is marshalled through
MainThread.InvokeOnMainThreadAsyncwith astaticlambda (:38-39). The adapter checks the current status first (:24) and only prompts when the status is neitherGrantednorRestricted(:36), which is what keeps an already-decided permission from re-prompting on every read. - Approximate-location handling, and why
Restrictedcounts as a grant. On Android 12+, "Approximate only" grants coarse location and denies fine, and MAUI's compositeLocationWhenInUsecheck reports that combination asDenied. An Android-only block probes coarse alone through aCoarseLocationOnlypermission subclass and, when that is granted, rewrites the status toRestricted(:25-35). Both the prompt guard (:36) and the give-up guard (:46) then acceptGrantedorRestricted, because Essentials' ownGeolocationcalls accept the same pair and rejectingRestrictedwould turn the deliberate coarse design into a silent no-hint for every approximate user (:42-45). This is also the one place in the group where#if ANDROIDappears, and it appears inside an adapter: the platform conditional is confined to the head-specific package, so shared component code still sees onlyIGeolocationService. [Rubric §26, Front-End Security]assesses handling of sensitive, permission-gated capabilities. Location is requested with the narrowest scope available (Permissions.LocationWhenInUse,:24), only when needed, and a denial simply returnsnullrather than blocking or retrying.[Rubric §12, Performance & Scalability]assesses resource cost. The cached-fix-first path plus a bounded timeout means the common case costs nothing and the worst case is ten seconds, not an open-ended GPS acquisition.[Rubric §29, Resilience & Business Continuity]assesses degradation. Every platform failure (unsupported device, location services switched off at the OS level, a refused permission, anything else) funnels to the same neutralnullthrough one catch filtered only on cancellation (:61-66).
- Freshness tiering. Asking the GPS for a current fix is slow and battery-expensive, so the adapter first takes the platform's last-known location and uses it only if it is younger than five minutes (
- Walkthrough
- Two
static readonly TimeSpanpolicy constants:LastKnownFreshnessof five minutes (MauiGeolocationService.cs:13) andCurrentFixTimeoutof ten seconds (:14). Naming them rather than inlining the literals is what turns the freshness policy into something a reader can find. IsSupported(MauiGeolocationService.cs:17): a constanttrue.GetCurrentOrLastKnownAsync(CancellationToken = default)(MauiGeolocationService.cs:20) in order: checkPermissions.CheckStatusAsync<Permissions.LocationWhenInUse>()(:24); on Android, upgrade a coarse-only grant toRestricted(:25-35); prompt on the main thread when the status is neitherGrantednorRestricted(:36-40); returnnullif it is still neither (:46-49); read the last-known location and return it as aGeoPointwhenIsFresh(:51-55); otherwise issue aGeolocationRequest(GeolocationAccuracy.Medium, CurrentFixTimeout)and return that fix, ornull(:57-59). This is the one adapter in the unit that forwards the caller'scancellationTokento the platform call (:58).- One catch,
catch (Exception ex) when (ex is not OperationCanceledException), returningnullfor an unsupported device, location services switched off, a refused permission or any other platform failure (:61-66). IsFresh(Location location)(MauiGeolocationService.cs:69-70):location.Timestamp >= DateTimeOffset.UtcNow - LastKnownFreshness.CoarseLocationOnly(MauiGeolocationService.cs:78, inside#if ANDROID): a private sealedPermissions.BasePlatformPermissionsubclass whoseRequiredPermissionslistsAccessCoarseLocationalone (:80-81). It exists purely as a status probe, because the built-inLocationWhenInUselists both coarse and fine as required and therefore can never reportGrantedfor an approximate-only grant (:73-77).
- Two
- Why it's built this way: ADR-042. The contract promises that location never blocks a feature, so the adapter is written to fail toward
nullat every step; the freshness and timeout constants exist so a proximity hint can never become the slow part of a page; and the coarse probe exists so the platform's own partial-grant model does not silently degrade to no hint at all. - Where it's used: registered as a singleton by
AddMauiDeviceCapabilities()(MMCA.Common.UI.Maui/DependencyInjection.cs:69), overriding theNullGeolocationServicedefault (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:47). Web heads keep the null default. - Caveats / not-in-source: the Android manifest entries that make
AccessCoarseLocationand the fine-location permission requestable are declared by the head, not here.
MauiSensitiveFileSaver
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.Files·MMCA.Common.UI.Maui/Capabilities/Files/MauiSensitiveFileSaver.cs:12· Level 2 · class (sealed)
- What it is: the MAUI adapter for
ISensitiveFileSaver. A native head cannot download through the WebView, so the file is staged in the head'sSensitiveFileStagingFolderand handed to the share sheet, which is where "save to Files" lives on both platforms (MMCA.Common.UI.Maui/Capabilities/Files/MauiSensitiveFileSaver.cs:6-11). - Depends on:
ISensitiveFileSaver(MMCA.Common.UI.Services.Capabilities.Files,:1),IShareService(:2,:14), andSensitiveFileStagingFolder(:15), both injected through the constructor (:20-24). - Concept: a composition of two existing capabilities rather than a new platform call. On browser heads the contract saves through a temporary object URL and its default presents nothing (
MMCA.Common.UI/Services/Capabilities/Files/ISensitiveFileSaver.cs:7-17); on a native head the "download" becomes stage-then-share.[Rubric §18, UI Architecture]: a component asks one contract to hand the user a file; whether that is a browser save or a share sheet is decided by which adapter the head registered.[Rubric §30, Compliance/Privacy]: the staged copy lives only in the dedicated folder, which is emptied before each write (MauiSensitiveFileSaver.cs:8).
- Walkthrough: one member.
SaveAsync(string fileName, string contentType, byte[] content, string shareTitle, CancellationToken = default)(MauiSensitiveFileSaver.cs:27-32) awaits_stagingFolder.StageAsync(fileName, content, cancellationToken)for the file path (:34), then returns theboolfrom_share.ShareFileAsync(shareTitle, filePath, contentType, cancellationToken)(:35). There is no try/catch: per the contract, a failed staging write throws andfalsemeans no share surface accepted the file (ISensitiveFileSaver.cs:34-38), andMauiShareServicealready reports any non-cancellation share failure asfalse. - Why it's built this way: reusing
IShareServicekeeps the share-sheet platform code in one adapter. The staged file is deliberately not deleted after the share, because Android's share request returns when the intent launches and a delete then would race the receiving app reading the file (ISensitiveFileSaver.cs:13-16); cleanup is left to the folder's purge-before-write, the app-startSensitiveFileStagingPurgeInitializerand the purge on every identity transition (MMCA.Common.UI.Maui/Capabilities/Files/SensitiveFileStagingTransitionParticipant.cs:18-22). - Where it's used: registered as a singleton
ISensitiveFileSaverbyAddMauiDeviceCapabilities(string)(MMCA.Common.UI.Maui/DependencyInjection.cs:61), next to its staging folder (:60), purge initializer (:62) and identity-transition purge (:63-64); siblings are the scopedBrowserSensitiveFileSaver(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:123) and the TryAdd defaultNullSensitiveFileSaver(:85). Covered byMauiSensitiveFileSaverTests(MMCA.Common/Tests/Presentation/MMCA.Common.UI.Tests/Services/Capabilities/Files/MauiSensitiveFileSaverTests.cs:20). - Caveats / not-in-source: the framework's own caller is
ApiFileDownloadButton, which hands every client-side download to this contract (MMCA.Common.UI/Components/Forms/ApiFileDownloadButton.razor.cs:172); ADC's personal-data export calls it directly (MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.UI/Pages/Users/Profile/LegalAndDataCard.razor.cs:44,:156).
DeepLinkRouteEventArgs
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Navigation·MMCA.Common.UI/Services/Capabilities/Navigation/DeepLinkRouteEventArgs.cs:4· Level 1 · class
- What it is: the event payload carrying an app-relative route requested by a native navigation source (a notification tap, a home-screen action, an app link, a QR scan) (
DeepLinkRouteEventArgs.cs:3). It is the argument type of the IDeepLinkDispatcherRouteRequestedevent. - Depends on:
System.EventArgs, which it derives from (DeepLinkRouteEventArgs.cs:4); nothing first-party. - Concept introduced: the classic .NET
EventArgs-derived payload for a typed event. It is immutable by construction: a constructor sets the singleRouteproperty, which is get-only (DeepLinkRouteEventArgs.cs:7,:10).[Rubric §25, Navigation & IA]§25 assesses coherent navigation. This type is the boundary object between native entry points and Blazor routing, carrying exactly one thing (an app-relative route) so every native source funnels through the same shape.
- Walkthrough: a
sealed class : EventArgs(DeepLinkRouteEventArgs.cs:4).- Constructor
DeepLinkRouteEventArgs(string route)(:7): assigns the route. Route(:10): the app-relative route to navigate to (for example/happening-now).
- Constructor
- Why it's built this way: a small dedicated
EventArgstype keeps the dispatcher's event strongly typed and lets the listener component read the route without casting, part of the single-funnel deep-link design (ADR-042). - Where it's used: declared as the payload of
IDeepLinkDispatcher.RouteRequested(MMCA.Common.UI/Services/Capabilities/Navigation/IDeepLinkDispatcher.cs:13), constructed inside DeepLinkDispatcher.Publish(MMCA.Common.UI/Services/Capabilities/Navigation/DeepLinkDispatcher.cs:137), and read by theDeepLinkListenercomponent's handler (MMCA.Common.UI/Components/Capabilities/DeepLinkListener.razor:32-36).
CapabilitiesJsModule
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities·MMCA.Common.UI/Services/Capabilities/CapabilitiesJsModule.cs:14· Level 1 · class (sealed,IAsyncDisposable)
What it is: the shared, lazily-imported accessor for
capabilities-interop.js. Every browser capability adapter in this group goes through it, so one Blazor scope (a Server circuit or a WASM app) performs exactly one ES-module import no matter how many capabilities the page touches.Depends on:
IJSRuntime(Microsoft.JSInterop,MMCA.Common.UI/Services/Capabilities/CapabilitiesJsModule.cs:1);JsInteropFailure, the shared predicate that names the JS-unavailable exception family (MMCA.Common.UI.Common,:2,:38);LazyJsModule, the framework's import-once helper it wraps (:18,:21); BCLValueTask. Its consumers are the seven JS-backed adapters below.Concept introduced: this is the type that makes the whole browser leg of the capability layer safe, and it teaches two ideas at once.
- Prerender-safe JS interop. A Blazor component's first render can happen on the server with no browser attached (SSR prerender), a Server circuit can be torn down mid-call, and an interop call can exceed the host's JS interop timeout. Calling into JS in any of those states throws. Rather than making every adapter (and every component) test for it, this class catches the whole JS-unavailable family through one exception filter and returns
default, so a capability call during prerender is simply a no-op that yieldsnullorfalse. The family is defined once, inJsInteropFailure.IsUnavailable:InvalidOperationException,JSDisconnectedException,JSException, orOperationCanceledException(which covers the timeout'sTaskCanceledException) (MMCA.Common.UI/Common/JsInteropFailure.cs:27-31). The filter adds one more condition,!cancellationToken.IsCancellationRequested, so a cancellation the caller asked for still propagates instead of being mistaken for an unavailable browser (CapabilitiesJsModule.cs:12,:38). - Import once per scope. An ES-module import is a network fetch plus an evaluation; doing it per capability call would be wasteful and would race.
LazyJsModulecaches the importedIJSObjectReference, and registering this class scoped (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:113) makes that cache per-circuit.
[Rubric §23, Front-End Performance]assesses whether the client avoids redundant work on the critical path; one shared module import instead of eight is exactly that.[Rubric §29, Resilience & Business Continuity]assesses graceful degradation; a disconnected circuit degrades a capability call to a silentdefaultrather than an unhandled exception in a render path.[Rubric §12, Performance & Scalability]applies because this is the single place the degradation policy is written, instead of eight copies of the same try/catch.- Prerender-safe JS interop. A Blazor component's first render can happen on the server with no browser attached (SSR prerender), a Server circuit can be torn down mid-call, and an interop call can exceed the host's JS interop timeout. Calling into JS in any of those states throws. Rather than making every adapter (and every component) test for it, this class catches the whole JS-unavailable family through one exception filter and returns
Walkthrough
ModulePath(MMCA.Common.UI/Services/Capabilities/CapabilitiesJsModule.cs:16):./_content/MMCA.Common.UI/capabilities-interop.js, the static-web-asset path the RCL publishes.- The constructor (
:21) builds the innerLazyJsModuleover the host'sIJSRuntime; nothing is imported yet. InvokeOrDefaultAsync<T>(string identifier, object?[] args, CancellationToken)(:28-44): the single entry point. Inside onetryit awaitsGetOrImportAsync(cancellationToken)(:35, where the import happens on first use) and thenmodule.InvokeAsync<T>(identifier, cancellationToken, args)(:36). A single catch arm,catch (Exception exception) when (JsInteropFailure.IsUnavailable(exception) && !cancellationToken.IsCancellationRequested), returnsdefault(:38-43); its comment lists the cases as prerender, a torn-down circuit, a throwing browser API, or the host's JS interop timeout (:40-41). Anything outside that family, and the caller's own cancellation, propagates, whichCapabilitiesJsModuleTestspins withInvokeOrDefaultAsync_WhenInteropIsUnavailable_ReturnsDefault,InvokeOrDefaultAsync_WhenTheCallerCancels_PropagatesandInvokeOrDefaultAsync_AnUnrelatedFailure_Propagates(MMCA.Common/Tests/Presentation/MMCA.Common.UI.Tests/Services/Capabilities/CapabilitiesJsModuleTests.cs:20,:37,:48).DisposeAsync()(:47) forwards to the inner module's disposal, releasing theIJSObjectReferencewhen the scope ends.
Why it's built this way: the nullable-returning signature is the load-bearing choice. Because every export is invoked as
InvokeOrDefaultAsync<bool?>or<string?>, adapters can distinguish "JS said no" (false) from "JS never ran" (null), which is howBrowserConnectivityStatusServiceknows to retry its subscription after hydration. The class doc records that this mirrorsMauiBackNavigationBridge's degradation contract and that a cancellation of the caller's own token propagates (:6-13), so both interop boundaries behave identically (ADR-042). Delegating the exception list toJsInteropFailurekeeps the best-effort set in one place rather than re-spelled as catch arms here.Where it's used: registered scoped by
AddBrowserDeviceCapabilities()(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:113) and injected intoBrowserShareService,BrowserClipboardService,BrowserExternalLinkService,BrowserAccessibilityAnnouncer,BrowserConnectivityStatusService,BrowserDevicePreferences, andBrowserLocalCacheStore.Caveats / not-in-source: it swallows the JS failure without logging (it takes no
ILogger), so a genuinely broken export is indistinguishable at runtime from an unsupported browser API.
MauiPublicLinkBuilder
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Services·MMCA.Common.UI.Maui/Services/MauiPublicLinkBuilder.cs:14· Level 1 · class (sealed)
- What it is: the native-head implementation of
IPublicLinkBuilder. It turns a relative path into an absolute URL rooted at the public web app, so a link the user shares or copies from the device points at the public site rather than the WebView's internal origin. - Depends on:
IPublicLinkBuilder(MMCA.Common.UI.Services,MMCA.Common.UI.Maui/Services/MauiPublicLinkBuilder.cs:2,:14);Microsoft.Extensions.Configuration.IConfiguration(:1,:24); BCLUri. - Concept introduced, per-head override of a shared UI service. On a browser head the default
NavigationPublicLinkBuildercan resolve against the current origin, because that origin IS the public site. A MAUIBlazorWebViewreports an internal shell address that is meaningless once pasted into a message, so this head substitutes a base URL pinned in the head's embeddedappsettingsunderPublicSite:BaseUrl(:6-13). The override works only because it is registered with a plainAddafterAddUISharedand after any module registration that supplies a builder of its own, so last-registration-wins (:9-12, and the DI doc atMMCA.Common.UI.Maui/DependencyInjection.cs:153-158).[Rubric §25, Navigation & IA]assesses whether links resolve to real destinations regardless of where they were produced; that is exactly what this builder guarantees.[Rubric §26, Front-End Security]applies because the shared URL is bound to one configured host instead of whatever origin the WebView happens to report. - Walkthrough
BaseUrlConfigKey = "PublicSite:BaseUrl"(MMCA.Common.UI.Maui/Services/MauiPublicLinkBuilder.cs:17): apublic const, so a head can reference the same key when it validates its own configuration.- The constructor (
:24-33): null-guards the configuration (:26), reads the key (:28), and throwsInvalidOperationExceptionwhen it is missing or blank (:29-31), a fail-fast that stops a misconfigured build from silently emitting broken share links. Otherwise it parses the value as an absoluteUriinto the readonly_baseUrlfield (:19,:32). BuildAbsolute(string relativePath)(:36-41): guards withArgumentException.ThrowIfNullOrWhiteSpace(relativePath)(:38), then combines the path onto the base via theUri(baseUri, relative)constructor (:40).
- Why it's built this way:
UriKind.Absoluteat construction plus the blank check means a badPublicSite:BaseUrlfails once, at container build, rather than producing a plausible but wrong link on every share. The class doc notes the value is pinned by the same mechanism as the head's gateway endpoint (:8-10), so one embedded configuration file defines both where the app talks and what it links to. - Where it's used: registered scoped as
IPublicLinkBuilderbyAddCommonMauiPublicLinkBuilder()(MMCA.Common.UI.Maui/DependencyInjection.cs:159-160), which replaces theTryAddScopeddefaultNavigationPublicLinkBuilderinstalled byAddUIShared(MMCA.Common.UI/DependencyInjection.cs:245). Consumed by the share, copy-link and QR affordances that pair withIShareServiceandIClipboardService.
MauiSecureTokenStore
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Services·MMCA.Common.UI.Maui/Services/MauiSecureTokenStore.cs:22· Level 1 · class (sealed)
- What it is: the raw half of the MAUI token pipeline, an
ISecureTokenStorethat keeps the access and refresh tokens in MAUISecureStorage(Android Keystore, iOS Keychain, Windows DPAPI) with every single call wrapped so an OS-invalidated entry can never crash the app. It has no freshness semantics: it reads back exactly what was written. - Depends on:
ISecureTokenStore(MMCA.Common.UI.Services.Auth,MMCA.Common.UI.Maui/Services/MauiSecureTokenStore.cs:1,:22); MAUI EssentialsSecureStorage.Default; BCLTask. It depends on nothing else, which is the point of the split described below. - Concept introduced, fail-to-signed-out, the recovery posture for platform secure storage. Keystore and Keychain entries are invalidated by the OS on its own schedule: an Android backup restored onto a new device, a security patch that rotates the master key, a biometric enrolment change. The raw APIs then throw a platform-specific exception rather than returning nothing, and an unhandled throw in a token read happens on launch, which bricks the app until it is reinstalled (
:8-15). The class therefore turns every failure into the one state that is always recoverable by the user: signed out. The second idea here is the acyclic split the interface exists for:ITokenStorageServicedepends onITokenRefresher, which depends on this raw store, so the graph runs storage to refresher to raw store with no loop and no runtime re-entrancy (MMCA.Common.UI/Services/Auth/Tokens/ISecureTokenStore.cs:4-9).[Rubric §11, Security]assesses whether credentials are protected at rest with platform-appropriate mechanisms; using the enclave-backed store rather than plain preferences is that.[Rubric §26, Front-End Security]assesses client-side credential handling specifically; the invariant that a failed write leaves no tokens (never a stale pair) is the security-relevant half.[Rubric §29, Resilience & Business Continuity]assesses graceful degradation; one clean re-login is the designed worst case. - Walkthrough
AccessTokenKey/RefreshTokenKey(MMCA.Common.UI.Maui/Services/MauiSecureTokenStore.cs:24-25): the twoauth_*entry names.GetAccessTokenAsync()/GetRefreshTokenAsync()(:28,:31): thin forwards to the privateGetAsync.SetTokensAsync(string accessToken, string refreshToken)(:34-53): writes the refresh token first, then the access token, with both writes inside onetry(:40-44). Any failure drops both entries viaTryRemoveand rethrows (:46-52). The inline comment (:36-39) records the bug this shape fixes: a failing refresh write used to escape before the guard was entered, leaving the OLD pair in place, so the app held a stale access token it believed was current until a manual sign-out.ClearTokensAsync()(:56-63): twoTryRemovecalls and a completed task, never throwing. The comment states the reasoning plainly (:58-59): an entry that cannot be deleted is one the OS already invalidated, which is the outcome the caller asked for.GetAsync(string key)(:69-85): returnsSecureStorage.Default.GetAsync(key)(:73), and on any exception removes the entry and returnsnull(:82-83), so the next write starts from a clean key. The catch is a barecatchunder a scoped#pragma warning disable CA1031(:75,:77) because the thrown type differs per OS and none of them are recoverable here. The comment also records that this store takes noILogger(it is constructed with no dependencies), so the swallow is documented in code rather than reported (:79-81).SetAsync(string key, string value)(:91-104): writes (:95), and on failure removes the key and retries the write once (:101-102). A second failure propagates, because a caller must never believe a token was persisted when it was not (:88-89).TryRemove(string key)(:107-120): best-effort delete; a delete that itself throws is already the goal, and the nextSetAsyncoverwrites the entry anyway (:117-118).
- Why it's built this way: the asymmetry between reads and writes is the design. A failed read is survivable by returning
null(whichISecureTokenStorealready documents as "no token stored",MMCA.Common.UI/Services/Auth/Tokens/ISecureTokenStore.cs:18-22), so it is swallowed. A failed write is not survivable silently, so it propagates, but only after storage has been forced into the clean signed-out state. Remove-then-retry on write is the concrete remedy for the common cause: an entry whose encryption key the OS rotated cannot be overwritten in place but can be recreated. - Where it's used: registered scoped as
ISecureTokenStorebyAddCommonMauiTokenStorage()(MMCA.Common.UI.Maui/DependencyInjection.cs:124), alongside the layer above it,SecureStoreTokenStorageService, registered as the scopedITokenStorageService(:118). The browser hosts have no equivalent: they hold the access token in memory and keep the refresh token in an HttpOnly cookie, so they implement no raw store at all (MMCA.Common.UI/Services/Auth/Tokens/ISecureTokenStore.cs:10-14).
MauiAppUserAgentHandler
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Services·MMCA.Common.UI.Maui/Services/MauiAppUserAgentHandler.cs:14· Level 1 · class (internal sealed partial)
- What it is: a
DelegatingHandlerthat stamps the native app'sUser-Agent(for exampleAtlDevCon/1.9.2 (Android 15; MmcaApp)) on every"APIClient"request (MMCA.Common.UI.Maui/Services/MauiAppUserAgentHandler.cs:5-13). The server records that header on the refresh session at login, register and refresh, so the signed-in devices list reads "{App} app on {Platform}" instead of "Unrecognized device". A MAUI head otherwise sends no header; browser heads get the visitor's own throughBrowserOriginHandler. - Depends on:
DelegatingHandler(BCL),AppUserAgent.BuildfromMMCA.Common.UI.Services.Auth.Devices(:1,:21), and MAUIAppInfoandDeviceInfo(:21-25). - Walkthrough
UserAgent(:21): astatic readonly Lazy<string>built once per process fromAppInfo.Name,AppInfo.VersionString,DeviceInfo.Platform.ToString()andDeviceInfo.VersionString. None can change while the app runs, andAppUserAgent.Buildalready sanitizes them into a legal header value (doc comment:16-20).SendAsync(...)(:28-38): null-checks the request, callsrequest.Headers.UserAgent.Clear(), thenTryAddWithoutValidation("User-Agent", UserAgent.Value), then forwards tobase.SendAsync. It replaces rather than appends, because the platform handler's own default (Dalvik/...,CFNetwork/...) would otherwise sit beside it and the server stores the header as one string.
- Where it's used:
AddCommonMauiAppUserAgent()registers it transient and appends it to the"APIClient"pipeline withAddHttpMessageHandler(MMCA.Common.UI.Maui/DependencyInjection.cs:177-182). It must be called afterAddUIShared, which registers the"APIClient"itself (:160-163). - Caveats / not-in-source: the class is
internal, so consumers reach it only through the registration extension.
MauiDeviceMetadataReporter
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Services·MMCA.Common.UI.Maui/Services/MauiDeviceMetadataReporter.cs:22· Level 1 · class (internal sealed partial, primary constructor)
- What it is: the native
IDeviceMetadataReporter. It reads the device from MAUIDeviceInfo(name, model, manufacturer, platform, idiom as the form factor, physical or virtual) plus a per-install id, andPUTs that description toauth/sessions/current/deviceover the authenticated"APIClient", whose bearer token names the refresh session the server records it on (MMCA.Common.UI.Maui/Services/MauiDeviceMetadataReporter.cs:8-12). The result is a signed-in devices list that names the phone itself, a level of detail the user-agent header fromMauiAppUserAgentHandlercannot carry. - Depends on:
IDeviceMetadataReporter(MMCA.Common.UI.Services.Auth.Devices,:3,:25),DeviceMetadata(MMCA.Common.Shared.Auth,:2,:34-41),IDevicePreferences(:4,:24) for the install id,IHttpClientFactoryandILogger<MauiDeviceMetadataReporter>, all three taken by the primary constructor (:22-25); MAUI EssentialsDeviceInfo;System.Net.Http.Jsonand source-generated[LoggerMessage]partials. - Concept introduced, a per-install id that is not a hardware id. iOS exposes no stable device identifier, so the reporter mints a random
Guidon first use and keeps it in device preferences under its own key,mmca.device.installationId(:27,:68-79). A GUID per install is enough to tell two phones of the same model apart (:14-15). It is deliberately not the push installation id kept byMauiPushRegistrationService, because the push service replaces that id when the server reports a collision (:15-17), and a device description must not change identity under it.[Rubric §29, Resilience & Business Continuity]assesses graceful degradation.ReportAsyncnever throws: a non-success status and any exception both log and answerfalse(:49-55,:59-66), the session keeps its user-agent description, and thefalseis what lets the refresh backfill try again (:17-18). The catch-all sits under a scoped#pragma warning disable CA1031with the reason inline: the report is best-effort (:59-61).[Rubric §13, Observability & Operability]assesses diagnosable failure paths. Both failures log at Warning through source-generated[LoggerMessage]methods, and the rejection carries the HTTP status code (:81-85).
- Walkthrough
InstallationIdKey(:27): the private preference key,mmca.device.installationId.ReportAsync(CancellationToken = default)(:30-66): builds aDeviceMetadatafrom the install id and sixDeviceInfo.Currentvalues (Name,Model,Manufacturer, andPlatform,Idiom,DeviceTypeas strings) (:34-41); creates the named"APIClient"(:43) andPutAsJsonAsyncs the record to the relativeauth/sessions/current/deviceURI (:44-47). A non-success status logsLogReportRejectedand returnsfalse(:49-55); the inline comment names the expected 404 cases, a token minted before the session id (sid) claim shipped or a session that just ended, both fixed by the next refresh (:51-52). Success returnstrue(:57).GetOrCreateInstallationIdAsync(CancellationToken)(:68-79, private): returns the stored id when non-blank (:70-74), otherwise createsGuid.NewGuid().ToString("N"), persists it throughIDevicePreferencesand returns it (:76-78).- Two
[LoggerMessage]partials at Warning: report rejected with a status code (:81-82) and report failed (:84-85).
- Why it's built this way: a browser session is described well enough by its user agent, so the web heads keep the inert
NullDeviceMetadataReporterregistered byAddDeviceCapabilityDefaults()(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:70-72); only the native head has richer facts to send. Sending them over the session's own bearer token means the server needs no device id in the URL: the token already names the session. The per-head override follows the same last-registration-wins rule as every other capability (ADR-042). - Where it's used: registered singleton as
IDeviceMetadataReporterbyAddMauiDeviceCapabilities()(MMCA.Common.UI.Maui/DependencyInjection.cs:87); the comment above it (:76-79) records the two triggers and why the lifetime is singleton: the once-per-process backfill is tracked per reporter instance. The triggers are the sign-in path,AuthUIServicethroughDeviceMetadataReporting.ReportAsync(MMCA.Common.UI/Services/Auth/AuthUIService.cs:531), and the token refresh,SecureStoreTokenStorageServicethroughDeviceMetadataReporting.ReportOncePerProcessAsyncuntil one report succeeds (MMCA.Common.UI/Services/Auth/Tokens/SecureStoreTokenStorageService.cs:141). - Caveats / not-in-source: the server handler for
auth/sessions/current/deviceand the columns it writes are not in this class; they belong to the auth sessions code (Group 8). The class isinternal, so a consumer reaches it only through the registration extension.
MauiPushRegistrationService
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.Notifications·MMCA.Common.UI.Maui/Capabilities/Notifications/MauiPushRegistrationService.cs:18· Level 2 · class (sealed partial, primary constructor,IDisposable)
- What it is: the MAUI implementation of
IPushRegistrationService(ADR-044): it orchestrates registering this device with the server by asking the app for notification permission and a platform push token, minting and remembering a stable installation id, and syncing that pair to the API'sNotifications/Devicesendpoints. Registration and unregistration are serialized behind one one-slotSemaphoreSlim(MauiPushRegistrationService.cs:26), which is why the class also implementsIDisposable(:22,:75). - Depends on:
IPushDeviceTokenProvider(the app-supplied permission prompt and token source),IHttpClientFactory,IDevicePreferences(durable storage for the installation id), andILogger<MauiPushRegistrationService>, all four taken by the primary constructor (MauiPushRegistrationService.cs:18-22); plusPushDeviceToken,System.Net.Http.Json,System.Threading.SemaphoreSlim, and source-generated[LoggerMessage]partials. - Concept introduced, the orchestrator adapter. Every other native adapter in this unit wraps one platform static. This one wraps nothing: it is a composition of three injected services plus an HTTP call, and it is the type that makes the two-part push design from
IPushDeviceTokenProviderconcrete. The framework ships the whole registration pipeline (this class), the app ships the credentialed token source, and until it does,GetTokenAsyncreturnsnullandRegisterCoreAsyncexits at its first check (MauiPushRegistrationService.cs:79-83). "Wired but inert" is not a special mode, it is just this early return.- The second idea here is the client-generated installation id. The device, not the server, mints a
Guid(:190, inCreateInstallationIdAsyncat:188) and persists it in device preferences under a fixed key (:24), so one physical install keeps one server-side device row across token rotations and re-registrations. UsingPUTrather thanPOSTagainstNotifications/Devices(PutInstallationAsync,:107-118) is what makes re-registration idempotent. If the server answers409 Conflict(it already holds that id for another user's device, which a restored backup or a copied preference store can cause),RegisterCoreAsyncmints a fresh id, persists it first so later passes and the logout delete use it, and retries thePUTonce (:89-96). - The third idea is serializing the non-interactive part of registration, not just the id creation, and putting the delete behind the same lock. Two registration passes can genuinely overlap:
OnNewTokenfires one on a Firebase thread while the login pass runs one from the renderer, and with an empty preference store (an iOS reinstall keeps the Keychain session but not the preferences) both would mint an installation id andPUTit, leaving two server rows for one device (:39-43). The remark also records why a lock around id creation alone is not enough: both passes would stillPUT, one with a stale id. SoRegisterAsyncholds_registrationacross the entireRegisterCoreAsynccall and releases it in afinally(:55-63). The permission prompt is the one step kept outside the lock: it runs before the wait and has no time bound, so a user still reading the dialog never holds up a sign-out, while everything inside the lock is non-interactive and bounded (:45-48,:54).UnregisterAsynctakes the same lock (:137), and its remark gives the sign-out race it closes: a registration still in flight (a FirebaseOnNewTokenpass) could otherwisePUTafter theDELETEand leave a live device row bound to the signed-out user, and waiting for it also means the delete names the id that registration settled on, including one it minted after a 409 (:122-125). That wait is bounded byUnregisterLockWait, five seconds, well under the ten-second sign-out step budget (:28-32); on timeout theDELETEstill goes out for the stored id without the lock, because deleting a row a stuck pass may still touch is the lesser risk than leaving it bound to the signed-out user (:127-130,:137-153). [Rubric §29, Resilience & Business Continuity]assesses degradation: registration is explicitly a best-effort side channel that never throws (:16). Both public methods funnel every exception into a warning log and afalseor void return (:66-71,:156-160), so a failed registration can never break a login, a sign-out or a page render. Because the permission call and each semaphore wait sit inside their method's outertry(:52-55,:135-137), a cancelled wait is caught the same way.[Rubric §13, Observability & Operability]assesses diagnostics quality. All four failure paths log through source-generated[LoggerMessage]methods at Warning (:195-205), and a rejected registration logs the actual HTTP status code, taken from the final attempt after any conflict retry (:100), which is the difference between a debuggable failure and a silent one.[Rubric §11, Security]assesses credential handling. The class holds no push credentials at all: it receives an already-minted platform token and posts it over the authenticated"APIClient"HTTP client (:86).
- The second idea here is the client-generated installation id. The device, not the server, mints a
- Walkthrough
- The primary constructor (
MauiPushRegistrationService.cs:18-22) takes the four dependencies;InstallationIdKeyis the fixed preference keymmca.push.installationId(:24);_registrationis aSemaphoreSlim(1, 1)(:26);UnregisterLockWaitis aninternalinit-only five-second bound (:32). IsSupported(MauiPushRegistrationService.cs:35): a constanttrue.RegisterAsync(CancellationToken = default)(MauiPushRegistrationService.cs:50): awaits the provider'sRequestPermissionAsync(:54), then_registration.WaitAsync(:55), runsRegisterCoreAsyncand releases the semaphore in afinally(:56-63); any exception is logged and turned intofalse(:66-71).Dispose()(MauiPushRegistrationService.cs:75): disposes the semaphore.RegisterCoreAsync(CancellationToken)(MauiPushRegistrationService.cs:77, private): gets the token and returnsfalseif there is none (:79-83); resolves or creates the installation id (:85); creates the named"APIClient"in ausing(:86); callsPutInstallationAsync(:87); onHttpStatusCode.Conflictcreates a fresh installation id andPUTs again once (:89-96); logs and returnsfalsewhen the final status is outside 200-299 (:98-102), otherwisetrue(:104).PutInstallationAsync(HttpClient, string, PushDeviceToken, CancellationToken)(MauiPushRegistrationService.cs:107, private static):PUTs an anonymous body of installation id,Platform, andPushChannelto the relativeNotifications/DevicesURI (:113-116), disposes the response, and returns only itsHttpStatusCode(:117).UnregisterAsync(CancellationToken = default)(MauiPushRegistrationService.cs:133): waits on_registrationfor at mostUnregisterLockWait(:137), logs when the wait timed out (:138-141), runsUnregisterCoreAsynceither way and releases the semaphore in afinallyonly when it was taken (:143-153); any exception is logged as an unregistration failure (:156-160).UnregisterCoreAsync(CancellationToken)(MauiPushRegistrationService.cs:163, private): reads the stored installation id and returns early when there is none (:165-169); otherwiseDELETEsNotifications/Devices/{id}with the id URL-escaped over the"APIClient"(:171-174). It deliberately does not clear the stored id, so a later re-register reuses the same installation.GetOrCreateInstallationIdAsync(CancellationToken)(MauiPushRegistrationService.cs:177, private): returns the stored id when non-blank (:179-183), else delegates toCreateInstallationIdAsync(:185).CreateInstallationIdAsync(CancellationToken)(MauiPushRegistrationService.cs:188, private): generatesGuid.NewGuid().ToString("N"), persists it throughIDevicePreferences, and returns it (:190-192). Both id methods are reached only fromRegisterCoreAsync, so they always run under the semaphore.- Four
[LoggerMessage]partial declarations at Warning level (MauiPushRegistrationService.cs:195-205): registration rejected with a status code, registration failed, unregistration lock wait timed out, unregistration failed. - Tests:
MauiPushRegistrationServiceTestscompiles this file as a linked source (MMCA.Common/Tests/Presentation/MMCA.Common.UI.Tests/MMCA.Common.UI.Tests.csproj:30) and pins the conflict retry, the single-retry cap, keeping the id on a non-conflict rejection, the delete waiting for a registration in flight, the delete not waiting on an open permission prompt, the delete still going out past the lock bound, and the permission request coming before the token fetch (MMCA.Common/Tests/Presentation/MMCA.Common.UI.Tests/Services/Capabilities/Notifications/MauiPushRegistrationServiceTests.cs:50,:67,:81,:97,:123,:147,:168).
- The primary constructor (
- Why it's built this way: ADR-044. Splitting "how do I get a token" (app-owned, credentialed) from "how do I tell the server about it" (framework-owned, this class) is what lets the framework ship a complete, tested push path that carries no vendor keys, and the registration comment in the composition root says exactly that (
MMCA.Common.UI.Maui/DependencyInjection.cs:98-100). - Where it's used: registered as a singleton by
AddMauiDeviceCapabilities()(MMCA.Common.UI.Maui/DependencyInjection.cs:101), overridingNullPushRegistrationService(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:67). The token provider it calls staysNullPushDeviceTokenProvider(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:68) unless the app registers a credentialed one. - Caveats / not-in-source: the server side of
Notifications/Devices(thePUT/DELETEhandlers and the device table) is not in this class or this chapter; it lives in the Notifications module. The"APIClient"named client's base address and auth handler are configured by the host, not here.
IDeepLinkDispatcher
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Navigation·MMCA.Common.UI/Services/Capabilities/Navigation/IDeepLinkDispatcher.cs:10· Level 2 · interface
- What it is: the single funnel between native navigation sources (notification taps, home-screen app actions, app links, QR scans) and Blazor routing (
IDeepLinkDispatcher.cs:3-9). Native code publishes an app-relative route; the sharedDeepLinkListenercomponent either receives it live or drains it from a pending buffer after a cold start. - Depends on: DeepLinkRouteEventArgs, the event payload;
System.EventHandler<T>otherwise. - Concept introduced: the live-event-or-buffered-cold-start handoff, the interesting mechanic of the deep-link design. When a listener is attached the route is raised live through
RouteRequested; when the app was cold-started by the tap and no listener exists yet, the route is buffered last-write-wins with capacity one forTryConsumePendingto drain after first render (IDeepLinkDispatcher.cs:5-9,:15-22). One interface covers both the warm and the cold navigation case.[Rubric §25, Navigation & IA]§25 assesses coherent, deep-linkable navigation. Every native entry point converges on this one contract, so routing behaves identically whether the app was already open or was launched by the link.[Rubric §19, State Management]§19 assesses where transient state lives. The pending route is a single-slot buffer owned by the dispatcher, a deliberately tiny piece of cross-render state rather than app-wide state.
- Walkthrough: three members.
RouteRequested(IDeepLinkDispatcher.cs:13): raised when a route is requested while a listener is attached; the contract documents that it runs on the publisher's thread, which is why the listener marshals onto the renderer.Publish(string)(:19): publishes a route request; with no listener attached the route is buffered, last-write-wins, capacity one.TryConsumePending(out string?)(:22): atomically takes the buffered pending route, if any.
- Why it's built this way: cold-start taps arrive before Blazor has rendered a listener, so a buffer is required to avoid dropping the launch route, and a single funnel keeps every native source consistent (ADR-042).
- Where it's used: implemented by DeepLinkDispatcher and consumed by the
DeepLinkListenercomponent, which subscribes and drains the buffer on first render (MMCA.Common.UI/Components/Capabilities/DeepLinkListener.razor:22-27) and unsubscribes on dispose (:30). Native publishers resolve it from the MAUI root service provider (MMCA.Common.UI.Maui/DeviceCapabilitiesInitializer.cs:25,:40), and LocalNotificationRequest.DeepLinkRoutefeeds routes into it on notification tap.
DeepLinkDispatcher
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities.Navigation·MMCA.Common.UI/Services/Capabilities/Navigation/DeepLinkDispatcher.cs:22· Level 3 · class
- What it is: the default IDeepLinkDispatcher. It hands a route to exactly one listener, the most recently attached one still subscribed, or, with none attached, buffers the most recent route (capacity one) so a cold-start tap survives until the Blazor router renders (
DeepLinkDispatcher.cs:250-271). It also drops a repeat of the same route inside a two-secondDuplicateWindow(:28,:253-256), andPublishrejects any route that is not app-relative before it does any of that (:232-237). A staticTryComposeRoutelets a platform head build that route from a link's encoded parts and drop a hostile one without throwing (:161-175). Registered as a singleton so native callers can resolve it from the MAUI root provider. - Depends on: IDeepLinkDispatcher, the contract it implements, and DeepLinkRouteEventArgs, what it raises; the BCL
System.Threading.Locktype for its gate andTimeProviderfor the duplicate window (:30,:45-46). - Concept introduced: choosing the listener inside the lock, and with it the modern
System.Threading.Lockand an event with explicit accessors. The obvious implementation snapshotsRouteRequestedinto a local, then takes a lock only to write the buffer. The source rejects that explicitly, and the comment records the interleaving it loses (DeepLinkDispatcher.cs:239-248):Publishsees no listener, the listener then subscribes, the listener drains an empty buffer, and only afterwards doesPublishwrite into a buffer nobody will read again, so the route is dropped. That race is real on a native head, where the callback thread and the first render are genuinely concurrent (the warm-boot deep link). Doing the duplicate check, the raise-or-buffer decision and the buffer write as one step under the same gate leaves only two orders: either the subscription was visible and the event fires, or it was not and the buffer write completes before the lock releases, so the listener'sTryConsumePending, which must take the same lock, finds the route. The invoke itself still happens outside the lock (:271) because a listener that navigates on that callback must not run under it. The event is not a plain multicast delegate: itsaddandremoveaccessors keep an ordered_listenerslist under the same gate (:53-81), soPublishcan invoke only the newest entry (:267). The type summary records why (:10-20): a multicast event fanned one QR scan out to everyDeepLinkListenerin the task (a recreated activity, or a Custom Tab returning into the app, leaves a second WebView), so one scan became two sponsor-visit posts and the second answered "already visited" on a first visit (A-27).[Rubric §19, State Management]§19 assesses safe transient state. The single-slot_pendingRoute(:33) is read and cleared atomically inTryConsumePending(:277-281), so a buffered route is delivered exactly once;_lastRouteand_lastRouteAt(:34-35) are written under the same gate, so a launch intent republished on activity recreation withinDuplicateWindowis dropped rather than navigated twice (:253-259).[Rubric §12, Performance & Scalability]§12 assesses lock discipline. The critical section is a clock read, a few field reads and assignments, and a list index; the listener invocation, which can trigger navigation and a render, is deliberately outside it.[Rubric §15, Best Practices & Code Quality]§15 assesses whether non-obvious code explains itself. The ten-line comment above the lock states the exact dropped-route interleaving, and the type summary names the A-27 double-delivery incident behind the one-listener and one-delivery rules, which is the kind of reasoning that is otherwise lost the first time someone "simplifies" the method.[Rubric §11, Security]§11 assesses input validation at a trust boundary.IsAppRelativeRoute(:113-136) is the SEC-Common-88 / SEC-ADC-65 fix: an exported Android activity is reachable by an explicit intent from any app on the device, which bypasses the manifest filter's scheme and host constraints, so a hostile caller can handPublisha route like//attacker.example/pthat resolves protocol-relative against the WebView base and leaves the app origin. The check is on the route's shape only (a single leading slash, no backslash, no control character, no scheme), never on the originating host, because a legitimate deep link (a home-screen widget) may have a placeholder host. A shape violation makesPublishthrowArgumentException(:232-237) instead of forwarding the route to navigation.TryComposeRoute(:161-175) adds a second check on the path once percent-decoded (IsSafeOnceDecoded,:181-196), because the router decodes before it matches: an encoded control character (%00raised the unhandled-error bar on MAUI and left every later deep link dead), an encoded backslash, an encoded slash that makes the path protocol-relative (/%2F...) or a..segment is dropped, while the route that is published stays encoded (:154-158).
- Walkthrough: the duplicate window and fields, the two constructors, the event, static validation helpers, then two instance methods.
DuplicateWindow(DeepLinkDispatcher.cs:28):internal static readonly, two seconds; short enough that a deliberate rescan of the same code still navigates, long enough to cover an activity recreation (:24-27)._timeProvider(:30),_gate(:31, aLockinstance, the typed C# 13 lock rather than locking on a plainobject),_listeners(:32, the ordered subscription list),_pendingRoute(:33, the single-slot buffer), and_lastRoute/_lastRouteAt(:34-35, the last published route and when, starting atDateTimeOffset.MinValue).- Constructors (
:38-46): the parameterless one chains toTimeProvider.System(:38-41); the other takes aTimeProviderand throwsArgumentNullExceptionon null (:45-46). The registration is by implementation type, so the container must pick a constructor whether or not the host registers aTimeProvider, whichDeepLinkDispatcherTests.Registration_ResolvesWithOrWithoutARegisteredClockpins (MMCA.Common/Tests/Presentation/MMCA.Common.UI.Tests/Services/Capabilities/DeepLinkDispatcherTests.cs:252). RouteRequestedevent (:53-81):addignores null, then under the gate removes and re-appends the handler so a re-subscribing listener moves to the end (:55-67);removeignores null and removes it under the gate (:69-80).IsAppRelativeRoute([NotNullWhen(true)] string?)(:113-136):falsefor null or whitespace (:115-118);falsefor any backslash or control character (:123-126);falsewhenStartsWithSchemematches (:128-131); otherwisetrueonly when the route starts with exactly one/followed by a non-slash character (:135). The[NotNullWhen(true)]annotation (:113) tells the compiler's flow analysis that atrueresult proves the route non-null, so a caller can guard with this check and pass the value straight toPublishwith no separate null test (:94-95).TryComposeRoute(string?, string?, string?, [NotNullWhen(true)] out string?)(:161-175): the head-facing entry point. It joins the encoded path,?plus the encoded query when present, and#plus the encoded fragment when present (:167-169), dropping the link's scheme and host, so the path is the route (:138-141). It answers the route only when the path is non-null, the joined value passesIsAppRelativeRoute, and the path passesIsSafeOnceDecoded(:171-174). The parts stay encoded so a%3For%23in the path cannot turn into a query or a fragment, and the fragment is kept because a guest-order or confirm-email token rides in it (:149-152).IsSafeOnceDecoded(string)(:181-196, private):Uri.UnescapeDataStringthe path (:183), then reject a backslash or control character (:185-188), a//opening (:190-193) and any..segment (:195).StartsWithScheme(string)(:198-220): a private RFC 3986 scheme check,ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) ":", used only byIsAppRelativeRoute.Publish(string)(:228-272): validates non-null/whitespace withArgumentException.ThrowIfNullOrWhiteSpace(:230), then throwsArgumentExceptionwhenIsAppRelativeRouterejects the route (:232-237). Insidelock (_gate)it reads the clock and returns silently when the route ordinally equals_lastRouteand less thanDuplicateWindowhas elapsed (:252-256), otherwise records the route and time (:258-259); with no listener it stores the route and returns while still holding the gate (:261-265), and otherwise takes the newest listener,_listeners[^1](:267). It invokes that one listener outside the lock with a new DeepLinkRouteEventArgs (:271). A buffered route also counts as the last route, so a repeat inside the window is dropped rather than overwriting the buffer.TryConsumePending(out string?)(:275-284): takes and clears the pending route under the lock (:277-281) and returns whether one was present (:283).
- Why it's built this way: native taps can arrive on any thread and either before or after the listener attaches, so the dispatcher must be both thread-safe and cold-start-safe. A singleton with a locked single-slot buffer is the minimal design that satisfies both (ADR-042). One route is one navigation: delivering to the newest listener only and suppressing a same-route repeat inside the window keep a recreated activity or a second WebView from turning one scan into two side effects (A-27). The route-shape check sits in
Publishrather than at each platform head because that is the one boundary every untrusted platform callback crosses (SEC-Common-88 / SEC-ADC-65);TryComposeRouteasks the same question up front so a native callback can drop a hostile link silently instead of throwing (:152). - Where it's used: registered as the singleton IDeepLinkDispatcher in
AddDeviceCapabilityDefaults(MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:93); published into by the MAUI notification-tap bridge (MMCA.Common.UI.Maui/DeviceCapabilitiesInitializer.cs:30-40) and byPlatformDeepLinksin UI.Maui, which callsTryComposeRouteon an Android intent's or an iOSNSUrlComponents' encoded parts and publishes only on success (MMCA.Common.UI.Maui/Capabilities/Navigation/PlatformDeepLinks.cs:37-38,:60-65,:69-77); the ADC Android and iOS heads hand their links to it (MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI/Platforms/Android/MainActivity.cs:71,:79; on iOS the scene delegate, for a cold launch and a running app,MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI/Platforms/iOS/SceneDelegate.cs:37,:53); consumed by theDeepLinkListenercomponent; exercised byDeepLinkDispatcherTests(on aFakeTimeProvider,DeepLinkDispatcherTests.cs:20),DeepLinkRouteShapeTests,DeepLinkDecodedPathTests, andDeepLinkListenerTests(see Group 27).
DependencyInjection
MMCA.Common.UI ·
MMCA.Common.UI.Services.Capabilities·MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:25· Level 4 · class (static,extension(IServiceCollection)block)
- What it is: the composition root for this entire group. One static class holding two registration helpers:
AddDeviceCapabilityDefaults()fills the container with a safe default for every capability contract, andAddBrowserDeviceCapabilities()overrides the subset a browser can really do (DependencyInjection.cs:17-24). - Depends on: every contract in this chapter, imported through the per-concern capability namespaces (
Accessibility,Auth,DeviceStatus,DeviceStorage,Files,Geo,Interop,Media,Navigation,Notifications,DependencyInjection.cs:4-13), plusMMCA.Common.UI.Services.Auth.Devicesfor the device-metadata reporter pair (:3);Microsoft.Extensions.DependencyInjectionand itsExtensionsnamespace for theTryAdd*helpers (:1-2). - Concept introduced: two-phase, last-registration-wins capability selection. This is the mechanism every other section in this chapter refers back to, so read the two phases as one story. Phase one:
AddUISharedcallsAddDeviceCapabilityDefaults()(MMCA.Common.UI/DependencyInjection.cs:266), whichTryAdd-registers a null or neutral implementation for every contract (DependencyInjection.cs:42-97).TryAddis what makes this idempotent: a host that callsAddUISharedtwice does not double-register, and an app that pre-registered its own implementation beforeAddUISharedkeeps it (DependencyInjection.cs:18-21,:30-31). Phase two: the head calls its own override helper afterAddUIShared, using a plainAddrather thanTryAdd, and because .NET DI resolves the last registration for a single-service request, the real implementation wins (DependencyInjection.cs:20-21). Browser overrides live in this same file; native overrides ship separately in theMMCA.Common.UI.Mauipackage asAddMauiDeviceCapabilities(DependencyInjection.cs:21-23), which is what keepsMMCA.Common.UIfree of any MAUI reference.[Rubric §1, SOLID]§1 assesses SOLID adherence. Open/Closed shows up concretely: adding a fourth head means adding a newAddXDeviceCapabilities()helper, not editing shared components or this defaults table.[Rubric §2, Design Patterns]§2 assesses whether classic patterns earn their keep. This is Strategy selected by the container, with Null Object as the default strategy (see NullGeocodingService for the null-object shape taught in full).[Rubric §22, Responsive / Cross-Browser]§22 assesses graceful behavior across heads. The point of the defaults table is that no shared component can ever fail to resolve a capability, whichever head it renders in, including during prerender before JS exists.[Rubric §14, Testability]§14 assesses how easily the production wiring can be reproduced in a test.AddDeviceCapabilityDefaults()is public precisely so a consumer's bUnit base can register the same set the host gets, instead of hand-mirroring a list that rots the moment a new contract ships here (DependencyInjection.cs:33-36).[Rubric §33, Developer Experience]§33 assesses how obvious the right thing is to do. The ordering rule (overrides afterAddUIShared) is stated in the class XML doc rather than left to be discovered, and each non-obvious lifetime choice carries an inline comment at its registration.
- Walkthrough
public static class DependencyInjection(DependencyInjection.cs:25) with a singleextension(IServiceCollection services)block (:27), the C# extension-member syntax this workspace uses for DI registration throughout.AddDeviceCapabilityDefaults()(DependencyInjection.cs:39) is public, and the XML doc says why (:33-36): consumer bUnit test bases call it directly, which they do atMMCA.ADC/Tests/Modules/Conference/MMCA.ADC.Conference.UI.Tests/BunitTestBase.cs:41,MMCA.ADC/Tests/Modules/Identity/MMCA.ADC.Identity.UI.Tests/BunitTestBase.cs:18, andMMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.UI.Tests/Components/ComponentsSnapshotTests.cs:69. Production hosts still get it throughAddUIShared. The body is grouped by lifetime and rationale:- Stateless no-op singletons, sixteen
TryAddSingletoncalls (DependencyInjection.cs:42-57), covering connectivity, share, clipboard, haptics, map navigation, geolocation, geocoding, external links, text-to-speech, accessibility announcements, local notifications, screenshots, battery, biometrics, speech-to-text, and the external auth broker, followed by the local cache store (:62). - Passkeys (ADR-139): IPasskeyCapability defaults to UnavailablePasskeyCapability (
:61), and the comment says what that buys: unless a browser head overrides it, a MAUI head (no native passkey support yet) hides the passkey button and the add-passkey action (:59-60). - Push (ADR-044): IPushRegistrationService and IPushDeviceTokenProvider both default to inert (
:67-68), with the comment recording the deliberate split, UI.Maui overrides the registration service while the app overrides the token provider once real FCM or APNs credentials exist (:64-66). - Device metadata:
IDeviceMetadataReporterdefaults toNullDeviceMetadataReporter(:72), because web sessions are described from the user agent; UI.Maui overrides it with MauiDeviceMetadataReporter (:70-71). - Media picking (ADR-045): IMediaPickerService defaults to null because web heads render
InputFileinstead (:74-75). - Barcode scanning: IBarcodeScannerService defaults to null because there is no browser primitive, and the native override is opt-in (
UseCommonBarcodeScannerin UI.Maui), so even a MAUI head keeps the default until it asks for the camera (:77-80). - Sensitive file hand-off (the personal-data export): ISensitiveFileSaver defaults to NullSensitiveFileSaver, which presents nothing (
:85); the comment records that browser heads save throughfile-download.jswhile MAUI heads stage the file in their own purged folder and share it (:82-84). IDevicePreferencesis the oneTryAddScoped(:89), and the comment says why: on Blazor Server the in-memory fallback must hold per-circuit (per-user) state, never cross-user state (:87-88).- IDeepLinkDispatcher is a singleton by contract (
:93) because native code publishes into it from outside any scope; web heads have no native publishers, so the shared buffer is simply inert there (:91-92). - IAppLifecycleNotifier is registered singleton for the same reason (
:97), stated by a comment reusing the deep-link dispatcher's rationale: the native window's background/foreground callbacks run outside any scope, and the app-lock overlay listens for them so it can re-arm (:95-96).
- Stateless no-op singletons, sixteen
AddBrowserDeviceCapabilities()(DependencyInjection.cs:110) is what a Blazor Server or WebAssembly host calls afterAddUIShared. It registers CapabilitiesJsModule scoped first so all browser services share one JS module import per scope or circuit (:112-113), then overrides nine contracts withAddScoped(:115-123): share, clipboard, external links, accessibility announcer, connectivity, device preferences, local cache store, map navigation, and the sensitive file saver (BrowserSensitiveFileSaver). A tenth, IPasskeyCapability to BrowserPasskeyCapability, is scoped because it holds the circuit's WebAuthn autofill callback (:125-126). Everything else keeps its null default, which is why web heads have no geolocation, geocoding, speech, media picker, device-metadata report, or local notifications.
- Why it's built this way: ADR-042 is cited on the class itself (
DependencyInjection.cs:18), with ADR-044 and ADR-045 cited inline for the push and media groups. TheTryAdd-then-Addordering is what lets one shared component tree run on three heads with zero host-detection code, and the scoped-versus-singleton split is driven by one question asked per contract: does this hold per-user state on a Blazor Server circuit? - Where it's used: called by
AddUIShared(MMCA.Common.UI/DependencyInjection.cs:266). The public browser helper is called on the Blazor Server side by the shared web-host composition inMMCA.Common.UI.Web, right afterAddUIShared(MMCA.Common.UI.Web/Hosting/BlazorWebHostExtensions.cs:107-109), and directly by each WebAssembly client: ADC atMMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI.Web.Client/Program.cs:37and Store atMMCA.Store/Source/Hosts/UI/MMCA.Store.UI.Web.Client/Program.cs:47. - Caveats / not-in-source: the MAUI-side helper (
AddMauiDeviceCapabilities) is not in this file; it ships in theMMCA.Common.UI.Mauipackage, which is deliberately outsideMMCA.Common.slnxand built by dedicated windows jobs (ADR-042).
NotificationTapRoute
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.Notifications·MMCA.Common.UI.Maui/Capabilities/Notifications/NotificationTapRoute.cs:21· Level 4 · class (internal static partial)
- What it is: the shape rule for the route a local notification carries to its tap (ADR-042, ADR-043). The route is checked twice: when the notification is scheduled (
EnsureSchedulable), so a caller bug fails where it was written, and when the tap arrives (TryPublish), so a route that is not safe to publish is dropped instead of thrown out of the platform's tap callback (MMCA.Common.UI.Maui/Capabilities/Notifications/NotificationTapRoute.cs:6-11). - Depends on:
DeepLinkDispatcher.TryComposeRoute, the rule it applies (:2,:80);IDeepLinkDispatcher, which it publishes into (:46,:62);Microsoft.Extensions.Logging.ILoggerand a source-generated[LoggerMessage]partial (:1,:83-84). It uses no MAUI API (:18), which is why the test project compiles it as a linked source file (MMCA.Common/Tests/Presentation/MMCA.Common.UI.Tests/MMCA.Common.UI.Tests.csproj:39-40). - Concept introduced, one rule checked at both ends of a round trip. A local notification stores its route in the platform's
ReturningDataand hands it back on tap, so the route leaves the app and comes back through a platform callback. The class applies the same predicate on the way out and on the way back, but with opposite failure modes. On the way out the caller is app code that can be fixed, so a bad route throwsArgumentExceptionat scheduling time. On the way back the caller is the platform's tap callback, where an escaping exception reaches the process-wide unhandled-error handler (:10-11), so a bad route is logged and dropped and the method returnsfalse. The predicate itself is not new: both checks areDeepLinkDispatcher.TryComposeRoute, the rule every other native entry point applies, an app-relative path whose percent-decoded path is also safe for the router (:13-15).[Rubric §11, Security]assesses input validation at a trust boundary. The tapped route is data handed back by the platform, and it is validated with the same shape and decoded-path rule as an app link or a QR scan before it can reach navigation (:56-62,:80).[Rubric §29, Resilience & Business Continuity]assesses graceful degradation.TryPublishnever throws for a bad route (:38-40): a malformed tap costs one navigation, not the process-wide unhandled-error path.[Rubric §13, Observability & Operability]assesses diagnosable failure paths. A dropped route logs one Warning carrying only the route's length (:44,:58,:83-84), so the drop is visible without writing the route itself, query and fragment included, to the log.
- Walkthrough
EnsureSchedulable(string? route)(NotificationTapRoute.cs:28-36): a no-op for anullor empty route; otherwise throwsArgumentException(parameter nameroute, message "must be an app-relative path beginning with a single '/', with no scheme, backslash or control character") whenIsPublishablerejects it (:30-35). It testsstring.IsNullOrEmpty, so a whitespace-only route counts as present and is refused.TryPublish(IDeepLinkDispatcher dispatcher, string? route, ILogger logger)(:46-64): null-guards the dispatcher and the logger (:48-49); returnsfalsewithout logging for anullor whitespace route, the ordinary tap on a notification that carries none (:51-54); logsLogDroppedRoutewithroute.Lengthand returnsfalsewhenIsPublishablerejects it (:56-60); otherwise callsdispatcher.Publish(route)and returnstrue(:62-63).IsPublishable(string route)(:70-81, private): splits at the first#into the part before it and the fragment (:72-74), splits that part at the first?into path and query (:76-78), keeping every part still encoded, and returnsDeepLinkDispatcher.TryComposeRoute(path, query, fragment, out _)(:80). Splitting rather than passing the whole string as the path is what letsTryComposeRouteapply its decoded-path check to the path alone.LogDroppedRoute(ILogger, int routeLength)(:83-84): Warning, "Dropped a notification tap whose route ({RouteLength} characters) is not an app-relative route".
- Why it's built this way:
DeepLinkDispatcher.PublishthrowsArgumentExceptionfor a route that is not app-relative, so publishing a stored route straight from the tap callback would turn a bad route into an unhandled exception on the platform's thread. AskingTryComposeRoutefirst, asPlatformDeepLinksdoes for app links (seeDeepLinkDispatcher), keeps one rule for every native source. Repeating the check at scheduling time moves the failure to the line that built the bad route, whichMauiLocalNotificationServicedocuments onScheduleAsync(MMCA.Common.UI.Maui/Capabilities/Notifications/MauiLocalNotificationService.cs:42-46). - Where it's used:
MauiLocalNotificationService.ScheduleAsynccallsEnsureSchedulableon the request'sDeepLinkRoute(MMCA.Common.UI.Maui/Capabilities/Notifications/MauiLocalNotificationService.cs:50).DeviceCapabilitiesInitializersubscribes toLocalNotificationCenter.Current.NotificationActionTapped(MMCA.Common.UI.Maui/DeviceCapabilitiesInitializer.cs:33), ignores a dismissal, and passes the tapped request'sReturningDatatoTryPublish(:36-44).NotificationTapRouteTestspins publishing an app-relative route, dropping and logging an unsafe one without throwing, ignoring a tap with no route, and both schedule-time outcomes (MMCA.Common/Tests/Presentation/MMCA.Common.UI.Tests/Services/Capabilities/Notifications/NotificationTapRouteTests.cs:44,:54,:77,:86,:94). - Caveats / not-in-source: the class is
internal, so it is reached only through those two callers. No ADR names it; the ADRs above are the ones its class doc cites.
MauiLocalNotificationService
MMCA.Common.UI.Maui ·
MMCA.Common.UI.Maui.Capabilities.Notifications·MMCA.Common.UI.Maui/Capabilities/Notifications/MauiLocalNotificationService.cs:15· Level 5 · class (sealed)
- What it is: the MAUI adapter for
ILocalNotificationService: it schedules, replaces, and cancels on-device reminders through thePlugin.LocalNotificationpackage, with no backend involvement. - Depends on:
ILocalNotificationServiceandLocalNotificationRequest;NotificationTapRoutefor the schedule-time route check (MauiLocalNotificationService.cs:50); thePlugin.LocalNotificationNuGet package (LocalNotificationCenter,NotificationRequest,NotificationRequestSchedule,AndroidScheduleOptions,MauiLocalNotificationService.cs:3-5). - Concept introduced, translation from a framework request record to a platform request object. Most adapters in this unit forward a primitive and translate a result. This one translates a whole payload in the other direction, which is exactly why
LocalNotificationRequestexists as a framework record: shared feature code never touchesNotificationRequest. Two mapping decisions are worth knowing.- The framework
Idbecomes the platformNotificationIdverbatim (MauiLocalNotificationService.cs:59), which is what makes the contract's "scheduling the same id replaces the pending entry" rule work: replacement is the platform's own id semantics, not extra bookkeeping here. - The optional
DeepLinkRouteis carried in the platform'sReturningDatafield, defaulted to an empty string when absent (:62). That is the payload the tap handler later reads. Crucially, this class does not route the tap: the class doc records that taps are routed toIDeepLinkDispatcherby the package bootstrap, not here (MauiLocalNotificationService.cs:12-13), and that bootstrap goes throughNotificationTapRoute.TryPublish(MMCA.Common.UI.Maui/DeviceCapabilitiesInitializer.cs:43). What this class does own is the other half of that rule:ScheduleAsyncrefuses a route that could never be published, documented as anArgumentExceptionso a caller bug fails when the reminder is scheduled rather than when the attendee taps it (:42-46,:50). [Rubric §26, Front-End Security]assesses permission-gated features. Permission maps to Android 13+POST_NOTIFICATIONSand iOS notification authorization (:10-11), and the adapter checks before it asks.[Rubric §17, DevOps]and[Rubric §32, Dependency & Supply-Chain]are both lightly relevant through one line of the class doc: scheduling uses inexact platform alarms deliberately, avoidingSCHEDULE_EXACT_ALARMbecause of Play policy (:11-12). That is a store-compliance constraint expressed in code, carried by a third-party package the framework pins. The cost of inexact alarms is lateness under Doze, and the plugin drops any alarm more thanAllowedDelaypastNotifyTime(default 1 minute), so the adapter widens that window to a 15-minute cap through a privateLateDeliveryWindowconstant (:17-18,:67-75): a late reminder is still useful, one past the window is stale, and the service does not know the caller's lead time.
- The framework
- Walkthrough
IsSupported(MauiLocalNotificationService.cs:21): a constanttrue.RequestPermissionAsync(CancellationToken = default)(MauiLocalNotificationService.cs:24): returnstrueimmediately ifAreNotificationsEnabled()already reports enabled (:28-31), otherwise callsRequestNotificationPermission()(:33). AnInvalidOperationExceptionis caught and reported as not permitted (:35-38).ScheduleAsync(LocalNotificationRequest request, CancellationToken = default)(MauiLocalNotificationService.cs:47): null-guards the request (:49); runsNotificationTapRoute.EnsureSchedulable(request.DeepLinkRoute), which throwsArgumentExceptionfor a route that is set but not app-relative (:50); silently returns for a delivery time at or before now (:52-55), which is where the contract's "requests in the past are ignored" rule is actually enforced; builds the platformNotificationRequestfrom the four mapped fields plus aNotificationRequestSchedulecarryingNotifyTimeand an AndroidAllowedDelayofLateDeliveryWindow(:57-77); then callsShowinside a try that swallowsInvalidOperationException, whose comment names the case as permission revoked mid-session, leaving the reminder a no-op (:79-86). The route check runs before the past-time check, so a bad route throws even for a request that would have been ignored.CancelAsync(IReadOnlyCollection<int> ids, CancellationToken = default)(MauiLocalNotificationService.cs:90): null-guards (:92), skips the platform call entirely for an empty collection, and otherwise spreads the ids into the platformCancelwith a collection expression (:94-97). The work is synchronous behind an async signature, so it returnsTask.CompletedTask(:99).CancelAllAsync(CancellationToken = default)(MauiLocalNotificationService.cs:103):CancelAll()thenTask.CompletedTask(:105-106).- None of the four methods forwards its
CancellationToken; the underlying plugin calls take none. - Tests:
MauiLocalNotificationServiceLateDeliveryTestsreads this file as an embedded resource to pin the Android late-delivery window (MMCA.Common/Tests/Presentation/MMCA.Common.UI.Tests/MMCA.Common.UI.Tests.csproj:52-53).
- Why it's built this way: ADR-042 for the per-head selection. On-device reminders need no server round trip, so the entire capability is native-only and web heads keep
NullLocalNotificationService; routing the tap through the shared dispatcher rather than through this class keeps navigation in one place regardless of which native source produced the tap. - Where it's used: registered as a singleton by
AddMauiDeviceCapabilities()(MMCA.Common.UI.Maui/DependencyInjection.cs:74), overriding the null default (MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:52). The preferred host entry point isbuilder.UseMauiDeviceCapabilities()onHostingDependencyInjection, which additionally wires thePlugin.LocalNotificationlifecycle hooks this adapter relies on (MMCA.Common.UI.Maui/DependencyInjection.cs:30-32).
⬅ ADC Application Host, UI Shell & Cross-Module Composition • Index • Common AI Integration ➡