- Swift 99.7%
- Makefile 0.3%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| AnotherIM | ||
| AnotherIMNotificationService | ||
| AnotherIMShared | ||
| AnotherIMTests | ||
| AnotherIMUITests | ||
| libtacky@06250dacfb | ||
| .gitignore | ||
| .gitmodules | ||
| .swiftformat | ||
| .swiftlint.yml | ||
| COPYING | ||
| LICENSE | ||
| Makefile | ||
| PRIVACY.md | ||
| project.yml | ||
| README.md | ||
| TACKY-MIGRATION.md | ||
Another.im XMPP iOS client
This is the source code for the another.im XMPP iOS app.
Building from a clean clone (on a Mac)
The app is the fifth host of Tacky's JSON protocol (TACKY-MIGRATION.md §2,
§8): it links the backend's iOS archive, AnotherTacky.xcframework, as a
Swift package (AnotherTacky, C module CTacky). The backend is the nested
submodule libtacky/ (libtacky, pinned by this repository; its
own submodules are third-party pins), so a clone of this repository alone
has everything the build reads, and the build writes only under build/.
What the Mac needs:
- Xcode 16.1 or later (the first with the iOS 18.1 SDK), simulator runtime included
(
xcode-select -ppointing at it; the project is Swift 6, the backend'sPackage.swiftswift-tools 6.0); - Homebrew:
brew install make cmake ninja xcodegen swiftlint-- GNU make 4.3 or later isgmake(macOS's ownmakeis 3.81, too old for the backend'splatforms/ios.mk). No Tcl is needed: thetclsh9.0that bundles the backend's script image is one on PATH or, failing that, built bygmake backendfrom the backend's pinned Tcl 9.0 underbuild/backend/host(Homebrew'stcl-tkis 9.1); - Rust through rustup, with the two iOS targets:
rustup target add aarch64-apple-ios aarch64-apple-ios-sim; - the network on the first build: the backend's make fetches the Tcl, tcllib and LibreSSL source tarballs (pinned by checksum), and xcodebuild resolves the app's other Swift packages.
git clone ssh://git@dev.another.im:3022/another-im/anotherim-swift.git
cd anotherim-swift
# the nested backend, over ssh as .gitmodules says (`gmake deps` does this):
git submodule update --init tacky
# or over https, without an ssh key for dev.another.im:
git -c submodule.tacky.url=https://dev.another.im/another-im/libtacky.git submodule update --init tacky
export PATH="$(brew --prefix rustup)/bin:$PATH" # Homebrew's rustup is keg-only
rustup target add aarch64-apple-ios aarch64-apple-ios-sim
gmake backend # build/backend/AnotherTacky: the xcframework + Package.swift (~25 min)
gmake app-ios # xcodegen, then an unsigned simulator build (compiles; does not run)
gmake test # AnotherIMTests on the simulator SIM (default "iPhone 17")
The Makefile puts Homebrew's rustup (/opt/homebrew/opt/rustup/bin) and
~/.cargo/bin on PATH itself when they exist, so gmake backend finds
cargo without the export; rustup itself needs it once for the targets.
On the simulator
An unsigned build compiles but stops at its first Keychain key, so the
simulator gets an ad hoc signed one (SIM_SIGNING: CODE_SIGN_IDENTITY=- CODE_SIGNING_ALLOWED=YES CODE_SIGNING_REQUIRED=NO). SIM is a simulator's
name or UDID (xcrun simctl list devices):
gmake run-sim SIM='iPhone 17' # build, boot, install, launch
gmake ui-test SIM='iPhone 17' # AnotherIMUITests (XCUITest)
ANOTHERIM_LIVE_REGISTRATION=1 gmake ui-test # also register a live ztest- account
A Debug simulator build takes a software key in place of the Secure
Enclave's .userPresence one (AppPresenceKey.softwareKeyForTests), which
a simulator has no passcode to answer; so the PIN screen can be passed
there. Launch with -SystemPresenceKey to try the real sheet instead. A
device build, Debug or Release, always uses the enclave. The live
registration UI test is skipped unless ANOTHERIM_LIVE_REGISTRATION=1:
another.im lets one IP register once per 600 s.
On an iPhone
The project signs automatically for team K78H7BT98L (project.yml's
DEVELOPMENT_TEAM); Xcode needs an Apple ID of that team signed in
(Settings > Accounts), and the iPhone in Developer Mode, unlocked and
trusting the Mac. DEVICE_ID is its UDID (xcrun devicectl list devices):
gmake app-device DEVICE_ID=<UDID> # build, -allowProvisioningUpdates
gmake run-device DEVICE_ID=<UDID> # and install + launch (xcrun devicectl)
gmake app-device # any iOS device (generic/platform=iOS)
gmake archive # a Release device archive, signed as project.yml says
app-device is, spelled out:
xcodebuild -project AnotherIM.xcodeproj -scheme AnotherIM \
-derivedDataPath build/DerivedData -configuration Debug \
-destination 'platform=iOS,id=<UDID>' \
-allowProvisioningUpdates -allowProvisioningDeviceRegistration build
xcrun devicectl device install app --device <UDID> \
build/DerivedData/Build/Products/Debug-iphoneos/AnotherIM.app
gmake help lists every target. What they are:
| target | what it does |
|---|---|
backend (xcframework) |
make -C tacky -f platforms/ios.mk libtacky-ios with every tree under build/backend: per slice LibreSSL and the Rust archives -- tacky-core, tacky-crypto, tacky-omemo (ios/), the interpreter, its Tcl sources and the merged archive (tacky/ios-<sdk>), the LibreSSL tarball (dl/), and the package project.yml links (AnotherTacky/) |
project |
xcodegen generate from project.yml |
app-ios |
unsigned simulator build (IOS_DESTINATION, BUILD_SIGNING=CODE_SIGNING_ALLOWED=NO, CONFIG=Debug): compiles, does not run |
app-sim, run-sim |
ad hoc signed build for the simulator SIM (SIM_SIGNING); run-sim also boots, installs and launches |
app-device, run-device |
build for the iPhone DEVICE_ID (any iOS device when unset), automatic signing with DEVICE_FLAGS=-allowProvisioningUpdates -allowProvisioningDeviceRegistration; run-device also installs and launches |
app-macos |
the app on an Apple-silicon Mac, "Designed for iPad" (MACOS_DESTINATION); it runs the device slice, so it needs no macOS slice of the backend |
app |
both of the above |
archive |
build/AnotherIM.xcarchive (ARCHIVE_DESTINATION=generic/platform=iOS, ARCHIVE_SIGNING, e.g. DEVELOPMENT_TEAM=…) |
test |
xcodebuild test -only-testing:AnotherIMTests on TEST_DESTINATION (the simulator SIM, default iPhone 17), results in build/AnotherIM.xcresult |
ui-test |
AnotherIMUITests on SIM, ad hoc signed, results in build/AnotherIMUI.xcresult; ANOTHERIM_LIVE_REGISTRATION=1 adds the live registration |
clean, clean-backend, distclean |
the Xcode project and DerivedData; build/backend; both |
XCODEBUILD_FLAGS goes on every xcodebuild line (-allowProvisioningUpdates,
-quiet). app-*, archive and test build the backend first only when
build/backend/AnotherTacky/Package.swift is missing; gmake backend
rebuilds it on request.
The nested checkout is only read, with one exception the backend's make does
not yet let a caller move: its ios-lib copies each slice's archive to
tacky/dist/libtacky-<sdk>.a (ignored by the backend's .gitignore) before
platforms/ios.mk folds the two.
From the another-im workspace
TACKY= names a backend checkout other than the nested one; the output
still lands in build/backend, so project.yml is the same:
gmake -C anotherim-swift app-ios TACKY=../another-tacky
or, with libtacky cloned beside this repository,
gmake app-ios TACKY=../libtacky.
From a Linux machine the workspace's mac/run.sh (MAC_HOST=user@mac)
syncs the tree to a Mac and runs a command there, e.g.
mac/run.sh gmake -C anotherim-swift backend app-ios TACKY=../another-tacky.
What has run, and what has not
On 2026-10-10 the steps above ran on an Apple-silicon Mac with Xcode 27.0
(iOS 27.0 SDK and simulator), from a clean build/ and with no Homebrew
Tcl: gmake backend (with its host tclsh9.0), gmake app-ios,
gmake app-macos (unsigned), and gmake test on
TEST_DESTINATION='platform=iOS Simulator,name=iPhone 17' (Xcode 27 has no
iPhone 16 simulator) -- 339 tests, no failure. The app was installed on that
simulator and opens on its PIN screen. Not run yet: gmake archive and a
signed app-macos (both need the team's signing identities), the app on a
device, and the app past its PIN screen. The user's rule behind the layout
(2026-09-24): a module's repository is cloned and built with make from
it, without the superproject's contents.
On 2026-11-07, Xcode 27.1 (iOS 27 simulators), with the backend built
before: gmake test -- 397 tests, no failure, on an iPhone 17 simulator;
gmake ui-test -- the PIN set and the welcome screen reached, the live
registration skipped; gmake run-sim -- the app installed, launched and on
its PIN screen; gmake app-device -- BUILD SUCCEEDED, signed "Apple
Development" with the team's provisioning profile (Xcode signed in to team
K78H7BT98L). Not run: run-device (the install on an iPhone).
The store and the PIN
The backend's store is in two tiers (libtacky 1.0.4, storage split):
accounts.db, which a call answered on the lock screen opens with the
device key alone (AppDeviceKey), and every account's history, roster and
keys, which open only with the PIN together with Face ID, Touch ID or the
passcode, or with Face ID or Touch ID alone, through a second key the
Secure Enclave releases only inside that authentication
(AppPresenceKey). A store from before is split on the first unlock after
the update. TACKY-MIGRATION.md §8.2 has the requests. The enclave's path is
compiled and was not run on a device: the tests take the software key.
Push
The app holds two APNs tokens and registers each with the server's App
Server, apushd (push.another.im, XEP-0357 through libtacky's
push set_target), under its own apushd module name, AppPushConfiguration:
| token | pushModule (sandbox / production) |
apushd module | wakes |
|---|---|---|---|
APNs (registerForRemoteNotifications) |
anotherimIOSdev / anotherimIOSprod |
pushType: alert, topic im.narayana.anotherim.ios |
the notification service extension, for a message |
PushKit (PKPushRegistry, .voIP) |
anotherimIOSVoipdev / anotherimIOSVoipprod |
pushType: voip, topic im.narayana.anotherim.ios.voip |
the app, for a call (CallKit) |
Two names because a module has one topic and one delivery class, so a
PushKit token can only be delivered through a voip module. The PushKit
registration carries apushCalls: only, which tells ejabberd's mod_apush
(anotherim-server) to push it calls and nothing else; the APNs one carries
none, which is messages only. Both carry the app's own X25519 key
(apushEncryptionPublicKey, TACKY-MIGRATION.md D7): mod_apush seals a
JSON summary to it (who, how many, a call's session and media; never a
message's text) under the label apush-v2, apushd passes it on unread as
apushEncrypted, and the extension or the app opens it here
(AppPushEncryption).
A message push carries the chat's opaque collapse tag (apushCollapse,
which apushd sends as apns-collapse-id), so a chat's newer notice
replaces the older one, and mod_apush holds a burst in one chat to one
push and one more after its window with the latest count. iOS names a
pushed notice itself (a random id or that tag), so the extension files it
under the chat's thread identifier (AppPushThread, <account>|<chat>)
and the app withdraws a chat's notices by that thread.
The four modules are in anotherim-server's push/settings.sh, which writes
apushd's settings.json: anotherimIOSdev and anotherimIOSprod with
"pushType": "alert" and the bundle id as topic, anotherimIOSVoipdev
and anotherimIOSVoipprod with "pushType": "voip" and the bundle id plus
.voip; the dev pair against the APNs sandbox, the prod pair against
production. The app picks the pair by the aps-environment of the profile
it is signed with (AppPushConfiguration.isSandbox), not by Debug or
Release: a token sent to the other environment is 400 BadDeviceToken.
License
Copyright (c) 2024 Another Foundation MTÜ
Licensed under the Mozilla Public License 2.0 (LICENSE). The backend it
embeds, libtacky (the nested libtacky/), is GPL-3.0, so an app build that links
it is distributed under the GPL-3.0 terms as a whole; MPL-2.0 is compatible
with that.