Skip to content

feat(ios): sign in to a TablePro account through the shared core - #4492

Merged
datlechin merged 8 commits into
mainfrom
feat/ios-core-account
Nov 25, 2026
Merged

datlechin merged 8 commits into
mainfrom
feat/ios-core-account

Conversation

@datlechin

@datlechin datlechin commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Summary

  • The vendored /v2 document is tablepro-cloud 0e8af822 (cloud#56, S0b), which takes ios on POST /v2/devices; on the SaaS an iPhone or iPad holds one of the 3 device slots.
  • Core: AppClient::IOS (client tablepro-ios, platform ios, the Mac's app.tablepro:/oauth/callback redirect) and AppClientTag::Ios in the FFI. C# bindings regenerated.
  • Build: apple/scripts/build-core.sh takes slices (arm64, x86_64, both, ios, ios-simulator) and builds one XCFramework with each. The iOS slices are built at the iOS app's 18.0 floor and checked like the Mac's: deployment target and system SQLite (API_AVAILABLE(ios(...))). TableProFFI declares iOS 18.
  • The iOS app links TableProFFI and compiles the Mac's account adapter from TablePro/Core/Services/Account/Shared/: CoreAccountBackend, CoreAccountMapping, KeychainHostSecrets, WebAuthenticationSessionAuthenticator and the account types. Left on the Mac: AccountError+CloudAPI, AccountProfile+CloudAPI, AccountCoreSetup.accountConfig(machine:).
  • Shared adapter changes: CoreAccountBackend takes each app's AccountConfig; KeychainHostSecrets takes each app's AccountTokenKeychain; the authenticator takes either platform's anchor; featureAccess(code:); AccountDevice.isThisMac is isThisDevice; AccountCodes.systemName and the development stack moved to the shared folder.
  • iOS account: a random 32-byte device ID in a ThisDeviceOnly Keychain item, made once (a locked Keychain waits for the unlock and never makes a new ID); refresh tokens under the Mac's item names, readable after first unlock, in the app's own access group, not the widget's; account.json in Application Support, kept out of backups; os_version with the system name ("iOS 26.1", "iPadOS 26.1").
  • iOS UI: Settings > TablePro Account with Sign In (ASWebAuthenticationSession over the scene in front), Server (tablepro.app or a company server address), Devices (swipe to remove), Sign Out, and the device-limit, refresh and company-license notices.
  • Managed AppConfig (ADR 0055): ManagedAppConfiguration reads AccountServerURL, AllowOtherAccountServers, PersonalSyncProvider, UsageDataAllowed and ICloudSyncAllowed from com.apple.configuration.managed; a value of another type counts as absent and is logged. The raw values reach the core as AccountConfig.policy (feat(policy): apply the ADR 0055 managed policy keys on the Mac and in the core #4497's ManagedPolicyArg), so every app applies one rule.
    • A change while the app runs goes to the core's apply_policy, in order; the account then calls a server the values no longer allow no more until the next launch.
    • iCloud sync follows the core's personal_sync_choices and settled_sync_provider over Off and iCloud, as the Mac does: PersonalSyncProvider can force iCloud or keep it off, and ICloudSyncAllowed=false takes it away. A change stops or starts sync at once, an upload stops before its next request, and the switch locks with the organization's wording; new passwords stay device-only while iCloud is off.
    • UsageDataAllowed=false stops usage data and locks its switch.
    • First run skips the iCloud question the configuration answers, and records no consent for it.
  • CI: the ios suite runs on core changes; iOS and Package Tests builds the Simulator slice; core.yml builds the iOS device slice. verify.sh ios builds the Simulator slice and keeps the slices the tree had.
  • The core crates' notices include the iOS targets (adds openssl-probe) and ship in the iOS Acknowledgements.
  • ADR 0047 gains the iOS seams beside the Mac's. Storage rules, CI rules, AGENTS, CONTRIBUTING and RELEASING updated; the local-stack probe follows the moved files. ROADMAP T-09 iOS ticked.
  • Docs: docs(ios): the TablePro account and managed configuration on iPhone and iPad docs#292 (draft, merges after this).

Left for a later lane, from the security pass:

  • ICloudSyncAllowed=false stops an upload before its first request and before each retry the coordinator makes; CloudKitSyncEngine still sends the rest of a split upload. The iOS engine moves into the core in I3, which checks the policy per request.

Tests changed on purpose:

  • FakeAccountBackend.featureAccess takes the feature code, and applyPolicy the core's ManagedPolicyArg (AccountServicesTests compares coreArgument); isThisMac renamed in the Mac account tests.
  • test_detect_changed_paths.py: the core-link cases cover the ios suite.

Screens, light and dark, rendered from the app's views in the iOS 27 Simulator:

Light Dark
Signed in to a company server, with iCloud sync and usage data turned off by managed configuration Signed in, managed, light Signed in, managed, dark
Signed out Signed out, light Signed out, dark
Server Server, light Server, dark
Devices Devices, light Devices, dark

Test plan

  • tablepro-account: an_iphone_signs_in_through_the_same_scheme_as_its_own_client_and_registers_as_ios (the authorize URL, the token exchange and POST /v2/devices carry tablepro-ios and ios); each_app_signs_in_as_its_own_client_platform_and_redirect.
  • tablepro-ffi: an_iphone_passes_its_client_and_the_device_id_it_keeps.
  • TableProFFITests: anIPhoneSignsInAsTheIOSClientThroughTheSameScheme.
  • TableProMobileTests on the Simulator slice: AccountCoreSignInTests (the core inside the iOS app signs in as tablepro-ios; a managed server holds the account), AccountModelTests (new values reach the core in order), AccountDeviceIDTests, MobileAccountKeychainTests, ManagedAppConfigurationTests, AppStateManagedConfigurationTests, onboarding and first-run cases.
  • TableProTests: AccountCoreSetupConfigTests and the account and Team Library suites.
  • build-core.sh arm64 ios ios-simulator: every slice passes the deployment target and system SQLite checks.
  • After merging P1 (feat(policy): apply the ADR 0055 managed policy keys on the Mac and in the core #4497), locally: tablepro-account 193 tests, clippy on tablepro-account and tablepro-ffi, build-core.sh arm64 ios-simulator, the C# bindings generated from that core equal to the committed ones, 127 iOS tests in the 12 suites this touches, and the Mac account, Team Library, managed policy and sync provider suites.

The iOS app links the core's iOS slices and the Mac's account adapter, reads ADR 0055's keys from managed app configuration, and reports the tablepro-ios client and the ios platform. The vendored /v2 document carries ios until cloud S0b's is vendored.
# Conflicts:
#	core/docs/decisions/0047-the-apple-apps-sign-in-through-the-core.md
@datlechin
datlechin enabled auto-merge (squash) November 25, 2026 12:35
iOS passes its managed values to the core as AccountConfig.policy, hands later ones to apply_policy, and takes iCloud's standing from the core's provider rule, as the Mac does.
# Conflicts:
#	apple/TableProMobile/TableProMobile/Localizable.xcstrings
#	apple/TableProMobile/TableProMobile/Onboarding/FirstRunPlan.swift
#	scripts/ci/detect-changed-paths.sh
@datlechin
datlechin disabled auto-merge November 25, 2026 18:42
@datlechin
datlechin merged commit 20eab6b into main Nov 25, 2026
2 checks passed
@datlechin
datlechin deleted the feat/ios-core-account branch November 25, 2026 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant