diff --git a/docs/night/IOS.md b/docs/night/IOS.md index e439495..bcacb36 100644 --- a/docs/night/IOS.md +++ b/docs/night/IOS.md @@ -70,7 +70,12 @@ Note: the VNC keyboard via `vncdotool` drops Shift (everything types lowercase, Capacitor **7** to match Android (Node 20 on inspiron). - **Swift Package Manager**, not CocoaPods: `ios/App/CapApp-SPM/Package.swift` is managed by `npx cap sync`; Xcode resolves `capacitor-swift-pm` itself. No Ruby/CocoaPods needed in the VM. -- **Node URL:** build-time `VITE_NODE_URL` (defaults to the testnet), same as Android. +- **Testnet build:** `build-sim.sh` sets the same defaults as `android/build-debug.sh`: `VITE_WIKIDECK_NETWORK=testnet`, + `VITE_WIKIDECK_GENESIS_TIME=1792411200`, `VITE_NODE_URL=http://192.168.1.32:3101` (override via env). +- **Plain HTTP to the LAN node:** `Info.plist` sets `NSAppTransportSecurity` → `NSAllowsLocalNetworking` (local/IP hosts + only, not arbitrary HTTP), because iOS ATS blocks cleartext by default. From the VM's simulator, 192.168.1.32 is reached + through QEMU's user-mode NAT on inspiron. +- **Plugins:** `@capacitor/app` and `@capacitor/browser` (from #35) are wired into `CapApp-SPM/Package.swift`. - **Origin check:** mobile-android routes native requests through `CapacitorHttp`, which sends no `Origin` header, so `server/testnet/http.ts` needs no change. Without it, the iOS WebView origin would be `capacitor://localhost`. - **SSO (#7):** `Info.plist` registers the `dev.eom.wikideck` URL scheme; redirect `dev.eom.wikideck:/oauth/callback` diff --git a/ios/App/App/Info.plist b/ios/App/App/Info.plist index d832438..39f617f 100644 --- a/ios/App/App/Info.plist +++ b/ios/App/App/Info.plist @@ -58,5 +58,10 @@ + NSAppTransportSecurity + + NSAllowsLocalNetworking + + diff --git a/ios/App/CapApp-SPM/Package.swift b/ios/App/CapApp-SPM/Package.swift index a1fc526..c50e888 100644 --- a/ios/App/CapApp-SPM/Package.swift +++ b/ios/App/CapApp-SPM/Package.swift @@ -11,14 +11,18 @@ let package = Package( targets: ["CapApp-SPM"]) ], dependencies: [ - .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0") + .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", exact: "7.6.10"), + .package(name: "CapacitorApp", path: "../../../node_modules/@capacitor/app"), + .package(name: "CapacitorBrowser", path: "../../../node_modules/@capacitor/browser") ], targets: [ .target( name: "CapApp-SPM", dependencies: [ .product(name: "Capacitor", package: "capacitor-swift-pm"), - .product(name: "Cordova", package: "capacitor-swift-pm") + .product(name: "Cordova", package: "capacitor-swift-pm"), + .product(name: "CapacitorApp", package: "CapacitorApp"), + .product(name: "CapacitorBrowser", package: "CapacitorBrowser") ] ) ] diff --git a/scripts/ios/build-sim.sh b/scripts/ios/build-sim.sh index 0a8e203..6150dab 100755 --- a/scripts/ios/build-sim.sh +++ b/scripts/ios/build-sim.sh @@ -13,6 +13,10 @@ sudo xcodebuild -license accept 2>/dev/null || true xcodebuild -runFirstLaunch >/dev/null 2>&1 || true npm ci +# Same testnet build settings as android/build-debug.sh (otherwise the app shows MAINNET). +export VITE_WIKIDECK_NETWORK="${VITE_WIKIDECK_NETWORK:-testnet}" +export VITE_WIKIDECK_GENESIS_TIME="${VITE_WIKIDECK_GENESIS_TIME:-1792411200}" +export VITE_NODE_URL="${VITE_NODE_URL:-http://192.168.1.32:3101}" npm run build npx cap sync ios