# BaoLife Phase 7: App Store Preparation

> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.

**Goal:** Legal compliance, marketing materials, successful App Store submission.

**Architecture:** Backend legal docs + deployment. Frontend App Store assets + submission process.

**Tech Stack:**
- Backend: Production deployment, legal compliance
- Frontend: App Store Connect, marketing assets

**Total Time Estimate:** 40-45 hours (Weeks 10-11)

---

## Backend Components (../lichun)

### Component 63: Legal & Compliance Documents

**Files:**
- Create: `../lichun/static/privacy.html`
- Create: `../lichun/static/terms.html`
- Create: `../lichun/static/support.html`

#### Privacy Policy

Create: `../lichun/static/privacy.html`

```html
<!DOCTYPE html>
<html>
<head>
    <title>BaoLife Privacy Policy</title>
</head>
<body>
    <h1>Privacy Policy for BaoLife</h1>
    <p>Last updated: November 2025</p>
    
    <h2>1. Information We Collect</h2>
    <p>We collect the following information:</p>
    <ul>
        <li><strong>Account Information:</strong> Username, email (optional)</li>
        <li><strong>Gameplay Data:</strong> Game progress, achievements, purchases</li>
        <li><strong>Analytics:</strong> App usage, features used, session duration</li>
        <li><strong>Device Information:</strong> Device type, OS version, crash logs</li>
    </ul>
    
    <h2>2. How We Use Your Information</h2>
    <ul>
        <li>Provide and improve game services</li>
        <li>Process in-app purchases</li>
        <li>Analyze app performance and user engagement</li>
        <li>Provide customer support</li>
    </ul>
    
    <h2>3. Third-Party Services</h2>
    <p>We use the following third-party services:</p>
    <ul>
        <li><strong>Firebase (Google):</strong> Analytics and crash reporting</li>
        <li><strong>Apple StoreKit:</strong> In-app purchases</li>
        <li><strong>OpenAI:</strong> AI-generated content (conversations, bios)</li>
    </ul>
    
    <h2>4. Data Retention</h2>
    <p>We retain your data as long as your account is active. You can request deletion at any time.</p>
    
    <h2>5. Your Rights</h2>
    <ul>
        <li>Access your personal data</li>
        <li>Request data deletion</li>
        <li>Export your data</li>
        <li>Opt out of analytics (in Settings)</li>
    </ul>
    
    <h2>6. Children's Privacy (COPPA)</h2>
    <p>BaoLife is not directed to children under 13. We do not knowingly collect data from children under 13.</p>
    
    <h2>7. GDPR Compliance (EU Users)</h2>
    <p>EU users have additional rights under GDPR, including data portability and the right to be forgotten.</p>
    
    <h2>8. Contact Us</h2>
    <p>Email: privacy@baolife.app</p>
</body>
</html>
```

#### Terms of Service

Create: `../lichun/static/terms.html`

```html
<!DOCTYPE html>
<html>
<head>
    <title>BaoLife Terms of Service</title>
</head>
<body>
    <h1>Terms of Service</h1>
    <p>Last updated: November 2025</p>
    
    <h2>1. Acceptance of Terms</h2>
    <p>By using BaoLife, you agree to these terms.</p>
    
    <h2>2. Account Rules</h2>
    <ul>
        <li>One account per person</li>
        <li>You are responsible for account security</li>
        <li>No account sharing or selling</li>
    </ul>
    
    <h2>3. Acceptable Use</h2>
    <p>You agree NOT to:</p>
    <ul>
        <li>Cheat, hack, or exploit bugs</li>
        <li>Harass other players</li>
        <li>Use offensive language</li>
        <li>Attempt to reverse-engineer the app</li>
    </ul>
    
    <h2>4. Purchases and Refunds</h2>
    <ul>
        <li>All purchases are final unless required by law</li>
        <li>Refund requests handled through Apple</li>
        <li>Virtual currency (diamonds) has no real-world value</li>
    </ul>
    
    <h2>5. Intellectual Property</h2>
    <p>All game content, including code, graphics, and text, is owned by BaoLife.</p>
    
    <h2>6. Termination</h2>
    <p>We may suspend or terminate accounts that violate these terms.</p>
    
    <h2>7. Disclaimers</h2>
    <p>The game is provided "as is" without warranties. We are not liable for data loss, bugs, or downtime.</p>
    
    <h2>8. Dispute Resolution</h2>
    <p>Disputes will be resolved through binding arbitration in [Your State/Country].</p>
    
    <h2>9. Changes to Terms</h2>
    <p>We may update these terms. Continued use constitutes acceptance.</p>
    
    <h2>10. Contact</h2>
    <p>Email: legal@baolife.app</p>
</body>
</html>
```

#### Support Page

Create: `../lichun/static/support.html`

```html
<!DOCTYPE html>
<html>
<head>
    <title>BaoLife Support</title>
</head>
<body>
    <h1>BaoLife Support</h1>
    
    <h2>Frequently Asked Questions</h2>
    
    <h3>How do I earn diamonds?</h3>
    <p>You can earn diamonds by:
    <ul>
        <li>Unlocking achievements</li>
        <li>Daily login rewards</li>
        <li>Completing quests</li>
        <li>Purchasing diamond packs</li>
    </ul>
    
    <h3>What is energy?</h3>
    <p>Energy is required to do activities. It regenerates over time (1 per minute) or you can buy refills with diamonds.</p>
    
    <h3>How do I restore purchases?</h3>
    <p>Go to More → Settings → Restore Purchases</p>
    
    <h3>How do I delete my account?</h3>
    <p>Go to More → Settings → Delete Account. This is permanent and cannot be undone.</p>
    
    <h2>Contact Support</h2>
    <p>Email: support@baolife.app</p>
    <p>Response time: Within 24 hours</p>
    
    <h2>Refund Policy</h2>
    <p>All purchases are processed through Apple. For refund requests:
    <ol>
        <li>Go to <a href="https://reportaproblem.apple.com">reportaproblem.apple.com</a></li>
        <li>Sign in with your Apple ID</li>
        <li>Find BaoLife purchase</li>
        <li>Select "Report a Problem"</li>
    </ol>
</body>
</html>
```

**Deploy:**
```bash
# Host at lichun.app/privacy, /terms, /support
# Or use GitHub Pages for static hosting
```

**Estimated Time:** 3-4 hours

---

### Component 64: Backend Deployment Checklist

**Files:**
- Create: `../lichun/deployment/production_checklist.md`
- Modify: `../lichun/.env.example`

**Production Checklist:**

```markdown
## Pre-Launch Backend Checklist

### Security
- [ ] All secrets in environment variables (.env)
- [ ] Database credentials secured
- [ ] API keys not in code
- [ ] HTTPS/WSS enabled
- [ ] CORS configured
- [ ] Rate limiting enabled

### Database
- [ ] Automated daily backups configured
- [ ] Backup restore tested
- [ ] Indexes on foreign keys
- [ ] Connection pooling enabled
- [ ] Slow query logging enabled

### Monitoring
- [ ] Sentry error tracking active
- [ ] Analytics events tracking
- [ ] Server uptime monitoring (UptimeRobot/Pingdom)
- [ ] Disk space alerts
- [ ] Memory usage alerts
- [ ] CPU usage alerts

### Performance
- [ ] Query caching enabled
- [ ] Message batching implemented
- [ ] Static files CDN (if applicable)
- [ ] WebSocket compression enabled
- [ ] Game loop FPS set to 60 (not 5000!)

### Logging
- [ ] Log rotation configured (daily)
- [ ] Error logs monitored
- [ ] Access logs enabled
- [ ] Log retention policy (30 days)

### Testing
- [ ] Load test: 10 concurrent users
- [ ] Load test: 100 concurrent users
- [ ] Database failover tested
- [ ] Graceful shutdown tested
- [ ] Reconnection logic tested

### Legal
- [ ] Privacy policy live at /privacy
- [ ] Terms of service live at /terms
- [ ] Support page live at /support
- [ ] GDPR compliance (EU)
- [ ] COPPA compliance (if <13 users)

### Deployment
- [ ] Production environment variables set
- [ ] Database migrations run
- [ ] Achievement definitions loaded
- [ ] Daily reward calendar loaded
- [ ] Quest templates loaded
- [ ] Health check endpoint working (/health)
- [ ] Staging environment matches production
```

**Health Check Endpoint:**

```python
# ../lichun/server.py
@app.route('/health')
def health_check():
    """Health check for monitoring"""
    try:
        # Check database
        db.execute_query("SELECT 1")
        
        # Check disk space
        import shutil
        total, used, free = shutil.disk_usage("/")
        disk_free_percent = (free / total) * 100
        
        if disk_free_percent < 10:
            return {'status': 'warning', 'message': 'Low disk space'}, 200
        
        return {'status': 'healthy', 'version': VERSION}, 200
    except Exception as e:
        return {'status': 'unhealthy', 'error': str(e)}, 500
```

**Estimated Time:** 4-5 hours

---

### Component 65: Customer Data Management (GDPR/CCPA)

**Files:**
- Create: `../lichun/api/data_export.py`
- Create: `../lichun/api/account_deletion.py`

**Data Export API:**

```python
from flask import jsonify
import json

@app.route('/api/player/<int:player_id>/export', methods=['GET'])
def export_player_data(player_id: int):
    """Export all player data (GDPR compliance)"""
    
    # Verify player owns this data (check session/auth)
    if not verify_player_access(player_id):
        return {'error': 'Unauthorized'}, 403
    
    # Collect all data
    export_data = {
        'player': get_player(player_id),
        'relationships': get_relationships(player_id),
        'achievements': get_achievements(player_id),
        'purchases': get_purchases(player_id),
        'conversations': get_conversations(player_id),
        'statistics': get_statistics(player_id),
        'photo_album': get_photo_album(player_id)
    }
    
    # Return as JSON
    return jsonify(export_data)

@app.route('/api/player/<int:player_id>/delete', methods=['DELETE'])
def delete_player_account(player_id: int):
    """Delete player account (right to be forgotten)"""
    
    if not verify_player_access(player_id):
        return {'error': 'Unauthorized'}, 403
    
    # Soft delete (mark deleted, keep for 30 days)
    db.execute_query(
        """UPDATE players
           SET deleted = TRUE, deleted_date = NOW()
           WHERE id = %s""",
        (player_id,),
        fetch=False
    )
    
    return {'message': 'Account marked for deletion. Data will be permanently deleted in 30 days.'}, 200

# Cron job for hard deletion
def hard_delete_expired_accounts():
    """Delete accounts marked for deletion >30 days ago"""
    from datetime import datetime, timedelta
    
    cutoff = datetime.now() - timedelta(days=30)
    
    accounts = db.execute_query(
        "SELECT id FROM players WHERE deleted = TRUE AND deleted_date < %s",
        (cutoff,)
    )
    
    for account in accounts:
        # Delete all related data
        player_id = account['id']
        db.execute_query("DELETE FROM relationships WHERE player_id = %s", (player_id,), fetch=False)
        db.execute_query("DELETE FROM player_achievements WHERE player_id = %s", (player_id,), fetch=False)
        db.execute_query("DELETE FROM conversations WHERE player_id = %s OR target_id = %s", (player_id, player_id), fetch=False)
        db.execute_query("DELETE FROM analytics_events WHERE player_id = %s", (player_id,), fetch=False)
        db.execute_query("DELETE FROM players WHERE id = %s", (player_id,), fetch=False)
        
        logging.info(f"Hard deleted player {player_id}")
```

**Estimated Time:** 3-4 hours

---

## Frontend Components (lichunWebsocket)

### Component 66: App Store Assets

**Files to Create:**

#### 1. App Icon (all sizes)

**Sizes needed:**
- 1024x1024 (App Store)
- 180x180 (iPhone @3x)
- 120x120 (iPhone @2x)
- 167x167 (iPad Pro)

**Design Requirements:**
- No transparency
- No rounded corners (iOS adds automatically)
- Clear and recognizable at small sizes
- Professional and polished

**Tools:**
- Design in Figma/Sketch at 1024x1024
- Export all sizes using Asset Catalog

---

#### 2. App Store Screenshots

**Required Sizes:**
- 6.7" (iPhone 15 Pro Max): 1290 x 2796
- 6.5" (iPhone 11 Pro Max): 1242 x 2688
- 5.5" (iPhone 8 Plus): 1242 x 2208

**Screenshot Content (5-7 screenshots):**

1. **Welcome/Character Creation**
   - Show customization options
   - Caption: "Create Your Unique Character"

2. **Home Dashboard**
   - Show life simulation in action
   - Caption: "Live Your Life, Your Way"

3. **Dating Interface**
   - Show profile with compatibility
   - Caption: "Find Love & Build Relationships"

4. **Activities Screen**
   - Show variety of activities
   - Caption: "School, Work, Hobbies & More"

5. **Achievements**
   - Show achievement unlock
   - Caption: "Earn Rewards for Life Milestones"

6. **Store/Premium**
   - Show diamond purchases
   - Caption: "Unlock Premium Features"

**Tips:**
- Add text overlays explaining features
- Show aspirational gameplay (advanced character)
- Use device frames for polish
- Localize for major markets

---

#### 3. App Preview Video (Optional but Recommended)

**Specs:**
- 15-30 seconds
- Portrait orientation (1080x1920)
- No sound required (auto-mute)

**Suggested Flow:**
1. Character creation (3s)
2. UI tour - swipe through tabs (5s)
3. Conversation with NPC (3s)
4. Activity selection (3s)
5. Achievement unlock (2s)
6. Dating swipe (3s)
7. Time progression montage (5s)
8. End card: "Download Now" (2s)

**Tools:**
- Screen record with QuickTime
- Edit with iMovie/Final Cut Pro
- Add text overlays and transitions

**Estimated Time:** 10-12 hours for all assets

---

### Component 67: App Store Listing

**Files:**
- Create: `docs/app-store/description.md`
- Create: `docs/app-store/keywords.txt`

#### App Name
**Primary:** "BaoLife - Life Simulator"
**Subtitle:** "Live a lifetime in your pocket"

#### Description (4000 character max)

```markdown
Ever wondered what your life could be like with different choices? BaoLife lets you experience an entire lifetime from childhood to old age, making meaningful decisions that shape your character's story.

🎭 BUILD YOUR LIFE STORY
• Create your unique character and watch them grow
• Progress from elementary school through college
• Build a career from entry-level to CEO
• Make life-changing decisions at every turn

💖 MEANINGFUL RELATIONSHIPS
• Meet people through an intelligent matching system
• Build friendships and romantic relationships
• Get married and start a family
• Maintain relationships as your life progresses

🎯 CAREER & EDUCATION
• Attend school and earn good grades
• Choose your major and career path
• Get promoted and climb the corporate ladder
• Earn money to increase your prestige

✨ ACHIEVEMENTS & PROGRESSION
• Unlock 40+ achievements for life milestones
• Earn diamonds through daily rewards
• Complete quests for bonus rewards
• Track your progress across multiple lives

💎 PREMIUM FEATURES
• Refill energy to keep playing
• Skip time to major life events
• Unlock exclusive careers and items
• Premium subscription for enhanced experience

🎨 BEAUTIFUL DESIGN
• Clean, modern interface
• Seasonal backgrounds
• Character customization
• Smooth animations

Download BaoLife today and start living the life you've always imagined!

SUBSCRIPTION INFORMATION (if applicable):
• Payment charged to iTunes Account at confirmation
• Auto-renews unless turned off 24 hours before period ends
• Manage subscriptions in Account Settings
• Terms: baolife.app/terms
• Privacy: baolife.app/privacy
```

#### Keywords (100 characters, comma-separated)

```
life simulator,life sim,virtual life,second life,choices matter,dating sim,life game,story game,relationship game,life choices
```

**ASO Research:**
- Use AppTweak or Sensor Tower
- Target high-volume, low-competition keywords
- Include competitor keywords if relevant

#### Promotional Text (170 characters, updatable without review)

```
🎉 New: Achievement system! Unlock rewards and track progress. Plus daily login bonuses and exclusive items. Start your new life today!
```

**Estimated Time:** 4-5 hours

---

### Component 68-70: App Store Connect Configuration

**Steps:**

#### 1. Create App Store Connect Listing

1. Go to appstoreconnect.apple.com
2. My Apps → + → New App
3. Fill in:
   - Platform: iOS
   - Name: BaoLife
   - Primary Language: English (U.S.)
   - Bundle ID: com.yourcompany.baolife
   - SKU: baolife-ios

#### 2. Pricing & Availability

- Price: Free (freemium)
- Availability: All territories (or English-speaking first)
- Pre-order: Optional (2-90 days)

#### 3. App Information

- Category: Games → Simulation
- Secondary Category: Games → Role Playing
- Content Rights: Original content
- Age Rating: Complete questionnaire
  - Likely 9+ or 12+ (no violence, mild themes)

#### 4. App Privacy

Fill out privacy questionnaire:

**Data Collected:**
- Contact Info: Email (optional, for support)
- Identifiers: User ID (for account)
- Usage Data: Gameplay analytics
- Diagnostics: Crash logs

**Data Linked to User:** Yes (game progress)
**Used for Tracking:** Yes (analytics)

**Data Not Collected:**
- Location
- Financial Info
- Health Data
- Contacts
- Photos

#### 5. In-App Purchases

Configure IAPs:

1. **Diamond Pack Small**
   - Product ID: com.baolife.diamond1
   - Type: Consumable
   - Price: $1.99 (Tier 3)
   - Display Name: "100 Diamonds"
   - Description: "Get 100 diamonds to unlock premium features"

2. **Diamond Pack Medium**
   - Product ID: com.baolife.diamond2
   - Type: Consumable
   - Price: $4.99 (Tier 10)
   - Display Name: "300 Diamonds"
   - Description: "Best value! Get 300 diamonds"

3. **Diamond Pack Large**
   - Product ID: com.baolife.diamond3
   - Type: Consumable
   - Price: $9.99 (Tier 15)
   - Display Name: "700 Diamonds"
   - Description: "Maximum value! Get 700 diamonds"

4. **Premium Subscription** (optional)
   - Product ID: com.baolife.premium
   - Type: Auto-Renewable Subscription
   - Price: $4.99/month
   - Benefits: 2x energy, 100 monthly diamonds, exclusive features

**Estimated Time:** 6-7 hours

---

### Component 71-72: TestFlight Beta & Submission

#### TestFlight Beta Testing

**Steps:**

1. **Archive Build**
   ```
   Product → Archive in Xcode
   ```

2. **Upload to App Store Connect**
   - Select archive
   - Distribute App → App Store Connect
   - Upload

3. **Create Internal Test Group**
   - Name: "Internal Team"
   - Add up to 100 Apple IDs
   - No review needed

4. **Create External Test Group**
   - Name: "Beta Testers"
   - Submit for Beta App Review
   - Add 25-50 testers
   - Requires limited review (faster than full)

5. **Collect Feedback**
   - Create feedback form (Google Forms/Typeform)
   - Questions:
     - How likely to recommend? (NPS: 0-10)
     - What was confusing?
     - Did you make purchases? Why/why not?
     - How long did you play?
     - What would make you return?

**Beta Success Criteria:**
- Crash rate < 0.1%
- Tutorial completion > 70%
- Day 1 retention > 40%
- NPS > 7/10
- No critical bugs

**Time:** 1-2 weeks of beta testing

---

#### Final Submission

**Pre-Submission Checklist:**

```markdown
- [ ] All screenshots uploaded (6.7", 6.5", 5.5")
- [ ] App icon uploaded (1024x1024)
- [ ] Description proofread
- [ ] Privacy policy URL working
- [ ] Support URL working
- [ ] Age rating appropriate
- [ ] IAPs configured and tested
- [ ] TestFlight beta successful (crash rate < 0.1%)
- [ ] All critical bugs fixed
- [ ] Backend production-ready
- [ ] All legal docs in place
- [ ] Team ready for launch support
```

**Submit for Review:**

1. Select build from TestFlight
2. Add version information:
   - Version: 1.0
   - Copyright: 2025 Your Company
   - Trade Representative Contact: Your email

3. App Review Information:
   - Contact: Your email
   - Phone: Your phone
   - Notes: "Life simulation game. Test account: username/password"
   - Demo account if needed

4. Submit

**Review Timeline:**
- Initial review: 24-48 hours typically
- If rejected: Fix issues, resubmit
- If approved: App goes live within hours

**Common Rejection Reasons:**
- Crashes on launch (test on real devices!)
- Privacy policy missing/incorrect
- IAP not working properly
- Misleading screenshots
- Incomplete app functionality

**Launch Day:**
- Monitor crash rate (Crashlytics)
- Monitor server load
- Respond to reviews
- Fix urgent bugs
- Celebrate! 🎉

**Estimated Time:** 8-10 hours (plus wait time for review)

---

## Phase 7 Summary

**Total Time:** 40-45 hours (Weeks 10-11)

**Backend (10-12h):**
- ✅ Component 63: Legal docs (3-4h)
- ✅ Component 64: Deployment checklist (4-5h)
- ✅ Component 65: Data management (3-4h)

**Frontend (30-33h):**
- ✅ Component 66: App Store assets (10-12h)
- ✅ Component 67: App Store listing (4-5h)
- ✅ Component 68-70: App Store Connect (6-7h)
- ✅ Component 71-72: TestFlight & submission (8-10h)

**What's Ready:**
- Legal compliance (GDPR, COPPA, privacy, terms)
- Production deployment
- App Store assets (icon, screenshots, video)
- App Store listing (description, keywords)
- IAP configuration
- TestFlight beta program
- Final submission

**🎉 READY FOR LAUNCH! 🎉**

---

## Complete Roadmap Summary

**Total Timeline:** 10-11 weeks (280-333 hours)

- ✅ Phase 0: Technical Debt (Week 1) - 25-33h
- ✅ Phase 1: Monetization (Weeks 2-3) - 45-55h
- ✅ Phase 2: Retention (Weeks 4-5) - 50-60h
- ✅ Phase 3: Onboarding (Week 6) - 25-30h
- ✅ Phase 4: Dating (Week 7) - 30-35h
- ✅ Phase 5: Polish (Week 8) - 35-40h
- ✅ Phase 6: Analytics (Week 9) - 30-35h
- ✅ Phase 7: App Store (Weeks 10-11) - 40-45h

**You're ready to launch! 🚀**

