@protobase/cli 0.94.6 → 0.94.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.94.6";
2
+ var version = "0.94.8";
3
3
  //#endregion
4
4
  export { version };
@@ -21,13 +21,14 @@ const readyTimeout = 3e4;
21
21
  * files, background updates off, a rolled-back bundle blocked and `readyTimeout`, within which the shell must call
22
22
  * ready() or the app goes back to its own files. CapacitorHttp and CapacitorCookies stay off; the keyboard plugin
23
23
  * resizes natively, its default, and fills the space beside the keyboard's rounded corners with the page's background
24
- * instead of black. With `push`, Capacitor's push plugin is compiled in and shows a push while the app is open. It
24
+ * instead of black. With `push`, Capacitor's push plugin is compiled in and shows a push while the app is open, and on
25
+ * iOS ProtobasePush names the APNs environment, beyond page script. It
25
26
  * never sets `server.allowNavigation`, so no other host loads inside the WebView. Protobase's plugin is compiled in last, so its stand-ins replace any plugin of the same name.
26
27
  * Service workers get nothing from the local server on Android, which they would reach past the WebViewClient that
27
28
  * guards it. The file ships outside the app's web part, so the fingerprint in the user agent and ProtobaseAuth's
28
29
  * origins are beyond page script and a live update.
29
30
  */
30
- const capacitorConfig = ({ appId, appName, fingerprint, shellVersion, plugins, liveUpdate, allowances, apiOrigin, platform, release, push }) => ({
31
+ const capacitorConfig = ({ appId, appName, fingerprint, shellVersion, plugins, liveUpdate, allowances, apiOrigin, platform, release, push, apnsEnvironment }) => ({
31
32
  appId,
32
33
  appName,
33
34
  webDir: "web",
@@ -46,6 +47,7 @@ const capacitorConfig = ({ appId, appName, fingerprint, shellVersion, plugins, l
46
47
  },
47
48
  Keyboard: { autoBackdropColor: "dom" },
48
49
  ...push && { PushNotifications: { presentationOptions: pushPresentation } },
50
+ ...apnsEnvironment && { ProtobasePush: { environment: apnsEnvironment } },
49
51
  ...liveUpdate && { LiveUpdate: {
50
52
  ...liveUpdate,
51
53
  readyTimeout,
@@ -1,5 +1,6 @@
1
1
  import { copyGoogleServices } from "./google-services.js";
2
2
  import { withLocalNetworking } from "./info-plist.js";
3
+ import { setUpIosPush } from "./ios-push.js";
3
4
  import { withProtobaseIcon } from "./native-icon.js";
4
5
  import path from "node:path";
5
6
  import { readFile, rm, writeFile } from "node:fs/promises";
@@ -8,10 +9,10 @@ const infoPlist = (ws) => path.join(ws, "ios", "App", "App", "Info.plist");
8
9
  /**
9
10
  * Generates the platform's native project in the workspace from its capacitor.config.json and app files, replacing
10
11
  * the last one: it is never edited by hand. Its home-screen icon is Protobase's, an Android app with push gets the
11
- * project's google-services.json from `googleServicesFrom`, and an iOS app calling the API over plain http may reach
12
- * local addresses.
12
+ * project's google-services.json from `googleServicesFrom`, an iOS app with push its entitlement in `apnsEnvironment` and
13
+ * the token forwarding, and an iOS app calling the API over plain http may reach local addresses.
13
14
  */
14
- const generatePlatform = async (ws, platform, { cleartext, googleServicesFrom }, cap) => {
15
+ const generatePlatform = async (ws, platform, { cleartext, googleServicesFrom, apnsEnvironment }, cap) => {
15
16
  await rm(path.join(ws, platform), {
16
17
  recursive: true,
17
18
  force: true
@@ -19,6 +20,7 @@ const generatePlatform = async (ws, platform, { cleartext, googleServicesFrom },
19
20
  await cap(["add", platform]);
20
21
  await withProtobaseIcon(ws, platform);
21
22
  if (platform === "android" && googleServicesFrom !== void 0) await copyGoogleServices(googleServicesFrom, ws);
23
+ if (platform === "ios" && apnsEnvironment !== void 0) await setUpIosPush(ws, apnsEnvironment);
22
24
  if (platform !== "ios" || !cleartext) return;
23
25
  await writeFile(infoPlist(ws), withLocalNetworking(await readFile(infoPlist(ws), "utf8")));
24
26
  };
@@ -0,0 +1,55 @@
1
+ import path from "node:path";
2
+ import { readFile, writeFile } from "node:fs/promises";
3
+ //#region src/mobile/ios-push.ts
4
+ /** Where the push entitlement goes in the generated iOS project, from `ios/App/`, as the target's build settings name it. */
5
+ const entitlementsPath = "App/App.entitlements";
6
+ /** The app's entitlements: push, in the APNs environment it registers in, which the entitlement calls `development` for the sandbox. */
7
+ const pushEntitlements = (environment) => `<?xml version="1.0" encoding="UTF-8"?>
8
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
9
+ <plist version="1.0">
10
+ <dict>
11
+ <key>aps-environment</key>
12
+ <string>${environment === "sandbox" ? "development" : "production"}</string>
13
+ </dict>
14
+ </plist>
15
+ `;
16
+ const infoPlistSetting = " INFOPLIST_FILE = App/Info.plist;\n";
17
+ const delegateEnd = "\n func application(_ application: UIApplication,\n configurationForConnecting";
18
+ const tokenForwarding = `
19
+ func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
20
+ NotificationCenter.default.post(name: .capacitorDidRegisterForRemoteNotifications, object: deviceToken)
21
+ }
22
+
23
+ func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
24
+ NotificationCenter.default.post(name: .capacitorDidFailToRegisterForRemoteNotifications, object: error)
25
+ }
26
+ `;
27
+ const insertBefore = (text, file, anchor, count, insert) => {
28
+ const parts = text.split(anchor);
29
+ if (parts.length - 1 !== count) throw new Error(`${file} has \`${anchor.trim().split("\n")[0]}\` ${parts.length - 1} times, not ${count} as in Capacitor's template: iOS push cannot be set up`);
30
+ return parts.join(`${insert}${anchor}`);
31
+ };
32
+ /** The project.pbxproj with the app target's Debug and Release configurations signing with the push entitlement. */
33
+ const withPushEntitlements = (pbxproj) => {
34
+ if (pbxproj.includes("CODE_SIGN_ENTITLEMENTS")) throw new Error("project.pbxproj already names entitlements");
35
+ return insertBefore(pbxproj, "project.pbxproj", infoPlistSetting, 2, `\t\t\t\tCODE_SIGN_ENTITLEMENTS = ${entitlementsPath};\n`);
36
+ };
37
+ /** The AppDelegate.swift forwarding the APNs token, or the failure to get one, to Capacitor's push plugin. */
38
+ const withTokenForwarding = (delegate) => {
39
+ if (delegate.includes("didRegisterForRemoteNotificationsWithDeviceToken")) throw new Error("AppDelegate.swift already handles the APNs token");
40
+ return insertBefore(delegate, "AppDelegate.swift", delegateEnd, 1, tokenForwarding);
41
+ };
42
+ const edit = async (file, change) => writeFile(file, change(await readFile(file, "utf8")));
43
+ /**
44
+ * Gives the iOS project `cap add ios` generated in the workspace `ws` push: the entitlement in `environment`, which the
45
+ * app target signs with, and the token forwarding in its AppDelegate. Each edit is checked against Capacitor's template
46
+ * and fails when it changed, rather than building an app that never gets a token.
47
+ */
48
+ const setUpIosPush = async (ws, environment) => {
49
+ const app = path.join(ws, "ios", "App");
50
+ await writeFile(path.join(app, entitlementsPath), pushEntitlements(environment));
51
+ await edit(path.join(app, "App.xcodeproj", "project.pbxproj"), withPushEntitlements);
52
+ await edit(path.join(app, "App", "AppDelegate.swift"), withTokenForwarding);
53
+ };
54
+ //#endregion
55
+ export { entitlementsPath, pushEntitlements, setUpIosPush, withPushEntitlements, withTokenForwarding };
@@ -1,6 +1,6 @@
1
1
  //#region ../mobile/package.json
2
2
  var name = "@protobase/mobile";
3
- var nativeContract = 9;
3
+ var nativeContract = 10;
4
4
  var dependencies = {
5
5
  "@capacitor/android": "8.5.3",
6
6
  "@capacitor/app": "8.1.2",
@@ -47,10 +47,16 @@ const checkProtobasePlugin = async (ws) => {
47
47
  throw new Error(`The Android app lacks Protobase's native plugin (${missing.join(", ")}): delete ${ws} and run the command again`);
48
48
  };
49
49
  /**
50
- * The classes of Protobase's iOS plugin, by `@objc` name: the bounce Capacitor turns off, and ProtobaseAuth, which keeps
51
- * page script away from the session.
50
+ * The classes of Protobase's iOS plugin, by `@objc` name: the bounce Capacitor turns off, ProtobaseAuth, which keeps
51
+ * page script away from the session, ProtobaseExternal, which opens a url outside the app, and ProtobasePush, which
52
+ * names what the app registers its APNs token with.
52
53
  */
53
- const protobaseIosPluginClasses = ["ProtobaseBounce", "ProtobaseAuthPlugin"];
54
+ const protobaseIosPluginClasses = [
55
+ "ProtobaseBounce",
56
+ "ProtobaseAuthPlugin",
57
+ "ProtobaseExternal",
58
+ "ProtobasePush"
59
+ ];
54
60
  /** The Swift package product `cap add ios` compiles @protobase/mobile into, by the name @capacitor/cli's fixName gives. */
55
61
  const protobaseIosProduct = "ProtobaseMobile";
56
62
  const readIosFile = (ws, ...parts) => readFile(path.join(ws, "ios", "App", ...parts), "utf8").catch((error) => {
@@ -57,8 +57,8 @@ const prepare = async ({ projectDir, platform, api, extensions, live, release },
57
57
  onWarning
58
58
  }) : await placeholderWebPart(ws);
59
59
  const fingerprint = nativeFingerprint(pinnedNative, mobile.plugins, { push: project.notifications });
60
- const push = project.notifications && platform === "android" && await hasGoogleServices(projectDir);
61
- if (project.notifications && platform === "android" && !push) onWarning(missingGoogleServices(projectDir));
60
+ const push = project.notifications && (platform === "ios" || await hasGoogleServices(projectDir));
61
+ if (project.notifications && !push) onWarning(missingGoogleServices(projectDir));
62
62
  const liveUpdate = liveUpdateSettings({
63
63
  ...mobile.publicKey && { publicKey: mobile.publicKey },
64
64
  ...builtInOrder && { builtInOrder },
@@ -66,6 +66,7 @@ const prepare = async ({ projectDir, platform, api, extensions, live, release },
66
66
  live: live !== void 0
67
67
  });
68
68
  if (liveUpdate.note) process.stderr.write(`note: ${liveUpdate.note}\n`);
69
+ const apnsEnvironment = push && platform === "ios" ? release ? "production" : "sandbox" : void 0;
69
70
  const config = {
70
71
  appId: mobile.appId,
71
72
  appName,
@@ -76,7 +77,8 @@ const prepare = async ({ projectDir, platform, api, extensions, live, release },
76
77
  apiOrigin: url.origin,
77
78
  platform,
78
79
  ...release && { release },
79
- ...push && { push }
80
+ ...push && { push },
81
+ ...apnsEnvironment && { apnsEnvironment }
80
82
  };
81
83
  await writeCapacitorConfig(ws, capacitorConfig({
82
84
  ...config,
@@ -85,7 +87,8 @@ const prepare = async ({ projectDir, platform, api, extensions, live, release },
85
87
  const cap = capacitorRunner(ws, env, run);
86
88
  await generatePlatform(ws, platform, {
87
89
  ...allowances,
88
- ...push && { googleServicesFrom: projectDir }
90
+ ...push && platform === "android" && { googleServicesFrom: projectDir },
91
+ ...apnsEnvironment && { apnsEnvironment }
89
92
  }, cap);
90
93
  if (platform === "android") {
91
94
  await guardLiveUpdate(ws);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/cli",
3
- "version": "0.94.6",
3
+ "version": "0.94.8",
4
4
  "description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -43,13 +43,13 @@
43
43
  "dependencies": {
44
44
  "@better-auth/core": "^1.7.12",
45
45
  "@hono/node-server": "^2.1.3",
46
- "@protobase/config": "0.94.6",
47
- "@protobase/layout": "0.94.6",
48
- "@protobase/query": "0.94.6",
49
- "@protobase/schema": "0.94.6",
50
- "@protobase/server": "0.94.6",
51
- "@protobase/ui": "0.94.6",
52
- "@protobase/workflows": "0.94.6",
46
+ "@protobase/config": "0.94.8",
47
+ "@protobase/layout": "0.94.8",
48
+ "@protobase/query": "0.94.8",
49
+ "@protobase/schema": "0.94.8",
50
+ "@protobase/server": "0.94.8",
51
+ "@protobase/ui": "0.94.8",
52
+ "@protobase/workflows": "0.94.8",
53
53
  "@react-email/render": "^2.1.0",
54
54
  "@scalar/hono-api-reference": "^0.12.10",
55
55
  "@sentry/vite-plugin": "^11.10.0",
@@ -12,7 +12,7 @@ A bell in the top bar and push to browsers and phones, for what your app tells i
12
12
  - [Notification history](../reference/notifications.md#history) (beta): Each user's inbox notifications are kept with when they were read, and the API lists them, counts the unread ones and marks them read.
13
13
  - [Web Push](../reference/notifications.md#web-push) (beta): Notifications reach desktop and Android browsers and home-screen web apps on iPhone through Web Push, with keys you generate.
14
14
  - [Push on Android](../reference/notifications.md#android) (beta): The server sends notifications to Android devices through Firebase Cloud Messaging with the service account key in `PROTOBASE_FCM_SERVICE_ACCOUNT`, and the mobile app receives them, set up by `protobase mobile` from a `google-services.json` in the project.
15
- - [Push on iOS](../reference/notifications.md#ios) (in development): The server sends notifications to iPhone and iPad through the Apple Push Notification service with the APNs key in `PROTOBASE_APNS_KEY`, `PROTOBASE_APNS_KEY_ID` and `PROTOBASE_APNS_TEAM_ID`; the mobile app registering for them and receiving them on iOS is coming soon.
15
+ - [Push on iOS](../reference/notifications.md#ios) (beta): The server sends notifications to iPhone and iPad through the Apple Push Notification service with the `.p8` key's text in `PROTOBASE_APNS_KEY`, its key ID in `PROTOBASE_APNS_KEY_ID` and the Apple team ID in `PROTOBASE_APNS_TEAM_ID`, and the mobile app receives them, set up by `protobase mobile`.
16
16
  - [Push relay](../reference/notifications.md#push-relay) (beta): Send push notifications through a relay that holds the mobile app's push keys, so your app needs only its own relay credential.
17
17
  - [Do not disturb](../reference/status.md#do-not-disturb) (beta): While someone is on do not disturb, sends push nothing to their devices and keep inbox notifications in the bell for later.
18
18
  - [Notification bell](../reference/notifications.md#the-bell) (beta): The top bar shows how many inbox notifications are unread; its panel opens each one, marks them read and turns push on or off for this device.
@@ -163,12 +163,20 @@ You submit the app under your own developer account, on both stores: Apple rejec
163
163
 
164
164
  ## 9. Push notifications
165
165
 
166
- With [`notifications()`](../reference/notifications.md) on, `protobase mobile` sets push up in the app itself: there is no push setting in the mobile section. Push on iOS is coming soon.
166
+ With [`notifications()`](../reference/notifications.md) on, `protobase mobile` sets push up in the app itself: there is no push setting in the mobile section.
167
+
168
+ The user turns push on from the bell, or from your own button with [`usePushNotifications`](../reference/notifications.md#in-the-browser). The phone asks for the permission then. Signing out removes the phone's registration.
169
+
170
+ A tap on a notification whose `url` is on your app's server opens that page inside the app. Any other `http` or `https` url opens in the phone's browser, never inside the app, and any other url opens nothing. Turning push on or off changes the app's native code, so it ships in a store release, not a [live update](#7-live-updates). <gap>An app with `notifications()` on cannot get live updates on Protobase Cloud because fingerprinting its release with the manifest's `push` is not implemented there.</gap> <gap>A self-hosted server cannot offer live updates to an app whose config function turns `notifications()` on for `build` and not for `serve`, or the other way round, because fingerprinting a served release from its bundle's manifest is not implemented.</gap>
167
171
 
168
172
  ### Android
169
173
 
170
- Put your Firebase project's `google-services.json` in the project folder, next to `protobase.config.ts`. You download it from the Firebase console (Project settings, Your apps, an Android app whose package name is the mobile section's `appId`). Every `protobase mobile` run and build copies it into the Android app. Without it, the Android app builds without push and every run says so, naming the path. The server sends through FCM once you set [`PROTOBASE_FCM_SERVICE_ACCOUNT`](../reference/notifications.md#android).
174
+ Put your Firebase project's `google-services.json` in the project folder, next to `protobase.config.ts`. You download it from the Firebase console (Project settings, Your apps, an Android app whose package name is the mobile section's `appId`). Every `protobase mobile` run and build copies it into the Android app. Without it, the Android app builds without push and every run says so, naming the path. The server sends through FCM once you set [`PROTOBASE_FCM_SERVICE_ACCOUNT`](../reference/notifications.md#android). Android asks for the permission from Android 13 on.
171
175
 
172
- The user turns push on from the bell, or from your own button with [`usePushNotifications`](../reference/notifications.md#in-the-browser). Android 13 and later ask for the permission then. Signing out removes the phone's registration.
176
+ ### iOS
173
177
 
174
- A tap on a notification whose `url` is on your app's server opens that page inside the app. Any other `http` or `https` url opens in the phone's browser, never inside the app, and any other url opens nothing. Turning push on or off changes the app's native code, so it ships in a store release, not a [live update](#7-live-updates). <gap>An app with `notifications()` on cannot get live updates on Protobase Cloud because fingerprinting its release with the manifest's `push` is not implemented there.</gap> <gap>A self-hosted server cannot offer live updates to an app whose config function turns `notifications()` on for `build` and not for `serve`, or the other way round, because fingerprinting a served release from its bundle's manifest is not implemented.</gap>
178
+ `protobase mobile` adds the push capability to the iOS app and forwards its APNs token to Capacitor itself, on every run and build. Automatic signing turns push on for the app id in your Apple developer account; with manual signing (`--certificate` and `--profile`), the provisioning profile must include push notifications. A free team cannot sign an app with push, so running one on a phone needs a paid team; the simulator needs none.
179
+
180
+ The server sends through APNs once you create an APNs key in your Apple developer account (Certificates, Identifiers & Profiles, Keys) and set three variables on the server: the `.p8` file's text in `PROTOBASE_APNS_KEY`, the key's id in `PROTOBASE_APNS_KEY_ID` and your team's id in `PROTOBASE_APNS_TEAM_ID`. See [iOS in the notifications reference](../reference/notifications.md#ios).
181
+
182
+ Development runs (`protobase mobile run` and `open`) register with the APNs sandbox, and store builds (`protobase mobile build`) with production, so a phone gets push only from a server sending to the environment its build registered in.
@@ -102,7 +102,7 @@ Make yourself the owner of an order, then change its status, in the app or with
102
102
 
103
103
  Every send is a background job: a failed one is on the [failed jobs page](../reference/jobs.md#failed-jobs-page), and the server log has a line per delivery of the subscription.
104
104
 
105
- On an iPhone or iPad, push reaches the app once it is added to the Home Screen, not a browser tab. Push to the Android and iOS builds of your app is coming soon; the [mobile guide](mobile-app.md) builds them.
105
+ On an iPhone or iPad, push reaches the app once it is added to the Home Screen, not a browser tab. The Android and iOS builds of your app receive push too, set up as the [mobile guide](mobile-app.md#9-push-notifications) shows.
106
106
 
107
107
  ## 6. Turn the bell off or replace a part
108
108
 
@@ -7,7 +7,7 @@ Turn on notifications, send them to users or devices, show each signed-in user t
7
7
  ## Turning them on
8
8
 
9
9
  :::caution[Beta]
10
- Push reaches browsers and the Android app. On iPhone and iPad the server delivers through [APNs](#ios), but the mobile app does not register for push yet.
10
+ Push reaches browsers and the iOS and Android app; push in the app is new.
11
11
  :::
12
12
 
13
13
  Notifications tell a user about something in the app, in a bell in the top bar and as push on their devices. [Send notifications](../guides/push-notifications.md) walks through turning them on and sending the first one. You turn them on in `protobase.config.ts`:
@@ -27,7 +27,7 @@ Every signed-in user gets [the bell](#the-bell), browsers receive push through [
27
27
  ## Devices
28
28
 
29
29
  :::caution[Beta]
30
- Browsers receive push through [Web Push](#web-push), and the Android app through [FCM](#android). The server delivers to iOS devices through [APNs](#ios), but the mobile app does not register for push on iOS yet.
30
+ The iOS and Android app register their push token as a device, which is new.
31
31
  :::
32
32
 
33
33
  A device is where a user receives push: a browser's push subscription, or an Android or iOS app's push token. Each signed-in user registers and removes only their own, through the API:
@@ -69,7 +69,7 @@ The path comes from `devicesPath('/api', id)`, and the name of its id parameter
69
69
  ## Sending
70
70
 
71
71
  :::caution[Beta]
72
- Browsers and the Android app receive push, and iOS devices through [APNs](#ios) once the mobile app registers them, which is coming soon. <gap>A send can reach a device twice, or keep an entry twice in a history store of your own, when a worker stops mid-send because saving the send's progress in the same step as the push is not implemented.</gap>
72
+ <gap>A send can reach a device twice, or keep an entry twice in a history store of your own, when a worker stops mid-send because saving the send's progress in the same step as the push is not implemented.</gap>
73
73
  :::
74
74
 
75
75
  [Send notifications](../guides/push-notifications.md) sends one from a record change, step by step. You send a notification from your server code, such as a job, a hook, an event subscription or an API function, with `sendNotification(db, to, message)` from `@protobase/server`. It is queued as a background job in `db`'s transaction when `db` is one, so it goes out only once your write commits, and nothing goes out when the transaction rolls back. A running job also has it as `sendNotification` in its context, beside `mail`, when the app has `notifications`.
@@ -191,7 +191,7 @@ Each message is encrypted for its browser and signed with the key. It goes only
191
191
 
192
192
  ### In the browser
193
193
 
194
- `usePushNotifications()` from `@protobase/ui` turns push on and off for the signed-in user in this browser, or in the Android app, for your own button or menu item. Its `state` tells whether push is `on`, `off`, `blocked` because the user refused notifications in the browser's or the phone's settings, or `unsupported`, and `loading` until it knows. Hide the button while it is `unsupported`: the browser has no Web Push, the app has no VAPID keys, the Android app was built without `google-services.json`, or it runs in the iOS app.
194
+ `usePushNotifications()` from `@protobase/ui` turns push on and off for the signed-in user in this browser, or in the iOS or Android app, for your own button or menu item. Its `state` tells whether push is `on`, `off`, `blocked` because the user refused notifications in the browser's or the phone's settings, or `unsupported`, and `loading` until it knows. Hide the button while it is `unsupported`: the browser has no Web Push, the app has no VAPID keys, or the Android app was built without `google-services.json`.
195
195
 
196
196
  ```tsx
197
197
  import { Button, usePushNotifications } from '@protobase/ui'
@@ -215,8 +215,8 @@ export const PushButton = () => {
215
215
 
216
216
  ## iOS
217
217
 
218
- :::caution[In development]
219
- The mobile app does not register for push on iOS yet.
218
+ :::caution[Beta]
219
+ Push on iOS is new.
220
220
  :::
221
221
 
222
222
  The server delivers push to iOS devices through the Apple Push Notification service (APNs), with token authentication. You create an APNs key in your Apple developer account, under Certificates, Identifiers & Profiles, Keys, and set it in three environment variables:
@@ -227,7 +227,7 @@ The server delivers push to iOS devices through the Apple Push Notification serv
227
227
  | `PROTOBASE_APNS_KEY_ID` | the key's id, ten letters and digits |
228
228
  | `PROTOBASE_APNS_TEAM_ID` | your team's id, ten letters and digits |
229
229
 
230
- Without them APNs is off and iOS devices are skipped. One or two of them set, a blank one, a key that is no APNs key or an id that is not ten letters and digits stops startup, naming the variable without its value, and so do the three set in an app without a [`mobile`](../guides/mobile-app.md) section. The key is a secret: keep it out of client code, `VITE_` variables and the repository. Anyone holding it can push to every iOS device of your apps.
230
+ Without them APNs is off and iOS devices are skipped. One or two of them set, a blank one, a key that is no APNs key or an id that is not ten letters and digits stops startup, naming the variable without its value, and so do the three set in an app without a [`mobile`](../guides/mobile-app.md) section. The key is a secret: keep it out of client code, `VITE_` variables and the repository. Anyone holding it can push to every iOS device of your apps. `protobase mobile` sets the app up: see [Push notifications in the mobile app guide](../guides/mobile-app.md#ios).
231
231
 
232
232
  The topic of every notification is the mobile app's `appId`. Each device goes to the environment it was registered with: development builds to the APNs sandbox, App Store and TestFlight builds to production. A device whose token is not lowercase hex, whose environment is neither `sandbox` nor `production`, or that was registered for another app id is `refused`.
233
233
 
@@ -941,7 +941,7 @@ The browser fetches the tiles, so their host must answer the app's origins with
941
941
 
942
942
  ### Related records
943
943
 
944
- Without any configuration, the record page's rail has a **Related records** card that counts the records pointing at this one: per resource, and per relation when one resource has two, such as Orders (Customer) and Orders (Supplier), how many there are, linking to its list filtered on this record (`/orders?filter=customer_id = "7"`). It counts each filterable relation to a resource with a one-field key, so an index serves the count, and leaves out a resource's tenant, a resource the user cannot list or whose relation they cannot read, and a relation an `l.related` section of the page already lists, its [lines](#record-lines) included.
944
+ Without any configuration, the record page's rail has a **Related records** card that counts the records pointing at this one: per resource, and per relation when one resource has two, such as Orders (Customer) and Orders (Supplier), how many there are, linking to its list filtered on this record (`/orders?filter=customer_id = "7"`). It counts each filterable relation to a resource with a one-field key, so an index serves the count, and leaves out a resource's tenant, a resource the user cannot list or whose relation they cannot read, and a relation an `l.related` section of the page already lists, its [lines](#record-lines) included. A custom component's `fallback` counts only where the page draws it, when the app has no component of that name. <gap>Related records cannot leave out what a fallback lists when its component throws because telling the rail about a component's render error is not implemented.</gap>
945
945
 
946
946
  `l.related(title, options)` lists the first records of `resource` that point at the record on the page, in the table or display the resource's list page uses (with its switch, and on a phone its cards in one sideways row, as a [`Table` block](blocks.md#table) shows them), and links to all of them in that list. They point at it directly, through a relation field, or through a join resource (`through`), such as the leases a tenant signed through `lease_tenants`:
947
947