# Pela Gardens – iOS (Xcode) project

Bundle ID: `com.kusaljayalath.pelagardens` · Name: Pela Gardens · Version 1.2 (build 1) · iPhone, portrait only, full screen, status bar hidden.
The game is bundled inside the app (works offline).

## 0. One-time setup on the Mac
1. Install **Xcode** from the Mac App Store (open it once, accept the license, let it install components).
2. Install **Node.js 20+** (https://nodejs.org) and **CocoaPods**: `sudo gem install cocoapods` (or `brew install cocoapods`).
3. Unzip this folder, then in Terminal:
   ```
   cd pela-gardens
   npm install
   npx cap sync ios
   npx cap open ios        # or: open ios/App/App.xcworkspace
   ```
   Always open **App.xcworkspace** (not App.xcodeproj).

## 1. Play on your own iPhone before App Store (free)
1. Connect the iPhone to the Mac with a cable; tap **Trust This Computer** on the iPhone.
2. On the iPhone enable **Developer Mode**: Settings > Privacy & Security > Developer Mode > On (the iPhone restarts; confirm after reboot). If the option is missing, connect to Xcode first, then it appears.
3. In Xcode: **Xcode > Settings > Accounts** > "+" > Apple ID — sign in with your (free) Apple ID.
4. In the project navigator select **App** > target **App** > **Signing & Capabilities**: tick "Automatically manage signing", Team = **Your Name (Personal Team)**.
   If Xcode says the bundle identifier is unavailable, change it to something unique, e.g. `com.kusaljayalath.pelagardens.dev` (only for this personal test build).
5. In the toolbar at the top, choose your **iPhone** as the run destination.
6. Press **Run** (▶ or Cmd+R). The first time, the app installs but will not open:
   on the iPhone go to **Settings > General > VPN & Device Management**, tap your Apple ID under Developer App, then **Trust**. Launch Pela Gardens from the Home Screen.
7. Note: with a free Apple ID, the app expires after **7 days**; just connect and press Run again to reinstall (your save stays as long as you don't delete the app).

## 2. Release to the App Store
1. Join the Apple Developer Program (US$99/yr, https://developer.apple.com/programs/).
2. In App Store Connect (https://appstoreconnect.apple.com) > My Apps > "+" New App: platform iOS, name Pela Gardens, bundle ID `com.kusaljayalath.pelagardens`, SKU e.g. `pelagardens`.
3. In Xcode Signing & Capabilities set Team to your paid developer team (bundle ID must be `com.kusaljayalath.pelagardens`).
4. Destination: **Any iOS Device (arm64)**. Menu **Product > Archive**.
5. When the Organizer opens: **Distribute App > App Store Connect > Upload**, keep defaults.
6. In App Store Connect add screenshots (`store/ios/6.7` 1290x2796 and `store/ios/6.5` 1242x2688), description, privacy policy URL https://pela-gardens-privacy.pages.dev/ , age rating, App Privacy = "Data Not Collected"; select the build and **Submit for Review**.
   Export compliance: the Info.plist already declares no non-exempt encryption.

If you change the game: replace `www/index.html`, then `npx cap sync ios` again.

## 3. Android: sideload the APK
`android/pela-gardens-release.apk` (signed release build) is included.
- Copy the APK to the phone (USB, Google Drive, email), open it, allow "Install unknown apps" for that app when asked, then Install.
- Or with a computer: enable Developer options (Settings > About phone > tap Build number 7x) > USB debugging, then `adb install -r pela-gardens-release.apk`.
- For Google Play, upload the AAB (`app-release.aab`) instead; the APK is only for testing.
