No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-22 13:15:35 +01:00
Gna Posibility to serve on an other domain 2026-11-22 13:15:35 +01:00
NotificationService Initial commit 2026-11-21 18:56:24 +01:00
Privacy Initial commit 2026-11-21 18:56:24 +01:00
Shared Initial commit 2026-11-21 18:56:24 +01:00
ShareExtension Initial commit 2026-11-21 18:56:24 +01:00
.gitignore Initial commit 2026-11-21 18:56:24 +01:00
project.yml Initial commit 2026-11-21 18:56:24 +01:00
README.md Initial commit 2026-11-21 18:56:24 +01:00

Gná for iOS

SwiftUI app (iOS 17+) plus a Notification Service Extension. The Xcode project is generated from project.yml with XcodeGen.

First build

brew install xcodegen
cd gna-ios
# Edit Config/Gna.xcconfig: GNA_TEAM_ID, GNA_DOMAIN (and GNA_BUNDLE_ID if needed)
xcodegen generate
open Gna.xcodeproj

Needs Xcode 16 or later. Rerun xcodegen generate after adding or removing files, or after editing project.yml or the xcconfig. The project, Info.plists and entitlements are generated and ignored by git.

Configuration

Everything deployment-specific is in Config/Gna.xcconfig:

Setting Used for
GNA_TEAM_ID Signing, keychain group, app group, and the server's app-site association
GNA_BUNDLE_ID App ID (se.rymdvarel.gna); the extension is <id>.NotificationService
GNA_DOMAIN Server URL (https://<domain>), webcredentials: and applinks:

In the Apple Developer portal, enable for the app ID: Associated Domains, Push Notifications and App Groups (group.<bundle id>). Automatic signing usually does this.

The server must match (in its .env, or exported; the single quotes keep the JSON list intact in a shell):

GNA_PUBLIC_URL=https://<GNA_DOMAIN>
GNA_APPLE_APP_IDS='["<GNA_TEAM_ID>.<GNA_BUNDLE_ID>"]'
# For real pushes:
GNA_PUSH_BACKEND=apns
GNA_APNS_TOPIC=<GNA_BUNDLE_ID>
GNA_APNS_KEY_PATH=… GNA_APNS_KEY_ID=… GNA_APNS_TEAM_ID=<GNA_TEAM_ID>

Debug builds register their device as sandbox, Release/TestFlight builds as production.

Developing without a domain

Passkeys and universal links only work against the real HTTPS domain. Before that:

  1. Run the server on the Mac with DEV_AUTH=1 (see gna-server's README); pushes are printed to the server's stdout.
  2. Run the app in the simulator. Debug builds have a gear on the sign-in screen that opens Developer settings: set the server to http://localhost:8000 and log in with DEV_USER/DEV_PASSWORD. None of this is compiled into Release builds.
  3. Invite links can be pasted under I have an invite, but creating a passkey still needs the real domain.

Plain http is only allowed to local addresses (NSAllowsLocalNetworking).

What is in it

  • Sign-in with a passkey; invite and passkey links (/invite#…, /passkey#…) via universal links or pasting, with "Welcome, " and an editable name.

  • Creating conversations (with a first token, shown once with a curl example); a settings sheet per conversation for name, icon, internal URLs, and creating and revoking tokens. Both token screens link to the server's API guide for bots (/integrations).

  • Deleting a conversation (settings sheet, or swipe / long-press in the list, after a confirmation): the server deletes it with its messages and tokens, so bots get 401. Other devices remove their copy when their list refresh no longer finds it.

  • Bot status: a green dot in the list and "online" / "last seen …" under the chat title. A bot is online while it long-polls /updates or /messages; refreshed every 15–20 s.

  • Conversation list: unread counts (computed on the device), last message, mute (swipe or long-press).

  • Conversation: one long-poll stream while in the foreground; messages stored on the device as JSON in Application Support; images with blurhash placeholders, tap for full size; replies (swipe right or long-press, tap a quote to jump to the original); callback and link buttons; tappable links with a preview card for the first web link (fetched by the phone itself via LinkPresentation, once per run); sending up to 10 images per message from the photo library or camera (re-encoded on the phone as JPEG, at most 2560 px, without location metadata).

  • Push: notification categories gna.message, gna.ok, gna.yes_no, gna.ok_cancel, with reply and button actions that require unlocking the phone; the service extension adds the thumbnail.

  • Icon badge: unread messages in unmuted conversations (Shared/Badge.swift). The app sets it after every save of its history and on returning to the foreground (0 when signed out); the service extension adds one per push meanwhile. Reading on another device corrects it only when this app next opens.

  • Share extension: "Gná" in other apps' share sheets for text, a link or up to 10 images (the activation rule in project.yml; not for other files). Pick a conversation, edit the text, Send. Sent messages are donated as INSendMessageIntent, so iOS suggests frequent conversations in the share sheet's top row.

  • Connection problems: "Waiting for network…" / "Can't reach the server" over the list and under the chat title (after two failed polls in a row); the sync and failed images retry as soon as the network returns. Replies and button presses from notifications get background time and three tries; if they still fail, a local notification says so and an unsent reply waits in the message field.

  • History lives on the device: the server deletes messages shortly after delivery. Images are downloaded as messages arrive, before the next poll confirms delivery. Per conversation: "Keep messages" (forever, 1 day, 1 week, 1 month), Clear history, and deleting single messages (long-press). Signing out keeps the history; signing in as another account removes it.

  • "Try the demo" on the sign-in screen when the server offers it (GET /server): a temporary account with a quote bot (POST /auth/demo). A banner shows when it ends and links to the support page for an invite; the ⋯ menu has "End demo…" instead of Sign out / Delete account. When it expires the server answers 401 and the app removes the demo's local data.

  • App icon: icons/Gná and Horse Moonstone Relief.png by default, scaled to 1024 px; the sign-in screen's Logo image set is the same picture, so keep the two in step. The picker in Appearance is hidden for now (AppIconChoice.isPickerEnabled); when on, it offers the others (logo2.png as "Classic", logo.png "Rider", logo3.png "Letter", logo4.png "Leaves") as alternate icons. Those logos have rounded white corners baked in, so their icon sets are cropped 108 px per side to a full square, as iOS requires (it applies its own mask), and scaled to 1024 px. Each also has a small …Preview image set for the settings screen, since alternate icons cannot be loaded as images.

  • IDs for debugging: the account's in the ⋯ menu and the conversation's at the bottom of its settings, both copied on tap; the server's IDs are pronounceable (conv_lusab-babad).

  • "Allow internal URLs" is offered only when the server permits it (GET /server, read when the app comes to the foreground; hidden until known).

  • Help & Support and Privacy Policy links (⋯ menu and sign-in screen) open the server's /support and /privacy pages (GNA_PAGES_DIR on the server).

  • Deleting the account (the ⋯ menu, after a confirmation): the server deletes it with all its conversations, tokens, passkeys and sessions, then the app removes the history, images, per-conversation settings, share suggestions and notifications from the phone. The passkey itself stays in the Passwords app until the user removes it.

Not yet: creating or sending in encrypted conversations, and Markdown formatting.

Layout

project.yml                  XcodeGen spec
Config/Gna.xcconfig          Team, bundle ID, domain
Shared/                      Compiled into app and extension: config, keychain session, JSON
Gna/App                      App entry, AppDelegate, AppModel (session, actions)
Gna/Networking               API client and models (mirror the server's schemas)
Gna/Auth                     Passkeys via AuthenticationServices
Gna/Sync                     Local store and the long-poll sync
Gna/Push                     Notification categories and actions
Gna/Views                    SwiftUI
NotificationService/         Thumbnail attachment for pushes
ShareExtension/              Share sheet: send text, links and images to a conversation
Privacy/<target>/            PrivacyInfo.xcprivacy per bundle: required-reason APIs, collected data

When code starts using another required-reason API (file timestamps, disk space, boot time, …) or sends new kinds of data, update that target's manifest and the App Privacy answers in App Store Connect.