Files
OSGKeyboard/Scripts/sim-import-account-session.sh
T
Rocky 4dce67df84 chore(release): bump version to 2.1.6 (build 131)
Version: CURRENT_PROJECT_VERSION 130 -> 131 (project.yml, AGENTS.md, READMEs,
docs/llms.txt).

fix(flow): host-app identification now compiles in every build configuration
(Debug, TestFlight, Release). The arbiter probe and HostAppIdentity were
DEBUG-only, so TestFlight/App Store builds never knew the host bundle id and
could not auto-return after a startflow handoff. Debug-only logging and the
Home test card are unchanged.

Also includes the pending work in the tree:
- Home: single account/setup card surface (HomeAccountSurfacePolicy/Views)
- Wide screens: voice key row and centred mic placement, iPhone Duo layout
- Keyboard: clipboard skill ranking and AI skill layout updates
- Debug: account session handoff to the Simulator (+ import script)
- Docs: portfolio assets, privacy policy URL, site/README refresh
2026-10-29 11:54:13 +08:00

50 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
# Hand a signed-in account session from a physical device to an iOS Simulator.
#
# The Simulator cannot produce DeviceCheck / App Attest evidence, so the
# account server rejects its Apple sign-in (`integrity_evidence_missing`).
# Refresh and managed-gateway calls only need the session, so a DEBUG build on
# a device can relinquish its session instead:
#
# 1. Device (DEBUG build): Settings → Diagnostics → 把账号会话交给模拟器,
# then AirDrop the file to this Mac.
# 2. Mac: Scripts/sim-import-account-session.sh ~/Downloads/osg-account-handoff.json [udid]
#
# The DEBUG Simulator build must already be installed. The script places the
# file in the app's Documents, deletes the source, and relaunches the app,
# which adopts the session and deletes the file. The file holds a live refresh
# token — treat it like a password.
set -euo pipefail
usage() {
echo "usage: $0 <osg-account-handoff.json> [simulator-udid|booted]" >&2
exit 64
}
[[ $# -ge 1 && $# -le 2 ]] || usage
source_file=$1
device=${2:-booted}
bundle_id=com.osgkeyboard.ios
format=osg-debug-account-handoff-v1
[[ -f "$source_file" ]] || { echo "error: $source_file not found" >&2; exit 66; }
grep -q "\"$format\"" "$source_file" || {
echo "error: $source_file is not an OSG account handoff file" >&2
exit 65
}
container=$(xcrun simctl get_app_container "$device" "$bundle_id" data) || {
echo "error: $bundle_id is not installed on simulator '$device' — run the DEBUG build first" >&2
exit 69
}
mkdir -p "$container/Documents"
install -m 600 "$source_file" "$container/Documents/osg-account-handoff.json"
rm -f "$source_file"
xcrun simctl terminate "$device" "$bundle_id" >/dev/null 2>&1 || true
xcrun simctl launch "$device" "$bundle_id" >/dev/null
echo "Session handed to simulator '$device'. The app adopts it on launch and deletes the file."