mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-23 05:21:15 +00:00
8b6a65023f
Brings the native apps branch up to dev (NestJS-only server, MikroORM
repositories, tracked sessions, per-domain locales, the lint ratchets) and
ports its new code onto that architecture:
- server: /api/auth/native moves onto injected services. The session is
minted by the auth domain's new LoginSessionService (login bookkeeping and
SessionsService.issue in one transaction), the one-time codes live behind a
NativeHandoffStore port with a capped in-memory implementation that drops
expired codes on write instead of running a timer, both routes declare
response contracts, and the exchange answers { success: true }. Unit and
e2e suites run on createTestModule and the ORM factories.
- shared: native strings for az, et, sk and th, native wired into every
locale, the address placeholder as a full URL.
- client: the account and export changes go into dev's shared hooks
(useAccountSettings, useTripExport), the native server card is a
desktop/phone pair on useNativeServer, the hand-off call moves out of the
page hook into native/, best-effort native failures go through
reportError instead of the console, and the address screen is known to
knip and lint:i18n-keys.
- package-lock.json regenerated on Linux.
21 lines
759 B
TypeScript
21 lines
759 B
TypeScript
import { Haptics, NotificationType } from '@capacitor/haptics'
|
|
import { isNativeApp } from './platform'
|
|
import { reportNativeFailure } from './reportFailure'
|
|
|
|
const FEEDBACK: Record<string, NotificationType | undefined> = {
|
|
success: NotificationType.Success,
|
|
warning: NotificationType.Warning,
|
|
error: NotificationType.Error,
|
|
}
|
|
|
|
/**
|
|
* The short tap a native app gives when something saved, warned or failed.
|
|
* Hung off the toasts because every save and delete already reports through
|
|
* one; plain info toasts stay silent. Does nothing in a browser.
|
|
*/
|
|
export function toastHaptic(type: string): void {
|
|
const feedback = FEEDBACK[type]
|
|
if (!feedback || !isNativeApp()) return
|
|
Haptics.notification({ type: feedback }).catch(reportNativeFailure)
|
|
}
|