feat(native): TREK in the share sheet, with the trip picked right there

A share extension puts TREK in the share sheet of Mail, Safari, Files, Wallet
and any app that shares a document, a link, text or a photo. It shows what came
in (a Wallet pass, a PDF, a mail, the page as Safari rendered it, text, a photo)
and the user's trips with their covers, the next one already picked, and hands
both to the app, which opens that trip's booking import with the file in place.
"Choose later" leaves the trip question to the app's import sheet as before.

- ShareExtension target (add-extension.rb learns "share": JavaScript and the
  localizations go in as resources), bundle com.liketrek.trek.share, signed in
  the release lane, its plists linted in native.yml
- Safari hands over the rendered page (SharePage.js), so a confirmation behind
  a sign-in arrives whole; other apps' links are fetched
- The item travels through the shared keychain group the widgets already use;
  the app takes it on com.liketrek.trek://share or when it next becomes active
- Feature shareSheet; strings in the app's 28 languages
This commit is contained in:
Maurice
2026-11-07 10:05:37 +01:00
parent 792e55b2ca
commit 7b8bd4b166
46 changed files with 2006 additions and 63 deletions
+7
View File
@@ -43,6 +43,13 @@ describe('shared booking documents', () => {
expect(useSharedImportStore.getState()).toMatchObject({ file: null, tripId: null });
});
it('takes the trip the share sheet already picked', async () => {
vi.mocked(TrekShell.takeSharedFile).mockResolvedValue({ file: { ...PDF, tripId: 12 } });
await startSharedFiles();
expect(useSharedImportStore.getState()).toMatchObject({ tripId: 12 });
expect(useSharedImportStore.getState().file?.name).toBe('booking.pdf');
});
it('does nothing in a binary without the feature', async () => {
vi.mocked(hasNativeFeature).mockReturnValue(false);
vi.mocked(TrekShell.addListener).mockClear();