Compare commits

...

190 Commits

Author SHA1 Message Date
dependabot[bot] 5c001febea chore(deps): bump dotenv from 16.6.1 to 18.0.10
Bumps [dotenv](https://github.com/motdotla/dotenv) from 16.6.1 to 18.0.10.
- [Changelog](https://github.com/motdotla/dotenv/blob/master/CHANGELOG.md)
- [Commits](https://github.com/motdotla/dotenv/compare/v16.6.1...v18.0.10)

---
updated-dependencies:
- dependency-name: dotenv
  dependency-version: 18.0.10
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-11-16 19:55:34 +00:00
Maurice 9890f31d10 chore(dawarich): keep the stay naming helpers module-private 2026-11-16 16:57:03 +01:00
Maurice 04e0dc26e1 fix(dawarich): name a stay from its geocoded points when Dawarich sends a placeholder
Since 1.22 Dawarich sends a visit's display name, which is "Unknown Location"
for a visit without a place. TREK showed that as the name, although the points
recorded during the stay are reverse geocoded. A stay without a real name now
takes its place's name or address, and otherwise the city most of its points
fall in. A visit without a place also takes the middle of its points as its
coordinate.

Closes #3105
2026-11-16 16:34:47 +01:00
Maurice eb56e77600 fix(studio): hold photos back only in the export's sheets
The print-mode photos held their source back for the print view, but the
assistant also draws pages in print mode and needs its photos loaded. Only
the export's sheets now ask for it, the loader reads a minimal print
document like whenReady, and the new test helpers stay within the client's
TypeScript target and lint baseline.
2026-11-16 10:47:50 +01:00
Maurice 1a50e7f0ac fix(costs): settle up only in the currency the debts were read in
After switching the display currency the flows stayed in the old one until
the new read landed, or for good when it failed offline, and a settle-up
booked those amounts in the new currency. The ledger now remembers the
currency it read, drops answers to older reads and only settles flows read
in the one shown.
2026-11-16 10:45:24 +01:00
Maurice 2a134babbc fix(trips): keep a visit's own stay when a trip is copied
insertAssignmentCopy took stay_minutes but never wrote it, so a copied trip
fell back to the place's duration for every visit.
2026-11-16 10:45:24 +01:00
Maurice 2180175040 fix(mail-ingest): refuse an undo when the booking was moved in between
A move keeps the entry's resolution and changes only its trip and created
ids, so an undo that read them before a move landed still claimed the entry,
removed nothing and left the moved booking behind. The claim is now bound to
the trip and ids it was read with.
2026-11-16 10:45:23 +01:00
Maurice 856d1e5ea5 fix(flight-live): keep a past flight's times in its booking view
The booking dialog and the phone sheet hid their departure and arrival tiles
as soon as the store held any leg of the flight, but a leg long over or never
seen by the feed draws no live card, so such a flight showed no times at
all. Both views now hide the tiles only for legs that get a card.
2026-11-16 10:45:23 +01:00
Maurice ea5542f8eb fix(plugins): require budget_edit for a plugin switching a trip's costs mode
trips.update checked trip_edit and the archive and cover permissions, but
let costs_mode through without the budget_edit check REST and MCP apply.
2026-11-16 10:45:23 +01:00
Maurice 40dea84085 fix(flight-live): leave a through flight's first sector aircraft to that sector
With two booked sectors under one flight number, the second is in its watch
window for the whole first one, and the aircraft flying the first sector was
read as the second having departed, with its departure notice hours early.
An aircraft that fits a sibling sector better is now left to it.
2026-11-16 10:45:22 +01:00
Maurice 89f7908359 fix(mail-ingest): let the pause notice job keep its cursor row
The CHECK on mail_ingest_cursor.transport did not allow 'notice', so the
hourly job that tells address holders the import is paused failed on its
lease insert every run. A new migration rebuilds the table with 'notice'
allowed, keeping every reader's position and lease.
2026-11-16 10:45:22 +01:00
Maurice f02c4c57c3 fix(android): keep the offline copy to its own server and whole across a refresh
The offline flag lived in the process, so after picking another server the
recreated activity still answered with the previous server's start page. The
copy now stands in only for the server it was activated for, and an online
start clears it.

A refresh stored the new start page before the build files it names, so one
cut off halfway left a page whose scripts were missing. The page now goes in
last, once every file is stored.
2026-11-16 10:45:21 +01:00
Maurice 5b0412bc2c fix(mail-ingest): read a mail of bare sender lines in one pass
isBareHeaderBlock rescanned the header run below every sender line, so a
plain-text mail of nothing but "From:" lines without a subject took
quadratic time and held the event loop for seconds before the address was
even checked. The block starts are now worked out for all lines in one pass
from the bottom up, with the same rule.
2026-11-16 10:45:21 +01:00
Maurice aa8d041a33 fix(studio): load a large book's photos a few at a time for the PDF export
Every printed photo got its src at once, off screen in the editor and again
in the print frame, so a journey with a few hundred photos asked for every
original in parallel and the browser failed with insufficient resources.

The print markup now holds the source back, and the print view hands it over
four at a time, retries a failed photo once, gives up on one that never
answers and shows the progress on the Save button.

Closes #3102
2026-11-16 10:30:32 +01:00
Maurice 24bc132476 fix(planner): keep an untimed stop between the bookings it was dropped between
The desktop day list hides the stop a lodging booking puts on the day, but
the places are stored across the full day. Bookings and notes were positioned
by counting only the visible places, so every hidden row ahead of a stop
pushed it one slot behind the booking it was dropped above, and it fell
below the evening flight on every drag or arrow move.

Position bookings and notes in the same full-day count the places are
stored in, and share that count with the page's reorder.

Closes #3100
2026-11-16 10:29:47 +01:00
Maurice f728b568ed test(plugins): avoid a non-null assertion in the new frame visibility tests
The added test used querySelector('iframe')! which pushes the tests
no-non-null-assertion count one over its frozen baseline; cast instead.
2026-11-15 20:39:19 +01:00
Maurice c4a2a91578 fix(plugins): pause and suspend plugin frames when they leave the screen
A tester reported that their own plugin, fine on the web, slowed the app down
badly on a phone. A sandboxed plugin iframe keeps running its timers, polling and
animation even off screen, and on a phone it shares the WebView's main thread with
the whole app, so a heavy one janks everything.

The frame now watches whether it is on screen and the app in the foreground
(IntersectionObserver + page visibility) and forwards it as trek:visibility, so a
plugin can pause its work while hidden; the design kit exposes trek.onVisibility /
trek.isVisible and pauses its own CSS animations via data-hidden. On a phone a
dashboard-widget plugin scrolled well out of view is suspended outright: its iframe
is unmounted and a placeholder holds the widget's height, so an offscreen widget
costs nothing and remounts when it scrolls back.
2026-11-15 20:33:27 +01:00
Maurice a58d0117c6 fix(packing): a lighter visibility switch and bringers side by side in the item window
The picked visibility is a raised light segment on the grey track, like the
other pills in the window, instead of a black block, and the +N of further
bringers sits beside the first picture rather than over its initial.
2026-11-15 15:08:26 +01:00
Maurice 439736e904 fix(packing): stack the item window and the Lists menu on the app's layers
The item window sits on the layer of the other floating menus and the Lists
menu just above the bars, through the z-index tokens instead of numbers, and
the theme baseline follows the files the redesign left with fewer literals.
2026-11-15 12:51:20 +01:00
Maurice 71510a62f3 fix(packing): take a bringer off in one transaction, and settle the last baselines
Clearing a common item's owner and dropping the bringer row now happen inside
one unit of work, so a failure cannot leave one without the other. The lint
and RTL baselines follow the rows that lost their last physical sides.
2026-11-15 12:40:01 +01:00
Maurice a65342574a test: bring the packing, todo and dashboard changes in line with the CI gates
Lower the lint and strict baselines the redesign made smaller, keep the
detail window and the todo tab under the complexity limit by moving their
choices into helpers, read the toast in the detail test through its module
rather than a window global, keep the new dialog focus case in the module's
existing test file, show the panel's progress once in the standalone header,
and point the planner wiring tests at the Lists menu.
2026-11-15 12:30:14 +01:00
Maurice 783a697d95 fix(dashboard): a long trip name in an upcoming booking ends in an ellipsis
The badge holds its text in an element of its own, which the ellipsis needs
inside a flex badge, and the row's middle column may shrink below its content.
2026-11-15 12:23:27 +01:00
Maurice b8966330e0 test: keep the bringer and panel width changes within the lint and RTL ratchets
The bringer tests read their items through a small type instead of any, the
panel hook names its two ceilings after the panels rather than the sides, and
the stored-width test runs on a window wide enough for the map's share.
2026-11-15 12:22:12 +01:00
Maurice cb1b5dd88c fix(dashboard): upcoming bookings read cleanly, pending as a letter on the icon
The PENDING pill beside a title broke long names over several lines; a small
dot on the type icon's corner now carries the status's first letter (A for
Ausstehend, P for Pending), with the word as its tooltip and accessible name.
The time and the trip or place below the name are soft badges instead of a
line strung together with dots. Desktop and phone alike.
2026-11-15 12:22:05 +01:00
Maurice a1f063c703 fix(collections): the add-place search reads as one field and takes the focus
The search runs from a small button inside the field, dark once there is
something to look for, instead of a greyed-out button beside it, and the row
keeps its distance from the address box below. A dialog can now mark the field
it starts in, so this one opens in the search rather than in the name above it.
2026-11-15 12:11:43 +01:00
Maurice b65a1bb65c feat(collections): the map's padlock, and a picked place on the full map keeps the map
The collections map gets the trip map's padlock (#2010): locked, a click on a
place leaves the camera where it is, so places can be clicked through without
the map zooming in and out. One setting for both maps. On the full map a
picked place no longer brings the list back: its details dock on the map's
edge, or open as a sheet on a narrow screen.
2026-11-15 12:11:42 +01:00
Maurice d1cb0a418a feat(todo): the phone's task list takes the look of the packing list
The progress card says how many tasks are done with a slim bar, a round "+"
for a new task and a "..." for the order and the lists; the filters sit in
one tinted track, with "Mine" kept short there; and the tasks are rows of one
card, with priority and due date under the name and the assignee's face.
2026-11-15 12:11:40 +01:00
Maurice 5536d29cbf feat(packing): a calmer packing list, with every item's choices in one window
A row now shows its box, its name and only what is set: the amount from two
up, the pieces packed while packing, and who brings it. A click on the name
opens a small window at the row with the list, amount, pieces packed, weight,
bag, who brings it and who sees it, each as one pill, plus copy and delete,
instead of fields, a bin and menus in menus on every row. Above the lists the
Lists bar keeps Add list and gathers templates, import, export, the order,
hiding packed items, the bags on a narrow screen and the clean-up in one menu;
the progress moves next to the Shared/My list switch. The bag overview stays.

The phone follows the same shape: one "..." sheet for the list's actions, a
sheet per list for its own, a slim row and an item sheet that saves as you go.
Who may change what about an item lives in one module both views read.
2026-11-15 12:11:15 +01:00
Maurice 7bbb5a9f71 fix(packing): anyone on the trip can be put down as the bringer of a shared item, and taken off again (#3098)
A common item only let you pledge yourself. Nobody else could be named,
and a bringer could never be removed, so an item that went personal and back
kept its owner's avatar for good. The item menu now lists every member to
tick on or off, a click on the avatar opens it there, and the add route takes
an optional user_id limited to the trip's members. Taking the owner off
clears the owner. The remove route now checks visibility for the caller, not
for the user named in the path.
2026-11-15 11:00:21 +01:00
Maurice a1bf57b71a feat(planner): planner panels widen as far as the window allows and follow the drag without lag
The side panels stopped at a fixed 520 px, which left a wide screen with a
narrow day plan. Each panel may now take whatever the window leaves once the
map keeps at least 35% of it (never under 360 px), the day plan keeping its
width first when the window shrinks. While a handle is held the width
transition is off, so the panel no longer trails behind the map and its
buttons.
2026-11-15 11:00:11 +01:00
Maurice 87bcb5a519 fix(native): an entry field pushed under the open keyboard by a new row comes back above it
The packing list keeps its entry field open after Enter, and each added item
lands above it. With the keyboard already up no keyboard event fires, so the
field slid under the keyboard after the first entry. While the keyboard is up,
a change to the page now checks the focused field again, once a frame at most.
2026-11-14 23:29:33 +01:00
Maurice c72c8dcaf7 fix(plugins): hand a visit's stay_minutes to plugins in the assignment output contract (#3092) 2026-11-14 18:03:20 +01:00
Maurice bac4599d64 fix(roadtrip): keep the stay on each visit, not on the place (#3092)
A nullable day_assignments.stay_minutes holds the stay of one visit; a visit without one keeps reading the place's duration, so existing trips drive as before. REST PUT /trips/:tripId/assignments/:id/stay and the MCP tool set_assignment_stay write it with day_edit.
2026-11-14 17:48:57 +01:00
Maurice 535761dbd5 fix(journey): draw lines across the antimeridian the short way on the Journey map (#3080) 2026-11-14 17:48:57 +01:00
Maurice 5be521199f fix(share): wrap a note's detail line and long words on a shared trip link (#3082) 2026-11-14 17:48:56 +01:00
Maurice f71acb08bd fix(assistant): send the earlier answer back to the provider in the shape it saw it (#3094)
Follow-up messages failed with HTTP 400: a whitespace-only text block, two model messages in a row where the turn had pushed for an answer, or a tool call renamed after its provider state was recorded. The rebuilt history now matches what the provider saw during the first answer.
2026-11-14 17:48:56 +01:00
Maurice d6905435ae refactor(mobile): move the trip shell's tab switch into a hook of its own, under the size limit 2026-11-14 17:48:56 +01:00
Luffy ba562c9047 fix(tests): ensure email channel is registered before sending notifications 2026-11-14 16:49:32 +01:00
Luffy 6bcc49fc6f fix(notifications): link admin emails to admin notification settings 2026-11-14 16:49:32 +01:00
Maurice 64847e906e fix(vacay): keep the last weekend day selected and restore the weekend days label 2026-11-14 16:49:31 +01:00
Luffy 75d458b06b fix(vacay): correct weekend toggling and remove redundant labels 2026-11-14 16:49:31 +01:00
Maurice a76a96ccca fix(notifications): drop a tab the planner lacks from the URL, link booking mails to the reservations tab, open the chat on the phone 2026-11-14 16:49:20 +01:00
Maurice bfdbf4d811 fix(notifications): format the tests, move the open-planner tab test into its own file, lower the exhaustive-deps baseline 2026-11-14 16:49:20 +01:00
Luffy b068e593fc fix(notifications): update navigation targets for trip and vacay events 2026-11-14 16:49:19 +01:00
Maurice d3ec833ab7 refactor(client): keep the login page's language corner class in a module of its own 2026-11-14 16:45:02 +01:00
Maurice 5e97123bdf chore(deps): raise the hono floor to 4.13.18 for its validator and routing security fixes 2026-11-14 16:37:28 +01:00
Maurice 2bcef51664 fix(native): the login page's language menu stands beside a Duo's status capsule 2026-11-14 16:33:05 +01:00
Maurice 0f42b8b8ae fix(mobile): put the top bar beside a Duo's status capsule and the page below it, full width
Keeping the whole right inset clear gave up a strip of the full height for a
capsule that only sits in the corner. The iOS app now measures an element in
a top corner (iOS 26 safe area with corner adaptation, vertical against
horizontal) and hands its reach and width to the page: the floating bars
stand beside it, the page keeps the full width and starts below it. Without
such an element, on every other device and before iOS 26, nothing changes.
2026-11-14 16:30:58 +01:00
Maurice c67c95201b style(test): format the safe-area chrome tests 2026-11-14 16:25:43 +01:00
Maurice e6f35158c5 fix(mobile): keep the page clear of a Duo's status capsule and leave a scrolled column's pull to it
TestFlight feedback from an iPhone Duo:

- Folded, the status capsule stands in the right inset and ran over the hero
  card's actions; the page now keeps clear of the side insets as iOS asks
  (.m-page), and a floating bar keeps a little air next to an inset.
- Unfolded, the top bar ignored the trailing inset and the capsule sat on the
  avatar; on a wide window the bars now end before it, by their box, so a
  bar that centres itself still does.
- Dragging the dashboard's second column back up refreshed the page: a pull
  that starts inside a box scrolled on its own now belongs to that box.
2026-11-14 16:19:44 +01:00
Maurice d541bfa838 test(mobile): the passkey confirm now closes with the user sheet it belongs to 2026-11-14 12:00:41 +01:00
Maurice ef5deada83 fix(android): write the session cookie down when the app leaves the screen
The web view flushes new cookies about half a minute after a sign-in; an
app Android ended in that time lost the sign-in it just had.
2026-11-14 11:50:51 +01:00
Maurice e1090d5427 chore(client): lower the complexity and function-length baselines the settings refactor shrank 2026-11-14 11:48:03 +01:00
Maurice 335dd9c788 fix(android): reach Capacitor's package-private injector by reflection for the offline copy 2026-11-14 11:36:47 +01:00
Maurice c23518dae0 fix(native): start without the server on Android and keep the offline start on iOS
A tester with a server on his home network could not open the Android app
away from it: after closing the app and turning Wi-Fi off it stayed on the
address screen ("No server answered at this address").

- Android keeps the server's UI itself (TrekOfflineShell): the start page
  and every file of the build, listed by native/offlineShell.ts from the
  server's manifest and downloaded natively. A web view runs no service
  worker on a plain-http server, the usual address of a server at home, so
  the old "Android has the service worker" assumption did not hold.
- Without a network, or once the server failed to load twice, the web view
  serves the copy under the server's origin with Capacitor's bridge; the UI
  runs on its own offline data and the API answers again once the server
  is back. The address screen opens the copy too (openOfflineCopy).
- The check an update asks for no longer locks the app out offline: on both
  platforms a server out of reach is put back on its copy and checked on
  the next launch that reaches it. iOS no longer throws its copy away when
  the update check runs.
2026-11-14 11:34:28 +01:00
Maurice 91f8deb3f3 refactor(mobile): keep the settings views under the size and complexity limits
The user sheet's actions on another account (passkeys, two-factor, SSO
link, delete) are MUserDangerActions with their own confirms, the place
names picker is MPlaceLanguage, and useApiKeys takes its copied flag from
a small useCopiedFlag.
2026-11-14 11:34:28 +01:00
Maurice a40ae60abb feat(mobile): API keys in the phone's settings
- MApiKeysSection: the keys with what each may read, creating one in a sheet
  (name, the areas as chips, the key shown once with a copy button), deleting
  behind a confirm sheet, and the endpoint to copy.
- The list and every action move from ApiKeysSection into useApiKeys, shared
  by both views; the calls go through a small online-only apiKeysRepo, so no
  view reaches the API (offline baseline loses ApiKeysSection and
  AdminSettingsTab).
- The phone's Integrations tab is always there now, as on the desktop: the
  keys in it need no addon.
- A test title no longer breaks on its apostrophe.
2026-11-14 11:19:06 +01:00
Maurice 5caa890523 feat(mobile): notification defaults, SSO unlink, wanderer and place names on the phone
- Admin notifications: the defaults every user's cells start as, one row per
  event with a pill per channel cycling On, Off and Blocked
  (MAdminNotificationDefaults); the grid's constants are shared with the
  desktop panel in notificationDefaultsModel.
- Editing a user offers "Remove SSO link" behind a confirm sheet, as on the
  desktop, once SSO is set up and never for yourself.
- Settings: the wanderer connection (MWandererConnectionSection, on
  useWandererConnection) and the language of place names under General.
- MSetCard takes a brand mark as its icon, not only a lucide icon.
2026-11-14 11:14:09 +01:00
Maurice a3620f9e05 feat(mobile): the admin services section gets what the desktop tab has
- Place search and routing as one card, as on the desktop: TREK's own
  services, today's allowance with a new identity behind a confirm sheet
  (MAdminServiceQuota), sharing place details (MAdminPlaceContrib), the transit
  backend and the place search provider as TREK selects, and the search log.
- The key card holds Google (with its options and the daily request cap,
  MAdminGoogleDailyLimit), Unsplash and Amap, in the desktop order.
- The logic both views need moves into one place: the transit switch into
  useAdminSettingsActions, the allowance figures into serviceIdentityModel,
  and the share-place-details panel into usePlaceContribPanel.
- MAdminSettingsSection renders each section in a function of its own.
- Tests follow the split admin sections (Save order, 2FA label, field marker).
2026-11-14 11:09:22 +01:00
Maurice dbda2d7d7c chore(client): lower the size, theme and knip baselines the mobile settings pass shrank 2026-11-14 10:59:10 +01:00
Maurice b6a296ffea style(i18n): format the help strings the Mapbox change shortened 2026-11-14 10:52:36 +01:00
Maurice ae3dfa2eb7 feat(mobile): admin and settings sections ordered and trimmed like the desktop
- The phone's admin sections follow the desktop sidebar: the same groups
  (Users, Configuration, Maintenance) in its dropdown, Security and Services
  instead of one Settings section, and live flights and booking mails beside
  the addons they configure. An old ?tab=settings link still opens Security.
- Passkey login and the 2FA rule sit with the other ways in; the passkey card
  keeps the domain, and a managed install no longer shows the danger zone.
- MAdminSelect replaces every native select on the admin screens: TREK's own
  field or row pill that opens the picker sheet (permissions, backup schedule,
  invite trip, plugin settings).
- Explanations wait behind an info mark (MHintLabel), as on the desktop: admin
  rows and fields, the settings rows' new `hint`, addon and provider rows.
- Permissions are one line each with the level as a pill; addon rows lose the
  type badge their heading already names; settings buttons no longer wrap.
- "Require 2FA" in every language; admin.tabs.settings is unused and gone.
2026-11-14 10:49:09 +01:00
Maurice bab1ca9dca feat(settings): drop the experimental badge from Mapbox GL 2026-11-14 10:29:49 +01:00
Maurice e1e8c4c63d fix(flight-live): sort attribution sources with an explicit compare 2026-11-14 10:18:03 +01:00
Maurice 5f49c87f4a fix(admin): map the retired integration group for managed tabs
The settings redesign folded the integration sidebar group into config,
but ManagedAdminTab still accepts group 'integration'. Indexing the label
map with it was an implicit any under the strict check and would have put
such a tab under an empty heading. It now lands under config.
2026-11-13 23:30:35 +00:00
Maurice 01653f81e3 test(settings): follow the redesigned settings and admin pages
The tests now look for what the pages show after the redesign: the admin
Settings tab is Security and Services, MCP Access and User Defaults are MCP
and Defaults, notification channels and the 2FA rule are rows with a named
switch, hints sit behind the info mark, each addon type card counts its own
addons, OAuth scopes and the AI sharing note are shown in full, and the 2FA
disable password is the field beside the code. The phone's MCP admin header
keeps its own title, MCP Access. The mail pill test renders with
translations, so it finds From mail rather than the key.
2026-11-13 23:10:05 +00:00
Maurice a0764b9c96 fix(settings): the checks the settings redesign left red
The phone's MCP card still read the config fold state that the shared hook
no longer holds, so the client failed to typecheck. The phone keeps its
folded config, so it now holds that state itself.

SettingsColumns takes start and end instead of left and right: the prop
types counted as two physical sides for lint:rtl, and in a right-to-left
language the first column is the right one anyway.

Also: an unused icon import, seven files outside the format baseline run
through Prettier, Routing (de) and Services (fr) confirmed as the same word
as in English, and the size and warning baselines lowered to what the
redesign left (AdminPluginsPanel one wrapped line shorter, two promise
warnings, one long function and two non-null assertions in tests fewer).
2026-11-13 23:10:05 +00:00
Maurice 94ac7673a5 feat(settings): one look for every user and admin settings page
The settings pages had grown into a mix of styles: folds, dialogs behind
rows, full-width rows next to boxed ones, pills for every figure and buttons
in four sizes. Every page now uses the same kit.

- Cards keep their tinted head band; every part of a card is a rounded block
  with its own small head (SettingsBlock), and rows sit in rounded boxes.
- Nothing folds and nothing hides behind a dialog: the MCP config, OAuth
  scopes, mail how-to, AI privacy note and addon sub-options are all shown.
- Each page is split into two columns balanced by length (SettingsColumns).
- Long explanations moved into an info mark next to the label (HintMark).
- One button size everywhere (text-control); tab names are one word.
- Admin: the old Settings tab is split into Security and Services
  (?tab=settings still opens Security, and the phone keeps its single
  Settings section for both); the Integration group is gone, live flights
  and mail import sit next to the addons they configure.
- Addons: one card per type with rows, no search, filter or fold.
- Quota, TREK API facts, mail import status and Google's daily limit are
  compact lines and strips instead of tiles and pills.
- Language is a select; routing has its own card under the defaults;
  storage saves from the foot of its categories card.
- Unused keys, FoldSummary and the page-width wrapper are removed.
2026-11-13 23:18:28 +01:00
Maurice 5fe3dea4cc feat(settings): collapsible settings cards, first on the integrations tab
The settings pages list everything at once, so they read as a wall of
forms. SettingsCard and Section take 'collapsible': the card starts shut
and its badge says its state ('Connected', 'Not set up'); its title is the
button, stretched over the head, the head's action stays its own button.
The body stays mounted while shut. A link to #id opens the card and
scrolls to it; the browser remembers a card left open.

Every integrations card is collapsible now; AI parsing shows its saved
model and MCP the apps signed in. The assistant's settings link opens the
AI connection card. Tests that read into a card open it first
(tests/helpers/settingsCards.ts).
2026-11-13 21:57:20 +01:00
Maurice 608f76f32c feat(settings): two columns for the integrations tab
From xl up, as on the admin settings: what connects your trips with other
services (booking mails, photo servers, AirTrail, Dawarich, Wanderer) on
the left, AI and developer access (AI connection, AI parsing, API keys,
MCP) on the right. A column with nothing to show drops out and the other
takes the whole width.
2026-11-13 21:35:04 +01:00
Maurice a2cc7af695 fix(bookings): keep 'From mail' out of the card and list head
Behind the title stood the review mark, the 'From mail' pill and the two
actions, and the title was cut short. Where a booking came from is looked
up in its detail dialog, so the pill stays there only. The AirTrail note
sat above the mail pill; it is back above AirTrailPill.
2026-11-13 21:21:49 +01:00
Maurice dfbe23e5b8 fix: one status tile list for both admin cards; clear the copied timer on unmount
- The mail import's status tiles (which, labels, tones) were written out
  in the desktop and the mobile card alike; statTiles in the shared model
  holds them, each card keeps its own look.
- The journey share link set 'copied' back two seconds after a copy even
  when the dialog had closed, which also broke a client test run (window
  gone at teardown). useCopied, the trip share's hook, moves to hooks/ and
  serves both; it clears its timer on unmount.
- PlanLlmConfig is not exported: only the union is used outside.
2026-11-13 21:17:28 +01:00
Maurice 6ac7bd2d96 fix(mail-ingest): read a mail as soon as a transport takes it in
Only an upload started a processing run; a forwarded mail waited for the
next two-minute tick, and one that came in right after a run waited for two.
The IMAP and relay runs start one run once they took anything in, the
webhook once per mail it accepted.
2026-11-13 21:05:54 +01:00
Maurice a67361c6bd fix(mail-ingest): read on to To when a delivery header names no address
Stalwart writes Delivered-To as the mailbox itself, its sub-address dropped,
so a forwarded mail to trek+<token>@ was refused as unknown_address: the
first delivery header won even though it carried no token. The headers are
now read in their order of trust, and the first that names a live address
decides.
2026-11-13 20:57:55 +01:00
Maurice 7a40225852 feat(llm-parse): read bookings on a ChatGPT plan
A ChatGPT sign-in only ever ran the assistant: parsing's clients call an
endpoint with a key, and a plan has none. AI connections now lends the plan
as a reader. Each document is one Responses call with the schema as the one
tool the model has to call (tool_choice required). The token is read and
refreshed per call by ChatgptAuthService, and a sign-in that has to be
renewed lends nothing.

- ResolvedLlmConfig is a union: ApiLlmConfig (what an admin configures) or
  PlanLlmConfig (provider chatgpt, a read function, never stored).
- ConnectionReadClient sends the text plus photo or scanned pages, and reads
  the filled shape, or the shape written as text; prose is unreadable.
- AiChatClientService.chatgptPlan is the one place that builds the plan's
  client, for the assistant and for parsing.
- Wiki: a ChatGPT sign-in reads bookings on its plan.
2026-11-13 20:49:08 +01:00
Maurice 29816f81a9 fix(mail-ingest): send an uploaded .eml as multipart; publish the booking origin as a contract
- The upload posted its FormData through the client's JSON default, so the
  form went as JSON and the server saw no file (400). It goes through
  postMultipart now, like every other upload.
- reservation-origin.ts becomes reservation-origin.contract.ts: the booking
  import sets an origin, and a contract is what another domain may import.
- CI: the client's strict type check holds the whole program with strict
  checks and outgrew the default ~4 GB heap; it gets 8 GB like the server's.
2026-11-13 20:49:08 +01:00
Maurice 4337969c2c fix(mail-ingest): the settings card makes the person's own address on first look
The own address was made only when asked for, and the card had no way to ask
before one existed, so it showed none. Once a template is set and the
person's import is on, the first look provisions it (idempotent; read after).
2026-11-13 20:32:31 +01:00
Maurice 6789ee1cb6 refactor(server): keep the grown files at their size baselines; centre the inbox dialog
- auth.service: how an admin form value is stored (validated, encrypted, a
  masked echo kept) moves to the app settings registry as storedAdminValue
  and isMaskEcho.
- reservations.service: a booking's origin (withoutOrigin, originColumns)
  moves to reservation-origin.ts, its input shapes to reservation-inputs.ts,
  exported on from the service so importers stay as they were.
- Reservations.repository: the joined projection, the origin lookup and the
  origin columns move to _shared/, like the Wallet pass context before.
- test-sql: MailIngestApplyService.prepare is marked as no SQL statement.
- The pending bookings dialog opens centred, and says 'nothing waiting' once.
2026-11-13 20:28:17 +01:00
Maurice 7ed15a77b4 style(mail-ingest): a more compact admin status 2026-11-13 19:55:13 +01:00
Maurice 4806c62976 feat(mail-ingest): the admin status as tiles with a health dot
The last read sits in the head line with a green dot, amber while the last
run failed; the day's numbers are tiles with their icon in a soft tone
(mails, added on their own, waiting, failed turning red above zero); the
last error is its own amber note. Desktop and phone.
2026-11-13 19:53:30 +01:00
Maurice 3957b292be feat(mail-ingest): a blue note under each way of taking mail in
Upload only, IMAP and webhook each explain themselves in the admin card,
desktop and phone: what the way means, what it needs (a mailbox of its own
taking plus addresses, a signing secret), with its icon centred beside the
title and the sentence. All 28 locales.
2026-11-13 19:50:47 +01:00
Maurice 783f679124 chore(server): lower the eslint baseline to what the code holds now 2026-11-13 19:38:57 +01:00
Maurice 7e1de86f0b test: no non-null assertions or awaits in a loop in the new mail import tests 2026-11-13 19:31:14 +01:00
Maurice c13c288f00 test(broadcast-parity): cases for the mail import's write tools
add, move, file, discard and undo of a mail booking and the import
settings each get a case with their REST twin. A trip expectation may
name its own room, for the move that announces in two trips.
2026-11-13 19:31:14 +01:00
Maurice 89b67a791f fix(mail-ingest): Outlook HTML forwards, the default AI limit, secret env vars, and the pipeline tests
- mime-walker: trim each line of a stripped HTML body, so the space a tag
  leaves is not read as a folded header line that swallows the booking
  under an Outlook forward's header block.
- settings: an unset daily AI limit is the default of ten, not zero
  (Number(null) is 0), which kept the AI from ever reading a mail.
- env: MAIL_INGEST_IMAP_PASS and MAIL_INGEST_WEBHOOK_SECRET are secrets
  and never printed in the boot report.
- pipeline test: the subject is kept without its forward prefixes, the
  demo move adds its booking before the second trip exists, the typed
  notification mock, and AI reading stays offered while the person
  switched it off.
- e2e: the pipeline tick runs in a request context of its own, as the
  cron registrar runs it, and the 401 checks run without awaiting in a loop.
2026-11-13 19:31:13 +01:00
Maurice 2ee413368b fix(mail-ingest): AI reading can be switched back on, and its hint names the addon
ai_available folded the person's own switch in, so switching AI reading off
greyed the switch out and it never came back. It now says only whether AI
reading works on the instance (the AI Parsing addon and a connection). When
it does not, the settings card says it needs the AI Parsing addon, by its
localized name, in all 28 locales; the wiki says the same.
2026-11-13 19:29:48 +01:00
Maurice 1aa586d829 test: type fixes the CI typecheck found, and the lowered test-new-service baseline
- mailInboxModel.test: actionsOf takes the entry alone since the AI reread left.
- booking-origin.test: its endpoint helper gives the sequence an endpoint has.
- test-new-service baseline follows booking-import's single service factory.
2026-11-13 19:20:09 +01:00
Maurice 53833fd212 fix(mail-ingest): server gates after joining dev, and smaller admin buttons
- lint:tx: the mail transports and the intake document why their writes stand
  alone (@txIndependent, network I/O between them, one copy per address); the
  JSDoc of NotificationsService.respond is back above it after the response
  actions were registered in between.
- lint:boundaries: booking-import asks McpToolGuardsService whether the person
  may edit the trip's bookings instead of reading the Users table; its unit
  test builds the service through one named factory.
- lint:query-api: findIdByExternal reads through Kysely.
- lint:test-mocks: the mail e2e hands its own snapshot db to the ORM instead
  of mocking the database module.
- Entities regenerated (index order only).
- Client: the review row reads the live booking, the shells share
  useMailInboxShell, and the admin card's buttons are one size down.
2026-11-13 18:58:55 +01:00
Maurice a7adef5353 feat(mail-ingest): admin card, review mark, inbox events and links, translations
- Admin settings (desktop and phone, self-hosted only): the instance switch,
  how mail arrives (IMAP or a signed webhook) with its fields, the address
  template, the AI allowance per person and day, a connection test and the
  status in counts. Changed fields only are saved; secrets stay masked.
- The review mark of an imported booking takes its mark off: the pill in the
  desktop dialog and a row in the phone's transport sheet ('Looks right'),
  through the ordinary booking update. Its hint no longer speaks of airports.
- The inbox follows mailInbox:changed and mailInbox:settings, and
  ?inbox=mail (the 'bookings waiting' notification) opens it.
- mailIngestRepo: the online-only path the views take, answers parsed
  against the shared contracts.
- Dropped 'read with AI' and the unused mail-review contract: the server
  reads a passing AI failure again on its own.
- mailInbox, mailAdmin and the new reservation, settings and notification
  strings in all 28 locales; the pending notice is a plural group.
- The live flight line on the booking cards is one of the card's fields,
  full width on the phone; the phone's live card keeps its map to the middle.
- Admin flight and mail cards sit in the left column.
2026-11-13 18:31:07 +01:00
Maurice bd11cd347d fix(mail-ingest): type errors and formatting after joining the flight work
The cron callbacks hand back nothing; the cursor's lookup is findCursor so it
no longer shadows the base repository's find(); the draft's suggested trip
uses the shared contract's type; endpoints spell out their optional columns;
the relay page's running count is typed. Prettier over every new file outside
the generated entities.
2026-11-13 18:03:14 +01:00
Maurice b19bd8e709 build: lock imapflow for the mail import's IMAP transport 2026-11-13 17:49:07 +01:00
Maurice 8dedab0375 feat(mail-ingest): inbox, settings and trip address UI on desktop and phone (wip) 2026-11-13 17:46:19 +01:00
Maurice cbd1800976 test(mail-ingest): name the control plane's fixture file the relay page is copied from
The fixture moved out of the control plane's sources so its tests read it
from disk; the comment now names where it lives.
2026-11-13 17:44:57 +01:00
Maurice 44f669cd0e feat(mail-ingest): tell every address holder once when the import stops
A plan without the import switches it off from outside the server, and an
admin can switch it off too; the plan promises a "mail import paused" note.
An hourly job sends mail_ingest_paused to each holder of a live address with
their own import on, notes the pause first, and forgets it once it is back.
2026-11-13 17:44:55 +01:00
Maurice 1d052f725f fix(mail-ingest): send mailInbox:settings, and give both events their client place
The settings event was registered with no sender; renewing or revoking an
address and changing the switches now send it. The client lists both events
as not yet shown, which keeps the registry-parity test green until the mail
screens move them to their listener.
2026-11-13 17:43:55 +01:00
Maurice f7bad3c5b3 docs(wiki): the mail import's deferred folder, recipients, limits and sender hint
Describes TREK/deferred, which header names the address, the webhook's 401
and 429 answers and where the sender hint can show at all. The variables
table leaves an empty default blank instead of a dash.
2026-11-13 17:43:54 +01:00
Maurice 264f352502 fix(mail-ingest): guard the public webhook and the settings that open it
The webhook refuses headers that cannot be signed right before reading a
byte, limits each address to 120 requests a minute and reads four bodies at
once. The admin save refuses a webhook secret under 32 characters, and the
MCP settings tool registers its input strict like every other tool.
2026-11-13 17:43:54 +01:00
Maurice 32291ce8b4 fix(mail-ingest): trust a sender verdict only from the IMAP box's own server
Anyone could add an Authentication-Results header with dmarc=pass. The hint
now needs a DKIM pass signed by the From domain or a DMARC pass naming it,
and reads it only for IMAP, where the receiving server's header is topmost;
the Cloud relay, the webhook and uploads never show a sender as verified.
2026-11-13 17:43:53 +01:00
Maurice c35f39add1 fix(mail-ingest): only the forwarder moves a booking, and filing claims the entry first
A co-member could move the forwarder's booking into a private trip, carrying
their mail along; undo stays open to editors. Move and filing refuse demo
accounts, and filing claims the entry before writing documents, putting it
back into the inbox when nothing could be filed.
2026-11-13 17:43:52 +01:00
Maurice 993ed4b472 fix(mail-ingest): refuse an upload while the person's import is off, and start no run in tests
An upload made an address and stored a mail the pipeline then put aside;
it now answers 409 instead. The run an upload asks for at once starts only
where the crons run, so it can no longer outlive a test's database.
2026-11-13 17:43:51 +01:00
Maurice e7db110417 fix(mail-ingest): read the Cloud inbox as it is sent, and keep mail refused for now
The relay job reads the control plane's { messages, more, next } page, checks
each mail on its own, pages on while more wait and is idle on a 404. A mail
for several addresses is stored for each, and a passing refusal (inbox full,
daily share taken) leaves it with the relay or in IMAP's TREK/deferred.
2026-11-13 17:43:51 +01:00
Maurice 011cc9f11f fix(mail-ingest): an empty IMAP folder is not asked for a uid range
Some servers refuse a FETCH range on a folder with no mails, which would turn
every quiet run into a failure on the status card.
2026-11-13 17:43:50 +01:00
Maurice 844d03a9cd feat(mail-ingest): REST routes and MCP tools for the settings card, the inbox and trip addresses
/api/mail-ingest serves the settings card, the inbox, the mail preview, the
.eml upload and every action on an entry; trip addresses and the admin status
and connection test have routes of their own. The MCP tools act through the
same services and never hand out an address, and the trip assistant is not offered them.
2026-11-13 17:43:50 +01:00
Maurice 1bfaf4ea98 feat(mail-ingest): read forwarded mails from an IMAP box, a signed webhook and the TREK Cloud relay
The IMAP job reads the box every two minutes through the SSRF guard, keeps a
uid cursor and moves read mails to TREK/processed. The webhook takes raw MIME
signed with HMAC-SHA256 over a timestamp, the recipient and the mail, and is a
404 unless it is the transport. The relay job collects a managed install's mails.
2026-11-13 17:43:49 +01:00
Maurice 6309064f40 feat(mail-ingest): the inbox a person reads, and moving an added booking to another trip
The inbox pages a person's entries with the mail each came from and the trip
it suggests (named only when the reader can see it), shows a mail as plain
text, and takes an uploaded .eml, reading it at once. Move writes the booking
anew in the other trip and removes it from the first in one transaction.
2026-11-13 17:43:49 +01:00
Maurice 7d3ed21a03 feat(mail-ingest): the transport settings in the admin form, each overridable from the environment
The IMAP box, the webhook secret and the address template join the admin
settings form (masked, encrypted, held by the operator on a managed install),
and MAIL_INGEST_* variables override them through the mailIngestConfig token.
The audit row masks every masked key, and key rotation covers the new secrets.
2026-11-13 17:43:48 +01:00
Maurice f319b3610a feat(mail-ingest): tell open clients when the inbox changes
Every new waiting entry and every decision sends mailInbox:changed with the count, so a badge follows without a reload.
2026-11-13 17:43:27 +01:00
Maurice 81d27d8e8d refactor(mail-ingest): keep the types nothing else imports private to their file
Exported types without a reader outside their file only add to the unused-export count.
2026-11-13 17:43:26 +01:00
Maurice de7de4b8de feat(mail-ingest): read forwarded booking mails and add what passes the checks to its trip
Addresses per person and per trip (random base32 token, stored hashed and
encrypted), an intake every transport shares, and a job that reads each
mail once under a lease: filters without AI, machine-readable data always,
one AI request with the person's trips, the server's checks G1 to G9, then
one transaction per mail that adds what passed, keeps the rest in the inbox
with a reason, and notifies the forwarder and co-travellers. Undo within
7 days, manual apply, filing as documents, a prefilled form and a nightly
retention complete it; on a managed install the operator's switch decides.
2026-11-13 17:43:26 +01:00
Maurice 340454cfc7 feat(notifications): events for bookings added from mail, and actions a domain registers
mail_booking_added tells the forwarder (with keep or undo) and co-travellers
of a shared trip; mail_booking_pending points at the inbox. Both are listed
only while the mail import is on, with texts in all 28 locales.
registerResponseAction lets a domain name what a yes/no tap does without
this module importing it.
2026-11-13 17:43:25 +01:00
Maurice 5f600cf263 style(mail-ingest): wrap the repository lines the way prettier does
The new repositories and their tests held a few lines past the 120-column print width.
2026-11-13 17:42:44 +01:00
Maurice aa84d71302 feat(llm-parse): read a forwarded booking mail and name its trip in one request
MailReadService sends one mail as one document: its subject, body and up to
three attachments inside data tags the prompt calls untrusted, with the
person's trips under references made up for the call. Answers keep only
offered trip references and known field names. BookingImportService reads
a mail's machine-readable parts and maps an AI reading to booking items.
2026-11-13 17:42:44 +01:00
Maurice baa906fb6b feat(mail-ingest): tables for forwarded booking mails and their bookings
Five tables carry the mail import: forwarding addresses (token hash plus the
encrypted token), a person's switches, the readers' cursor and lease, every
mail as it arrived, and each booking read from it with its checks and fate.
Repositories read the trips a booking may go to by column, so the import
weighs a booking without reaching into five other domains.
2026-11-13 17:42:43 +01:00
Maurice 53ebc9d632 fix(llm-parse): the local router reports how its reading ended
The Ollama router catches a failed model call and answered an empty list, which
the outcome read as a document without bookings. It now returns the outcome with
the list; failureOutcome and foundOutcome move to llm-outcome.ts so the router and
the service share them without importing each other.
2026-11-13 17:40:53 +01:00
Maurice 332206089b build(server): add imapflow for the mail import's IMAP transport
The self-hosted import reads its catch-all mailbox over IMAP; imapflow is the
client the transport is written against. The lockfile follows with the install.
2026-11-13 17:40:53 +01:00
Maurice 57d0b42726 feat(llm-parse): a MIME walker that keeps a booking mail's body and attachments
walkMail() reads a forwarded mail for the import: the envelope apart, a body
without From, To, Cc or forwarding header blocks, message/rfc822 and quoted
forwards unwrapped up to depth 10, and the PDF, pkpass, ics, JPEG, PNG and WebP
attachments whose bytes match their type. Nothing is rendered or fetched.
2026-11-13 17:40:52 +01:00
Maurice d01f973e62 feat(mail-ingest): shared contracts for the booking mail import
Zod contracts for the forwarding address, the person's switches, messages,
the bookings read from them, the inbox and every action on an entry, the upload,
the webhook and the admin status card. One reason enum names why a mail or booking
waits, mapped from every AI outcome; mailInbox:changed and mailInbox:settings are
registered as user-scoped events.
2026-11-13 17:40:51 +01:00
Maurice d557f08e28 feat(llm-parse): a typed outcome for every AI reading instead of warning text
LlmParseService.parse() now says how a reading ended (ok, empty, no_text,
quota_exhausted, ai_disabled, user_cap, provider_error, too_large). The clients throw
LlmRequestError with status and body code, so the TREK Cloud gate's 429 QUOTA_SPENT
and HARD_CAP read as a spent allowance. The preview reports the outcome per file and
the assistant reads its empty reason from it rather than matching warning strings.
2026-11-13 17:40:29 +01:00
Maurice 5dc1de0e5b feat(booking-import): report each unconfirmed item and check the right in confirm()
confirm() now answers { created, failed: [{ index, reason }] } instead of logging
and dropping the items it could not write, and checks the trip and reservation_edit
itself so the import route and the assistant get one answer. An item with a booking
reference records it as its origin (sync off) and a repeat import is a duplicate.
2026-11-13 17:40:27 +01:00
Maurice d2b12cd3dd feat(reservations): record an import's origin and scope the joined read to its trip
CreateReservationData and insertReservation take an optional external_source,
external_id and sync_enabled, so an importer can record where a booking came from;
without them every write keeps the column defaults. Client bodies on REST and the
plugin RPC have the origin stripped, so no caller can pose as an import or a link.
getReservationWithJoins now takes the trip and reads nothing outside it.
2026-11-13 17:40:27 +01:00
Maurice 64418489e2 fix(map): guard the GL bridge's resize frame on the layer it attaches
Reading the bridge's MaplibreGL export threw under the test mocks, which
define only the factory, so every mocked basemap counted as an unloaded
chunk. The guard now patches the class of the layer being attached, and
only a class that has _transitionEnd itself, so stand-in layers are left
alone.
2026-11-13 17:20:15 +01:00
Maurice 7238f8ae25 fix(flight-live): reuse the basemap's label hiding and keep the GL guard optional
The resize guard reached for the bridge's MaplibreGL class, which the test
mocks of the bridge do not provide, so every mocked basemap counted as an
unloaded chunk. The guard now only applies where the class exists. The
mini map hides place names through VectorBasemap's own hideLabelLayers
(a hideLabels prop) instead of a second copy of that logic, and the route
test no longer uses Array.prototype.at, which the client's lib target lacks.
2026-11-13 17:02:39 +01:00
Maurice e525e0b838 feat(flight-live): route mini map and a calmer live card; fix the CI gates
The live flight card shows a small real map behind the pass: the great
circle between the airports, solid where flown and dotted ahead, the
aircraft on the line turned along the route. The route is framed in the
free middle, the map fades out under the airports and times laid over it,
and its place names are hidden. Data and map credits sit on the map as its
hover text instead of a footer line.

The card head now follows the booking dialog: a tinted band with pills for
the state, what comes next and the delay; the numbers of the moment use the
dialog's fields on the desktop and the sheet's stat boxes on the phone; both
times sit on equal tiles in one line. Without live data the card, the strips
and the plan line show nothing, and the pulsing dots are gone.

Also fixes the failed dev run: unit symbols and the leg position are listed
as NOT_PLURAL, the aircraft label uses logical sides, the flight store is in
the test reset registry, the sync loop stops once no flight lies ahead (no
endless timers under fake timers), and timeCell and widgetFlight drop below
the max-params and complexity limits. Guards the GL bridge's resize frame
against a layer removed before it runs, and keeps the booking code pill as
tall as its neighbours.
2026-11-13 16:39:46 +01:00
Maurice 2d95bf6744 docs(wiki): live flight status and FLIGHT_LIVE_ENABLED
The transport page explains what TREK follows, where it shows and what open
data cannot give; the environment page documents the switch and what leaves
the server.
2026-11-13 15:36:43 +01:00
Maurice 41134cc455 fix(native): read the flight widget's direction from the locale
Android lint refuses a composition reading the Configuration through
LocalContext. The arc's mirroring now follows the locale's layout direction,
which is what the widget's language decides anyway.
2026-11-13 15:36:43 +01:00
Maurice 27f12c2245 feat(native): a flight widget and a boarding-pass Live Activity
A new Flight widget on iOS (small to large and the lock screen) and Android
shows the trip's next flight or the one in the air: both airports, the arc
with the aircraft, a countdown the system keeps running, and the delay. It
follows the feed's phase, so a late departure is not flown along the arc.
Around a flight the travel day's Live Activity becomes a boarding pass with
a running bar and countdown, in the Dynamic Island too.
2026-11-13 15:29:21 +01:00
Maurice 4796615439 feat(flight-live): a live boarding pass on the web, desktop and phone
The booking dialog and the phone's transport sheet show a flight's moment,
both airports with planned and expected times, the route as an arc with the
aircraft on it and the numbers of the flight; booking cards and day plan
rows get a one-line state with a progress bar. The trip map draws the
aircraft in the air on Leaflet and GL, and the admin settings carry the
switch. Translated into every language.
2026-11-13 15:29:10 +01:00
Maurice 154563f34d feat(flight-live): follow booked flights live from keyless ADS-B feeds
A new flight-live domain polls the open feeds adsb.lol and adsb.fi (no key,
no cost; adsb.fi only on self-hosted installs, its terms are non-commercial)
for every booked flight leg in its watch window, derives phase, take-off,
landing, delay and an arrival estimate, and pushes changes as flight:live.
GET /api/trips/:tripId/flights/live, the MCP tool get_trip_flight_status,
notifications for take-off, landing and delays, and the admin switch
flight_live_enabled (FLIGHT_LIVE_ENABLED wins) come with it.
2026-11-13 15:29:03 +01:00
Maurice 3365511b10 fix(bookings): the file buttons of a booking never wrap their label
"Vorhandene verknüpfen" broke onto two lines in the narrow half of the
booking dialog. The labels now truncate instead of wrapping, and the German
label is the shorter "Datei verknüpfen", matching "Datei anhängen".
2026-11-13 15:28:55 +01:00
Maurice c2c0535d52 fix(ci): list the packing share pair, and read a stored costs mode through its enum
The whole-list sharing runs on usePackingCategorySharing in the packing panel
and the phone tab, its sheet is markup fed by the tab. The trips service reads
a stored costs_mode as one of TripsCostsMode, which the export check wants used.
2026-11-13 13:30:37 +01:00
Maurice d6799d1205 fix(ci): the calendar query DTO as the contract it publishes, and two typed tests
feeds and trips import the calendar query DTO, so it lives in
calendar.contract.ts rather than as calendar's internal dto file. The places
controller tests pass the KML service in every call, and the revisit pill
test builds a whole list.
2026-11-13 13:13:13 +01:00
Maurice 9cbf31da27 fix(client): the trip form's review and the slow-open splash, and the tests that followed
Inside the trip settings, Escape and the backdrop no longer close the dialog
while the date question is up, and the embedded form does not load the
members it does not show. Every trip open is timed afresh for the splash.
The tests follow the cover image card, the danger button, the delayed splash
and the open and download mocks.
2026-11-13 12:57:57 +01:00
Maurice 71cc97822a fix(ci): the second round of the quick-win checks on the server
oidc_auto_redirect is managed-locked in the registry too, costs_mode is read
as the mode it is, the days of a dated trip are read through the factories,
and the dashboard's country order moves out of the atlas service into a
module of its own, so the service keeps its size.
2026-11-13 12:57:56 +01:00
Maurice c2ba78253d fix(client): lint, theme and size ratchets of the quick-win round, and the tests that followed the features
New warnings fixed at their source (refs written in effects, typed tile
options, no stray imports, smaller functions and components), the payer and
split heads hold their switch instead of letting it overhang, the baselines
lowered where the round removed warnings, and the tests updated to the
solo trip, the shares view and the revisit status.
2026-11-13 12:40:17 +01:00
Maurice 75aeba29ed feat(mobile): calmer trip settings, list editing, selecting places and the journey map switch
The trip settings sheet opens on a list of its areas, each a page of its own
with a way back, and the journal there is drawn in the phone's own cards. A
new packing list is typed into a card with its add and cancel, selecting
places keeps its way out in view with the actions as icons below, and the
journey's satellite switch sits in its bar beside the menu.
2026-11-13 12:40:16 +01:00
Maurice bd58f17ec0 feat(trip-settings): edit the trip inside its settings, in one look across the areas and the trip form
Edit trip is an area of the settings dialog, beside People, Sharing and
Journal, instead of a second dialog. The side column names the areas only, the
dialog keeps one height, and every area uses the same cards, fields and
buttons; the trip form on its own takes the same head, cards and buttons. A
trip that loads quickly opens without the splash on the desktop too.
2026-11-13 12:40:16 +01:00
Maurice 721a610a70 fix(ci): green the quick-win round on the server, the shared contracts and the plugin facts
The trips entity takes costs_mode as the generator writes it, the plugin
output contract publishes it, and the hand-built test schemas carry it. The
new MCP fields come from @trek/shared, the link tool tests join the collab
file that already mocks the database, oidc_auto_redirect is the operator's
on a managed install, and the tests follow the KML service, the dated trip
days and the zod pipe.
2026-11-13 12:40:15 +01:00
Maurice eda27f1e59 fix(costs): the receipt link is an icon, so the receipts title keeps one line (#2839) 2026-11-13 11:06:48 +01:00
Maurice a08d4b944e feat(mobile): icon-only action rows in the transport and booking sheets (#2585)
The transport sheet's row wrapped once a ticket and the wallet were there.
Its actions are icons now, named by their labels, and the attachments sit in
their own rows with a download, like the transports list. The wallet is a
black circle, beside the close button in the booking editor. A failed
download on the phone now says so.
2026-11-13 10:49:30 +01:00
Maurice 5137bcb86a docs(wiki): no dashes in the collab sub-feature sentence (#3076) 2026-11-13 10:49:30 +01:00
Maurice 7861006bf5 fix(journey): theme tokens for the album date range (#2859) 2026-11-13 10:49:29 +01:00
Maurice 5f6594f697 fix(tours): Google Maps follows a tour on foot or by bike, CoMaps only gets a route it can follow (#2812)
The Google link carried no mode, so a hike opened as a drive, and a stop on
the equator or the prime meridian was dropped. CoMaps routes a start and an
end only; a tour with stops between would reach it as unrouted pins.
2026-11-13 10:49:28 +01:00
Maurice fcbb538c24 fix(costs): the count beside the total adds up what it does, and its left-out chip counts all again (#2819, #2839)
With a category left out the total card still counted every expense, and in
the table view the only way back was to switch views; the chip now brings
everything back. The phone says what is left out once, under the total.
Linking a receipt offers pictures and PDFs only, like the upload.
2026-11-13 10:49:28 +01:00
Maurice 43a8984e4c feat(planner): a calmer place inspector footer, and a folded place opens in full again
The footer wrapped once a place had a day, a website and a collection. Now
only adding to the day, navigation and edit carry words, website and
collection are icons, and removing from the day and delete sit behind one
"…". The words drop out when the panel is narrow (a tablet) instead of the
row wrapping. Folding is kept for the place on show only (#3039).
2026-11-13 10:49:17 +01:00
Maurice e958a9a2bb feat(ui): icon footer button, and a button menu at the foot opens above its button
DialogIconButton is the square footer button DeleteButton already was, for
any action named by its tooltip. A "…" menu near the bottom of the window
used to be pushed up over its own button; it now opens above it.
2026-11-13 10:49:17 +01:00
Maurice 986dabf11f fix(categories): the new bus, station and airport icons count as transport (#2706) 2026-11-13 10:48:58 +01:00
Maurice 318e71aa0c fix(pdf): shrink place photos without AbortSignal.timeout and decode them near thumbnail size (#1501)
Safari before 16 has no AbortSignal.timeout, which cost the whole export; a
controller and a timer replace it. Photos decode at twice the thumbnail
height and three at a time, so a long trip no longer ends the web view.
2026-11-13 10:48:58 +01:00
Maurice 308daec14e feat(packing): change the sharing of a whole list at once (#2961)
The list menu on desktop and phone gets "Sharing for Whole List": pick
Shared, Personal or Shared with people once and every item of yours in
that list moves there through the existing per-item sharing write. Items
other people added stay as they are, and the dialog says so up front.
2026-11-13 10:17:35 +01:00
Maurice 3f68c8a50e feat(bookings): download button on booking and transport attachments (#2585)
Each attached file row now has a download icon next to its name, on the
desktop booking cards and detail dialog and on the phone's bookings and
transports cards. On the phone the file rows move out of the card body
button so open and download are two real sibling buttons.
2026-11-13 10:17:35 +01:00
Maurice 74af74fb5e feat(atlas): show the most recently visited countries first on the dashboard (#2648)
The place and endpoint reads behind the passport tile now carry the last day
of each started trip, and getTravelStats orders the countries by their latest
visit, with countries only marked by hand after them. The country set is
unchanged; repository, parity and service tests pin the order.
2026-11-13 10:17:26 +01:00
Maurice 924b4e0787 feat(auth): let admins keep the login page on OIDC-only instances (#2925)
A new app setting oidc_auto_redirect (default on) is part of the admin form
and the public app config. Off, an instance without password login no longer
sends visitors straight to the IdP: the login page shows its SSO button,
also while the cached config is read. Admin toggle on desktop and phone.
2026-11-13 10:17:26 +01:00
Maurice d5d9428cf2 feat(calendar): let a feed leave out the per-day summary events (#2602)
Both feed routes and the one-off export.ics take ?days=0, validated by a
shared query contract, and then skip the all-day "Day N" event per day; the
default is unchanged. The subscribe dialog gets a Day overview events switch
that adds the parameter to its links, export_trip_ics takes dayEvents and the
feed tools explain the parameter.
2026-11-13 10:17:25 +01:00
Maurice b9231ffb53 feat(mcp): manage the trip's shared links over MCP (#3076)
list_collab_links, create_collab_link, update_collab_link and
delete_collab_link run the Links panel's REST routes as tools: the shared
body contracts, trip access, collab_edit on writes and the collab🔗*
broadcasts, behind the links sub-feature flag. Unit, e2e and broadcast
parity cases cover them; the wiki lists the tools.
2026-11-13 10:17:15 +01:00
Maurice 489ba93c0c feat(mcp): let update_display_settings set the dashboard world clocks (#3044)
dashboard_timezones joins the display-preference allow-list as a list of
IANA zone ids, each checked with Intl like the widget does, without repeats
and capped at 24. The write goes through saveMany, so open tabs refresh, and
both tool descriptions name the widget's fallback zones.
2026-11-13 10:17:15 +01:00
Maurice 2a448722c6 feat(helm): make the PVC access modes configurable (#3061)
persistence.data.accessModes and persistence.uploads.accessModes default to
ReadWriteOnce, so existing installs render the same claims. ReadWriteMany lets a
backup pod mount the volumes; values.yaml and the docs warn that SQLite allows
only one writer of travel.db. CI renders the override too.
2026-11-13 10:17:14 +01:00
Maurice cd53d0a895 feat(tours): open a tour's route in Google Maps, Apple Maps or CoMaps (#2812)
The tour detail gets a Maps button beside Navigation that hands the whole route
to the apps that follow one, in the tour's own mode (walking or cycling). The
stops are spread evenly along the line and capped at ten, the most a Google
Maps directions link opens. Ski, paddle and horse tours are not offered, since
a map app would route them by road; the GPX export stays the way for those.
2026-11-13 10:17:14 +01:00
Maurice db6bb911c2 feat(roadtrip): show the place photo on the stop sheet and the stop dialog (#2629)
On the road a stop's picture is often what decides whether it is worth the
detour. The phone's stop sheet shows the place's picture full width under its
name and the desktop stop dialog shows it in place of the kind tile; both open
the place's photos on tap. The picture is the place's own image, else the
provider photo for its Google or OSM id through the shared photo cache.
2026-11-13 10:17:14 +01:00
Maurice 69552ffeef feat(journey): satellite base layer on every journey map, the shared page included (#2594)
The journey map gets the planner's round satellite switch in its top corner,
on the desktop aside, the phone views and the public page. Leaflet takes the
vector basemap off while the imagery shows and reattaches it on the way back;
the GL renderer slides the imagery under the journey's own layers. The choice
is per view and opens on the map, so no setting is read or written.
2026-11-13 10:17:13 +01:00
Maurice 1f710bd217 feat(journey): narrow an open photo album to a date range (#2859)
A shared Immich or Synology album can hold hundreds of photos from other
trips. Once an album is open the picker now offers a from/to range that
filters the already loaded assets by the day the grid files them under, so
Select all only takes the photos in range. No server change.
2026-11-13 10:17:13 +01:00
Maurice 11e4fe6ae3 feat(dawarich): preselect the stay's day in the accept dialog (#3068)
The accept dialog opened on "not on a day yet" although the stay carries its
local date. It now picks the trip day whose date matches, on open and when the
trip is switched, and falls back to no day when the trip has none that matches.
2026-11-13 10:17:13 +01:00
Maurice 3e98938c95 feat(export): places as KML for Google My Maps (#1866)
Google Maps takes no list from outside, but My Maps imports a KML layer.
The trip export dialog and the phone export sheet get "Places for Google
My Maps" (GET places/export.kml, MCP export_trip_kml), and a list's export
menu gets KML next to GPX. The KML codec gains a pin writer; the list file
mapping moves to collections.helpers to keep the service within its size.
2026-11-13 10:17:12 +01:00
Maurice 7283b75cac feat(mcp): list_collection_places pages a long list compactly (#2647)
A read tool that answers one list a page at a time (100 by default, up to
500) as compact one-line JSON rows, filtered by status, label or "no label",
with the list's labels, the matching total and a cursor. The cursor is the
last place's position (sort_order, created_at, id), so labelling a page
while paging through unlabelled places skips none. getCollection orders by
the same keys, id last, so both tools agree on ties.
2026-11-13 10:17:11 +01:00
Maurice cae04e83dd feat(collections): edit a saved place's provider ids, website, phone and price (#2646)
The update contract takes google_place_id, google_ftid, osm_id, website,
phone, price and currency like saving does, website with the same
normalisation and refusal. REST and update_collection_place share it, so an
agent can correct a place instead of re-saving it and losing its labels,
ratings, position and id. The assistant's change card names the new fields.
2026-11-13 10:17:11 +01:00
Maurice 72e8b1f8d9 feat(collections): "want to revisit" status for saved places (#2567)
A fourth status after visited, for a place already seen that the user wants
to go back to. It joins the one-tap cycle, the filters, the pickers, the
assistant cards and the MCP status tool, and counts as visited wherever
visits are counted (isVisitedCollectionStatus), so "visited everywhere"
keeps it. The status pickers go two by two where four would not fit.
2026-11-13 10:17:11 +01:00
Maurice 73ac4b29ad feat(collections): filter by category on the phone (#2618)
The phone toolbar gets a category chip beside the status and label chips,
fed by the same categoryOptions the desktop dropdown uses, and no longer
clears a category picked on desktop. Managing labels moves into the label
panel so the row keeps four chips at phone width.
2026-11-13 10:17:10 +01:00
Maurice 208af03212 feat(dialogs): save a dialog with Ctrl/Cmd+Enter (#1303)
Ctrl/Cmd+Enter in any field of a DialogShell presses its one primary footer
button, focusing it first so blur-committed fields keep their value. Dialogs
with no or several primaries leave the keys to the field, as does the journal
story editor, which opts out with data-keeps-ctrl-enter.
2026-11-13 10:17:07 +01:00
Maurice 8401428ca7 feat(pdf): bake place photos into the trip PDF at thumbnail size (#1501)
The print engine embedded every place photo at full resolution, so a trip of a
few hundred stops saved to a PDF of tens of megabytes. Same-origin photos are now
fetched six at a time, scaled to a 156 px short side and inlined as JPEG data
URLs; photos from other origins, failures and an aborted export keep the URL.
2026-11-13 10:17:06 +01:00
Maurice 12406bbbf4 feat(pdf): large text switch in the trip PDF preview (#2817)
A third switch next to the page break and transport notes switches scales the
day content's type by 1.35 and darkens its greys, for readers who print the
plan. Off by default and remembered per browser like the other two; the day
content's sizes and greys now come from three CSS variables on <body>.
2026-11-13 10:17:06 +01:00
Maurice 12ae32b69e feat(map): setting to hide the Mapbox basemap points of interest (#1761)
Mapbox Standard labels shops, restaurants and sights of its own; they look like trip
places but cannot be picked. A Hide Points of Interest switch next to the other Mapbox
options, on the desktop and the phone, turns them off on the trip map and the preview
without a rebuild. The Standard config handling moves into useStandardBasemapConfig.
2026-11-13 10:17:06 +01:00
Maurice 5176dc29d6 feat(places): say when a place has an address but no coordinates (#2837)
A place saved with a typed address and no search pick, link or map point gets no
coordinates, so it never shows on the map, and nothing said why. The place form warns
under the address while that is so, and the inspector, the phone's place sheet and
both place lists mark such a place. No geocoding on save; the form stays unchanged
for a service stop, which explains a missing position itself.
2026-11-13 10:17:05 +01:00
Maurice 0eac3a9f49 feat(planner): fold the place inspector to its head and keep the place selected (#3039)
On a landscape phone or a small tablet the inspector covered most of the map, and the
only way to clear it was closing it, which deselected the place. A chevron in the head
now folds the card to the avatar and name; the next place opens in full. The head band
moves to PlaceInspectorHead so the inspector stays inside its size budget.
2026-11-13 10:17:05 +01:00
Maurice 64b86c2403 feat(planner): edit the trip from its settings in the planner (#2811)
The trip form was mounted in the planner but nothing opened it, so title, dates,
cover and currency could only be changed from My Trips. Trip settings now lists
Edit Trip at the foot of its areas for anyone with trip_edit; it swaps the dialog
for the trip form. The phone already has Edit Trip in the More sheet.
2026-11-13 10:17:04 +01:00
Maurice 66d85729ff feat(categories): icons for parking, bus stops, stations, airports and fuel (#2706)
The category picker had no icon to tell a car park or a terminal apart from the
places a trip visits. Five transport icons join the shared table, which the admin
pickers, map pins and the PDF all read; the ship's tooltip now also says ferry.
2026-11-13 10:17:04 +01:00
Maurice e7bff6681e fix(roadtrip): a hire car picked up after a night sets off from the stay (#2993)
With hotel bookends on, a day whose first stop was a hire car pick-up got no morning
bookend, so the drive from the stay to the desk was missing. Only a landing means the
traveller was not at the hotel; the pick-up is the first drive of the day.
2026-11-13 10:17:04 +01:00
Maurice c7cfa5a64f feat(costs): read a trip in another currency from the Costs tab (#1683)
Costs always converted to the display currency from Settings, so a trip
that moves on to another country could not be read in its new local
currency. A picker in the Costs bar (beside the Expenses heading on the
phone) now reads one trip in any currency; the server already settles in
any base. The pick is per trip and kept in this browser, nothing stored.
2026-11-13 10:17:03 +01:00
Maurice 72fc61a016 feat(costs): leave a category out of the totals for a look (#2819)
Seeing what a trip cost without, say, food meant adding it up by hand. A
click (or tap) on a category in the breakdown now leaves it out of the
total, your share and what you paid, dimmed in place with a line naming it
and Count all to undo. View only: nothing is saved, and what is owed, open
or settled stays whole. The desktop breakdown moves into its own component.
2026-11-13 10:17:03 +01:00
Maurice a70eea5bf2 feat(costs): let a trip keep its costs as totals only (#1714)
Travellers who track what a trip costs but never split it saw an
Unfinished warning on every expense and a settle-up they had no use for.
A trip now has a costs mode (appended migration, trips.costs_mode, split
by default); totals leaves payers, shares and settling up out of Costs on
desktop and phone through the same gate as a trip of one, and saves new
expenses without a payer. PUT /api/trips/:id and update_trip take it on
budget_edit. The split chips move into their own component.
2026-11-13 10:17:03 +01:00
Maurice c9c419b4ad feat(costs): leave out owing and settling on a trip of one (#2689)
With one traveler every share is the whole amount, yet Costs showed owe,
owed, outstanding, settle-up, balances and the final budget. A shared gate
(showsSplitting) now hides that side on desktop and phone, unless the ledger
still names someone else; the expense editor drops who paid and the split
while the expense holds nothing more. The payment dialog moves into its own
file to keep the panel under the size ratchet.
2026-11-13 10:17:03 +01:00
Maurice 6759277c3b feat(costs): link a trip file as an expense receipt (#2839)
A booking confirmation that is also the invoice had to be uploaded a second
time to sit on the expense. The expense editor (desktop and phone) now lists
the trip's files to link, the booking's own first; the save sends the id in
receipt_file_ids, which the server already links. The desktop receipts block
moves into its own component.
2026-11-13 10:17:02 +01:00
Maurice 10d5f3ed46 feat(costs): split a custom expense by shares (#1165)
A stay shared by people who slept a different number of nights had to be
worked out by hand. The custom split now takes shares next to amounts and
percent: five nights against four split the total 5/9 to 4/9, cent-exact by
largest remainder. Only the amounts are saved, so server and MCP are
unchanged; the phone sheet gains the same unit switch, percent included.
2026-11-13 10:17:02 +01:00
Maurice 2934319722 feat(costs): start a new expense in the trip currency (#2807)
A new expense opened in the display currency, so every bill on the road
needed the trip currency picked from the full list. It now starts in the
trip's own currency (a scanned receipt keeps the one it read), and the
trip and display currencies lead the picker on desktop and phone.
2026-11-13 10:17:02 +01:00
Maurice d4c81bc5f2 chore(lint): lower the warning baseline for the two promise rules the dock change cleared 2026-11-13 08:42:01 +01:00
Maurice 35e0613986 test(native): read the listener names as strings, so the appLinks case typechecks 2026-11-13 08:34:05 +01:00
Maurice ccfa92f650 feat(mobile): the assistant is an entry of the dock, sorted like the pages
The home assistant sat behind the More button on every page outside a
trip, so a dock with free slots showed "..." for a single entry. It is now
an entry of the dock list while its addon is on and it can run for the
user: an account that never sorted its dock gets it in a slot the addons
leave free, and Settings > Appearance > Mobile can move it between the bar
and More like any page.
2026-11-13 08:27:31 +01:00
Maurice fdb2095ced fix(native): a widget tap opens its page every time, also after iOS ended the page
A widget or Live Activity tap reached the UI as Capacitor's appUrlOpen, or
as the launch URL. When iOS had ended the web view's process in the
background, the event went to the old page's listeners and was lost, and
the reloaded page found the same link in getLaunchUrl that it had already
followed once and skipped it: the second tap on the packing widget opened
the start page.

The binary now takes com.liketrek.trek://navigate links itself and hands
them over like a quick action, held until the UI takes it and kept for a
page that is still loading. It reports the feature appLinks, and the UI
only follows the link through Capacitor for binaries without it.
2026-11-13 08:27:23 +01:00
Maurice d6a6b49b6b test(planner): the #3074 case in a file of its own, and the category pick inside guessedCategory, so both files stay within their size 2026-11-12 23:18:51 +01:00
Maurice 0855bafca7 fix(search): place searches find a name typed without its accents (#3075)
"Obidos" did not find "Óbidos", nor "Sao Bras" "São Brás". The search of the
places list, a collection, the saved-place picker, the import from a trip
and the location picker now compare without case and Latin accents, with
letters such as ß, ø or ł folded to their plain spelling. Marks outside Latin
script stay, since there they change the word.
2026-11-12 23:06:36 +01:00
Maurice a39f3fe40c fix(planner): a place added from a collection keeps its category (#3074)
The place form guessed the category of a picked place from its kind, so a
place taken from a collection inside a trip lost the category it was saved
under, while adding it from the collection kept it. A picked place that
carries a category this server has now brings it along; a category chosen
in the form by hand still wins.
2026-11-12 23:06:35 +01:00
Maurice f13a0aa6ee fix(collections): pins on the map show their place's category (#3073)
The server nests a saved place's category, while the markers and the hover
card read the flat fields a trip place carries, so every pin on a
collection's map was the grey default. The map now hands its places on with
the category's colour, icon and name where the markers look for them.
2026-11-12 22:02:05 +01:00
Maurice 10d1a61614 fix(ios): a running TREK Cloud subscription is found on a fresh install too
The check before a purchase read only the entitlements on the device. Those
can be empty while the subscription runs, so the app offered the plans and
the purchase changed the running subscription's plan in the App Store. The
status of the subscription group now decides when the device has none. A
renewal the device has not finished yet no longer counts as a purchase
waiting for its instance either, which also let the check through.
2026-11-12 21:21:51 +01:00
1658 changed files with 60036 additions and 10382 deletions
+8 -1
View File
@@ -458,7 +458,10 @@ jobs:
# tsconfig.strict.json is the same program with strictNullChecks and
# noImplicitAny; its errors per file may not rise above
# scripts/strict-baseline.json, and a file without an entry, every new
# one included, has to be clean (scripts/strict-lint.mjs).
# one included, has to be clean (scripts/strict-lint.mjs). It holds the
# whole program with strict checks, past Node's default ~4 GB heap.
env:
NODE_OPTIONS: --max-old-space-size=8192
run: cd client && npm run lint:strict
- name: Page pattern check
@@ -1276,6 +1279,10 @@ jobs:
--set httpRoute.enabled=true \
--set 'httpRoute.parentRefs[0].name=gateway' \
> "$out/http-route.yaml"
helm template trek charts/trek \
--set 'persistence.data.accessModes[0]=ReadWriteMany' \
--set 'persistence.uploads.accessModes[0]=ReadWriteMany' \
> "$out/access-modes.yaml"
helm template trek charts/trek \
--set podSecurityContext.runAsUser=1000 \
--set podSecurityContext.runAsGroup=1000 \
+2 -1
View File
@@ -43,7 +43,8 @@ See `values.yaml` for more options.
## Notes
- Ingress is off by default. Enable and configure hosts for your domain.
- PVCs use the cluster's default StorageClass. Set `persistence.data.storageClassName` and/or `persistence.uploads.storageClassName` to bind a specific class.
- To use your own PVCs, set `persistence.data.existingClaim` and/or `persistence.uploads.existingClaim`. The other values for that volume (size, storageClassName, annotations) are then ignored.
- Both PVCs are `ReadWriteOnce`. Set `persistence.data.accessModes` and/or `persistence.uploads.accessModes` to override, for example `[ReadWriteMany]` so a backup pod can mount the volume. On the data volume such a pod may only read: SQLite corrupts `travel.db` when a second process writes it over a network filesystem.
- To use your own PVCs, set `persistence.data.existingClaim` and/or `persistence.uploads.existingClaim`. The other values for that volume (size, storageClassName, accessModes, annotations) are then ignored.
- With `persistence.enabled: false`, the data and uploads volumes use an `emptyDir` — storage is ephemeral and lost on pod restart. Intended for testing only.
- `JWT_SECRET` is managed entirely by the server — auto-generated into the data PVC on first start and rotatable via the admin panel (Settings → Danger Zone). No Helm configuration needed.
- `ENCRYPTION_KEY` encrypts stored secrets (API keys, MFA, SMTP, OIDC) at rest. Recommended: set via `secretEnv.ENCRYPTION_KEY` or `existingSecret`. If left empty, the server falls back automatically: existing installs use `data/.jwt_secret` (no action needed on upgrade); fresh installs auto-generate a key persisted to the data PVC.
+2 -2
View File
@@ -11,7 +11,7 @@ metadata:
{{- end }}
spec:
accessModes:
- ReadWriteOnce
{{- toYaml (.Values.persistence.data.accessModes | default (list "ReadWriteOnce")) | nindent 4 }}
{{- with .Values.persistence.data.storageClassName }}
storageClassName: {{ . | quote }}
{{- end }}
@@ -33,7 +33,7 @@ metadata:
{{- end }}
spec:
accessModes:
- ReadWriteOnce
{{- toYaml (.Values.persistence.uploads.accessModes | default (list "ReadWriteOnce")) | nindent 4 }}
{{- with .Values.persistence.uploads.storageClassName }}
storageClassName: {{ . | quote }}
{{- end }}
+10 -1
View File
@@ -247,12 +247,21 @@ persistence:
size: 1Gi
# Leave empty to use the cluster's default StorageClass; set to bind a specific class.
storageClassName: ""
# Bind an existing PVC. The other values (size, storageClassName, annotations) are then ignored.
# Access modes of the claim. ReadWriteMany lets another pod mount the volume, for
# example a backup sidecar, but only for reading: SQLite needs every writer on one
# host, so two pods writing travel.db over a network filesystem corrupt it.
accessModes:
- ReadWriteOnce
# Bind an existing PVC. The other values (size, storageClassName, accessModes,
# annotations) are then ignored.
existingClaim: ""
annotations: {}
uploads:
size: 1Gi
storageClassName: ""
# Access modes of the claim; ReadWriteMany lets other pods read or add uploads.
accessModes:
- ReadWriteOnce
# Specify an existing PVC to bind. The other values are then ignored.
existingClaim: ""
annotations: {}
+9
View File
@@ -36,3 +36,12 @@
@android.webkit.JavascriptInterface <methods>;
}
-keep public class * extends com.getcapacitor.Plugin
# The stored copy of the server's UI gets Capacitor's bridge the way the
# server's own page does (TrekOfflineShell.withBridge reads it by reflection).
-keepclassmembers class com.getcapacitor.Bridge {
private com.getcapacitor.JSInjector getJSInjector();
}
-keep class com.getcapacitor.JSInjector {
public java.io.InputStream getInjectedStream(java.io.InputStream);
}
@@ -15,6 +15,7 @@ import androidx.glance.appwidget.GlanceRemoteViews
import com.liketrek.trek.tripday.TripDayNotification
import com.liketrek.trek.widget.AtlasWidget
import com.liketrek.trek.widget.BookingsWidget
import com.liketrek.trek.widget.FlightWidget
import com.liketrek.trek.widget.CollabWidget
import com.liketrek.trek.widget.PackingWidget
import com.liketrek.trek.widget.TodayWidget
@@ -74,6 +75,7 @@ class WidgetGalleryActivity : Activity() {
"trip" to TripWidget(),
"today" to TodayWidget(),
"bookings" to BookingsWidget(),
"flight" to FlightWidget(),
"todos" to TodosWidget(),
"packing" to PackingWidget(),
"atlas" to AtlasWidget(),
@@ -142,6 +142,15 @@
</intent-filter>
<meta-data android:name="android.appwidget.provider" android:resource="@xml/widget_bookings" />
</receiver>
<receiver
android:name=".widget.FlightWidgetReceiver"
android:label="@string/widget_flight_name"
android:exported="false">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider" android:resource="@xml/widget_flight" />
</receiver>
<receiver
android:name=".widget.TodosWidgetReceiver"
android:label="@string/widget_todos_name"
@@ -10,6 +10,7 @@ import android.view.KeyboardShortcutGroup;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.CookieManager;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
@@ -34,7 +35,19 @@ public class MainActivity extends BridgeActivity {
// runs and on its own origin. BridgeActivity reads `config` while it
// builds the bridge inside super.onCreate().
boolean restarting = TrekServerStore.consumeRestart(this);
TrekServerStore.recheckAfterUpdate(this);
// Without a network the server cannot answer: with a copy of its UI the
// app starts on that at once (TrekOfflineShell), as it does when the
// address screen found the server out of reach. The check an update asks
// for waits for a launch that can reach the server.
boolean offlineStart = TrekServerStore.consumeOfflineStart(this)
|| (!TrekOfflineShell.hasNetwork(this) && TrekOfflineShell.hasCopy(this, TrekServerStore.getUrlOrPrevious(this)));
if (offlineStart && TrekOfflineShell.hasCopy(this, TrekServerStore.getUrlOrPrevious(this))) {
TrekServerStore.restoreForOffline(this);
TrekOfflineShell.activate(TrekServerStore.getUrl(this));
} else {
TrekOfflineShell.deactivate();
TrekServerStore.recheckAfterUpdate(this);
}
String server = TrekServerStore.getUrl(this);
boolean onServer = server != null && !TrekServerStore.consumeShellOnce(this);
config = TrekServerStore.configFor(this, onServer ? server : null, restarting);
@@ -79,6 +92,18 @@ public class MainActivity extends BridgeActivity {
if (group != null) data.add(group);
}
/**
* The web view keeps new cookies in memory and writes them to disk on its
* own schedule, about half a minute later. An app Android ends in that time
* (swiped away, or reclaimed for memory) forgets the sign-in it just had, so
* the session is written down whenever the app leaves the screen.
*/
@Override
public void onPause() {
super.onPause();
CookieManager.getInstance().flush();
}
@Override
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
@@ -0,0 +1,330 @@
package com.liketrek.trek;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.Uri;
import android.util.Log;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import com.getcapacitor.Bridge;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
/**
* The server's UI kept on the device, so the app starts without its server: on
* a trip without reception, or away from home with a server on the home
* network. The web view runs no service worker on a plain-http server, the
* usual address of a server at home, so the app keeps the start page and every
* file of the build itself (refreshed by native/offlineShell.ts while the
* server is reachable) and serves them under the server's own origin while it
* is not. The data comes from the UI's own offline store; the API is tried as
* usual and answers again once the server is back.
*/
final class TrekOfflineShell {
private static final String DIR = "offline-shell";
private static final String PAGE = "index.html";
private static final String STAMP = "server.txt";
private static final String FILES = "files";
/** A path of the build: no "..", no query, nothing outside the copy's folder. */
private static final Pattern SAFE_PATH = Pattern.compile("^[A-Za-z0-9._@\\-]+(?:/[A-Za-z0-9._@\\-]+)*$");
private static final Map<String, String> TYPES = new HashMap<>();
static {
TYPES.put("js", "text/javascript");
TYPES.put("mjs", "text/javascript");
TYPES.put("css", "text/css");
TYPES.put("json", "application/json");
TYPES.put("webmanifest", "application/manifest+json");
TYPES.put("svg", "image/svg+xml");
TYPES.put("png", "image/png");
TYPES.put("jpg", "image/jpeg");
TYPES.put("jpeg", "image/jpeg");
TYPES.put("webp", "image/webp");
TYPES.put("ico", "image/x-icon");
TYPES.put("woff", "font/woff");
TYPES.put("woff2", "font/woff2");
TYPES.put("ttf", "font/ttf");
TYPES.put("wasm", "application/wasm");
TYPES.put("html", "text/html");
}
/**
* The server whose copy the UI comes from in this run: it did not answer
* when the app started. Null while the UI comes from the server itself.
* Bound to the server, so a copy never answers for another one.
*/
private static volatile String activeServer;
/** Capacitor's JSInjector (package-private there) and its getInjectedStream, found once. */
private static volatile Object injector;
private static volatile Method injectMethod;
private static volatile boolean injectorLooked;
private TrekOfflineShell() {}
static boolean isActive() {
return activeServer != null;
}
static void activate(String server) {
activeServer = server;
}
/**
* A start that goes to the server. The flag lives in the process, and
* restart() recreates the activity in that same process (another server
* picked, the address screen, a reload once the server is back), so each
* start sets it anew instead of keeping the last run's copy in front.
*/
static void deactivate() {
activeServer = null;
}
/** Whether the copy stands in for this server in this run. */
static boolean isActiveFor(String server) {
String current = activeServer;
return current != null && current.equals(server);
}
private static File root(Context context) {
return new File(context.getFilesDir(), DIR);
}
/** Whether there is a copy of this server's UI to start from. */
static boolean hasCopy(Context context, String server) {
return hasCopy(root(context), server);
}
static boolean hasCopy(File root, String server) {
if (server == null) return false;
File page = new File(root, PAGE);
return page.isFile() && server.equals(readStamp(root));
}
/** Whether the device has a network at all; with none, the server cannot answer and the copy starts at once. */
static boolean hasNetwork(Context context) {
try {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (cm == null) return true;
Network network = cm.getActiveNetwork();
if (network == null) return false;
NetworkCapabilities caps = cm.getNetworkCapabilities(network);
return caps != null && caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET);
} catch (RuntimeException e) {
return true;
}
}
/**
* Before a refresh fetches the files of a build: a copy of another server
* is thrown away, one of this server stays as it is until savePage.
*/
static boolean beginRefresh(Context context, String server) {
return beginRefresh(root(context), server);
}
static boolean beginRefresh(File root, String server) {
if (!server.equals(readStamp(root))) deleteTree(root);
return root.isDirectory() || root.mkdirs();
}
/**
* Keeps the start page, and only once every file it names is stored: the
* page points at the build's files by their hashes, so a refresh cut off
* halfway (no reception, the app ended) keeps the previous page with its
* complete build instead of a new page whose scripts are missing.
*/
static boolean savePage(Context context, String server, byte[] html) {
return savePage(root(context), server, html);
}
static boolean savePage(File root, String server, byte[] html) {
if (!root.isDirectory() && !root.mkdirs()) return false;
return write(new File(root, STAMP), server.getBytes(StandardCharsets.UTF_8)) && write(new File(root, PAGE), html);
}
static boolean hasFile(Context context, String path) {
return hasFile(root(context), path);
}
static boolean hasFile(File root, String path) {
File file = fileFor(root, path);
return file != null && file.isFile();
}
static boolean saveFile(Context context, String path, byte[] data) {
return saveFile(root(context), path, data);
}
static boolean saveFile(File root, String path, byte[] data) {
File file = fileFor(root, path);
if (file == null) return false;
File parent = file.getParentFile();
if (parent != null && !parent.isDirectory() && !parent.mkdirs()) return false;
return write(file, data);
}
/** Drops the files of older builds once the current one is complete. */
static void prune(Context context, Set<String> keep) {
prune(root(context), keep);
}
static void prune(File root, Set<String> keep) {
File base = new File(root, FILES);
pruneDir(base, base, keep);
}
/**
* The copy's answer for a request of the server's UI while it is active:
* the start page for any page of the app (it routes itself), with
* Capacitor's bridge injected as into the server's own page, and a file of
* the build by its path. Null for anything else, which goes on as usual.
*/
static WebResourceResponse serve(Context context, Bridge bridge, String server, WebResourceRequest request) {
if (!isActiveFor(server) || !"GET".equalsIgnoreCase(request.getMethod())) return null;
Uri url = request.getUrl();
Uri origin = Uri.parse(server);
if (!sameOrigin(url, origin)) return null;
try {
if (request.isForMainFrame()) {
File page = new File(root(context), PAGE);
if (!page.isFile()) return null;
InputStream html = withBridge(bridge, new FileInputStream(page));
return response("text/html", html);
}
String path = url.getPath();
if (path == null) return null;
File file = fileFor(root(context), path);
if (file == null || !file.isFile()) return null;
return response(typeOf(path), new FileInputStream(file));
} catch (IOException e) {
Log.w("TrekShell", "Offline copy could not answer " + url, e);
return null;
}
}
private static WebResourceResponse response(String type, InputStream body) {
Map<String, String> headers = new HashMap<>();
headers.put("Cache-Control", "no-store");
String charset = type.startsWith("text/") || type.endsWith("json") ? "utf-8" : null;
return new WebResourceResponse(type, charset, 200, "OK", headers, body);
}
/**
* Capacitor injects its bridge into the server's page as it passes through;
* the copy gets the same script. Its builder is internal to Capacitor, hence
* the reflection on both (kept in proguard-rules.pro). Without it the UI still runs,
* as it would in a browser, just without the app's native parts.
*/
private static InputStream withBridge(Bridge bridge, InputStream html) {
if (!injectorLooked) {
injectorLooked = true;
try {
Method method = Bridge.class.getDeclaredMethod("getJSInjector");
method.setAccessible(true);
Object built = method.invoke(bridge);
if (built != null) {
Method inject = built.getClass().getDeclaredMethod("getInjectedStream", InputStream.class);
inject.setAccessible(true);
injectMethod = inject;
injector = built;
}
} catch (ReflectiveOperationException | RuntimeException e) {
Log.w("TrekShell", "No bridge for the offline copy", e);
}
}
Object current = injector;
Method inject = injectMethod;
if (current == null || inject == null) return html;
try {
Object injected = inject.invoke(current, html);
return injected instanceof InputStream ? (InputStream) injected : html;
} catch (ReflectiveOperationException | RuntimeException e) {
Log.w("TrekShell", "Bridge not injected into the offline copy", e);
return html;
}
}
private static boolean sameOrigin(Uri a, Uri b) {
if (a.getScheme() == null || b.getScheme() == null || a.getHost() == null || b.getHost() == null) return false;
return a.getScheme().equalsIgnoreCase(b.getScheme())
&& a.getHost().equalsIgnoreCase(b.getHost())
&& port(a) == port(b);
}
private static int port(Uri uri) {
if (uri.getPort() != -1) return uri.getPort();
return "https".equalsIgnoreCase(uri.getScheme()) ? 443 : 80;
}
private static File fileFor(File root, String path) {
String clean = path.startsWith("/") ? path.substring(1) : path;
if (clean.isEmpty() || clean.contains("..") || !SAFE_PATH.matcher(clean).matches()) return null;
return new File(new File(root, FILES), clean);
}
private static String typeOf(String path) {
int dot = path.lastIndexOf('.');
String ext = dot < 0 ? "" : path.substring(dot + 1).toLowerCase(Locale.ROOT);
String type = TYPES.get(ext);
return type == null ? "application/octet-stream" : type;
}
private static String readStamp(File root) {
File stamp = new File(root, STAMP);
if (!stamp.isFile()) return null;
try (FileInputStream in = new FileInputStream(stamp)) {
byte[] data = new byte[(int) Math.min(stamp.length(), 4096)];
int read = in.read(data);
return read <= 0 ? null : new String(data, 0, read, StandardCharsets.UTF_8);
} catch (IOException e) {
return null;
}
}
/** Written beside the target and moved over it, so a cut-off write never leaves half a file. */
private static boolean write(File target, byte[] data) {
File temp = new File(target.getPath() + ".part");
try (FileOutputStream out = new FileOutputStream(temp)) {
out.write(data);
out.getFD().sync();
} catch (IOException e) {
temp.delete();
return false;
}
return temp.renameTo(target);
}
private static void pruneDir(File base, File dir, Set<String> keep) {
File[] children = dir.listFiles();
if (children == null) return;
for (File child : children) {
if (child.isDirectory()) {
pruneDir(base, child, keep);
String[] left = child.list();
if (left != null && left.length == 0) child.delete();
} else {
String relative = base.toURI().relativize(child.toURI()).getPath();
if (!keep.contains(relative)) child.delete();
}
}
}
private static void deleteTree(File file) {
File[] children = file.listFiles();
if (children != null) for (File child : children) deleteTree(child);
file.delete();
}
}
@@ -38,6 +38,7 @@ final class TrekServerStore {
private static final String KEY_SIGN_IN_HOSTS = "sign_in_hosts";
private static final String KEY_SHELL_ONCE = "shell_once";
private static final String KEY_RESTART = "restart";
private static final String KEY_OFFLINE_START = "offline_start";
private static final String KEY_WELCOME = "welcome";
private static final String CONFIG_DIR = "trek-server-config";
@@ -191,6 +192,37 @@ final class TrekServerStore {
return consume(context, KEY_RESTART);
}
/** The next onCreate starts on the stored copy of the server's UI (TrekOfflineShell). */
static void markOfflineStart(Context context) {
prefs(context).edit().putBoolean(KEY_OFFLINE_START, true).commit();
}
static boolean consumeOfflineStart(Context context) {
return consume(context, KEY_OFFLINE_START);
}
/**
* The remembered server, or the one an update asked to check again: the
* server the stored copy of the UI belongs to.
*/
static String getUrlOrPrevious(Context context) {
String url = getUrl(context);
return url != null ? url : getPreviousUrl(context);
}
/**
* Starting on the stored copy while the check an update asked for could not
* run: the server goes back in place, unchecked for now, and the check runs
* again on the next launch, which reaches the server.
*/
static void restoreForOffline(Context context) {
SharedPreferences prefs = prefs(context);
if (prefs.getString(KEY_URL, null) != null) return;
String previous = prefs.getString(KEY_PREVIOUS_URL, null);
if (previous == null) return;
prefs.edit().putString(KEY_URL, previous).remove(KEY_PREVIOUS_URL).putInt(KEY_SERVER_CHECK, 0).commit();
}
private static boolean consume(Context context, String key) {
boolean set = prefs(context).getBoolean(key, false);
if (set) prefs(context).edit().remove(key).commit();
@@ -526,19 +526,98 @@ public class TrekShellPlugin extends Plugin {
authBrowserOpen = false;
}
/** iOS only: Android keeps the service worker, which already starts TREK offline. */
/**
* Keeps the server's UI on the device for a start without the server
* (TrekOfflineShell): the start page, and each file of the build that
* native/offlineShell.ts lists from the server's manifest and the copy does
* not hold yet. Once all of them are there, files of older builds go. A web
* view runs no service worker on a plain-http server, the usual address of a
* server at home, so without this the app could not start away from it.
*/
@PluginMethod
public void refreshOfflineCopy(PluginCall call) {
JSObject result = new JSObject();
result.put("saved", false);
call.resolve(result);
Context context = getContext();
String server = TrekServerStore.getUrl(context);
JSArray listed = call.getArray("files");
if (server == null || TrekOfflineShell.isActive()) {
JSObject result = new JSObject();
result.put("saved", false);
call.resolve(result);
return;
}
new Thread(() -> {
JSObject result = new JSObject();
byte[] page = download(server, "", "text/html");
boolean complete = page != null && TrekOfflineShell.beginRefresh(context, server);
Set<String> keep = new HashSet<>();
if (complete && listed != null) {
for (int i = 0; i < listed.length(); i++) {
String path = listed.optString(i, null);
if (path == null || path.isEmpty()) continue;
String clean = path.startsWith("/") ? path.substring(1) : path;
keep.add(clean);
if (TrekOfflineShell.hasFile(context, clean)) continue;
byte[] data = download(server, clean, null);
if (data == null || !TrekOfflineShell.saveFile(context, clean, data)) complete = false;
}
}
// The new page goes in last: until all its files are there the
// stored page stays the previous one, whose build is still whole.
boolean saved = complete && TrekOfflineShell.savePage(context, server, page);
complete = saved;
if (saved && listed != null) TrekOfflineShell.prune(context, keep);
result.put("saved", saved);
result.put("complete", complete);
call.resolve(result);
}).start();
}
/** A file of the server's UI, or null: only a 200 counts, and the page only as HTML. */
private static byte[] download(String server, String path, String wantType) {
java.net.HttpURLConnection connection = null;
try {
java.net.URL base = new java.net.URL(server.endsWith("/") ? server : server + "/");
java.net.URL url = new java.net.URL(base, path);
connection = (java.net.HttpURLConnection) url.openConnection();
connection.setConnectTimeout(15000);
connection.setReadTimeout(30000);
connection.setInstanceFollowRedirects(true);
if (wantType != null) connection.setRequestProperty("Accept", wantType);
if (connection.getResponseCode() != 200) return null;
String type = connection.getContentType();
if (wantType != null && (type == null || !type.startsWith(wantType))) return null;
try (java.io.InputStream in = connection.getInputStream()) {
java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream();
byte[] buffer = new byte[16384];
for (int n = in.read(buffer); n > 0; n = in.read(buffer)) out.write(buffer, 0, n);
return out.toByteArray();
}
} catch (java.io.IOException | RuntimeException e) {
return null;
} finally {
if (connection != null) connection.disconnect();
}
}
/**
* The address screen found the server out of reach: with a copy of its UI
* the app restarts on that instead (TrekOfflineShell), the same way it
* leaves the server for the address screen. Also for the server an update
* asked to check again, whose check then waits for the next launch.
*/
@PluginMethod
public void openOfflineCopy(PluginCall call) {
Context context = getContext();
JSObject result = new JSObject();
result.put("opened", false);
if (!TrekOfflineShell.hasCopy(context, TrekServerStore.getUrlOrPrevious(context)) || getActivity() == null) {
result.put("opened", false);
call.resolve(result);
return;
}
TrekServerStore.markOfflineStart(context);
result.put("opened", true);
call.resolve(result);
restart();
}
// ---- Widgets, shortcuts and the travel day ----
@@ -40,6 +40,7 @@ class TrekWebViewClient extends BridgeWebViewClient {
private boolean retriedMainFrame;
/** The page loaded again after a network error, until that load starts: its error page counts for nothing. */
private String retryUrl;
private final Bridge bridge;
TrekWebViewClient(
Bridge bridge,
@@ -49,6 +50,7 @@ class TrekWebViewClient extends BridgeWebViewClient {
Set<String> signInHosts
) {
super(bridge);
this.bridge = bridge;
this.onUnreachable = onUnreachable;
this.onSignInPage = onSignInPage;
this.onErrorPage = onErrorPage;
@@ -115,9 +117,15 @@ class TrekWebViewClient extends BridgeWebViewClient {
return signInHosts.contains(key) || (url.getPort() != -1 && signInHosts.contains(key + ":" + url.getPort()));
}
/** Mapbox's map resources go through the app's own store (tiles/TrekTileStore.kt). */
/**
* Mapbox's map resources go through the app's own store (tiles/TrekTileStore.kt),
* and while the server is out of reach the UI comes from its stored copy
* (TrekOfflineShell).
*/
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
WebResourceResponse copy = TrekOfflineShell.serve(view.getContext(), bridge, TrekServerStore.getUrl(view.getContext()), request);
if (copy != null) return copy;
if (com.liketrek.trek.tiles.TrekTileStore.INSTANCE.handles(request)) {
WebResourceResponse stored = com.liketrek.trek.tiles.TrekTileStore.INSTANCE.serve(request);
if (stored != null) return stored;
@@ -171,6 +179,15 @@ class TrekWebViewClient extends BridgeWebViewClient {
}, 1500);
return;
}
// Out of reach for good (a trip without reception, a server at home):
// the stored copy of the UI takes over, with the app's own offline data.
String server = TrekServerStore.getUrl(view.getContext());
if (isNetworkError(error.getErrorCode()) && !TrekOfflineShell.isActive() && TrekOfflineShell.hasCopy(view.getContext(), server)) {
TrekOfflineShell.activate(server);
String url = request.getUrl().toString();
view.post(() -> view.loadUrl(url));
return;
}
TrekServerStore.setFailure(view.getContext(), error.getDescription() + " (" + error.getErrorCode() + ")");
onUnreachable.run();
return;
@@ -32,6 +32,10 @@ class BookingsWidgetReceiver : TrekWidgetReceiver() {
override val glanceAppWidget: GlanceAppWidget = BookingsWidget()
}
class FlightWidgetReceiver : TrekWidgetReceiver() {
override val glanceAppWidget: GlanceAppWidget = FlightWidget()
}
class TodosWidgetReceiver : TrekWidgetReceiver() {
override val glanceAppWidget: GlanceAppWidget = TodosWidget()
}
@@ -56,6 +60,7 @@ object TrekWidgetUpdater {
TripWidgetReceiver::class,
TodayWidgetReceiver::class,
BookingsWidgetReceiver::class,
FlightWidgetReceiver::class,
TodosWidgetReceiver::class,
PackingWidgetReceiver::class,
AtlasWidgetReceiver::class,
@@ -448,6 +448,173 @@ private fun BookingRow(booking: WidgetSnapshot.Booking, labels: WidgetSnapshot.L
}
}
// ---- Flight ----
/**
* Where a flight stands now (as FlightMoment on iOS). What the feed saw wins: a
* flight still at the gate past its planned departure is not flown along the
* arc, and it is only landed once confirmed. Only a flight the feed never heard
* of moves on by its schedule alone; a lost one stops two hours after arrival.
*/
private class FlightMoment(f: WidgetSnapshot.Flight, nowSeconds: Long) {
val start: Long = f.depActual ?: f.depExpected ?: f.dep
val end: Long = maxOf(f.arrExpected ?: f.arr, start + 60)
private val heard = f.seen != null
val landed = f.landed || (!heard && nowSeconds >= end) || nowSeconds >= end + 7200
val airborne = !landed && (f.airborne || f.depActual != null || (!heard && nowSeconds >= start))
val ready = !landed && !airborne && nowSeconds >= start
val progress: Float = when {
landed -> 1f
airborne -> ((nowSeconds - start).toFloat() / (end - start)).coerceIn(0f, 0.98f)
else -> 0f
}
}
/** A duration in the app's words: "2 d 4 h", "1 h 5 min", "12 min". */
private fun durationText(seconds: Long, labels: WidgetSnapshot.Labels): String {
val minutes = ((seconds + 59) / 60).coerceAtLeast(1)
val days = minutes / 1440
val hours = (minutes % 1440) / 60
val rest = minutes % 60
return when {
days > 0 -> labels.durDaysHours.replace("{d}", "$days").replace("{h}", "$hours")
hours > 0 -> labels.durHoursMinutes.replace("{h}", "$hours").replace("{m}", "$rest")
else -> labels.durMinutes.replace("{m}", "$rest")
}
}
/** "Departs in 2 h 10 min", "Lands in 1 h 5 min", "Landed". */
private fun momentText(m: FlightMoment, labels: WidgetSnapshot.Labels, nowSeconds: Long): String = when {
m.landed -> labels.flightLanded
m.ready -> labels.flightReady
m.airborne -> labels.flightLands.replace("{time}", durationText(m.end - nowSeconds, labels))
else -> labels.flightDeparts.replace("{time}", durationText(m.start - nowSeconds, labels))
}
/** The delay as a chip's text and colour; nothing to say without data. */
private fun delayChip(delay: Int?, labels: WidgetSnapshot.Labels): Pair<String, ColorProvider>? = when {
delay == null -> null
delay > 5 -> labels.flightLate.replace("{m}", "$delay") to (if (delay >= 30) TrekStatus.danger else TrekStatus.pending)
delay < -5 -> labels.flightEarly.replace("{m}", "${-delay}") to TrekStatus.confirmed
else -> labels.flightOnTime to TrekStatus.confirmed
}
private const val FLIGHT_BLUE = 0xFF4A7DDB.toInt()
/**
* The trip's next flight, or the one in the air: both airports large, the
* route as an arc with the aircraft on it, the moment in words and the delay.
* The arc and the words follow the clock each time the widget is drawn.
*/
class FlightWidget : TrekWidget() {
@Composable
override fun Content(snapshot: WidgetSnapshot?) {
val context = LocalContext.current
val size = LocalSize.current
val labels = snapshot?.labels ?: return EmptyWidget(WidgetSamples.emptyText(context))
val flight = snapshot.flight
WidgetFrame(onClick = openPath(context, flight?.path ?: snapshot.trip?.path ?: "/")) {
Column(modifier = GlanceModifier.fillMaxSize()) {
Row(verticalAlignment = Alignment.CenterVertically, modifier = GlanceModifier.fillMaxWidth()) {
Icon(Icons.Rounded.Flight, GlanceTheme.colors.primary, 14.dp)
Spacer(GlanceModifier.width(5.dp))
Eyebrow(flight?.number ?: labels.flight, GlanceTheme.colors.primary, GlanceModifier.defaultWeight())
flight?.let { f ->
delayChip(f.delay, labels)?.let { (text, color) ->
if (size.isWide || (f.delay ?: 0) > 5) Chip(text, GlanceTheme.colors.surfaceVariant, color)
}
}
}
if (flight == null) {
Spacer(GlanceModifier.defaultWeight())
Line(labels.noFlight, 14.sp, GlanceTheme.colors.onSurfaceVariant, FontWeight.Medium, maxLines = 2)
Spacer(GlanceModifier.defaultWeight())
} else {
FlightBody(flight, labels, size.isWide, size.isTall)
}
}
}
}
}
/**
* The origin stands on the right in a right-to-left layout, so the drawn arc is
* mirrored with it. Read from the locale the widget speaks, not from the
* Configuration, which a composition may not read directly.
*/
private fun isRtl(): Boolean =
android.text.TextUtils.getLayoutDirectionFromLocale(java.util.Locale.getDefault()) == android.view.View.LAYOUT_DIRECTION_RTL
@Composable
private fun ColumnScope.FlightBody(f: WidgetSnapshot.Flight, labels: WidgetSnapshot.Labels, wide: Boolean, tall: Boolean) {
val now = System.currentTimeMillis() / 1000
val m = FlightMoment(f, now)
val arrival = f.arrTimeExpected ?: f.arrTime
val momentColor = if (m.airborne) GlanceTheme.colors.primary else GlanceTheme.colors.onSurface
Spacer(GlanceModifier.defaultWeight())
if (!wide) Line(momentText(m, labels, now), 13.sp, momentColor, FontWeight.Bold, maxLines = 2)
Spacer(GlanceModifier.height(6.dp))
Row(verticalAlignment = Alignment.CenterVertically, modifier = GlanceModifier.fillMaxWidth()) {
Column(modifier = GlanceModifier.defaultWeight()) {
Line(f.from, if (wide) 26.sp else 22.sp, weight = FontWeight.Bold)
if (wide) f.fromCity?.let { Line(it, 11.sp, GlanceTheme.colors.onSurfaceVariant) }
}
if (wide) {
Image(
provider = ImageProvider(WidgetArt.flightArc(m.progress, FLIGHT_BLUE, android.graphics.Color.argb(90, 120, 120, 130), rtl = isRtl())),
contentDescription = null,
contentScale = ContentScale.Fit,
modifier = GlanceModifier.width(120.dp).height(26.dp),
)
}
Column(modifier = GlanceModifier.defaultWeight(), horizontalAlignment = Alignment.End) {
Line(f.to, if (wide) 26.sp else 22.sp, weight = FontWeight.Bold)
if (wide) f.toCity?.let { Line(it, 11.sp, GlanceTheme.colors.onSurfaceVariant) }
}
}
if (!wide) {
Image(
provider = ImageProvider(WidgetArt.flightArc(m.progress, FLIGHT_BLUE, android.graphics.Color.argb(90, 120, 120, 130), rtl = isRtl())),
contentDescription = null,
contentScale = ContentScale.FillBounds,
modifier = GlanceModifier.fillMaxWidth().height(22.dp),
)
}
Spacer(GlanceModifier.height(4.dp))
Row(modifier = GlanceModifier.fillMaxWidth()) {
Line(f.depTime, 12.sp, GlanceTheme.colors.onSurfaceVariant, FontWeight.Bold, modifier = GlanceModifier.defaultWeight())
Line(arrival, 12.sp, GlanceTheme.colors.onSurfaceVariant, FontWeight.Bold)
}
if (wide) {
Spacer(GlanceModifier.height(8.dp))
Line(momentText(m, labels, now), 13.sp, momentColor, FontWeight.Bold)
if (m.airborne) {
Spacer(GlanceModifier.height(5.dp))
Bar(m.progress, GlanceTheme.colors.primary, GlanceTheme.colors.surfaceVariant, 5.dp)
}
}
if (tall) {
Spacer(GlanceModifier.height(10.dp))
f.aircraft?.let { FlightFact(it) }
f.fromCity?.let { from -> f.toCity?.let { to -> FlightFact("$from \u2192 $to") } }
}
Spacer(GlanceModifier.defaultWeight())
}
@Composable
private fun FlightFact(text: String) {
Row(
modifier = GlanceModifier.fillMaxWidth().background(GlanceTheme.colors.surfaceVariant).cornerRadius(12.dp)
.padding(horizontal = 10.dp, vertical = 7.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(Icons.Rounded.Flight, GlanceTheme.colors.primary, 13.dp)
Spacer(GlanceModifier.width(7.dp))
Line(text, 12.sp, GlanceTheme.colors.onSurfaceVariant, FontWeight.Medium)
}
Spacer(GlanceModifier.height(5.dp))
}
// ---- To-dos ----
/** What is still open for the trip, and how far the packing has come. */
@@ -149,4 +149,100 @@ object WidgetArt {
}
return bitmap
}
/**
* A flight's route as an arc: dashed ahead, solid where it has flown, a dot
* at either airport and an airliner riding the curve at its heading. White
* on a translucent track, like the ring; the widget tints nothing, so the
* caller passes the flight colour.
*/
fun flightArc(
progress: Float,
color: Int,
track: Int,
width: Int = 600,
height: Int = 120,
showPlane: Boolean = true,
rtl: Boolean = false,
): Bitmap {
val bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
val canvas = Canvas(bitmap)
// Right to left the origin stands on the right: the whole drawing is mirrored.
if (rtl) canvas.scale(-1f, 1f, width / 2f, height / 2f)
val p = progress.coerceIn(0f, 1f)
val inset = height * 0.14f
val sx = inset
val sy = height - inset
val ex = width - inset
val ey = height - inset
val cx = width / 2f
val cy = -height * 0.45f
val path = android.graphics.Path().apply {
moveTo(sx, sy)
quadTo(cx, cy, ex, ey)
}
val line = Paint(Paint.ANTI_ALIAS_FLAG).apply {
style = Paint.Style.STROKE
strokeCap = Paint.Cap.ROUND
strokeWidth = height * 0.035f
this.color = track
pathEffect = android.graphics.DashPathEffect(floatArrayOf(height * 0.02f, height * 0.07f), 0f)
}
canvas.drawPath(path, line)
val measure = android.graphics.PathMeasure(path, false)
if (p > 0f) {
val flown = android.graphics.Path()
measure.getSegment(0f, measure.length * p, flown, true)
line.pathEffect = null
line.strokeWidth = height * 0.045f
line.color = color
canvas.drawPath(flown, line)
}
val dot = Paint(Paint.ANTI_ALIAS_FLAG).apply { this.color = color }
canvas.drawCircle(sx, sy, height * 0.05f, dot)
val ring = Paint(Paint.ANTI_ALIAS_FLAG).apply {
style = if (p >= 1f) Paint.Style.FILL else Paint.Style.STROKE
strokeWidth = height * 0.03f
this.color = color
}
canvas.drawCircle(ex, ey, height * 0.06f, ring)
if (showPlane) {
val pos = FloatArray(2)
val tan = FloatArray(2)
measure.getPosTan(measure.length * p, pos, tan)
canvas.save()
canvas.translate(pos[0], pos[1])
canvas.rotate(Math.toDegrees(kotlin.math.atan2(tan[1].toDouble(), tan[0].toDouble())).toFloat())
val scale = height * 0.012f
canvas.scale(scale, scale)
canvas.drawCircle(0f, 0f, 13f, Paint(Paint.ANTI_ALIAS_FLAG).apply { this.color = Color.WHITE })
canvas.drawPath(airliner(), Paint(Paint.ANTI_ALIAS_FLAG).apply { this.color = color })
canvas.restore()
}
return bitmap
}
/** An airliner seen from above, nose along +x, about 18 units long, centred. */
private fun airliner(): android.graphics.Path = android.graphics.Path().apply {
moveTo(9f, 0f)
cubicTo(9f, -0.9f, 8.3f, -1.3f, 7.4f, -1.3f)
lineTo(3.2f, -1.3f)
lineTo(-1.6f, -7.6f)
lineTo(-3.7f, -7.6f)
lineTo(-1.4f, -1.3f)
lineTo(-5.5f, -1.3f)
lineTo(-7.2f, -3.7f)
lineTo(-8.8f, -3.7f)
lineTo(-7.8f, 0f)
lineTo(-8.8f, 3.7f)
lineTo(-7.2f, 3.7f)
lineTo(-5.5f, 1.3f)
lineTo(-1.4f, 1.3f)
lineTo(-3.7f, 7.6f)
lineTo(-1.6f, 7.6f)
lineTo(3.2f, 1.3f)
lineTo(7.4f, 1.3f)
cubicTo(8.3f, 1.3f, 9f, 0.9f, 9f, 0f)
close()
}
}
@@ -11,6 +11,19 @@ import org.json.JSONObject
* (WidgetSnapshot.sample in TrekFamily.swift).
*/
object WidgetSamples {
/** In the air on a running trip, two days ahead before one: the same LH 716 as the iOS sample. */
private fun flightJson(running: Boolean): String {
val now = System.currentTimeMillis() / 1000
val dep = if (running) now - 4 * 3600 else now + 2 * 86_400 + 5 * 3600
val live = if (running) {
""""depActual": ${dep + 18 * 60}, "arrExpected": ${dep + 12 * 3600 + 41 * 60}, "arrTimeExpected": "08:46", "delay": 16, "aircraft": "A359 D-AIXA","""
} else {
""
}
return """{"number": "LH 716", "from": "FRA", "to": "HND", "fromCity": "Frankfurt", "toCity": "Tokyo Haneda",
"dep": $dep, "arr": ${dep + 12 * 3600 + 25 * 60}, $live "depTime": "13:05", "arrTime": "08:30", "path": "/trips/1?booking=1"}"""
}
fun emptyText(context: Context): String = context.getString(R.string.widget_empty)
fun snapshot(running: Boolean, now: LocalDate = LocalDate.now()): WidgetSnapshot = WidgetSnapshot.fromJson(JSONObject(json(running, now)))
@@ -37,6 +50,7 @@ object WidgetSamples {
"place": "Kyoto, Japan", "dayCount": 9, "placeCount": 34, "memberCount": 3},
$today
"weather": {"temp": 18, "high": 21, "low": 11, "main": "${if (running) "Clear" else "Clouds"}", "label": "Mostly sunny", "place": "Kyoto", "rain": 10},
"flight": ${flightJson(running)},
"bookings": [
{"title": "LH 716", "kind": "flight", "date": "${iso(if (running) 6 else 12)}", "time": "13:05", "detail": "FRA → HND", "confirmed": true, "path": "/trips/1"},
{"title": "Shinkansen Nozomi 21", "kind": "train", "date": "${iso(if (running) 0 else 13)}", "time": "09:12", "detail": "Tokyo → Kyoto", "confirmed": true, "path": "/trips/1"},
@@ -25,6 +25,8 @@ data class WidgetSnapshot(
val atlas: Atlas?,
val collab: Collab?,
val labels: Labels,
/** The trip's next flight or the one in the air; last and defaulted, so older callers keep compiling. */
val flight: Flight? = null,
) {
data class Trip(
val title: String,
@@ -105,6 +107,39 @@ data class WidgetSnapshot(
data class Collab(val members: List<Member>, val messages: List<Message>, val poll: Poll?, val path: String)
/**
* The flight widget's flight. Times are epoch seconds, so the widget moves on
* with the clock between two snapshots; the clock times at either airport
* come formatted, since the widget has no zone data.
*/
data class Flight(
val number: String,
val from: String,
val to: String,
val fromCity: String?,
val toCity: String?,
val dep: Long,
val arr: Long,
/** Observed take-off. */
val depActual: Long?,
/** Before take-off: the planned departure plus the delay seen so far. */
val depExpected: Long?,
/** The feed saw the aircraft in the air when the app last looked. */
val airborne: Boolean,
/** Touchdown once landed, else the estimate while in the air. */
val arrExpected: Long?,
val landed: Boolean,
val depTime: String,
val arrTime: String,
val arrTimeExpected: String?,
/** Minutes late against the schedule, negative when early. */
val delay: Int?,
val aircraft: String?,
/** When the feed last heard the aircraft; null for a flight it never heard of. */
val seen: Long?,
val path: String,
)
/** The labels, translated by the app. The optional ones fall back to English. */
data class Labels(private val raw: JSONObject) {
val nextTrip get() = text("nextTrip", "Next trip")
@@ -137,6 +172,23 @@ data class WidgetSnapshot(
val votes get() = text("votes", "votes")
val noMessages get() = text("noMessages", "No messages yet")
val departure get() = text("departure", "Departure")
val flight get() = text("flight", "Flight")
/** Contains "{time}". */
val flightDeparts get() = text("flightDeparts", "Departs in {time}")
/** Contains "{time}". */
val flightLands get() = text("flightLands", "Lands in {time}")
val flightLanded get() = text("flightLanded", "Landed")
val flightReady get() = text("flightReady", "Ready for departure")
val noFlight get() = text("noFlight", "No flight ahead")
val flightOnTime get() = text("flightOnTime", "On time")
/** Contains "{m}". */
val flightLate get() = text("flightLate", "+{m} min")
/** Contains "{m}". */
val flightEarly get() = text("flightEarly", "{m} min early")
/** Contain "{d}" and "{h}", "{h}" and "{m}", and "{m}". */
val durDaysHours get() = text("durDaysHours", "{d} d {h} h")
val durHoursMinutes get() = text("durHoursMinutes", "{h} h {m} min")
val durMinutes get() = text("durMinutes", "{m} min")
private fun text(key: String, fallback: String): String = raw.optString(key).ifBlank { fallback }
}
@@ -240,6 +292,29 @@ data class WidgetSnapshot(
)
},
labels = Labels(o.optJSONObject("labels") ?: JSONObject()),
flight = o.optJSONObject("flight")?.let { f ->
Flight(
number = f.optString("number"),
from = f.optString("from"),
to = f.optString("to"),
fromCity = f.str("fromCity"),
toCity = f.str("toCity"),
dep = f.optLong("dep"),
arr = f.optLong("arr"),
depActual = f.long("depActual"),
depExpected = f.long("depExpected"),
airborne = f.optBoolean("airborne"),
arrExpected = f.long("arrExpected"),
landed = f.optBoolean("landed"),
depTime = f.optString("depTime"),
arrTime = f.optString("arrTime"),
arrTimeExpected = f.str("arrTimeExpected"),
delay = f.int("delay"),
aircraft = f.str("aircraft"),
seen = f.long("seen"),
path = f.optString("path", "/"),
)
}?.takeIf { it.dep > 0 && it.arr > 0 },
)
fun day(iso: String?): LocalDate? {
@@ -258,6 +333,8 @@ data class WidgetSnapshot(
private fun JSONObject.int(key: String): Int? = if (has(key) && !isNull(key)) optInt(key) else null
private fun JSONObject.long(key: String): Long? = if (has(key) && !isNull(key)) optLong(key) else null
private fun JSONArray?.objects(): List<JSONObject> =
if (this == null) emptyList() else (0 until length()).mapNotNull { optJSONObject(it) }
@@ -8,6 +8,8 @@
<string name="widget_today_description">خطة اليوم كخط زمني، مع الطقس والمحطة التالية.</string>
<string name="widget_bookings_name">الحجوزات</string>
<string name="widget_bookings_description">رحلاتك وقطاراتك وفنادقك وحجوزات المطاعم القادمة ومواعيدها.</string>
<string name="widget_flight_name">الرحلة</string>
<string name="widget_flight_description">رحلتك القادمة مباشرة: عد تنازلي للإقلاع، والطائرة في طريقها، والتأخير والوصول.</string>
<string name="widget_todos_name">المهام</string>
<string name="widget_todos_description">ما تبقى للرحلة، ومدى تقدم تجهيز الأمتعة.</string>
<string name="widget_packing_name">قائمة الأمتعة</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">Günün planı zaman xətti kimi, hava və növbəti dayanacaqla.</string>
<string name="widget_bookings_name">Bronlar</string>
<string name="widget_bookings_description">Növbəti uçuşlar, qatarlar, otellər və restoranlar, nə vaxt olduqları ilə.</string>
<string name="widget_flight_name">Uçuş</string>
<string name="widget_flight_description">Növbəti uçuşun canlı: uçuşa qədər geri sayım, yolda olan təyyarə, gecikmə və gəliş.</string>
<string name="widget_todos_name">Tapşırıqlar</string>
<string name="widget_todos_description">Səyahət üçün hələ nəyin qaldığı və yığışmağın nə yerdə olduğu.</string>
<string name="widget_packing_name">Yük siyahısı</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">以时间线显示今天的计划,附带天气和下一站。</string>
<string name="widget_bookings_name">预订</string>
<string name="widget_bookings_description">你接下来的航班、火车、酒店和餐厅,以及时间。</string>
<string name="widget_flight_name">航班</string>
<string name="widget_flight_description">实时查看下一班航班:起飞倒计时、飞行中的飞机、延误和到达。</string>
<string name="widget_todos_name">待办</string>
<string name="widget_todos_description">旅行还剩哪些事没做,以及行李收拾到哪一步。</string>
<string name="widget_packing_name">行李</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">以時間軸顯示今天的計畫,附上天氣與下一站。</string>
<string name="widget_bookings_name">預訂</string>
<string name="widget_bookings_description">你接下來的航班、火車、飯店與餐廳,以及時間。</string>
<string name="widget_flight_name">航班</string>
<string name="widget_flight_description">即時查看下一班航班:起飛倒數、飛行中的飛機、延誤和抵達。</string>
<string name="widget_todos_name">待辦</string>
<string name="widget_todos_description">旅行還剩哪些事沒做,以及行李整理到哪一步。</string>
<string name="widget_packing_name">行李</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">El pla del dia com a línia de temps, amb el temps i la propera parada.</string>
<string name="widget_bookings_name">Reserves</string>
<string name="widget_bookings_description">Els teus propers vols, trens, hotels i taules, i quan toquen.</string>
<string name="widget_flight_name">Vol</string>
<string name="widget_flight_description">El teu proper vol en directe: compte enrere de la sortida, l’avió en camí, retard i arribada.</string>
<string name="widget_todos_name">Tasques</string>
<string name="widget_todos_description">El que encara queda per al viatge i com va l\'equipatge.</string>
<string name="widget_packing_name">Equipatge</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">Plán dne jako časová osa, s počasím a další zastávkou.</string>
<string name="widget_bookings_name">Rezervace</string>
<string name="widget_bookings_description">Tvoje další lety, vlaky, hotely a stoly, a kdy tě čekají.</string>
<string name="widget_flight_name">Let</string>
<string name="widget_flight_description">Tvůj další let živě: odpočet do odletu, letadlo na cestě, zpoždění a přílet.</string>
<string name="widget_todos_name">Úkoly</string>
<string name="widget_todos_description">Co ještě zbývá k cestě a jak daleko je balení.</string>
<string name="widget_packing_name">Balení</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">Der Tagesplan als Zeitleiste, mit dem Wetter und dem nächsten Stopp.</string>
<string name="widget_bookings_name">Buchungen</string>
<string name="widget_bookings_description">Deine nächsten Flüge, Züge, Hotels und Tische, und wann sie anstehen.</string>
<string name="widget_flight_name">Flug</string>
<string name="widget_flight_description">Dein nächster Flug live: Countdown bis zum Abflug, die Maschine unterwegs, Verspätung und Ankunft.</string>
<string name="widget_todos_name">To-dos</string>
<string name="widget_todos_description">Was für die Reise noch offen ist und wie weit das Packen ist.</string>
<string name="widget_packing_name">Packliste</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">Το πρόγραμμα της ημέρας ως χρονολόγιο, με τον καιρό και την επόμενη στάση.</string>
<string name="widget_bookings_name">Κρατήσεις</string>
<string name="widget_bookings_description">Οι επόμενες πτήσεις, τα τρένα, τα ξενοδοχεία και τα τραπέζια σου, και πότε είναι.</string>
<string name="widget_flight_name">Πτήση</string>
<string name="widget_flight_description">Η επόμενη πτήση σου ζωντανά: αντίστροφη μέτρηση για την αναχώρηση, το αεροσκάφος καθ’ οδόν, καθυστέρηση και άφιξη.</string>
<string name="widget_todos_name">Εκκρεμότητες</string>
<string name="widget_todos_description">Τι μένει ακόμα για το ταξίδι και πόσο έχει προχωρήσει το πακετάρισμα.</string>
<string name="widget_packing_name">Αποσκευές</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">El plan del día como línea de tiempo, con el tiempo y la próxima parada.</string>
<string name="widget_bookings_name">Reservas</string>
<string name="widget_bookings_description">Tus próximos vuelos, trenes, hoteles y mesas, y cuándo tocan.</string>
<string name="widget_flight_name">Vuelo</string>
<string name="widget_flight_description">Tu próximo vuelo en directo: cuenta atrás de la salida, el avión en camino, retraso y llegada.</string>
<string name="widget_todos_name">Tareas</string>
<string name="widget_todos_description">Lo que aún queda para el viaje y cómo va la maleta.</string>
<string name="widget_packing_name">Equipaje</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">Päeva plaan ajajoonena, koos ilma ja järgmise peatusega.</string>
<string name="widget_bookings_name">Broneeringud</string>
<string name="widget_bookings_description">Sinu järgmised lennud, rongid, hotellid ja lauad ning millal need on.</string>
<string name="widget_flight_name">Lend</string>
<string name="widget_flight_description">Sinu järgmine lend otse: loendus väljumiseni, lennuk teel, hilinemine ja saabumine.</string>
<string name="widget_todos_name">Ülesanded</string>
<string name="widget_todos_description">Mis reisi jaoks veel tegemata on ja kui kaugel pakkimine on.</string>
<string name="widget_packing_name">Pakkimine</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">Le programme du jour en frise, avec la météo et la prochaine étape.</string>
<string name="widget_bookings_name">Réservations</string>
<string name="widget_bookings_description">Vos prochains vols, trains, hôtels et tables, et quand ils arrivent.</string>
<string name="widget_flight_name">Vol</string>
<string name="widget_flight_description">Votre prochain vol en direct : compte à rebours du départ, l’avion en route, retard et arrivée.</string>
<string name="widget_todos_name">À faire</string>
<string name="widget_todos_description">Ce qui reste à faire pour le voyage et où en sont les bagages.</string>
<string name="widget_packing_name">Bagages</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">A nap terve idővonalon, az időjárással és a következő megállóval.</string>
<string name="widget_bookings_name">Foglalások</string>
<string name="widget_bookings_description">A következő járataid, vonataid, szállásaid és asztalfoglalásaid, és hogy mikor esedékesek.</string>
<string name="widget_flight_name">Járat</string>
<string name="widget_flight_description">A következő járatod élőben: visszaszámlálás az indulásig, a gép útközben, késés és érkezés.</string>
<string name="widget_todos_name">Teendők</string>
<string name="widget_todos_description">Ami még hátravan az utazáshoz, és hol tart a csomagolás.</string>
<string name="widget_packing_name">Csomagolás</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">Rencana hari ini sebagai linimasa, dengan cuaca dan perhentian berikutnya.</string>
<string name="widget_bookings_name">Pemesanan</string>
<string name="widget_bookings_description">Penerbangan, kereta, hotel, dan meja berikutnya, beserta waktunya.</string>
<string name="widget_flight_name">Penerbangan</string>
<string name="widget_flight_description">Penerbangan berikutnya secara langsung: hitung mundur keberangkatan, pesawat dalam perjalanan, keterlambatan, dan kedatangan.</string>
<string name="widget_todos_name">Tugas</string>
<string name="widget_todos_description">Yang masih tersisa untuk perjalanan dan sejauh mana persiapan barang.</string>
<string name="widget_packing_name">Barang bawaan</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">Il programma del giorno come linea del tempo, con il meteo e la prossima tappa.</string>
<string name="widget_bookings_name">Prenotazioni</string>
<string name="widget_bookings_description">I tuoi prossimi voli, treni, hotel e tavoli, e quando sono.</string>
<string name="widget_flight_name">Volo</string>
<string name="widget_flight_description">Il tuo prossimo volo in tempo reale: conto alla rovescia per la partenza, l’aereo in viaggio, ritardo e arrivo.</string>
<string name="widget_todos_name">Da fare</string>
<string name="widget_todos_description">Cosa manca ancora per il viaggio e a che punto è la valigia.</string>
<string name="widget_packing_name">Bagagli</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">תוכנית היום כציר זמן, עם מזג האוויר והעצירה הבאה.</string>
<string name="widget_bookings_name">הזמנות</string>
<string name="widget_bookings_description">הטיסות, הרכבות, המלונות והשולחנות הבאים שלך, ומתי הם.</string>
<string name="widget_flight_name">טיסה</string>
<string name="widget_flight_description">הטיסה הבאה שלך בזמן אמת: ספירה לאחור עד ההמראה, המטוס בדרך, עיכוב והגעה.</string>
<string name="widget_todos_name">משימות</string>
<string name="widget_todos_description">מה עוד פתוח לטיול וכמה התקדמה האריזה.</string>
<string name="widget_packing_name">אריזה</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">今日の予定をタイムラインで、天気と次の予定とともに表示します。</string>
<string name="widget_bookings_name">予約</string>
<string name="widget_bookings_description">次のフライト、列車、ホテル、レストランとその日時。</string>
<string name="widget_flight_name">フライト</string>
<string name="widget_flight_description">次のフライトをライブで:出発までのカウントダウン、飛行中の機体、遅延と到着。</string>
<string name="widget_todos_name">やること</string>
<string name="widget_todos_description">旅行のために残っていることと、荷造りの進み具合。</string>
<string name="widget_packing_name">持ち物</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">오늘 일정을 타임라인으로, 날씨와 다음 장소와 함께 보여 줍니다.</string>
<string name="widget_bookings_name">예약</string>
<string name="widget_bookings_description">다가오는 항공편, 기차, 호텔, 식당과 그 시간.</string>
<string name="widget_flight_name">항공편</string>
<string name="widget_flight_description">다음 항공편을 실시간으로: 출발 카운트다운, 비행 중인 항공기, 지연과 도착.</string>
<string name="widget_todos_name">할 일</string>
<string name="widget_todos_description">여행을 위해 남은 일과 짐 싸기 진행 상황.</string>
<string name="widget_packing_name">짐 싸기</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">Het dagplan als tijdlijn, met het weer en de volgende stop.</string>
<string name="widget_bookings_name">Boekingen</string>
<string name="widget_bookings_description">Je volgende vluchten, treinen, hotels en tafels, en wanneer ze zijn.</string>
<string name="widget_flight_name">Vlucht</string>
<string name="widget_flight_description">Je volgende vlucht live: aftellen tot vertrek, het toestel onderweg, vertraging en aankomst.</string>
<string name="widget_todos_name">Taken</string>
<string name="widget_todos_description">Wat er nog openstaat voor de reis en hoe ver het inpakken is.</string>
<string name="widget_packing_name">Bagage</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">Plan dnia jako oś czasu, z pogodą i kolejnym przystankiem.</string>
<string name="widget_bookings_name">Rezerwacje</string>
<string name="widget_bookings_description">Twoje najbliższe loty, pociągi, hotele i stoliki oraz ich terminy.</string>
<string name="widget_flight_name">Lot</string>
<string name="widget_flight_description">Twój następny lot na żywo: odliczanie do odlotu, samolot w drodze, opóźnienie i przylot.</string>
<string name="widget_todos_name">Zadania</string>
<string name="widget_todos_description">Co jeszcze zostało do zrobienia przed podróżą i jak idzie pakowanie.</string>
<string name="widget_packing_name">Pakowanie</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">O plano do dia como linha do tempo, com o clima e a próxima parada.</string>
<string name="widget_bookings_name">Reservas</string>
<string name="widget_bookings_description">Seus próximos voos, trens, hotéis e mesas, e quando acontecem.</string>
<string name="widget_flight_name">Voo</string>
<string name="widget_flight_description">Seu próximo voo ao vivo: contagem regressiva para a partida, o avião a caminho, atraso e chegada.</string>
<string name="widget_todos_name">Tarefas</string>
<string name="widget_todos_description">O que ainda falta para a viagem e quanto da mala já está pronto.</string>
<string name="widget_packing_name">Bagagem</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">План дня в виде ленты времени, с погодой и следующей остановкой.</string>
<string name="widget_bookings_name">Бронирования</string>
<string name="widget_bookings_description">Ближайшие рейсы, поезда, отели и столики и когда они.</string>
<string name="widget_flight_name">Рейс</string>
<string name="widget_flight_description">Ваш следующий рейс в реальном времени: отсчёт до вылета, самолёт в пути, задержка и прибытие.</string>
<string name="widget_todos_name">Задачи</string>
<string name="widget_todos_description">Что ещё осталось сделать к поездке и как идут сборы.</string>
<string name="widget_packing_name">Сборы</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">Plán dňa ako časová os, s počasím a ďalšou zastávkou.</string>
<string name="widget_bookings_name">Rezervácie</string>
<string name="widget_bookings_description">Tvoje ďalšie lety, vlaky, hotely a stoly a kedy ťa čakajú.</string>
<string name="widget_flight_name">Let</string>
<string name="widget_flight_description">Tvoj ďalší let naživo: odpočet do odletu, lietadlo na ceste, meškanie a prílet.</string>
<string name="widget_todos_name">Úlohy</string>
<string name="widget_todos_description">Čo ešte zostáva na cestu a ako ďaleko je balenie.</string>
<string name="widget_packing_name">Balenie</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">Dagens plan som tidslinje, med vädret och nästa stopp.</string>
<string name="widget_bookings_name">Bokningar</string>
<string name="widget_bookings_description">Dina nästa flyg, tåg, hotell och bord, och när de är.</string>
<string name="widget_flight_name">Flyg</string>
<string name="widget_flight_description">Ditt nästa flyg live: nedräkning till avgång, planet på väg, försening och ankomst.</string>
<string name="widget_todos_name">Att göra</string>
<string name="widget_todos_description">Vad som återstår inför resan och hur långt packningen har kommit.</string>
<string name="widget_packing_name">Packning</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">แผนของวันนี้เป็นไทม์ไลน์ พร้อมสภาพอากาศและจุดหมายถัดไป</string>
<string name="widget_bookings_name">การจอง</string>
<string name="widget_bookings_description">เที่ยวบิน รถไฟ โรงแรม และร้านอาหารถัดไปของคุณ และเวลาของแต่ละรายการ</string>
<string name="widget_flight_name">เที่ยวบิน</string>
<string name="widget_flight_description">เที่ยวบินถัดไปแบบสด: นับถอยหลังถึงเวลาออกเดินทาง เครื่องบินระหว่างทาง ความล่าช้า และเวลาถึง</string>
<string name="widget_todos_name">สิ่งที่ต้องทำ</string>
<string name="widget_todos_description">สิ่งที่ยังค้างอยู่สำหรับทริป และความคืบหน้าการจัดกระเป๋า</string>
<string name="widget_packing_name">จัดกระเป๋า</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">Günün planı zaman çizelgesi olarak, hava durumu ve sonraki durakla.</string>
<string name="widget_bookings_name">Rezervasyonlar</string>
<string name="widget_bookings_description">Sıradaki uçuşların, trenlerin, otellerin ve masaların, ne zaman oldukları ile.</string>
<string name="widget_flight_name">Uçuş</string>
<string name="widget_flight_description">Bir sonraki uçuşun canlı: kalkışa geri sayım, yoldaki uçak, gecikme ve varış.</string>
<string name="widget_todos_name">Yapılacaklar</string>
<string name="widget_todos_description">Seyahat için hâlâ açık olanlar ve bavulun ne durumda olduğu.</string>
<string name="widget_packing_name">Bavul</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">План дня у вигляді стрічки часу, з погодою і наступною зупинкою.</string>
<string name="widget_bookings_name">Бронювання</string>
<string name="widget_bookings_description">Найближчі рейси, поїзди, готелі й столики та коли вони.</string>
<string name="widget_flight_name">Рейс</string>
<string name="widget_flight_description">Ваш наступний рейс наживо: відлік до вильоту, літак у дорозі, затримка й прибуття.</string>
<string name="widget_todos_name">Завдання</string>
<string name="widget_todos_description">Що ще лишилося зробити до подорожі і як просувається пакування.</string>
<string name="widget_packing_name">Пакування</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">Kế hoạch hôm nay dạng dòng thời gian, kèm thời tiết và điểm dừng tiếp theo.</string>
<string name="widget_bookings_name">Đặt chỗ</string>
<string name="widget_bookings_description">Các chuyến bay, tàu, khách sạn và bàn sắp tới của bạn, cùng thời gian.</string>
<string name="widget_flight_name">Chuyến bay</string>
<string name="widget_flight_description">Chuyến bay tiếp theo trực tiếp: đếm ngược giờ khởi hành, máy bay đang bay, độ trễ và giờ đến.</string>
<string name="widget_todos_name">Việc cần làm</string>
<string name="widget_todos_description">Những gì còn lại cho chuyến đi và việc soạn hành lý đã tới đâu.</string>
<string name="widget_packing_name">Hành lý</string>
@@ -8,6 +8,8 @@
<string name="widget_today_description">Today\'s plan as a timeline, with the weather and what is next.</string>
<string name="widget_bookings_name">Bookings</string>
<string name="widget_bookings_description">Your next flights, trains, hotels and tables, and when they are due.</string>
<string name="widget_flight_name">Flight</string>
<string name="widget_flight_description">Your next flight live: departure countdown, the aircraft on its way, delay and arrival.</string>
<string name="widget_todos_name">To-dos</string>
<string name="widget_todos_description">What is still open for the trip, and how far the packing has come.</string>
<string name="widget_packing_name">Packing</string>
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- The flight widget (widget/TrekWidgets.kt). Sizes in cells for Android 12+, dp before.
No previewImage: Glance draws the picker preview from the sample trip (providePreview). -->
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:description="@string/widget_flight_description"
android:initialLayout="@layout/glance_default_loading_layout"
android:minWidth="110dp"
android:minHeight="110dp"
android:minResizeWidth="110dp"
android:minResizeHeight="110dp"
android:maxResizeWidth="530dp"
android:maxResizeHeight="450dp"
android:targetCellWidth="4"
android:targetCellHeight="2"
android:resizeMode="horizontal|vertical"
android:updatePeriodMillis="1800000"
android:widgetCategory="home_screen"
android:configure="com.liketrek.trek.widget.WidgetConfigActivity"
android:widgetFeatures="reconfigurable|configuration_optional" />
@@ -0,0 +1,91 @@
package com.liketrek.trek
import java.io.File
import java.nio.file.Files
import org.junit.After
import org.junit.Assert.assertArrayEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
/** The stored copy of the server's UI (TrekOfflineShell), on a plain folder. */
class TrekOfflineShellTest {
private val root: File = Files.createTempDirectory("offline-shell").toFile()
@After
fun cleanUp() {
TrekOfflineShell.deactivate()
root.deleteRecursively()
}
@Test
fun theCopyAnswersOnlyForTheServerItWasStartedFor() {
TrekOfflineShell.activate("https://a.example.com")
assertTrue(TrekOfflineShell.isActive())
assertTrue(TrekOfflineShell.isActiveFor("https://a.example.com"))
// Another server picked in the same process: its pages come from the server.
assertFalse(TrekOfflineShell.isActiveFor("https://b.example.com"))
assertFalse(TrekOfflineShell.isActiveFor(null))
// A start that reaches the server leaves the copy behind.
TrekOfflineShell.deactivate()
assertFalse(TrekOfflineShell.isActive())
assertFalse(TrekOfflineShell.isActiveFor("https://a.example.com"))
}
@Test
fun aRefreshCutOffHalfwayKeepsThePreviousBuildWhole() {
val server = "https://a.example.com"
val oldPage = "<script src=/assets/index-old.js>".toByteArray()
assertTrue(TrekOfflineShell.beginRefresh(root, server))
assertTrue(TrekOfflineShell.saveFile(root, "assets/index-old.js", byteArrayOf(1)))
assertTrue(TrekOfflineShell.savePage(root, server, oldPage))
assertTrue(TrekOfflineShell.hasCopy(root, server))
// The next build: one file arrives, then the connection drops before the page is taken over.
assertTrue(TrekOfflineShell.beginRefresh(root, server))
assertTrue(TrekOfflineShell.saveFile(root, "assets/index-new.js", byteArrayOf(2)))
assertTrue(TrekOfflineShell.hasCopy(root, server))
assertArrayEquals(oldPage, File(root, "index.html").readBytes())
assertTrue(TrekOfflineShell.hasFile(root, "assets/index-old.js"))
// The file already fetched stays for the next try.
assertTrue(TrekOfflineShell.hasFile(root, "assets/index-new.js"))
}
@Test
fun aCompleteRefreshTakesTheNewPageAndDropsTheOldBuild() {
val server = "https://a.example.com"
TrekOfflineShell.beginRefresh(root, server)
TrekOfflineShell.saveFile(root, "assets/index-old.js", byteArrayOf(1))
TrekOfflineShell.savePage(root, server, "old".toByteArray())
TrekOfflineShell.beginRefresh(root, server)
TrekOfflineShell.saveFile(root, "assets/index-new.js", byteArrayOf(2))
assertTrue(TrekOfflineShell.savePage(root, server, "new".toByteArray()))
TrekOfflineShell.prune(root, setOf("assets/index-new.js"))
assertArrayEquals("new".toByteArray(), File(root, "index.html").readBytes())
assertTrue(TrekOfflineShell.hasFile(root, "assets/index-new.js"))
assertFalse(TrekOfflineShell.hasFile(root, "assets/index-old.js"))
}
@Test
fun aRefreshForAnotherServerThrowsTheOldCopyAwayFirst() {
TrekOfflineShell.beginRefresh(root, "https://a.example.com")
TrekOfflineShell.saveFile(root, "assets/index-a.js", byteArrayOf(1))
TrekOfflineShell.savePage(root, "https://a.example.com", "a".toByteArray())
assertTrue(TrekOfflineShell.beginRefresh(root, "https://b.example.com"))
assertFalse(TrekOfflineShell.hasCopy(root, "https://a.example.com"))
assertFalse(TrekOfflineShell.hasCopy(root, "https://b.example.com"))
assertFalse(TrekOfflineShell.hasFile(root, "assets/index-a.js"))
}
@Test
fun pathsOutsideTheCopyAreRefused() {
assertFalse(TrekOfflineShell.saveFile(root, "../escape.js", byteArrayOf(1)))
assertFalse(TrekOfflineShell.saveFile(root, "assets/index.js?v=1", byteArrayOf(1)))
assertFalse(TrekOfflineShell.hasFile(root, ""))
}
}
+1 -1
View File
@@ -375,7 +375,7 @@ const SCRIPTS: Record<string, GuideScript> = {
only(p => section(p, 'Authentication Methods').getByText('Password Login', { exact: true }).locator('xpath=../..')),
// The SSO rows exist only once OIDC is configured; the run shows where that happens.
only(p => section(p, 'Single Sign-On (OIDC)')),
only(p => section(p, 'Require two-factor authentication (2FA)')),
only(p => section(p, 'Require 2FA')),
],
},
'admin-passkeys': {
@@ -37,6 +37,7 @@
512499AF65E091B2BBC9A7BB /* UniformTypeIdentifiers.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45050B942C96E1ACCAB7CE9 /* UniformTypeIdentifiers.framework */; };
5480CCC12F42E9605044AB6B /* ShareHandoff.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56050CCA8DE4BEB4680D9E0B /* ShareHandoff.swift */; };
5A4D344328829E0F0B4D2B94 /* BookingsContent.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6D2F4930E5F152C8090C4F8 /* BookingsContent.swift */; };
F11E0C0A9B7D4E2A8C3F5A01 /* FlightContent.swift in Sources */ = {isa = PBXBuildFile; fileRef = F11E0C0A9B7D4E2A8C3F5A02 /* FlightContent.swift */; };
5BBE9EE02A47EC67C31F5E21 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = D0A4B2C6C93971E884561CFA /* Localizable.strings */; };
612BB9680DC27BB8BF553060 /* TrekFamily.swift in Sources */ = {isa = PBXBuildFile; fileRef = A030A06726542A2D7F61C54B /* TrekFamily.swift */; };
634F4E63DC7C2A0027F0D118 /* Details.swift in Sources */ = {isa = PBXBuildFile; fileRef = F406A4A31BD875A880A7CA14 /* Details.swift */; };
@@ -305,6 +306,7 @@
E5800E4ECECED54A47CDABAA /* tr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = tr; path = tr.lproj/Localizable.strings; sourceTree = "<group>"; };
E6831E849332626BE8D54CEF /* ShareView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = ShareView.swift; sourceTree = "<group>"; };
E6D2F4930E5F152C8090C4F8 /* BookingsContent.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = BookingsContent.swift; sourceTree = "<group>"; };
F11E0C0A9B7D4E2A8C3F5A02 /* FlightContent.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = FlightContent.swift; sourceTree = "<group>"; };
EAFBDD97043B34E4B64FDA86 /* pt-BR */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/Localizable.strings"; sourceTree = "<group>"; };
EC8D1292C9FC6430C059960A /* nl */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Localizable.strings; sourceTree = "<group>"; };
ECC80E1314B31ED2D2347411 /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/Localizable.strings; sourceTree = "<group>"; };
@@ -538,6 +540,7 @@
DE6873D246AC6B8E2CB6C8B4 /* TripContent.swift */,
24B175DE91E1E6E850DB0285 /* TodayContent.swift */,
E6D2F4930E5F152C8090C4F8 /* BookingsContent.swift */,
F11E0C0A9B7D4E2A8C3F5A02 /* FlightContent.swift */,
AEF7DCAA1AEE67F1291668D1 /* TodosContent.swift */,
);
name = TREKWidgets;
@@ -849,6 +852,7 @@
8FC5873BE6A8CB2AFB31A46A /* TripContent.swift in Sources */,
9A175689CFCC630BE9BB9EE1 /* TodayContent.swift in Sources */,
5A4D344328829E0F0B4D2B94 /* BookingsContent.swift in Sources */,
F11E0C0A9B7D4E2A8C3F5A01 /* FlightContent.swift in Sources */,
F1E29B18C5B1E75A5BC01B57 /* TodosContent.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
+29 -2
View File
@@ -17,6 +17,11 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
for context in connectionOptions.urlContexts where context.url.isFileURL {
TrekSharedFiles.receive(context.url)
}
// Launched by a tap on a widget or a Live Activity: held like a quick action.
// Capacitor still hears of the link, the UI ignores it there (feature appLinks).
for context in connectionOptions.urlContexts {
if let path = TrekQuickActions.appLinkPath(context.url) { TrekQuickActions.open(path: path) }
}
SceneDelegateProxy.shared.scene(scene, willConnectTo: session, options: connectionOptions)
}
@@ -40,7 +45,14 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
// com.liketrek.trek://share: the share sheet left an item for the import.
let handoffs = URLContexts.filter { $0.url.scheme == "com.liketrek.trek" && $0.url.host == "share" }
if !handoffs.isEmpty { TrekSharedFiles.receiveFromShareExtension() }
let others = URLContexts.subtracting(files).subtracting(handoffs)
// com.liketrek.trek://navigate/<path>: a widget or Live Activity tap. Through
// Capacitor it was an event a page reloading after the system ended its process
// never heard, and that page then took the same link for one already followed.
let appLinks = URLContexts.filter { TrekQuickActions.appLinkPath($0.url) != nil }
for context in appLinks {
if let path = TrekQuickActions.appLinkPath(context.url) { TrekQuickActions.open(path: path) }
}
let others = URLContexts.subtracting(files).subtracting(handoffs).subtracting(appLinks)
if !others.isEmpty { SceneDelegateProxy.shared.scene(scene, openURLContexts: others) }
}
@@ -104,10 +116,25 @@ enum TrekQuickActions {
static func open(_ item: UIApplicationShortcutItem) -> Bool {
guard let path = item.userInfo?[pathKey] as? String, path.hasPrefix("/") else { return false }
if let onOpen { onOpen(path) } else { pending = path }
open(path: path)
return true
}
/// A path to open: at once when the UI listens, else held for it to take.
/// Widget and Live Activity taps come this way too, so each is followed once.
static func open(path: String) {
if let onOpen { onOpen(path) } else { pending = path }
}
/// The path in com.liketrek.trek://navigate/<path>, the link widgets and Live Activities open.
static func appLinkPath(_ url: URL) -> String? {
let prefix = "com.liketrek.trek://navigate"
guard url.absoluteString.hasPrefix(prefix) else { return nil }
let path = String(url.absoluteString.dropFirst(prefix.count))
if path.isEmpty { return "/" }
return path.hasPrefix("/") ? path : nil
}
/// The action the app was launched with, once.
static func take() -> String? {
defer { pending = nil }
@@ -120,18 +120,47 @@ class TrekBridgeViewController: CAPBridgeViewController {
bottom: max(0, safe.bottom - (window.bounds.maxY - frame.maxY)),
right: max(0, safe.right - (window.bounds.maxX - frame.maxX))
)
if !force, insets == publishedSafeArea { return }
let corner = cornerElement(in: frame, window: window)
if !force, insets == publishedSafeArea, corner == publishedCorner { return }
publishedSafeArea = insets
publishedCorner = corner
let px = { (v: CGFloat) in "'\(Int(v.rounded(.up)))px'" }
let js = "(function(s){"
+ "s.setProperty('--trek-native-safe-top',\(px(insets.top)));"
+ "s.setProperty('--trek-native-safe-left',\(px(insets.left)));"
+ "s.setProperty('--trek-native-safe-right',\(px(insets.right)));"
+ "s.setProperty('--trek-native-safe-bottom',\(px(insets.bottom)));"
+ "s.setProperty('--trek-native-corner-bottom',\(px(corner.top)));"
+ "s.setProperty('--trek-native-corner-left',\(px(corner.left)));"
+ "s.setProperty('--trek-native-corner-right',\(px(corner.right)));"
+ "})(document.documentElement.style)"
webView.evaluateJavaScript(js, completionHandler: nil)
}
private var publishedCorner: UIEdgeInsets?
/// An element in a top corner of the screen, such as the status capsule of
/// an iPhone Duo: how far down it reaches (top) and how wide it is on its
/// side (left/right), in the web view's coordinates; zero where there is
/// none. iOS 26 tells a corner apart from a whole edge: the safe area with
/// the corner avoided vertically reaches lower than the one avoiding it
/// horizontally, which in turn is wider on the corner's side. The page puts
/// its top bar beside the element and starts its content below it, using
/// the full width (mobile.css), instead of giving up a strip of the whole
/// height.
private func cornerElement(in frame: CGRect, window: UIWindow) -> UIEdgeInsets {
guard #available(iOS 26.0, *) else { return .zero }
let vertical = view.edgeInsets(for: .safeArea(cornerAdaptation: .vertical))
let horizontal = view.edgeInsets(for: .safeArea(cornerAdaptation: .horizontal))
guard vertical.top > horizontal.top + 1 else { return .zero }
return UIEdgeInsets(
top: max(0, vertical.top - frame.minY),
left: max(0, horizontal.left - vertical.left - frame.minX),
bottom: 0,
right: max(0, horizontal.right - vertical.right - (window.bounds.maxX - frame.maxX))
)
}
// MARK: - A proxy's sign-in page
/// Over a proxy's sign-in page (Pangolin, authentik, ...) the server's UI is
@@ -455,10 +484,26 @@ enum TrekServerStore {
guard defaults.integer(forKey: checkedKey) < serverCheck else { return }
defaults.set(serverCheck, forKey: checkedKey)
guard let server = url else { return }
url = nil
// Not through `url`, which throws the offline copy away: it still belongs
// to this server, and is what the app starts on if the check cannot run.
defaults.removeObject(forKey: key)
defaults.removeObject(forKey: signInHostsKey)
defaults.set(server, forKey: previousKey)
}
/// The check an update asked for cannot run (the server is out of reach),
/// but there is a copy of its UI: the server goes back in place, unchecked
/// for now, and the check runs again on the next launch.
static func restoreForOffline() -> Bool {
let defaults = UserDefaults.standard
guard url == nil, let previous = previousURL,
FileManager.default.fileExists(atPath: offlineCopyURL.path) else { return false }
defaults.set(previous, forKey: key)
defaults.removeObject(forKey: previousKey)
defaults.set(0, forKey: checkedKey)
return true
}
/// The server an update asked to check again, until a server is set.
static var previousURL: String? {
UserDefaults.standard.string(forKey: previousKey)
+74 -10
View File
@@ -69,7 +69,7 @@ public class TrekShellPlugin: CAPPlugin, CAPBridgedPlugin, ASWebAuthenticationPr
/// builds a snapshot for nothing; "wallet" only where Wallet can take a pass (an
/// iPhone: an iPad has no Wallet app), so the UI offers no button that does nothing.
static var features: [String] {
var names = ["capabilities", "edgeBack", "tileCache", "biometricLock", "geolocation", "sharedFiles", "nativePush", "widgets", "liveActivity", "widgetTrips", "storeKit", "shareSheet", "keyCommands", "quickActions", "clientCertificate", "filePreview"]
var names = ["capabilities", "edgeBack", "tileCache", "biometricLock", "geolocation", "sharedFiles", "nativePush", "widgets", "liveActivity", "widgetTrips", "storeKit", "shareSheet", "keyCommands", "quickActions", "appLinks", "clientCertificate", "filePreview"]
if canAddWalletPasses { names.append("wallet") }
if TrekWatchLink.isAvailable { names.append("watch") }
return names
@@ -94,8 +94,9 @@ public class TrekShellPlugin: CAPPlugin, CAPBridgedPlugin, ASWebAuthenticationPr
TrekKeyCommands.onPress = { [weak self] id in
self?.notifyListeners("keyCommand", data: ["id": id])
}
// Kept until a listener takes it: a tap while the page reloads reaches the new page.
TrekQuickActions.onOpen = { [weak self] path in
DispatchQueue.main.async { self?.notifyListeners("quickAction", data: ["path": path]) }
DispatchQueue.main.async { self?.notifyListeners("quickAction", data: ["path": path], retainUntilConsumed: true) }
}
}
@@ -173,7 +174,8 @@ public class TrekShellPlugin: CAPPlugin, CAPBridgedPlugin, ASWebAuthenticationPr
nextName: nextName,
nextTime: call.getString("nextTime"),
done: call.getInt("done") ?? 0,
total: call.getInt("total") ?? 0
total: call.getInt("total") ?? 0,
flight: TrekShellPlugin.activityFlight(call.getObject("flight"))
)
// Stale at the end of the day, so a forgotten one fades out on its own.
let stale = Calendar.current.startOfDay(for: Date().addingTimeInterval(86_400))
@@ -193,6 +195,19 @@ public class TrekShellPlugin: CAPPlugin, CAPBridgedPlugin, ASWebAuthenticationPr
call.resolve(["running": false])
}
/// The day's flight the UI sent along (native/widgets.ts tripDayState), when complete.
@available(iOS 16.1, *)
static func activityFlight(_ raw: JSObject?) -> TripDayAttributes.Flight? {
guard let raw, let number = raw["number"] as? String, let from = raw["from"] as? String, let to = raw["to"] as? String,
let dep = (raw["dep"] as? NSNumber)?.doubleValue, let arr = (raw["arr"] as? NSNumber)?.doubleValue, arr > dep,
let depTime = raw["depTime"] as? String, let arrTime = raw["arrTime"] as? String else { return nil }
return TripDayAttributes.Flight(
number: number, from: from, to: to, dep: dep, arr: arr, depTime: depTime, arrTime: arrTime,
delay: (raw["delay"] as? NSNumber)?.intValue,
airborne: (raw["airborne"] as? Bool) ?? false
)
}
@objc func endTripDay(_ call: CAPPluginCall) {
#if canImport(ActivityKit)
if #available(iOS 16.2, *) {
@@ -462,6 +477,18 @@ public class TrekShellPlugin: CAPPlugin, CAPBridgedPlugin, ASWebAuthenticationPr
}
@objc func openOfflineCopy(_ call: CAPPluginCall) {
// The server an update asked to check again, out of reach: back to it on
// its copy. The new bridge loads the server, fails, and this screen comes
// back with the server set, which then opens the copy below.
if TrekServerStore.url == nil {
if TrekServerStore.restoreForOffline() {
call.resolve(["opened": true])
restartBridge()
} else {
call.resolve(["opened": false])
}
return
}
// With the trailing slash, like the bridge's serverURL: Capacitor only
// keeps a navigation in the app when it starts with that exact string,
// and hands anything else to Safari.
@@ -685,7 +712,7 @@ extension TrekShellPlugin {
// A held one that was delivered stops the purchase here. One that was paid
// but never set up is handed back as bought, so its instance is set up now.
if let held = await TrekStore.currentEntitlement(prefix: "cloud.") {
if await TrekStore.isUnfinished(held.id) {
if await TrekStore.awaitingSetup(held) {
call.resolve(["kind": "bought", "jws": held.jws, "transactionId": String(held.id), "productId": held.productId])
} else {
call.resolve(["kind": "subscribed"])
@@ -759,8 +786,8 @@ extension TrekShellPlugin {
call.resolve(["held": false])
return
}
let unfinished = await TrekStore.isUnfinished(held.id)
call.resolve(["held": !unfinished])
let awaiting = await TrekStore.awaitingSetup(held)
call.resolve(["held": !awaiting])
}
}
}
@@ -793,17 +820,54 @@ enum TrekStore {
}
}
static func currentEntitlement(prefix: String) async -> (jws: String, id: UInt64, productId: String)? {
var newest: (date: Date, jws: String, id: UInt64, productId: String)?
typealias Held = (jws: String, id: UInt64, productId: String, firstPurchase: Bool)
/// The subscription this Apple ID holds under `prefix`, newest first. The
/// entitlements on the device come first; on a fresh install they can still
/// be empty while the subscription runs, so the status of the subscription
/// group, which StoreKit asks the App Store for, decides then.
static func currentEntitlement(prefix: String) async -> Held? {
var newest: (date: Date, held: Held)?
for await result in Transaction.currentEntitlements {
guard case .verified(let transaction) = result,
transaction.productID.hasPrefix(prefix),
transaction.revocationDate == nil else { continue }
if newest == nil || transaction.purchaseDate > newest!.date {
newest = (transaction.purchaseDate, result.jwsRepresentation, transaction.id, transaction.productID)
newest = (transaction.purchaseDate, held(result.jwsRepresentation, transaction))
}
}
return newest.map { (jws: $0.jws, id: $0.id, productId: $0.productId) }
if let newest { return newest.held }
return await subscriptionGroupHeld(prefix: prefix)
}
/// The plans the control plane sells (`cloud.<plan>.<monthly|yearly>`, as
/// productIdFor in iap.ts); one of them is enough to find their group.
private static let plans = ["start", "basis", "plus", "pro"]
private static func subscriptionGroupHeld(prefix: String) async -> Held? {
let ids = plans.flatMap { ["\(prefix)\($0).monthly", "\(prefix)\($0).yearly"] }
guard let products = try? await Product.products(for: ids),
let group = products.compactMap({ $0.subscription?.subscriptionGroupID }).first,
let statuses = try? await Product.SubscriptionInfo.status(for: group) else { return nil }
let running: [Product.SubscriptionInfo.RenewalState] = [.subscribed, .inGracePeriod, .inBillingRetryPeriod]
for status in statuses where running.contains(status.state) {
if case .verified(let transaction) = status.transaction, transaction.revocationDate == nil {
return held(status.transaction.jwsRepresentation, transaction)
}
}
return nil
}
private static func held(_ jws: String, _ transaction: Transaction) -> Held {
(jws: jws, id: transaction.id, productId: transaction.productID, firstPurchase: transaction.originalID == transaction.id)
}
/// A first purchase that was paid but whose instance was never set up: handed
/// back as bought so it is set up now. A renewal the device has not finished
/// yet is no such purchase; its subscription is running and counts as held.
static func awaitingSetup(_ held: Held) async -> Bool {
guard held.firstPurchase else { return false }
return await isUnfinished(held.id)
}
/// Paid but not delivered yet: the shell finishes a transaction once its instance exists.
@@ -0,0 +1,266 @@
import SwiftUI
/// The trip's next flight, or the one in the air: both airports large, the
/// route as an arc with the aircraft riding it, the moment in words with a
/// countdown the system keeps running, and the delay. Between two snapshots
/// the widget moves on with the clock: it takes off at the observed (or
/// planned) time, flies along the arc and lands at the expected (or planned)
/// arrival.
struct FlightContent: View {
let snapshot: WidgetSnapshot?
let family: TrekFamily
let now: Date
@Environment(\.colorScheme) private var scheme
private let accent = Trek.booking("flight").color
var body: some View {
if let flight = snapshot?.flight, let labels = snapshot?.labels {
let moment = FlightMoment(flight, now: now)
switch family {
case .circular: circular(flight, moment)
case .rectangular: rectangular(flight, moment, labels)
case .inline: inline(flight, moment, labels)
case .small: small(flight, moment, labels)
case .medium: medium(flight, moment, labels)
default: large(flight, moment, labels)
}
} else {
empty(snapshot?.labels)
}
}
// MARK: Small: the moment above, the route below
private func small(_ f: WidgetSnapshot.Flight, _ m: FlightMoment, _ labels: WidgetSnapshot.Labels) -> some View {
VStack(alignment: .leading, spacing: 0) {
HStack(spacing: 6) {
Image(systemName: "airplane").font(.system(size: 12, weight: .bold)).foregroundStyle(accent)
Text(f.number).font(.system(size: 12, weight: .heavy)).foregroundStyle(Trek.ink(scheme)).lineLimit(1)
Spacer(minLength: 0)
delayChip(f, labels, compact: true)
}
Spacer(minLength: 0)
momentText(f, m, labels)
.font(.system(size: 13, weight: .bold))
.foregroundStyle(m.stage == .airborne ? accent : Trek.ink(scheme))
.lineLimit(2)
.minimumScaleFactor(0.85)
Spacer(minLength: 6)
HStack(alignment: .firstTextBaseline) {
Text(f.from).font(Trek.number(24, .heavy)).foregroundStyle(Trek.ink(scheme))
Spacer(minLength: 2)
Text(f.to).font(Trek.number(24, .heavy)).foregroundStyle(Trek.ink(scheme))
}
RouteArc(progress: m.progress, color: accent).flipsForRightToLeftLayoutDirection(true).frame(height: 20).padding(.vertical, 3)
HStack {
Text(f.depTime).font(Trek.number(12, .bold)).foregroundStyle(Trek.muted(scheme))
Spacer(minLength: 2)
Text(f.arrTimeExpected ?? f.arrTime).font(Trek.number(12, .bold)).foregroundStyle(Trek.muted(scheme))
}
}
}
// MARK: Medium: a boarding pass
private func medium(_ f: WidgetSnapshot.Flight, _ m: FlightMoment, _ labels: WidgetSnapshot.Labels) -> some View {
VStack(alignment: .leading, spacing: 0) {
HStack(spacing: 7) {
Text(labels.flight ?? "").trekEyebrow(scheme)
Text(f.number).font(.system(size: 11, weight: .heavy)).foregroundStyle(accent)
Spacer(minLength: 4)
delayChip(f, labels, compact: false)
}
Spacer(minLength: 4)
HStack(alignment: .center, spacing: 10) {
airport(f.from, f.fromCity, time: f.depTime, planned: nil, align: .leading)
VStack(spacing: 4) {
RouteArc(progress: m.progress, color: accent).flipsForRightToLeftLayoutDirection(true).frame(height: 30)
progressBar(m)
}
.frame(maxWidth: .infinity)
airport(f.to, f.toCity, time: f.arrTimeExpected ?? f.arrTime, planned: f.arrTimeExpected.flatMap { $0 == f.arrTime ? nil : f.arrTime }, align: .trailing)
}
Spacer(minLength: 6)
momentText(f, m, labels)
.font(.system(size: 13, weight: .bold))
.foregroundStyle(m.stage == .airborne ? accent : Trek.ink(scheme))
.lineLimit(1)
.minimumScaleFactor(0.85)
}
}
// MARK: Large and extra large: the pass with the details under it
private func large(_ f: WidgetSnapshot.Flight, _ m: FlightMoment, _ labels: WidgetSnapshot.Labels) -> some View {
VStack(alignment: .leading, spacing: 12) {
medium(f, m, labels).frame(maxHeight: 150)
Rectangle().fill(Trek.track(scheme)).frame(height: 0.8)
LazyVGrid(columns: [GridItem(.flexible(), spacing: 8), GridItem(.flexible(), spacing: 8)], spacing: 8) {
if let aircraft = f.aircraft { detail(systemImage: "airplane.circle", value: aircraft) }
detail(systemImage: "clock", value: "\(f.depTime) → \(f.arrTimeExpected ?? f.arrTime)")
if let fromCity = f.fromCity { detail(systemImage: "airplane.departure", value: fromCity) }
if let toCity = f.toCity { detail(systemImage: "airplane.arrival", value: toCity) }
}
Spacer(minLength: 0)
}
}
// MARK: Lock screen
private func circular(_ f: WidgetSnapshot.Flight, _ m: FlightMoment) -> some View {
ProgressRing(value: m.progress, lineWidth: 5, colors: [.white], trackColor: Color.white.opacity(0.25)) {
Image(systemName: m.stage == .landed ? "airplane.arrival" : m.stage == .airborne ? "airplane" : "airplane.departure")
.font(.system(size: 17, weight: .bold))
}
.padding(4)
}
private func rectangular(_ f: WidgetSnapshot.Flight, _ m: FlightMoment, _ labels: WidgetSnapshot.Labels) -> some View {
VStack(alignment: .leading, spacing: 2) {
HStack(spacing: 4) {
Image(systemName: "airplane").font(.system(size: 11, weight: .bold))
Text("\(f.number) \(f.from) → \(f.to)").font(.system(size: 12, weight: .heavy)).lineLimit(1)
}
momentText(f, m, labels).font(.system(size: 13, weight: .semibold)).lineLimit(1)
if m.stage == .airborne {
ProgressView(timerInterval: m.start...m.end, countsDown: false) { EmptyView() } currentValueLabel: { EmptyView() }
.progressViewStyle(.linear)
}
}
.frame(maxWidth: .infinity, alignment: .leading)
}
private func inline(_ f: WidgetSnapshot.Flight, _ m: FlightMoment, _ labels: WidgetSnapshot.Labels) -> some View {
Text("\(Image(systemName: "airplane")) \(f.number) ") + momentText(f, m, labels)
}
// MARK: Parts
private func airport(_ code: String, _ city: String?, time: String, planned: String?, align: HorizontalAlignment) -> some View {
VStack(alignment: align, spacing: 1) {
Text(code).font(Trek.number(28, .heavy)).foregroundStyle(Trek.ink(scheme))
if let city { Text(city).font(.system(size: 10.5, weight: .semibold)).foregroundStyle(Trek.faint(scheme)).lineLimit(1) }
if let planned { Text(planned).font(Trek.number(10.5, .bold)).strikethrough().foregroundStyle(Trek.faint(scheme)) }
Text(time).font(Trek.number(14, .heavy)).foregroundStyle(Trek.ink(scheme))
}
.frame(maxWidth: 96, alignment: align == .leading ? .leading : .trailing)
}
@ViewBuilder
private func progressBar(_ m: FlightMoment) -> some View {
if m.stage == .airborne {
// The system runs this bar on its own, so it fills between two snapshots too.
ProgressView(timerInterval: m.start...m.end, countsDown: false) { EmptyView() } currentValueLabel: { EmptyView() }
.progressViewStyle(.linear)
.tint(accent)
} else {
Capsule().fill(m.stage == .landed ? accent : Trek.track(scheme)).frame(height: 4)
}
}
private func detail(systemImage: String, value: String) -> some View {
HStack(spacing: 6) {
Image(systemName: systemImage).font(.system(size: 12, weight: .semibold)).foregroundStyle(accent)
Text(value).font(.system(size: 12, weight: .semibold)).foregroundStyle(Trek.muted(scheme)).lineLimit(1)
Spacer(minLength: 0)
}
.padding(.horizontal, 10)
.padding(.vertical, 8)
.background(RoundedRectangle(cornerRadius: 12, style: .continuous).fill(Trek.card(scheme)))
}
/// "Departs in 2 hr, 10 min", "Lands in 1 hr", "Landed": the countdowns are the system's own running text.
private func momentText(_ f: WidgetSnapshot.Flight, _ m: FlightMoment, _ labels: WidgetSnapshot.Labels) -> Text {
switch m.stage {
case .upcoming:
return Countdown.text(labels.flightDeparts ?? "{time}", until: m.start)
case .ready:
return Text(labels.flightReady ?? "")
case .airborne:
// "In the air" is what the blue line and the moving aircraft say; the words count down to landing.
return Countdown.text(labels.flightLands ?? "{time}", until: m.end)
case .landed:
return Text(labels.flightLanded ?? "")
}
}
@ViewBuilder
private func delayChip(_ f: WidgetSnapshot.Flight, _ labels: WidgetSnapshot.Labels, compact: Bool) -> some View {
if let delay = f.delay {
let late = delay > 5
let early = delay < -5
let color = late ? (delay >= 30 ? Trek.danger : Trek.pending) : Trek.confirmed
let text = late
? (labels.flightLate ?? "+{m}").replacingOccurrences(of: "{m}", with: "\(delay)")
: early ? (labels.flightEarly ?? "{m}").replacingOccurrences(of: "{m}", with: "\(-delay)") : (labels.flightOnTime ?? "")
if !(compact && !late) {
Text(text)
.font(.system(size: 10.5, weight: .heavy))
.foregroundStyle(color)
.padding(.horizontal, 7)
.padding(.vertical, 3)
.background(Capsule().fill(color.opacity(scheme == .dark ? 0.22 : 0.14)))
.lineLimit(1)
}
}
}
private func empty(_ labels: WidgetSnapshot.Labels?) -> some View {
VStack(alignment: .leading, spacing: 6) {
Text(labels?.flight ?? "").trekEyebrow(scheme)
Spacer(minLength: 0)
Image(systemName: "airplane").font(.system(size: 30, weight: .bold)).foregroundStyle(accent.opacity(0.35))
Text(labels?.noFlight ?? labels?.noBookings ?? "").font(.system(size: 13, weight: .semibold)).foregroundStyle(Trek.muted(scheme)).lineLimit(2)
}
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .leading)
}
}
/// Where a flight stands at a given moment, from the snapshot's times. What the
/// feed saw wins: a flight still at the gate past its planned departure is not
/// flown along the arc, and a flight is only landed once confirmed. Only a
/// flight the feed never heard of moves on by its schedule alone.
struct FlightMoment {
enum Stage { case upcoming, ready, airborne, landed }
let stage: Stage
/// 0 at the gate, 1 at the destination.
let progress: Double
/// Take-off and touchdown the moment is measured between: observed or expected where known, planned otherwise.
let start: Date
let end: Date
init(_ f: WidgetSnapshot.Flight, now: Date) {
let start = Date(timeIntervalSince1970: f.depActual ?? f.depExpected ?? f.dep)
let end = max(Date(timeIntervalSince1970: f.arrExpected ?? f.arr), start.addingTimeInterval(60))
self.start = start
self.end = end
let heard = f.seen != nil
let flying = f.airborne == true || f.depActual != nil || (!heard && now >= start)
// A flight the feed lost stops counting two hours after its arrival.
if f.landed == true || (!heard && now >= end) || now >= end.addingTimeInterval(7200) {
stage = .landed
progress = 1
} else if flying {
stage = .airborne
// Unconfirmed, it never quite arrives on the arc.
progress = min(0.98, max(0, now.timeIntervalSince(start) / end.timeIntervalSince(start)))
} else if now >= start {
stage = .ready
progress = 0
} else {
stage = .upcoming
progress = 0
}
}
}
/// A sentence with "{time}" in it, the placeholder replaced by a countdown the system keeps running.
enum Countdown {
static func text(_ sentence: String, until date: Date) -> Text {
let parts = sentence.components(separatedBy: "{time}")
guard parts.count == 2 else { return Text(sentence) }
return Text(parts[0]) + Text(date, style: .relative) + Text(parts[1])
}
}
@@ -158,6 +158,30 @@ private struct BookingsFamilyView: View {
var body: some View { BookingsContent(snapshot: entry.snapshot, family: TrekFamily(family), now: entry.date) }
}
// MARK: - Flight
struct FlightWidget: Widget {
var body: some WidgetConfiguration {
AppIntentConfiguration(kind: "TripFlight", intent: SelectTripIntent.self, provider: TrekTripProvider()) { entry in
TrekContainer(link: entry.snapshot?.flight.flatMap { WidgetSnapshot.link($0.path) }) {
FlightFamilyView(entry: entry)
} background: {
TrekPaper()
}
}
.configurationDisplayName("widget.flight.name")
.description("widget.flight.description")
.supportedFamilies([.systemSmall, .systemMedium, .systemLarge, .accessoryCircular, .accessoryRectangular, .accessoryInline])
}
}
private struct FlightFamilyView: View {
@Environment(\.widgetFamily) private var family
let entry: TrekEntry
var body: some View { FlightContent(snapshot: entry.snapshot, family: TrekFamily(family), now: entry.date) }
}
// MARK: - To-dos
struct TodosWidget: Widget {
@@ -1,7 +1,7 @@
import SwiftUI
import WidgetKit
/// The TREK widgets: the trip, today's plan, the bookings ahead, the to-dos,
/// The TREK widgets: the trip, today's plan, the bookings ahead, the next flight, the to-dos,
/// the packing list, the Atlas and the travel group on the home and lock
/// screen, and the travel day as a Live Activity.
@main
@@ -10,6 +10,7 @@ struct TREKWidgetsBundle: WidgetBundle {
NextTripWidget()
TodayWidget()
BookingsWidget()
FlightWidget()
TodosWidget()
PackingWidget()
AtlasWidget()
@@ -115,6 +115,29 @@ extension WidgetSnapshot {
poll: "Poll", votes: "votes", noMessages: "No messages yet", departure: "Departure"
)
)
// In the air on a running trip, two days ahead before one.
let departure = running ? now.addingTimeInterval(-4 * 3600) : now.addingTimeInterval(2 * 86_400 + 5 * 3600)
snapshot.flight = Flight(
number: "LH 716", from: "FRA", to: "HND", fromCity: "Frankfurt", toCity: "Tokyo Haneda",
dep: departure.timeIntervalSince1970, arr: departure.addingTimeInterval(12 * 3600 + 25 * 60).timeIntervalSince1970,
depActual: running ? departure.addingTimeInterval(18 * 60).timeIntervalSince1970 : nil,
depExpected: nil, airborne: running ? true : nil,
arrExpected: running ? departure.addingTimeInterval(12 * 3600 + 41 * 60).timeIntervalSince1970 : nil,
landed: nil, depTime: "13:05", arrTime: "08:30", arrTimeExpected: running ? "08:46" : nil,
delay: running ? 16 : nil, aircraft: running ? "A359 D-AIXA" : nil, seen: running ? now.timeIntervalSince1970 : nil,
path: "/trips/1?booking=1"
)
snapshot.labels.flight = "Flight"
snapshot.labels.flightDeparts = "Departs in {time}"
snapshot.labels.flightInAir = "In the air"
snapshot.labels.flightLands = "Lands in {time}"
snapshot.labels.flightLanded = "Landed"
snapshot.labels.flightOnTime = "On time"
snapshot.labels.flightLate = "+{m} min"
snapshot.labels.flightEarly = "{m} min early"
snapshot.labels.flightEstimated = "estimated"
snapshot.labels.flightReady = "Ready for departure"
snapshot.labels.noFlight = "No flight ahead"
snapshot.packing?.bags = [
.init(name: "Suitcase", color: "#4A7DDB", grams: 14_200, limit: 23_000, packed: 15, total: 19),
.init(name: "Daypack", color: "#2FA37A", grams: 4_100, limit: 8_000, packed: 8, total: 12),
@@ -174,6 +197,7 @@ extension WidgetSnapshot {
snapshot.packing = nil
snapshot.atlas = Atlas(count: 0, codes: [], recent: [], continents: [])
snapshot.collab = nil
snapshot.flight = nil
return snapshot
}
}
@@ -16,6 +16,27 @@ struct TripDayAttributes: ActivityAttributes {
/// Stops behind, out of the day's stops.
var done: Int
var total: Int
/// The day's flight while it is near or in the air, so the activity turns into
/// a boarding pass. Optional: a state written by an older app decodes without it.
var flight: Flight?
}
/// A flight the activity follows on its own between two updates: the system
/// runs the bar and the countdown from the two times.
struct Flight: Codable, Hashable {
var number: String
var from: String
var to: String
/// Take-off and touchdown, epoch seconds: observed or expected where known.
var dep: Double
var arr: Double
/// The clock at either airport, formatted by the app.
var depTime: String
var arrTime: String
/// Minutes late, for the colour of the arrival time.
var delay: Int?
/// In the air when the app last looked: the countdown runs to touchdown.
var airborne: Bool?
}
var tripTitle: String
@@ -7,11 +7,17 @@ import WidgetKit
struct TripDayLiveActivity: Widget {
var body: some WidgetConfiguration {
ActivityConfiguration(for: TripDayAttributes.self) { context in
TripDayBanner(
tripTitle: context.attributes.tripTitle, dayLabel: context.state.dayLabel,
nextName: context.state.nextName, nextTime: context.state.nextTime,
done: context.state.done, total: context.state.total
)
Group {
if let flight = context.state.flight {
FlightBanner(flight: flight, tripTitle: context.attributes.tripTitle)
} else {
TripDayBanner(
tripTitle: context.attributes.tripTitle, dayLabel: context.state.dayLabel,
nextName: context.state.nextName, nextTime: context.state.nextTime,
done: context.state.done, total: context.state.total
)
}
}
.activityBackgroundTint(Color(hex: 0x0C0C0F).opacity(0.92))
.activitySystemActionForegroundColor(.white)
.widgetURL(WidgetSnapshot.link(context.attributes.path))
@@ -33,17 +39,32 @@ struct TripDayLiveActivity: Widget {
}
}
DynamicIslandExpandedRegion(.bottom) {
VStack(alignment: .leading, spacing: 8) {
Text(state.nextName).font(.system(size: 17, weight: .heavy)).lineLimit(1)
DayStopProgress(done: state.done, total: state.total)
if let flight = state.flight {
FlightPass(flight: flight).padding(.horizontal, 4)
} else {
VStack(alignment: .leading, spacing: 8) {
Text(state.nextName).font(.system(size: 17, weight: .heavy)).lineLimit(1)
DayStopProgress(done: state.done, total: state.total)
}
.padding(.horizontal, 4)
}
.padding(.horizontal, 4)
}
} compactLeading: {
Image(systemName: "mappin.circle.fill").foregroundStyle(Trek.confirmed)
if let flight = state.flight {
HStack(spacing: 3) {
Image(systemName: "airplane").foregroundStyle(Trek.info)
Text(flight.to).font(Trek.number(13, .heavy))
}
} else {
Image(systemName: "mappin.circle.fill").foregroundStyle(Trek.confirmed)
}
} compactTrailing: {
Text(state.nextTime ?? "\(state.done)/\(state.total)")
.font(Trek.number(13, .heavy))
if let flight = state.flight {
FlightCountdown(flight: flight).font(Trek.number(13, .heavy)).frame(maxWidth: 64)
} else {
Text(state.nextTime ?? "\(state.done)/\(state.total)")
.font(Trek.number(13, .heavy))
}
} minimal: {
ZStack {
Circle().stroke(Color.white.opacity(0.25), lineWidth: 2.5)
@@ -59,3 +80,76 @@ struct TripDayLiveActivity: Widget {
}
}
}
/// The day's flight on the lock screen: both airports, the bar the system runs
/// from take-off to touchdown, and a countdown to whichever comes next.
struct FlightBanner: View {
let flight: TripDayAttributes.Flight
let tripTitle: String
var body: some View {
VStack(alignment: .leading, spacing: 10) {
HStack(spacing: 6) {
Image(systemName: "airplane").font(.system(size: 12, weight: .bold)).foregroundStyle(Trek.info)
Text(flight.number).font(.system(size: 12, weight: .heavy)).foregroundStyle(.white)
Text(tripTitle)
.font(.system(size: 11, weight: .bold))
.tracking(0.5)
.textCase(.uppercase)
.foregroundStyle(.white.opacity(0.55))
.lineLimit(1)
Spacer(minLength: 4)
FlightCountdown(flight: flight).font(Trek.number(15, .heavy)).foregroundStyle(.white)
}
FlightPass(flight: flight)
}
.padding(16)
}
}
/// The two airports with their times and the bar between them.
struct FlightPass: View {
let flight: TripDayAttributes.Flight
var body: some View {
let start = Date(timeIntervalSince1970: flight.dep)
let end = Date(timeIntervalSince1970: flight.arr)
let late = (flight.delay ?? 0) > 5
HStack(alignment: .center, spacing: 12) {
VStack(alignment: .leading, spacing: 0) {
Text(flight.from).font(Trek.number(26, .heavy)).foregroundStyle(.white)
Text(flight.depTime).font(Trek.number(13, .bold)).foregroundStyle(.white.opacity(0.7))
}
VStack(spacing: 4) {
Image(systemName: "airplane").font(.system(size: 13, weight: .bold)).foregroundStyle(Trek.info)
ProgressView(timerInterval: start...end, countsDown: false) { EmptyView() } currentValueLabel: { EmptyView() }
.progressViewStyle(.linear)
.tint(Trek.info)
}
.frame(maxWidth: .infinity)
VStack(alignment: .trailing, spacing: 0) {
Text(flight.to).font(Trek.number(26, .heavy)).foregroundStyle(.white)
Text(flight.arrTime).font(Trek.number(13, .bold)).foregroundStyle(late ? Trek.pending : .white.opacity(0.7))
}
}
}
}
/// A running countdown, in the system's own format: to touchdown once the app saw
/// the aircraft in the air, to take-off before. The system runs it between two
/// updates; the stage changes with the app's next update after take-off.
struct FlightCountdown: View {
let flight: TripDayAttributes.Flight
var body: some View {
let start = Date(timeIntervalSince1970: flight.dep)
let end = Date(timeIntervalSince1970: flight.arr)
let flying = flight.airborne == true
let target = flying ? end : start
HStack(spacing: 3) {
Image(systemName: flying ? "airplane.arrival" : "airplane.departure")
Text(timerInterval: min(Date(), target)...target, countsDown: true)
.multilineTextAlignment(.trailing)
}
}
}
@@ -160,6 +160,38 @@ struct WidgetSnapshot: Codable {
}
}
/// The trip's next flight or the one in the air, for the flight widget.
/// Times are epoch seconds, so the widget moves its countdown and its
/// aircraft on with the clock between two snapshots; the clock times at
/// either airport come formatted, the widget has no zone data.
struct Flight: Codable {
var number: String
var from: String
var to: String
var fromCity: String?
var toCity: String?
var dep: Double
var arr: Double
/// Observed take-off.
var depActual: Double?
/// Before take-off: the planned departure plus the delay seen so far.
var depExpected: Double?
/// The feed saw the aircraft in the air when the app last looked.
var airborne: Bool?
/// Touchdown once landed, else the estimate while in the air.
var arrExpected: Double?
var landed: Bool?
var depTime: String
var arrTime: String
var arrTimeExpected: String?
/// Minutes late against the schedule, negative when early.
var delay: Int?
var aircraft: String?
/// When the feed last heard the aircraft.
var seen: Double?
var path: String
}
struct Labels: Codable {
var nextTrip: String
var today: String
@@ -193,6 +225,22 @@ struct WidgetSnapshot: Codable {
var votes: String?
var noMessages: String?
var departure: String?
var flight: String?
/// Contains "{time}", where the widget puts its running countdown.
var flightDeparts: String?
var flightInAir: String?
/// Contains "{time}".
var flightLands: String?
var flightLanded: String?
var flightOnTime: String?
/// Contains "{m}".
var flightLate: String?
/// Contains "{m}".
var flightEarly: String?
var flightEstimated: String?
/// Past the departure time with the aircraft not yet in the air.
var flightReady: String?
var noFlight: String?
}
var trip: Trip?
@@ -203,6 +251,7 @@ struct WidgetSnapshot: Codable {
var packing: Packing?
var atlas: Atlas?
var collab: Collab?
var flight: Flight?
var labels: Labels
/// The dashboard's snapshot.
@@ -5,6 +5,8 @@
"widget.today.description" = "خطة اليوم كخط زمني، مع الطقس والمحطة التالية.";
"widget.bookings.name" = "الحجوزات";
"widget.bookings.description" = "رحلاتك وقطاراتك وفنادقك وحجوزات المطاعم القادمة ومواعيدها.";
"widget.flight.name" = "الرحلة";
"widget.flight.description" = "رحلتك القادمة مباشرة: عد تنازلي للإقلاع، والطائرة في طريقها، والتأخير والوصول.";
"widget.todos.name" = "المهام";
"widget.todos.description" = "ما تبقى للرحلة، ومدى تقدم تجهيز الأمتعة.";
"widget.packing.name" = "قائمة الأمتعة";
@@ -5,6 +5,8 @@
"widget.today.description" = "Günün planı zaman xətti kimi, hava və növbəti dayanacaqla.";
"widget.bookings.name" = "Bronlar";
"widget.bookings.description" = "Növbəti uçuşlar, qatarlar, otellər və restoranlar, nə vaxt olduqları ilə.";
"widget.flight.name" = "Uçuş";
"widget.flight.description" = "Növbəti uçuşun canlı: uçuşa qədər geri sayım, yolda olan təyyarə, gecikmə və gəliş.";
"widget.todos.name" = "Tapşırıqlar";
"widget.todos.description" = "Səyahət üçün hələ nəyin qaldığı və yığışmağın nə yerdə olduğu.";
"widget.packing.name" = "Yük siyahısı";
@@ -5,6 +5,8 @@
"widget.today.description" = "El pla del dia com a línia de temps, amb el temps i la propera parada.";
"widget.bookings.name" = "Reserves";
"widget.bookings.description" = "Els teus propers vols, trens, hotels i taules, i quan toquen.";
"widget.flight.name" = "Vol";
"widget.flight.description" = "El teu proper vol en directe: compte enrere de la sortida, l’avió en camí, retard i arribada.";
"widget.todos.name" = "Tasques";
"widget.todos.description" = "El que encara queda per al viatge i com va l'equipatge.";
"widget.packing.name" = "Equipatge";
@@ -5,6 +5,8 @@
"widget.today.description" = "Plán dne jako časová osa, s počasím a další zastávkou.";
"widget.bookings.name" = "Rezervace";
"widget.bookings.description" = "Tvoje další lety, vlaky, hotely a stoly, a kdy tě čekají.";
"widget.flight.name" = "Let";
"widget.flight.description" = "Tvůj další let živě: odpočet do odletu, letadlo na cestě, zpoždění a přílet.";
"widget.todos.name" = "Úkoly";
"widget.todos.description" = "Co ještě zbývá k cestě a jak daleko je balení.";
"widget.packing.name" = "Balení";
@@ -5,6 +5,8 @@
"widget.today.description" = "Der Tagesplan als Zeitleiste, mit dem Wetter und dem nächsten Stopp.";
"widget.bookings.name" = "Buchungen";
"widget.bookings.description" = "Deine nächsten Flüge, Züge, Hotels und Tische, und wann sie anstehen.";
"widget.flight.name" = "Flug";
"widget.flight.description" = "Dein nächster Flug live: Countdown bis zum Abflug, die Maschine unterwegs, Verspätung und Ankunft.";
"widget.todos.name" = "To-dos";
"widget.todos.description" = "Was für die Reise noch offen ist und wie weit das Packen ist.";
"widget.packing.name" = "Packliste";
@@ -5,6 +5,8 @@
"widget.today.description" = "Το πρόγραμμα της ημέρας ως χρονολόγιο, με τον καιρό και την επόμενη στάση.";
"widget.bookings.name" = "Κρατήσεις";
"widget.bookings.description" = "Οι επόμενες πτήσεις, τα τρένα, τα ξενοδοχεία και τα τραπέζια σου, και πότε είναι.";
"widget.flight.name" = "Πτήση";
"widget.flight.description" = "Η επόμενη πτήση σου ζωντανά: αντίστροφη μέτρηση για την αναχώρηση, το αεροσκάφος καθ’ οδόν, καθυστέρηση και άφιξη.";
"widget.todos.name" = "Εκκρεμότητες";
"widget.todos.description" = "Τι μένει ακόμα για το ταξίδι και πόσο έχει προχωρήσει το πακετάρισμα.";
"widget.packing.name" = "Αποσκευές";
@@ -5,6 +5,8 @@
"widget.today.description" = "Today's plan as a timeline, with the weather and what is next.";
"widget.bookings.name" = "Bookings";
"widget.bookings.description" = "Your next flights, trains, hotels and tables, and when they are due.";
"widget.flight.name" = "Flight";
"widget.flight.description" = "Your next flight live: departure countdown, the aircraft on its way, delay and arrival.";
"widget.todos.name" = "To-dos";
"widget.todos.description" = "What is still open for the trip, and how far the packing has come.";
"widget.packing.name" = "Packing";
@@ -5,6 +5,8 @@
"widget.today.description" = "El plan del día como línea de tiempo, con el tiempo y la próxima parada.";
"widget.bookings.name" = "Reservas";
"widget.bookings.description" = "Tus próximos vuelos, trenes, hoteles y mesas, y cuándo tocan.";
"widget.flight.name" = "Vuelo";
"widget.flight.description" = "Tu próximo vuelo en directo: cuenta atrás de la salida, el avión en camino, retraso y llegada.";
"widget.todos.name" = "Tareas";
"widget.todos.description" = "Lo que aún queda para el viaje y cómo va la maleta.";
"widget.packing.name" = "Equipaje";
@@ -5,6 +5,8 @@
"widget.today.description" = "Päeva plaan ajajoonena, koos ilma ja järgmise peatusega.";
"widget.bookings.name" = "Broneeringud";
"widget.bookings.description" = "Sinu järgmised lennud, rongid, hotellid ja lauad ning millal need on.";
"widget.flight.name" = "Lend";
"widget.flight.description" = "Sinu järgmine lend otse: loendus väljumiseni, lennuk teel, hilinemine ja saabumine.";
"widget.todos.name" = "Ülesanded";
"widget.todos.description" = "Mis reisi jaoks veel tegemata on ja kui kaugel pakkimine on.";
"widget.packing.name" = "Pakkimine";
@@ -5,6 +5,8 @@
"widget.today.description" = "Le programme du jour en frise, avec la météo et la prochaine étape.";
"widget.bookings.name" = "Réservations";
"widget.bookings.description" = "Vos prochains vols, trains, hôtels et tables, et quand ils arrivent.";
"widget.flight.name" = "Vol";
"widget.flight.description" = "Votre prochain vol en direct : compte à rebours du départ, l’avion en route, retard et arrivée.";
"widget.todos.name" = "À faire";
"widget.todos.description" = "Ce qui reste à faire pour le voyage et où en sont les bagages.";
"widget.packing.name" = "Bagages";
@@ -5,6 +5,8 @@
"widget.today.description" = "תוכנית היום כציר זמן, עם מזג האוויר והעצירה הבאה.";
"widget.bookings.name" = "הזמנות";
"widget.bookings.description" = "הטיסות, הרכבות, המלונות והשולחנות הבאים שלך, ומתי הם.";
"widget.flight.name" = "טיסה";
"widget.flight.description" = "הטיסה הבאה שלך בזמן אמת: ספירה לאחור עד ההמראה, המטוס בדרך, עיכוב והגעה.";
"widget.todos.name" = "משימות";
"widget.todos.description" = "מה עוד פתוח לטיול וכמה התקדמה האריזה.";
"widget.packing.name" = "אריזה";
@@ -5,6 +5,8 @@
"widget.today.description" = "A nap terve idővonalon, az időjárással és a következő megállóval.";
"widget.bookings.name" = "Foglalások";
"widget.bookings.description" = "A következő járataid, vonataid, szállásaid és asztalfoglalásaid, és hogy mikor esedékesek.";
"widget.flight.name" = "Járat";
"widget.flight.description" = "A következő járatod élőben: visszaszámlálás az indulásig, a gép útközben, késés és érkezés.";
"widget.todos.name" = "Teendők";
"widget.todos.description" = "Ami még hátravan az utazáshoz, és hol tart a csomagolás.";
"widget.packing.name" = "Csomagolás";
@@ -5,6 +5,8 @@
"widget.today.description" = "Rencana hari ini sebagai linimasa, dengan cuaca dan perhentian berikutnya.";
"widget.bookings.name" = "Pemesanan";
"widget.bookings.description" = "Penerbangan, kereta, hotel, dan meja berikutnya, beserta waktunya.";
"widget.flight.name" = "Penerbangan";
"widget.flight.description" = "Penerbangan berikutnya secara langsung: hitung mundur keberangkatan, pesawat dalam perjalanan, keterlambatan, dan kedatangan.";
"widget.todos.name" = "Tugas";
"widget.todos.description" = "Yang masih tersisa untuk perjalanan dan sejauh mana persiapan barang.";
"widget.packing.name" = "Barang bawaan";
@@ -5,6 +5,8 @@
"widget.today.description" = "Il programma del giorno come linea del tempo, con il meteo e la prossima tappa.";
"widget.bookings.name" = "Prenotazioni";
"widget.bookings.description" = "I tuoi prossimi voli, treni, hotel e tavoli, e quando sono.";
"widget.flight.name" = "Volo";
"widget.flight.description" = "Il tuo prossimo volo in tempo reale: conto alla rovescia per la partenza, l’aereo in viaggio, ritardo e arrivo.";
"widget.todos.name" = "Da fare";
"widget.todos.description" = "Cosa manca ancora per il viaggio e a che punto è la valigia.";
"widget.packing.name" = "Bagagli";
@@ -5,6 +5,8 @@
"widget.today.description" = "今日の予定をタイムラインで、天気と次の予定とともに表示します。";
"widget.bookings.name" = "予約";
"widget.bookings.description" = "次のフライト、列車、ホテル、レストランとその日時。";
"widget.flight.name" = "フライト";
"widget.flight.description" = "次のフライトをライブで:出発までのカウントダウン、飛行中の機体、遅延と到着。";
"widget.todos.name" = "やること";
"widget.todos.description" = "旅行のために残っていることと、荷造りの進み具合。";
"widget.packing.name" = "持ち物";
@@ -5,6 +5,8 @@
"widget.today.description" = "오늘 일정을 타임라인으로, 날씨와 다음 장소와 함께 보여 줍니다.";
"widget.bookings.name" = "예약";
"widget.bookings.description" = "다가오는 항공편, 기차, 호텔, 식당과 그 시간.";
"widget.flight.name" = "항공편";
"widget.flight.description" = "다음 항공편을 실시간으로: 출발 카운트다운, 비행 중인 항공기, 지연과 도착.";
"widget.todos.name" = "할 일";
"widget.todos.description" = "여행을 위해 남은 일과 짐 싸기 진행 상황.";
"widget.packing.name" = "짐 싸기";
@@ -5,6 +5,8 @@
"widget.today.description" = "Het dagplan als tijdlijn, met het weer en de volgende stop.";
"widget.bookings.name" = "Boekingen";
"widget.bookings.description" = "Je volgende vluchten, treinen, hotels en tafels, en wanneer ze zijn.";
"widget.flight.name" = "Vlucht";
"widget.flight.description" = "Je volgende vlucht live: aftellen tot vertrek, het toestel onderweg, vertraging en aankomst.";
"widget.todos.name" = "Taken";
"widget.todos.description" = "Wat er nog openstaat voor de reis en hoe ver het inpakken is.";
"widget.packing.name" = "Bagage";
@@ -5,6 +5,8 @@
"widget.today.description" = "Plan dnia jako oś czasu, z pogodą i kolejnym przystankiem.";
"widget.bookings.name" = "Rezerwacje";
"widget.bookings.description" = "Twoje najbliższe loty, pociągi, hotele i stoliki oraz ich terminy.";
"widget.flight.name" = "Lot";
"widget.flight.description" = "Twój następny lot na żywo: odliczanie do odlotu, samolot w drodze, opóźnienie i przylot.";
"widget.todos.name" = "Zadania";
"widget.todos.description" = "Co jeszcze zostało do zrobienia przed podróżą i jak idzie pakowanie.";
"widget.packing.name" = "Pakowanie";
@@ -5,6 +5,8 @@
"widget.today.description" = "O plano do dia como linha do tempo, com o clima e a próxima parada.";
"widget.bookings.name" = "Reservas";
"widget.bookings.description" = "Seus próximos voos, trens, hotéis e mesas, e quando acontecem.";
"widget.flight.name" = "Voo";
"widget.flight.description" = "Seu próximo voo ao vivo: contagem regressiva para a partida, o avião a caminho, atraso e chegada.";
"widget.todos.name" = "Tarefas";
"widget.todos.description" = "O que ainda falta para a viagem e quanto da mala já está pronto.";
"widget.packing.name" = "Bagagem";
@@ -5,6 +5,8 @@
"widget.today.description" = "План дня в виде ленты времени, с погодой и следующей остановкой.";
"widget.bookings.name" = "Бронирования";
"widget.bookings.description" = "Ближайшие рейсы, поезда, отели и столики и когда они.";
"widget.flight.name" = "Рейс";
"widget.flight.description" = "Ваш следующий рейс в реальном времени: отсчёт до вылета, самолёт в пути, задержка и прибытие.";
"widget.todos.name" = "Задачи";
"widget.todos.description" = "Что ещё осталось сделать к поездке и как идут сборы.";
"widget.packing.name" = "Сборы";
@@ -5,6 +5,8 @@
"widget.today.description" = "Plán dňa ako časová os, s počasím a ďalšou zastávkou.";
"widget.bookings.name" = "Rezervácie";
"widget.bookings.description" = "Tvoje ďalšie lety, vlaky, hotely a stoly a kedy ťa čakajú.";
"widget.flight.name" = "Let";
"widget.flight.description" = "Tvoj ďalší let naživo: odpočet do odletu, lietadlo na ceste, meškanie a prílet.";
"widget.todos.name" = "Úlohy";
"widget.todos.description" = "Čo ešte zostáva na cestu a ako ďaleko je balenie.";
"widget.packing.name" = "Balenie";
@@ -5,6 +5,8 @@
"widget.today.description" = "Dagens plan som tidslinje, med vädret och nästa stopp.";
"widget.bookings.name" = "Bokningar";
"widget.bookings.description" = "Dina nästa flyg, tåg, hotell och bord, och när de är.";
"widget.flight.name" = "Flyg";
"widget.flight.description" = "Ditt nästa flyg live: nedräkning till avgång, planet på väg, försening och ankomst.";
"widget.todos.name" = "Att göra";
"widget.todos.description" = "Vad som återstår inför resan och hur långt packningen har kommit.";
"widget.packing.name" = "Packning";
@@ -5,6 +5,8 @@
"widget.today.description" = "แผนของวันนี้เป็นไทม์ไลน์ พร้อมสภาพอากาศและจุดหมายถัดไป";
"widget.bookings.name" = "การจอง";
"widget.bookings.description" = "เที่ยวบิน รถไฟ โรงแรม และร้านอาหารถัดไปของคุณ และเวลาของแต่ละรายการ";
"widget.flight.name" = "เที่ยวบิน";
"widget.flight.description" = "เที่ยวบินถัดไปแบบสด: นับถอยหลังถึงเวลาออกเดินทาง เครื่องบินระหว่างทาง ความล่าช้า และเวลาถึง";
"widget.todos.name" = "สิ่งที่ต้องทำ";
"widget.todos.description" = "สิ่งที่ยังค้างอยู่สำหรับทริป และความคืบหน้าการจัดกระเป๋า";
"widget.packing.name" = "จัดกระเป๋า";
@@ -5,6 +5,8 @@
"widget.today.description" = "Günün planı zaman çizelgesi olarak, hava durumu ve sonraki durakla.";
"widget.bookings.name" = "Rezervasyonlar";
"widget.bookings.description" = "Sıradaki uçuşların, trenlerin, otellerin ve masaların, ne zaman oldukları ile.";
"widget.flight.name" = "Uçuş";
"widget.flight.description" = "Bir sonraki uçuşun canlı: kalkışa geri sayım, yoldaki uçak, gecikme ve varış.";
"widget.todos.name" = "Yapılacaklar";
"widget.todos.description" = "Seyahat için hâlâ açık olanlar ve bavulun ne durumda olduğu.";
"widget.packing.name" = "Bavul";
@@ -5,6 +5,8 @@
"widget.today.description" = "План дня у вигляді стрічки часу, з погодою і наступною зупинкою.";
"widget.bookings.name" = "Бронювання";
"widget.bookings.description" = "Найближчі рейси, поїзди, готелі й столики та коли вони.";
"widget.flight.name" = "Рейс";
"widget.flight.description" = "Ваш наступний рейс наживо: відлік до вильоту, літак у дорозі, затримка й прибуття.";
"widget.todos.name" = "Завдання";
"widget.todos.description" = "Що ще лишилося зробити до подорожі і як просувається пакування.";
"widget.packing.name" = "Пакування";
@@ -5,6 +5,8 @@
"widget.today.description" = "Kế hoạch hôm nay dạng dòng thời gian, kèm thời tiết và điểm dừng tiếp theo.";
"widget.bookings.name" = "Đặt chỗ";
"widget.bookings.description" = "Các chuyến bay, tàu, khách sạn và bàn sắp tới của bạn, cùng thời gian.";
"widget.flight.name" = "Chuyến bay";
"widget.flight.description" = "Chuyến bay tiếp theo trực tiếp: đếm ngược giờ khởi hành, máy bay đang bay, độ trễ và giờ đến.";
"widget.todos.name" = "Việc cần làm";
"widget.todos.description" = "Những gì còn lại cho chuyến đi và việc soạn hành lý đã tới đâu.";
"widget.packing.name" = "Hành lý";
@@ -5,6 +5,8 @@
"widget.today.description" = "以时间线显示今天的计划,附带天气和下一站。";
"widget.bookings.name" = "预订";
"widget.bookings.description" = "你接下来的航班、火车、酒店和餐厅,以及时间。";
"widget.flight.name" = "航班";
"widget.flight.description" = "实时查看下一班航班:起飞倒计时、飞行中的飞机、延误和到达。";
"widget.todos.name" = "待办";
"widget.todos.description" = "旅行还剩哪些事没做,以及行李收拾到哪一步。";
"widget.packing.name" = "行李";
@@ -5,6 +5,8 @@
"widget.today.description" = "以時間軸顯示今天的計畫,附上天氣與下一站。";
"widget.bookings.name" = "預訂";
"widget.bookings.description" = "你接下來的航班、火車、飯店與餐廳,以及時間。";
"widget.flight.name" = "航班";
"widget.flight.description" = "即時查看下一班航班:起飛倒數、飛行中的飛機、延誤和抵達。";
"widget.todos.name" = "待辦";
"widget.todos.description" = "旅行還剩哪些事沒做,以及行李整理到哪一步。";
"widget.packing.name" = "行李";
@@ -375,6 +375,7 @@ struct LockAccessory: View {
switch kind {
case .trip: TripContent(snapshot: snapshot, family: family, now: now)
case .bookings: BookingsContent(snapshot: snapshot, family: family, now: now)
case .flight: FlightContent(snapshot: snapshot, family: family, now: now)
case .todos: TodosContent(snapshot: snapshot, family: family, now: now)
case .packing: PackingContent(snapshot: snapshot, family: family, now: now)
case .atlas: AtlasContent(snapshot: snapshot, family: family)
@@ -107,13 +107,14 @@ struct Render {
}
enum WidgetKind: String, CaseIterable {
case trip, today, bookings, todos, packing, atlas, collab
case trip, today, bookings, flight, todos, packing, atlas, collab
var families: [TrekFamily] {
switch self {
case .trip: return [.small, .medium, .large, .extraLarge, .circular, .rectangular, .inline]
case .today: return [.medium, .large, .extraLarge]
case .bookings: return [.small, .medium, .large, .extraLarge, .rectangular, .inline]
case .flight: return [.small, .medium, .large, .circular, .rectangular, .inline]
case .todos: return [.small, .medium, .large, .circular, .rectangular]
case .packing: return [.small, .medium, .large, .circular, .rectangular]
case .atlas: return [.small, .medium, .large, .circular, .rectangular, .inline]
@@ -158,6 +159,7 @@ struct WidgetFrame: View {
case .trip: TripContent(snapshot: snapshot, family: family, now: now)
case .today: TodayContent(snapshot: snapshot, family: family, now: now)
case .bookings: BookingsContent(snapshot: snapshot, family: family, now: now)
case .flight: FlightContent(snapshot: snapshot, family: family, now: now)
case .todos: TodosContent(snapshot: snapshot, family: family, now: now)
case .packing: PackingContent(snapshot: snapshot, family: family, now: now)
case .atlas: AtlasContent(snapshot: snapshot, family: family)
+12
View File
@@ -1805,6 +1805,18 @@ async function start(): Promise<void> {
return;
}
if (!url && previousUrl) {
// An update asks to check the server once more. Out of reach (a trip, a
// server at home), that check cannot run: with a stored copy of the UI the
// app starts on that and checks on a later launch. Only for a server that
// did not answer, never for one that answered with a reason to stop.
const probe = await probeServer(previousUrl, get).catch(() => null);
if (!probe || (!probe.ok && probe.reason === 'unreachable')) {
const opened = await TrekShell.openOfflineCopy().then(
(r) => r.opened,
() => false
);
if (opened) return;
}
showConnect(previousUrl, { recheck: true });
} else if (!url) {
showWelcome();
+13 -13
View File
@@ -1,20 +1,20 @@
{
"src": {
"@typescript-eslint/no-non-null-assertion": 375,
"@typescript-eslint/no-misused-promises": 843,
"@typescript-eslint/no-non-null-assertion": 368,
"@typescript-eslint/no-misused-promises": 820,
"no-console": 88,
"complexity": 218,
"@typescript-eslint/no-explicit-any": 144,
"complexity": 217,
"@typescript-eslint/no-explicit-any": 143,
"trek/no-swallowed-catch": 128,
"max-params": 31,
"trek/store-without-selector": 67,
"react-hooks/refs": 553,
"react-hooks/set-state-in-effect": 192,
"@typescript-eslint/no-floating-promises": 164,
"react-hooks/exhaustive-deps": 114,
"@typescript-eslint/no-unused-vars": 123,
"trek/store-without-selector": 66,
"react-hooks/refs": 534,
"react-hooks/set-state-in-effect": 189,
"@typescript-eslint/no-floating-promises": 162,
"react-hooks/exhaustive-deps": 113,
"@typescript-eslint/no-unused-vars": 122,
"react-hooks/immutability": 28,
"max-lines-per-function": 130,
"max-lines-per-function": 127,
"react-hooks/static-components": 50,
"react-hooks/preserve-manual-memoization": 12,
"no-useless-assignment": 7,
@@ -31,11 +31,11 @@
},
"suppressed": {
"@typescript-eslint/no-explicit-any": 38,
"react-hooks/exhaustive-deps": 45
"react-hooks/exhaustive-deps": 44
},
"tests": {
"@typescript-eslint/no-explicit-any": 489,
"@typescript-eslint/no-non-null-assertion": 1911,
"@typescript-eslint/no-non-null-assertion": 1876,
"@typescript-eslint/no-misused-promises": 22,
"@typescript-eslint/no-unused-vars": 51,
"@typescript-eslint/no-floating-promises": 33,
+99 -2
View File
@@ -57,6 +57,51 @@
"desktop": ["src/pages/admin/AdminSettingsTab.tsx"],
"mobile": ["src/mobile/screens/admin/MAdminSettingsSection.tsx"]
},
{
"feature": "API keys",
"hooks": ["src/components/Settings/useApiKeys.ts"],
"desktop": ["src/components/Settings/ApiKeysSection.tsx"],
"mobile": ["src/mobile/screens/settings/MApiKeysSection.tsx"]
},
{
"feature": "Wanderer connection",
"hooks": ["src/components/Settings/useWandererConnection.ts"],
"desktop": ["src/components/Settings/WandererConnectionSection.tsx"],
"mobile": ["src/mobile/screens/settings/MWandererConnectionSection.tsx"]
},
{
"feature": "Admin notification defaults",
"hooks": [
"src/pages/admin/useNotificationDefaults.ts",
"src/pages/admin/notificationDefaultsModel.ts"
],
"desktop": ["src/pages/admin/AdminNotificationDefaultsPanel.tsx"],
"mobile": ["src/mobile/screens/admin/MAdminNotificationDefaults.tsx"]
},
{
"feature": "Admin Google daily limit",
"hooks": ["src/components/Admin/useGoogleQuota.ts"],
"desktop": ["src/components/Admin/GoogleDailyLimitRow.tsx"],
"mobile": ["src/mobile/screens/admin/MAdminGoogleDailyLimit.tsx"]
},
{
"feature": "Admin share place details",
"hooks": [
"src/components/Admin/usePlaceContribPanel.ts",
"src/components/Admin/placeContribModel.ts"
],
"desktop": ["src/components/Admin/PlaceContribPanel.tsx"],
"mobile": ["src/mobile/screens/admin/MAdminPlaceContrib.tsx"]
},
{
"feature": "Admin TREK services allowance",
"hooks": [
"src/components/Admin/useServiceIdentity.ts",
"src/components/Admin/serviceIdentityModel.ts"
],
"desktop": ["src/components/Admin/ServiceIdentityPanel.tsx"],
"mobile": ["src/mobile/screens/admin/MAdminServiceQuota.tsx"]
},
{
"feature": "Admin users invite status",
"hooks": ["src/pages/admin/adminModel.ts"],
@@ -130,6 +175,24 @@
"src/mobile/screens/trip/sheets/MTransportFormSheet.tsx"
]
},
{
"feature": "Booking mail import: pending bookings",
"hooks": ["src/components/MailIngest/useMailInbox.ts", "src/components/MailIngest/mailInboxModel.ts"],
"desktop": ["src/components/MailIngest/MailInboxDialog.tsx"],
"mobile": ["src/mobile/screens/mail/MMailInboxSheet.tsx"]
},
{
"feature": "Booking mail import: settings card",
"hooks": ["src/components/MailIngest/useMailImportSettings.ts"],
"desktop": ["src/components/Settings/MailImportSection.tsx"],
"mobile": ["src/mobile/screens/settings/MMailImportSection.tsx"]
},
{
"feature": "Booking mail import: admin card",
"hooks": ["src/components/Admin/mailIngest/useMailIngestAdmin.ts", "src/components/Admin/mailIngest/mailIngestAdminModel.ts"],
"desktop": ["src/components/Admin/mailIngest/MailIngestAdminCard.tsx"],
"mobile": ["src/mobile/screens/admin/MMailIngestAdminCard.tsx"]
},
{
"feature": "Booking save follow-up: travellers and files before the editor closes",
"hooks": ["src/components/Planner/useBookingFollowUp.ts"],
@@ -279,7 +342,7 @@
"feature": "Costs/budget ledger: costsModel",
"hooks": ["src/components/Budget/costsModel.ts"],
"desktop": ["src/components/Budget/CostsPanel.tsx"],
"mobile": ["src/mobile/screens/trip/sheets/MCostSheet.tsx", "src/mobile/screens/trip/tabs/MCostsTab.tsx"]
"mobile": ["src/mobile/screens/trip/tabs/MCostsTab.tsx"]
},
{
"feature": "Costs/budget ledger: useCostsLedger, useExpenseLinks",
@@ -287,10 +350,16 @@
"desktop": ["src/components/Budget/CostsPanel.tsx"],
"mobile": ["src/mobile/screens/trip/tabs/MCostsTab.tsx"]
},
{
"feature": "Costs/budget splitting or totals only: useCostsMode",
"hooks": ["src/components/Budget/useCostsMode.ts"],
"desktop": ["src/components/Budget/CostsModeCard.tsx"],
"mobile": ["src/mobile/screens/trip/tabs/MCostsTab.tsx"]
},
{
"feature": "Costs/budget settle-up payment: useSettlementForm",
"hooks": ["src/components/Budget/useSettlementForm.ts"],
"desktop": ["src/components/Budget/CostsPanel.tsx"],
"desktop": ["src/components/Budget/SettlementModal.tsx"],
"mobile": ["src/mobile/screens/trip/tabs/MCostsPayment.tsx"]
},
{
@@ -410,6 +479,12 @@
"desktop": ["src/components/Planner/usePlacesSidebar.ts"],
"mobile": ["src/mobile/screens/trip/sheets/ImpListStep.tsx"]
},
{
"feature": "Live flight status",
"hooks": ["src/components/Planner/flightLive/useFlightLiveCard.ts"],
"desktop": ["src/components/Planner/flightLive/FlightLiveCard.tsx", "src/components/Planner/flightLive/FlightLiveStrip.tsx"],
"mobile": ["src/mobile/screens/trip/sheets/MFlightLiveCard.tsx", "src/mobile/screens/trip/MFlightLiveStrip.tsx"]
},
{
"feature": "Places column file routing between the Tours and places imports",
"hooks": ["src/components/Planner/usePlacesColumnFileImport.ts"],
@@ -572,6 +647,18 @@
"desktop": ["src/components/Packing/usePackingListPanel.ts"],
"mobile": ["src/mobile/screens/trip/tabs/MPackingListTab.tsx"]
},
{
"feature": "Packing list: who brings and who sees an item",
"hooks": ["src/components/Packing/packingItemAccess.ts"],
"desktop": ["src/components/Packing/PackingItemDetail.tsx"],
"mobile": ["src/mobile/screens/trip/tabs/MPackItemSheet.tsx"]
},
{
"feature": "Packing list: sharing of a whole list",
"hooks": ["src/components/Packing/usePackingCategorySharing.ts"],
"desktop": ["src/components/Packing/usePackingListPanel.ts"],
"mobile": ["src/mobile/screens/trip/tabs/MPackingListTab.tsx"]
},
{
"feature": "Packing list: usePackingImport",
"hooks": ["src/components/Packing/usePackingImport.ts"],
@@ -876,6 +963,12 @@
"desktop": ["src/components/Planner/DayPlanSidebarTransportDetailModal.tsx"],
"mobile": ["src/mobile/screens/trip/sheets/MTransportSheet.tsx"]
},
{
"feature": "Live flight cards in the booking detail: useFlightLiveCard",
"hooks": ["src/components/Planner/flightLive/useFlightLiveCard.ts"],
"desktop": ["src/components/Planner/bookings/BookingDetailDialog.tsx"],
"mobile": ["src/mobile/screens/trip/sheets/MTransportSheet.tsx"]
},
{
"feature": "Transport booking form: bookingFormModel",
"hooks": ["src/components/Planner/bookingFormModel.ts"],
@@ -1009,6 +1102,8 @@
}
],
"mobileOnly": {
"src/mobile/screens/trip/sheets/MReviewNotice.tsx": "The transport sheet's row asking for a look at an imported booking; the desktop dialog folds the same \"looks right\" action into its review pill (ReviewPill in bookingParts.tsx), so there is no separate twin.",
"src/mobile/screens/mail/MMailInboxHost.tsx": "Mounts the phone shell's one inbox sheet and reads the person's import settings; the desktop mounts its dialog from the Navbar, so there is no twin.",
"src/mobile/screens/admin/MAdminOidcCard.tsx": "Markup only; the OIDC card of MAdminSettingsSection, with the form state from useAdmin and the save from its useAdminSettingsActions handed in through props.",
"src/mobile/screens/admin/MAdminResetMfaSheet.tsx": "Markup only; the 2FA reset confirm that MAdminSheets opens, with the reset handed in through props from its useAdminUserActions.",
"src/mobile/screens/admin/MAdminUi.tsx": "Phone only admin UI primitives (button, card, field, input, secret input, sheet frame).",
@@ -1043,6 +1138,7 @@
"src/mobile/screens/trip/MTripRail.tsx": "Phone shell only; the trip's sections on the leading edge of a wide window in place of the dock, with the tabs and handlers MTripShell hands in.",
"src/mobile/screens/trip/MTripShellParts.tsx": "Markup only; small pieces of MTripShell's top controls (segment pill, compact toggle, document sync button), with the state and handlers MTripShell hands in.",
"src/mobile/screens/trip/dockTabs.ts": "Phone only helper that picks which trip tabs get a seat in the mobile dock.",
"src/mobile/screens/trip/useTripTabSwitch.ts": "Phone shell only; switches the section the dock and a notification link open, and the collab part a message link means. The desktop switches through useTripPlanner alone.",
"src/mobile/screens/trip/lib/dayNotes.ts": "Phone only helper that splits a leading time off a day note for the plan timeline.",
"src/mobile/screens/trip/map/MMapArea.tsx": "Phone map stage framing; already shares usePoiExplore and useMergedMapPois with the desktop trip planner.",
"src/mobile/screens/trip/places/MPlacesBulkCategorySheet.tsx": "Markup only; categories and the pick handler come through props from MPlacesBrowser.",
@@ -1081,6 +1177,7 @@
"src/mobile/screens/trip/tabs/MCollabTab.tsx": "Phone collab sub tab router that reuses the desktop CollabLinks component.",
"src/mobile/screens/trip/tabs/MFilesBoard.tsx": "Markup only; the trip's files as tiles and the picked file's preview on a wide window, with the files and their actions handed in through props from MFilesTab.",
"src/mobile/screens/trip/tabs/MListsTab.tsx": "Phone router between the packing and to-do bodies, with no logic of its own.",
"src/mobile/screens/trip/tabs/MPackingCategorySharingSheet.tsx": "Markup only; the sheet that shares a whole list, with its state from usePackingCategorySharing handed in through props by MPackingListTab.",
"src/mobile/screens/trip/tabs/MReceiptScanButton.tsx": "Already shares useReceiptScan and ReceiptScanModal with the desktop CostsPanel.",
"src/mobile/screens/trip/tabs/MReservationCardParts.tsx": "Markup only: the title, actions, date, files and delete sheet parts both phone booking tabs draw.",
"src/mobile/screens/trip/tabs/MTodoSidebar.tsx": "Markup only; the to-do filters as a pane beside the tasks on a wide window, with the filter state and the counts handed in through props from useTodoView.",
-5
View File
@@ -577,16 +577,12 @@
"src/components/Packing/PackingListPanelItemRow.test.tsx",
"src/components/Packing/PackingListPanelItemRow.tsx",
"src/components/Packing/PackingListPanelList.tsx",
"src/components/Packing/PackingListPanelQuantityInput.test.tsx",
"src/components/Packing/PackingListPanelQuantityInput.tsx",
"src/components/Packing/PackingListPanelViewTabs.tsx",
"src/components/Packing/PackingPackedCounter.test.tsx",
"src/components/Packing/PackingPackedCounter.tsx",
"src/components/Packing/PackingPopover.test.tsx",
"src/components/Packing/PackingPopover.tsx",
"src/components/Packing/PackingPrintPreview.tsx",
"src/components/Packing/PackingShareControl.test.tsx",
"src/components/Packing/PackingShareControl.tsx",
"src/components/Packing/PackingWeightSummary.tsx",
"src/components/Packing/packingExport.test.ts",
"src/components/Packing/packingExport.ts",
@@ -1025,7 +1021,6 @@
"src/components/Tours/useTourPermissions.ts",
"src/components/Trips/TripDateReview.tsx",
"src/components/Trips/TripFormModal.test.tsx",
"src/components/Trips/TripFormModal.tsx",
"src/components/Trips/TripMemberAvatar.tsx",
"src/components/Trips/TripMembersModal.test.tsx",
"src/components/Trips/TripMembersModal.tsx",
-2
View File
@@ -97,7 +97,6 @@
"src/components/Roadtrip/useDayBoundaries.ts",
"src/components/Roadtrip/useRefuelSearch.ts",
"src/components/Roadtrip/useRoadtripVias.ts",
"src/components/Settings/ApiKeysSection.tsx",
"src/components/Settings/useAccountSettings.ts",
"src/components/Settings/useAirTrailSettings.ts",
"src/components/Settings/useMcpIntegration.ts",
@@ -129,7 +128,6 @@
"src/mobile/screens/trip/tabs/MCollabNotes.tsx",
"src/pages/JourneyDetailPage.tsx",
"src/pages/OAuthAuthorizePage.tsx",
"src/pages/admin/AdminSettingsTab.tsx",
"src/pages/admin/useAdmin.ts",
"src/pages/admin/useNotificationDefaults.ts",
"src/pages/atlas/useAtlas.ts",
+1 -3
View File
@@ -39,8 +39,6 @@
"components/PDF/tripMapImage.ts": 1,
"components/Packing/PackingListPanelBagCard.tsx": 1,
"components/Packing/PackingListPanelCategoryGroup.tsx": 3,
"components/Packing/PackingListPanelItemRow.tsx": 2,
"components/Packing/PackingShareControl.tsx": 3,
"components/Planner/DayDetailPanel.tsx": 1,
"components/Planner/PlaceInspector.tsx": 1,
"components/Planner/TransitSearchPanel.tsx": 3,
@@ -63,7 +61,7 @@
"components/Vacay/VacayCalendar.tsx": 3,
"components/Vacay/VacayMonthCard.tsx": 7,
"components/Vacay/VacaySettings.tsx": 1,
"components/shared/ContextMenu.tsx": 3,
"components/shared/ContextMenu.tsx": 1,
"components/shared/CustomDateTimePicker.tsx": 2,
"components/shared/CustomSelect.tsx": 4,
"components/shared/CustomTimePicker.tsx": 3,
+2
View File
@@ -1,10 +1,12 @@
{
"components/Collections/CollectionMap.tsx": 1,
"components/Packing/PackingItemDetail.tsx": 1,
"components/Studio/LineHandles.tsx": 1,
"components/Studio/StudioSelectionChrome.tsx": 2,
"components/Studio/inspector/FocalPad.tsx": 1,
"mobile/components/trek3d/MascotClip.tsx": 1,
"mobile/screens/trip/MTripShell.tsx": 1,
"mobile/screens/vacay/MVacay.tsx": 1,
"pages/CollectionsPage.tsx": 1,
"pages/tripPlanner/PlanMapStage.tsx": 4
}
+7 -7
View File
@@ -2,26 +2,26 @@
"e2e/help/fixtures.ts": 2291,
"src/api/client.ts": 1873,
"src/components/Admin/AdminPluginsPanel.test.tsx": 2704,
"src/components/Admin/AdminPluginsPanel.tsx": 1266,
"src/components/Budget/CostsPanel.test.tsx": 2730,
"src/components/Budget/CostsPanel.tsx": 1798,
"src/components/Admin/AdminPluginsPanel.tsx": 1265,
"src/components/Budget/CostsPanel.test.tsx": 2725,
"src/components/Budget/CostsPanel.tsx": 1607,
"src/components/Map/MapView.tsx": 1200,
"src/components/Map/MapViewGL.test.tsx": 2919,
"src/components/Map/MapViewGL.tsx": 2126,
"src/components/Map/MapViewGL.tsx": 2116,
"src/components/Planner/DayDetailPanel.test.tsx": 2333,
"src/components/Planner/DayPlanSidebar.test.tsx": 5349,
"src/components/Planner/DayPlanSidebar.tsx": 2910,
"src/components/Planner/PlaceFormModal.test.tsx": 2836,
"src/components/Planner/PlaceInspector.tsx": 1287,
"src/components/Planner/PlaceInspector.tsx": 1128,
"src/components/Studio/TravelElements.tsx": 1559,
"src/components/Studio/countryShapes.ts": 2595,
"src/index.css": 1636,
"src/mobile/screens/admin/MAdminPluginsPanel.tsx": 1506,
"src/mobile/screens/admin/MAdminPluginsPanel.tsx": 1503,
"src/pages/JourneyDetailPage.test.tsx": 4028,
"src/pages/LoginPage.tsx": 1294,
"src/pages/TripPlannerPage.tsx": 1128,
"src/pages/atlas/useAtlas.ts": 1207,
"src/pages/tripPlanner/useTripPlanner.roadtrip.test.tsx": 3518,
"src/pages/tripPlanner/useTripPlanner.test.tsx": 3270,
"src/pages/tripPlanner/useTripPlanner.test.tsx": 3269,
"src/styles/studio.css": 1918
}
+1 -2
View File
@@ -43,8 +43,7 @@
"src/components/Map/ReservationOverlay.test.tsx": 1,
"src/components/Map/transitGeometry.ts": 1,
"src/components/Map/useMarkerThumbs.ts": 1,
"src/components/PDF/TripPDF.tsx": 40,
"src/components/Packing/PackingListPanelItemRow.test.tsx": 2,
"src/components/PDF/TripPDF.tsx": 38,
"src/components/Planner/DayPlanSidebar.constants.ts": 1,
"src/components/Planner/DayPlanSidebar.tsx": 52,
"src/components/Planner/DayPlanSidebarNoteModal.test.tsx": 1,
+16 -18
View File
@@ -72,12 +72,10 @@
"components/Map/ratingBadge.ts": 2,
"components/Map/reservationsMapbox.ts": 1,
"components/Map/switcherRow.ts": 1,
"components/PDF/TripPDF.tsx": 51,
"components/PDF/TripPDF.tsx": 44,
"components/Packing/PackingListPanelBagModal.tsx": 2,
"components/Packing/PackingListPanelCategoryGroup.tsx": 5,
"components/Packing/PackingListPanelHeader.tsx": 5,
"components/Packing/PackingListPanelItemRow.tsx": 2,
"components/Packing/PackingShareControl.tsx": 3,
"components/Packing/PackingListPanelHeader.tsx": 3,
"components/Packing/packingPrintDocument.ts": 24,
"components/Planner/AirTrailImportModal.tsx": 4,
"components/Planner/BookingCostsSection.tsx": 1,
@@ -110,7 +108,7 @@
"components/SystemNotices/SystemNoticeModal.tsx": 107,
"components/Todo/TodoListPanel.tsx": 6,
"components/Todo/todoListModel.ts": 3,
"components/Trips/TripFormModal.tsx": 9,
"components/Trips/TripFormModal.tsx": 6,
"components/Vacay/VacayBadge.tsx": 3,
"components/Vacay/VacayCalendar.tsx": 20,
"components/Vacay/VacayMonthCard.tsx": 5,
@@ -148,9 +146,9 @@
"mobile/components/MToastHost.tsx": 2,
"mobile/components/MUserPickerList.tsx": 1,
"mobile/screens/admin/MAdmin.tsx": 8,
"mobile/screens/admin/MAdminAddonManager.tsx": 9,
"mobile/screens/admin/MAdminAddonManager.tsx": 4,
"mobile/screens/admin/MAdminAuditLogPanel.tsx": 15,
"mobile/screens/admin/MAdminBackupPanel.tsx": 8,
"mobile/screens/admin/MAdminBackupPanel.tsx": 7,
"mobile/screens/admin/MAdminCategoryManager.tsx": 8,
"mobile/screens/admin/MAdminDefaultUserSettings.tsx": 5,
"mobile/screens/admin/MAdminDevNotificationsPanel.tsx": 6,
@@ -158,13 +156,13 @@
"mobile/screens/admin/MAdminMcpTokensPanel.tsx": 14,
"mobile/screens/admin/MAdminNotifyMatrix.tsx": 5,
"mobile/screens/admin/MAdminPackingTemplateManager.tsx": 8,
"mobile/screens/admin/MAdminPermissionsPanel.tsx": 5,
"mobile/screens/admin/MAdminPluginsPanel.tsx": 129,
"mobile/screens/admin/MAdminSettingsSection.tsx": 10,
"mobile/screens/admin/MAdminPermissionsPanel.tsx": 1,
"mobile/screens/admin/MAdminPluginsPanel.tsx": 128,
"mobile/screens/admin/MAdminSettingsSection.tsx": 2,
"mobile/screens/admin/MAdminSheets.tsx": 11,
"mobile/screens/admin/MAdminStoragePanel.tsx": 42,
"mobile/screens/admin/MAdminUi.tsx": 10,
"mobile/screens/admin/MAdminUsersSection.tsx": 14,
"mobile/screens/admin/MAdminUi.tsx": 7,
"mobile/screens/admin/MAdminUsersSection.tsx": 13,
"mobile/screens/admin/MApiProviderBlocks.tsx": 10,
"mobile/screens/atlas/MAtlas.tsx": 5,
"mobile/screens/atlas/MAtlasBucketSheet.tsx": 14,
@@ -182,7 +180,7 @@
"mobile/screens/collections/MCollShareSheet.tsx": 14,
"mobile/screens/collections/MCollSheetKit.tsx": 5,
"mobile/screens/collections/MCollTripPickerSheet.tsx": 4,
"mobile/screens/collections/MCollections.tsx": 14,
"mobile/screens/collections/MCollections.tsx": 13,
"mobile/screens/dashboard/MDashWidgets.tsx": 22,
"mobile/screens/dashboard/MDashboard.tsx": 30,
"mobile/screens/dashboard/MNewTripSheet.tsx": 12,
@@ -212,7 +210,7 @@
"mobile/screens/settings/MSettingsNotifications.tsx": 5,
"mobile/screens/settings/MSettingsOffline.tsx": 18,
"mobile/screens/settings/MSettingsPlugins.tsx": 14,
"mobile/screens/settings/MSettingsUi.tsx": 11,
"mobile/screens/settings/MSettingsUi.tsx": 10,
"mobile/screens/settings/MWebPushCard.tsx": 1,
"mobile/screens/trip/MTripLoadingSplash.tsx": 2,
"mobile/screens/trip/MTripShell.tsx": 7,
@@ -250,7 +248,7 @@
"mobile/screens/trip/sheets/MPlaceSheet.tsx": 23,
"mobile/screens/trip/sheets/MReservationSheet.tsx": 2,
"mobile/screens/trip/sheets/MTransportFormSheet.tsx": 9,
"mobile/screens/trip/sheets/MTransportSheet.tsx": 12,
"mobile/screens/trip/sheets/MTransportSheet.tsx": 9,
"mobile/screens/trip/sheets/MTripSheetUi.tsx": 5,
"mobile/screens/trip/sheets/PlCategoryPicker.tsx": 2,
"mobile/screens/trip/sheets/PlFileAttach.tsx": 7,
@@ -270,12 +268,12 @@
"mobile/screens/trip/tabs/MFileMenuSheet.tsx": 1,
"mobile/screens/trip/tabs/MFileTrashSheet.tsx": 4,
"mobile/screens/trip/tabs/MFilesTab.tsx": 12,
"mobile/screens/trip/tabs/MPackItemSheet.tsx": 7,
"mobile/screens/trip/tabs/MPackItemSheet.tsx": 1,
"mobile/screens/trip/tabs/MPackingImportSheet.tsx": 3,
"mobile/screens/trip/tabs/MPackingListTab.tsx": 32,
"mobile/screens/trip/tabs/MPackingListTab.tsx": 2,
"mobile/screens/trip/tabs/MReservationCardParts.tsx": 6,
"mobile/screens/trip/tabs/MTaskSheet.tsx": 6,
"mobile/screens/trip/tabs/MTodoListTab.tsx": 15,
"mobile/screens/trip/tabs/MTodoListTab.tsx": 3,
"mobile/screens/trip/tabs/MTransportsTab.tsx": 2,
"mobile/screens/trip/tabs/filesModel.ts": 5,
"mobile/screens/trip/tabs/tabChrome.tsx": 12,
+8
View File
@@ -0,0 +1,8 @@
import { assignmentSchema, type AssignmentStayRequest } from '@trek/shared';
import { apiClient } from './client';
/** How long the drive stands at one visit (#3092); null hands it back to the place's stay. */
export async function saveAssignmentStay(tripId: number | string, id: number, body: AssignmentStayRequest) {
const saved = await apiClient.put(`/trips/${tripId}/assignments/${id}/stay`, body);
return assignmentSchema.parse(saved.data.assignment);
}

Some files were not shown because too many files have changed in this diff Show More