# Allam Mobile - App Store Publishing Guide

**Complete step-by-step guide for publishing to Google Play Store and Apple App Store**

*Based on your Expo 54 + React Native 0.81.5 project configuration*

---

## 📋 Table of Contents

1. [Required Assets & Screenshots](#1-required-assets--screenshots)
2. [Google Play Store Publishing](#2-google-play-store-publishing)
3. [Apple App Store Publishing](#3-apple-app-store-publishing)
4. [CI/CD Recommendations](#4-cicd-recommendations)
5. [Estimated Costs](#5-estimated-costs)
6. [Quick Reference Checklist](#6-quick-reference-checklist)

---

## 1. Required Assets & Screenshots

### 📱 Google Play Store Assets

**App Icon:**
- ✅ Already have: `assets/icon.png` (required: 512x512 px PNG)
- Your current icon looks good!

**Feature Graphic (Required):**
- Size: 1024x500 px PNG/JPEG
- No transparency
- Used at top of store listing
- **ACTION NEEDED**: Create this graphic with your app branding

**Screenshots (Required - at least 2):**
- Phone: 16:9 or 9:16 aspect ratio (min 320px, max 3840px)
- 7-inch tablet: 16:9 or 9:16 (optional but recommended)
- 10-inch tablet: 16:9 or 9:16 (optional but recommended)
- **Recommendation**: 5-8 screenshots showing key features
- **ACTION NEEDED**: Take screenshots of your app

**Other Assets:**
- ✅ Already have: `assets/splash-icon.png` (splash screen)
- High-res icon: 512x512 px (already have)
- Promo video (optional): YouTube URL

### 🍎 Apple App Store Assets

**App Icon:**
- ✅ Already have base: `assets/icon.png`
- **ACTION NEEDED**: Create iOS-specific icons in all required sizes
- Use Expo's icon generation or tools like `expo-icon-builder`

**Screenshots (Required):**
- iPhone 6.7" (iPhone 14 Pro Max): 1290x2796 px
- iPhone 6.5" (iPhone 11 Pro Max): 1242x2688 px
- iPhone 5.5" (iPhone 8 Plus): 1242x2208 px
- iPad Pro 12.9": 2048x2732 px (if supporting iPad)
- **Recommendation**: 5-8 screenshots per device size
- **ACTION NEEDED**: Take screenshots using EAS Build + TestFlight

**App Preview Video (Optional but recommended):**
- 15-30 seconds showing app functionality
- .mov or .mp4 format

---

## 2. Google Play Store Publishing

### Step 1: Build Android App Bundle (AAB)

Your `eas.json` is already configured correctly. To build the AAB:

```bash
# Navigate to your project
cd /home/moe/Allam/allam-mobile

# Install EAS CLI if not already installed
npm install -g eas-cli

# Log in to Expo
eas login

# Build production AAB (Android App Bundle)
eas build --platform android --profile production
```

**What this does:**
- EAS Build creates a cloud build
- Outputs an `.aab` file (Android App Bundle)
- Automatically signs it if keystore is configured

**Time estimate:** 15-30 minutes for cloud build

### Step 2: Set Up Keystore for Release Signing

**Important:** Once you publish your app, you must never change the keystore. Lose it, and you can never update your app!

#### Option A: Let EAS Manage Your Keystore (Recommended)

```bash
# EAS will generate and securely store your keystore
eas credentials

# Select "Android"
# Choose "Set up a new keystore"
# EAS will generate and encrypt it in their servers
```

**Advantages:**
- No local file to lose
- Automatically used for all builds
- Can be transferred if needed

#### Option B: Manual Keystore (Advanced)

If you prefer local control:

```bash
# Generate keystore (DO THIS ONLY ONCE!)
keytool -genkeypair \
  -alias allam-mobile \
  -keyalg RSA \
  -keysize 2048 \
  -validity 10000 \
  -keystore allam-mobile-keystore.jks \
  -storepass YOUR_STORE_PASSWORD \
  -keypass YOUR_KEY_PASSWORD \
  -dname "CN=Allam, OU=Mobile, O=Allam, L=City, ST=State, C=Country"
```

**⚠️ CRITICAL: Backup this keystore file securely!**
- Save to multiple secure locations
- Never lose the passwords
- This is irreversible once app is published

Update `eas.json` to use local keystore:

```json
{
  "build": {
    "production": {
      "android": {
        "keystore": {
          "keystorePath": "./allam-mobile-keystore.jks",
          "keystorePassword": "YOUR_STORE_PASSWORD",
          "keyAlias": "allam-mobile",
          "keyPassword": "YOUR_KEY_PASSWORD"
        }
      }
    }
  }
}
```

### Step 3: Google Play Console Setup

1. **Create Google Play Developer Account:**
   - Go to https://play.google.com/console
   - One-time fee: $25 USD
   - Requires Google account

2. **Create New App:**
   - Click "Create app"
   - App name: "Allam"
   - Default language: English (or Arabic if primary)
   - App or game: App
   - Free or paid: Choose based on your model

3. **Complete Store Listing Information:**

**Required Information:**
- **App Name:** "Allam" (max 50 characters)
- **Short Description:** (80 characters)
  ```
  Allam - Smart learning platform for students and teachers
  ```
- **Full Description:** (4000 characters max)
  ```
  Allam is a comprehensive educational platform that connects students, 
  teachers, and committees. Features include:
  
  • Interactive learning courses
  • Real-time notifications
  • Document sharing and management
  • Committee management tools
  • And much more...
  
  [Expand with your actual features in Arabic/English]
  ```

**Contact Details:**
- Email address (required)
- Phone number (optional)
- Website (optional)

**Privacy Policy (Required):**
- Must be a publicly accessible URL
- **ACTION NEEDED**: Create privacy policy (see template below)

### Step 4: Privacy Policy Requirements

**Your app collects:**
- Camera access (for photos)
- Photo library access
- Notifications
- Possibly user data via API

**Create privacy policy at:** `https://allam.com/privacy` or use free hosting

**Minimum requirements:**
1. What data you collect
2. How you use it
3. How users can request deletion
4. Contact information
5. Arabic + English (since your app uses Arabic)

**Quick template:**
```markdown
# Privacy Policy - Allam Mobile App

Last updated: [DATE]

## Information We Collect
- Photos/media (with your permission)
- Camera access (with your permission)
- Device notifications token
- Usage data via our API

## How We Use Information
- Provide educational services
- Send notifications about courses/updates
- Improve app functionality

## Data Deletion
Contact us at [EMAIL] to delete your data.

## Contact
Email: [YOUR EMAIL]
```

**Free privacy policy generators:**
- https://www.privacypolicytemplate.net/
- https://termsfeed.com/privacy-policy-generator/

### Step 5: Content Rating Questionnaire

1. In Google Play Console, go to **Policy > App content > Content rating**
2. Complete questionnaire:
   - **Category:** Education
   - **Violence:** None
   - **Sexual content:** None
   - **Language:** Mild (if any)
   - **Controlled substances:** None
   - **User-generated content:** Yes (if users can post)
3. Submit for rating

**Expected rating for educational app:** PEGI 3 or ESRB Everyone

### Step 6: Upload and Release

```bash
# After EAS build completes, download the .aab file
# Or use EAS Submit to automate upload:

eas submit --platform android --profile production
```

This requires:
- `google-service-account.json` (already referenced in your eas.json)
- Create service account in Google Cloud Console
- Download JSON key
- Place in project root as `google-service-account.json`

**Manual upload alternative:**
1. Download .aab from EAS Build dashboard
2. In Play Console, go to **Release > Production**
3. Upload .aab file
4. Add release notes
5. Review and roll out

---

## 3. Apple App Store Publishing

### Challenge: You're on Linux 🐧

Since you can't run Xcode on Linux, you'll use **EAS Build** for cloud-based iOS builds.

### Step 1: Apple Developer Account Setup

**Requirements:**
1. **Apple Developer Account:** $99 USD/year
   - Enroll at https://developer.apple.com/
   - Personal or Organization account
   - Organization requires D-U-N-S Number (free)

2. **App Store Connect Access:**
   - Automatically included with Developer Account
   - Access at https://appstoreconnect.apple.com/

### Step 2: Set Up EAS Build for iOS

Your `eas.json` already has iOS submit configuration, but needs details.

#### 2.1: Configure iOS in eas.json

Update the submit section:

```json
{
  "submit": {
    "production": {
      "ios": {
        "appleId": "tareqmonaffal@gmail.com",
        "ascAppId": "YOUR_APP_ID_HERE",
        "appleTeamId": "YOUR_TEAM_ID_HERE"
      }
    }
  }
}
```

**To get these values:**
1. Log in to https://appstoreconnect.apple.com/
2. Create new app (see Step 3)
3. Copy "App ID" from URL or app details
4. Get Team ID from https://developer.apple.com/account/#/membership

#### 2.2: Register Bundle Identifier

```bash
# EAS can do this automatically, or manually:
# 1. Go to https://developer.apple.com/account/resources/identifiers/list
# 2. Register new identifier
# 3. Bundle ID: com.allam.mobile (already in your app.json)
# 4. Enable capabilities your app needs:
#    - Push Notifications (if using expo-notifications)
#    - Background Modes (already in infoPlist)
```

#### 2.3: Create Distribution Certificate & Provisioning Profile

**Let EAS handle this (recommended):**

```bash
eas credentials

# Select "iOS"
# Choose "Set up a new distribution certificate"
# EAS will:
# - Create certificate signing request
# - Upload to Apple
# - Download and encrypt certificate
# - Create provisioning profile
```

**This requires:**
- Apple Developer account credentials
- 2FA device nearby (you'll need to approve)

### Step 3: Create App in App Store Connect

1. Go to https://appstoreconnect.apple.com/
2. Click "My Apps" > "+" > "New App"
3. Fill in:
   - **Platforms:** iOS
   - **Name:** Allam
   - **Primary language:** English or Arabic
   - **Bundle ID:** com.allam.mobile
   - **SKU:** Unique identifier (e.g., "allam-mobile-2024")
   - **Limit to available services:** Check what you need

### Step 4: Build iOS App with EAS

```bash
# Build iOS app (requires Apple Developer account)
eas build --platform ios --profile production
```

**Time estimate:** 20-40 minutes for cloud build

**What happens:**
1. EAS builds your app on macOS server
2. Signs it with your distribution certificate
3. Produces `.ipa` file
4. You can download from EAS dashboard

### Step 5: TestFlight for Beta Testing

**TestFlight is built into App Store Connect**

1. **Upload Build:**
   ```bash
   # Option A: Automatic submit after build
   eas submit --platform ios --profile production
   
   # Option B: Download .ipa and upload manually via App Store Connect
   ```

2. **Wait for Processing:**
   - Apple processes build (10-30 minutes)
   - You'll get email when ready

3. **Add Beta Testers:**
   - In App Store Connect, go to "TestFlight" tab
   - Add internal testers (App Store Connect users)
   - Add external testers (up to 10,000 users via email)
   - Create public link for easy sharing

4. **Test Information:**
   - Add "What to test" instructions
   - Provide test account credentials if needed

5. **Beta Review:**
   - External testers require Apple review (1-2 days)
   - Internal testers don't require review

### Step 6: App Store Review & Release

**App Store Review Guidelines to watch for:**
- **Guideline 2.1:** Performance - App should not crash
- **Guideline 5.1.1:** Data collection - Need privacy policy
- **Guideline 2.4.5:** Use appropriate API permissions (you have these in infoPlist)

**Before submitting:**
1. Test thoroughly on TestFlight
2. Prepare app metadata:
   - Keywords (100 characters)
   - Support URL
   - Marketing URL (optional)
   - Privacy policy URL
3. Set pricing (Free or Paid)
4. Select available territories

**Submit for Review:**
1. In App Store Connect, go to "App Store" tab
2. Fill in all required metadata
3. Upload screenshots
4. Click "Submit for Review"

**Review time:** 24-48 hours typically

---

## 4. CI/CD Recommendations

### Option A: EAS Build (Recommended for Expo)

**Advantages:**
- Native Expo integration
- Handles both iOS and Android
- Manages certificates/secrets
- $2/build for small teams (first 30 builds/month free)

**Setup:**

Create `.github/workflows/eas-build.yml` (if using GitHub):

```yaml
name: EAS Build
on:
  push:
    branches: [main]
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 18
      - name: Setup EAS
        uses: expo/expo-github-action@v8
        with:
          eas-version: latest
          token: ${{ secrets.EXPO_TOKEN }}
      - name: Install dependencies
        run: npm install
      - name: Build on EAS
        run: eas build --platform all --profile production --non-interactive
```

**Add secrets to GitHub:**
- `EXPO_TOKEN`: Get from https://expo.dev/accounts/[your-account]/settings/access-tokens

### Option B: Codemagic

**Good for:**
- More control over build process
- Easy iOS signing management
- Good free tier (500 build minutes/month)

**Setup:**
1. Sign up at https://codemagic.io/
2. Connect GitHub repository
3. Use their GUI to configure:
   - Build triggers
   - Signing certificates
   - Distribution (TestFlight, Play Store)

**codemagic.yaml example:**

```yaml
workflows:
  android-workflow:
    name: Android Release
    environment:
      groups:
        - android_signing
    scripts:
      - name: Install dependencies
        script: npm install
      - name: Build Android
        script: eas build --platform android --profile production --non-interactive
    artifacts:
      - build/**/*.aab

  ios-workflow:
    name: iOS Release
    environment:
      groups:
        - ios_signing
    scripts:
      - name: Install dependencies
        script: npm install
      - name: Build iOS
        script: eas build --platform ios --profile production --non-interactive
    artifacts:
      - build/**/*.ipa
```

### Option C: GitHub Actions (Manual)

**Most control, most setup required**

Use if you want to:
- Self-host builds
- Have macOS runner for iOS
- Customize every step

**Not recommended for Expo projects** - EAS is easier.

---

## 5. Estimated Costs

### One-Time Costs

| Item | Cost | Notes |
|------|------|-------|
| Google Play Developer | $25 | One-time, lifetime access |
| Apple Developer | $99/year | Must renew annually |
| Domain for privacy policy | $10-15/year | Optional but professional |

### Recurring Costs

| Item | Cost | Notes |
|------|------|-------|
| Apple Developer | $99/year | Required for iOS updates |
| EAS Build | $0-240/year | First 30 builds/month free, then $2/build |
| Codemagic | $0-48/month | 500 free minutes/month, then paid |
| GitHub Actions | $0 | Free for public repos, 2000 min/month private |

### Cost Scenarios

**Minimal (Solo Developer):**
- Year 1: $25 + $99 + $0 (using free EAS) = **$124**
- Year 2+: $99 (Apple renewal) = **$99/year**

**Small Team (Monthly releases):**
- EAS Build: ~12 builds/month = Free tier sufficient
- Total: **$99/year** + Apple = **$124/year**

**Frequent Releases (Multiple/week):**
- EAS Build: ~30+ builds/month = Need paid tier
- EAS: $2 × ~20 extra builds = $40/month = **$480/year**
- Or Codemagic: $48/month = **$576/year**

---

## 6. Quick Reference Checklist

### Before You Start

- [ ] Google Play Developer account created ($25)
- [ ] Apple Developer account created ($99/year)
- [ ] Privacy policy URL ready
- [ ] App screenshots taken (Android + iOS)
- [ ] Feature graphic created (Google Play)

### Google Play Store

- [ ] Build AAB: `eas build --platform android --profile production`
- [ ] Keystore configured (EAS managed or manual)
- [ ] App created in Google Play Console
- [ ] Store listing completed (name, description, screenshots)
- [ ] Privacy policy URL added
- [ ] Content rating completed
- [ ] App signed and uploaded
- [ ] Review timeline: 1-3 days

### Apple App Store

- [ ] Bundle ID registered: `com.allam.mobile`
- [ ] Distribution certificate created (via EAS)
- [ ] App created in App Store Connect
- [ ] Build iOS: `eas build --platform ios --profile production`
- [ ] Uploaded to TestFlight
- [ ] Internal testing completed
- [ ] External testers added (if needed)
- [ ] App metadata completed
- [ ] Submitted for review
- [ ] Review timeline: 24-48 hours

### Post-Launch

- [ ] Monitor crash reports (Firebase Crashlytics recommended)
- [ ] Respond to user reviews
- [ ] Plan update cycle
- [ ] Keep Apple Developer account renewed

---

## 🚀 Next Steps for Allam Mobile

Based on your current setup:

1. **Immediate (Week 1):**
   - [ ] Take app screenshots (use Android emulator or physical device)
   - [ ] Create feature graphic for Google Play
   - [ ] Write privacy policy and host it
   - [ ] Create Google Play Developer account

2. **Short-term (Week 2-3):**
   - [ ] Run `eas build --platform android` and test the AAB
   - [ ] Create Apple Developer account
   - [ ] Configure iOS signing in EAS
   - [ ] Build iOS and test via TestFlight

3. **Launch (Week 4):**
   - [ ] Submit to Google Play (internal testing → production)
   - [ ] Submit to App Store (TestFlight → review)

---

## 📚 Additional Resources

- **Expo Documentation:** https://docs.expo.dev/distribution/introduction/
- **Google Play Console Help:** https://support.google.com/googleplay/android-developer/
- **App Store Review Guidelines:** https://developer.apple.com/app-store/review/guidelines/
- **EAS Build Documentation:** https://docs.expo.dev/build/introduction/

---

**Need help?** Open an issue in your project repository or consult the Expo Discord community.

Good luck with your launch! 🎉
