|
| 1 | +# Acode iOS Support + iSH Integration — Conversation Export |
| 2 | + |
| 3 | +## User request |
| 4 | +- Add iOS support across Cordova plugins (keep JS API intact), only Terminal + Proot can be unsupported initially. |
| 5 | +- Add `setup-ios.sh` to prepare macOS for iOS builds. |
| 6 | +- Add stricter iOS permission handling and iOS Info.plist entries. |
| 7 | +- Implement iSH-style x86 emulation for Terminal on iOS and integrate with Cordova. |
| 8 | +- Export conversation summary for macOS continuation. |
| 9 | + |
| 10 | +## Work completed (high level) |
| 11 | +- Added iOS implementations or stubs for plugins, with real implementations for: |
| 12 | + - BuildInfo, Browser, System (partial), FTP, SFTP, WebSocket, Server, IAP, SDcard. |
| 13 | +- Added iOS permission handling + Info.plist entries. |
| 14 | +- Added iSH source clone, bridge stubs, and initial iSH integration wiring. |
| 15 | +- Added build + rootfs scripts and hooks. |
| 16 | + |
| 17 | +## Key file changes |
| 18 | + |
| 19 | +### iOS plugin implementations |
| 20 | +- BuildInfo iOS: `src/plugins/cordova-plugin-buildinfo/src/ios/CDVBuildInfo.m` |
| 21 | +- Browser iOS: `src/plugins/browser/ios/Browser.m` |
| 22 | +- System iOS: `src/plugins/system/src/ios/System.m` |
| 23 | +- FTP iOS (GRRequests): `src/plugins/ftp/src/ios/Ftp.m` |
| 24 | +- SFTP iOS (NMSSH): `src/plugins/sftp/src/ios/Sftp.m` |
| 25 | +- WebSocket iOS (URLSessionWebSocketTask): `src/plugins/websocket/src/ios/WebSocketPlugin.m` |
| 26 | +- Server iOS (GCDWebServer): `src/plugins/server/src/ios/Server.m` |
| 27 | +- IAP iOS (StoreKit): `src/plugins/iap/src/ios/Iap.m` |
| 28 | +- SDcard iOS (UIDocumentPicker + FS): `src/plugins/sdcard/src/ios/SDcard.m` |
| 29 | + |
| 30 | +### JS action mapping for iOS |
| 31 | +- System action mapping: `src/plugins/system/www/plugin.js` |
| 32 | +- SDcard action mapping: `src/plugins/sdcard/www/plugin.js` |
| 33 | + |
| 34 | +### iOS permissions + Info.plist |
| 35 | +- Stricter permissions in System plugin: `src/plugins/system/src/ios/System.m` |
| 36 | + - Notifications, camera, mic, photos mapped to iOS prompts. |
| 37 | +- Info.plist keys in `config.xml`: |
| 38 | + - `NSCameraUsageDescription` |
| 39 | + - `NSMicrophoneUsageDescription` |
| 40 | + - `NSPhotoLibraryUsageDescription` |
| 41 | + - `NSPhotoLibraryAddUsageDescription` |
| 42 | + - `NSLocalNetworkUsageDescription` |
| 43 | + |
| 44 | +### iSH integration |
| 45 | +- iSH cloned: `third_party/ish` |
| 46 | +- Bridge + rootfs support: |
| 47 | + - `src/plugins/terminal/src/ios/IshBridge.h` |
| 48 | + - `src/plugins/terminal/src/ios/IshBridge.m` |
| 49 | + - `src/plugins/terminal/src/ios/IshRootfs.h` |
| 50 | + - `src/plugins/terminal/src/ios/IshRootfs.c` |
| 51 | +- Executor streaming wired: |
| 52 | + - `src/plugins/terminal/src/ios/Executor.m` |
| 53 | +- Headers synced: |
| 54 | + - `src/plugins/terminal/src/ios/ish/include/LinuxInterop.h` |
| 55 | + - `src/plugins/terminal/src/ios/ish/include/Terminal.h` |
| 56 | +- Plugin hooks and files: |
| 57 | + - `src/plugins/terminal/plugin.xml` |
| 58 | + |
| 59 | +### Scripts and docs |
| 60 | +- iOS setup: `setup-ios.sh` |
| 61 | +- iSH build: `scripts/build-ish.sh` |
| 62 | +- iSH header sync: `scripts/sync-ish-headers.sh` |
| 63 | +- iSH rootfs prep: `scripts/prepare-ish-rootfs.sh` |
| 64 | +- iSH fetch: `scripts/fetch-ish.sh` |
| 65 | +- iSH docs: `docs/ISH_INTEGRATION.md` |
| 66 | + |
| 67 | +## iSH integration notes |
| 68 | + |
| 69 | +### What is wired |
| 70 | +- iSH sessions started via `linux_start_session`. |
| 71 | +- PTY output bridged by swizzling `Terminal sendOutput:length:`. |
| 72 | +- Input sent via `Terminal sendInput:`. |
| 73 | +- Rootfs copied from app bundle `ish-rootfs` into `Documents/ish-rootfs`. |
| 74 | +- Rootfs path provided by `DefaultRootPath()` in `IshRootfs.c`. |
| 75 | + |
| 76 | +### What’s still required (macOS) |
| 77 | +1) Build iSH static library |
| 78 | + - `scripts/build-ish.sh` |
| 79 | + - Update scheme after `xcodebuild -list -project third_party/ish/iSH.xcodeproj` |
| 80 | +2) Sync headers |
| 81 | + - `scripts/sync-ish-headers.sh` |
| 82 | +3) Prepare rootfs |
| 83 | + - `scripts/prepare-ish-rootfs.sh /path/to/alpine-rootfs.tar.gz` |
| 84 | +4) Add iOS platform |
| 85 | + - `npx cordova platform add ios` |
| 86 | +5) Optional auto-linking |
| 87 | + - `npm install -D xcode` |
| 88 | + - Hook `hooks/ios/add-ish-lib.js` links `libiSHLinux.a` into Xcode project |
| 89 | + |
| 90 | +## Outstanding TODOs |
| 91 | +- Add exit callbacks from iSH sessions to JS (`exit:<code>`) |
| 92 | +- Ensure iSH static library is linked properly in Cordova iOS build |
| 93 | +- Bundle a minimal Alpine rootfs in `src/ios/ish-rootfs` |
| 94 | + |
| 95 | +## iOS dependency notes |
| 96 | +- iOS pods/frameworks added via plugin.xml: |
| 97 | + - GRRequests (FTP) |
| 98 | + - NMSSH (SFTP) |
| 99 | + - GCDWebServer (Server) |
| 100 | + - StoreKit.framework (IAP) |
| 101 | + - UserNotifications.framework (System) |
| 102 | + - MobileCoreServices.framework + UniformTypeIdentifiers.framework (SDcard) |
| 103 | + |
| 104 | +## Command summary (macOS) |
| 105 | +``` |
| 106 | +./setup-ios.sh |
| 107 | +scripts/fetch-ish.sh |
| 108 | +scripts/sync-ish-headers.sh |
| 109 | +scripts/prepare-ish-rootfs.sh /path/to/alpine-rootfs.tar.gz |
| 110 | +scripts/build-ish.sh |
| 111 | +npm install -D xcode |
| 112 | +npx cordova platform add ios |
| 113 | +npx cordova build ios |
| 114 | +``` |
| 115 | + |
0 commit comments