You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							101 lines
						
					
					
						
							2.7 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							101 lines
						
					
					
						
							2.7 KiB
						
					
					
				
								#!/bin/bash
							 | 
						|
								
							 | 
						|
								# iOS Test App Setup Script
							 | 
						|
								echo "🚀 Setting up iOS Test App..."
							 | 
						|
								
							 | 
						|
								# Check if we're in the right directory
							 | 
						|
								if [ ! -d "ios-test" ]; then
							 | 
						|
								    echo "❌ Error: ios-test directory not found!"
							 | 
						|
								    echo "Please run this script from the test-apps directory"
							 | 
						|
								    exit 1
							 | 
						|
								fi
							 | 
						|
								
							 | 
						|
								cd ios-test
							 | 
						|
								
							 | 
						|
								# Check Node.js version
							 | 
						|
								echo "🔍 Checking Node.js version..."
							 | 
						|
								node_version=$(node --version 2>/dev/null)
							 | 
						|
								if [ $? -ne 0 ]; then
							 | 
						|
								    echo "❌ Error: Node.js not found!"
							 | 
						|
								    echo "Please install Node.js 18+ from https://nodejs.org/"
							 | 
						|
								    exit 1
							 | 
						|
								fi
							 | 
						|
								echo "✅ Node.js version: $node_version"
							 | 
						|
								
							 | 
						|
								# Install dependencies
							 | 
						|
								echo "📦 Installing dependencies..."
							 | 
						|
								npm install
							 | 
						|
								if [ $? -ne 0 ]; then
							 | 
						|
								    echo "❌ Error: Failed to install dependencies!"
							 | 
						|
								    exit 1
							 | 
						|
								fi
							 | 
						|
								
							 | 
						|
								# Install Capacitor CLI globally if not present
							 | 
						|
								if ! command -v cap &> /dev/null; then
							 | 
						|
								    echo "🔧 Installing Capacitor CLI globally..."
							 | 
						|
								    npm install -g @capacitor/cli
							 | 
						|
								    if [ $? -ne 0 ]; then
							 | 
						|
								        echo "❌ Error: Failed to install Capacitor CLI!"
							 | 
						|
								        exit 1
							 | 
						|
								    fi
							 | 
						|
								else
							 | 
						|
								    echo "✅ Capacitor CLI already installed"
							 | 
						|
								fi
							 | 
						|
								
							 | 
						|
								# Initialize Capacitor (only if not already initialized)
							 | 
						|
								if [ ! -f "capacitor.config.ts" ]; then
							 | 
						|
								    echo "⚡ Initializing Capacitor..."
							 | 
						|
								    npx cap init "Daily Notification iOS Test" "com.timesafari.dailynotification.iostest"
							 | 
						|
								    if [ $? -ne 0 ]; then
							 | 
						|
								        echo "❌ Error: Failed to initialize Capacitor!"
							 | 
						|
								        exit 1
							 | 
						|
								    fi
							 | 
						|
								else
							 | 
						|
								    echo "✅ Capacitor already initialized"
							 | 
						|
								fi
							 | 
						|
								
							 | 
						|
								# Add iOS platform (only if not already added)
							 | 
						|
								if [ ! -d "ios" ]; then
							 | 
						|
								    echo "🍎 Adding iOS platform..."
							 | 
						|
								    npx cap add ios
							 | 
						|
								    if [ $? -ne 0 ]; then
							 | 
						|
								        echo "❌ Error: Failed to add iOS platform!"
							 | 
						|
								        echo "Make sure Xcode and iOS SDK are installed"
							 | 
						|
								        exit 1
							 | 
						|
								    fi
							 | 
						|
								else
							 | 
						|
								    echo "✅ iOS platform already added"
							 | 
						|
								fi
							 | 
						|
								
							 | 
						|
								# Build web assets
							 | 
						|
								echo "🔨 Building web assets..."
							 | 
						|
								npm run build
							 | 
						|
								if [ $? -ne 0 ]; then
							 | 
						|
								    echo "❌ Error: Failed to build web assets!"
							 | 
						|
								    exit 1
							 | 
						|
								fi
							 | 
						|
								
							 | 
						|
								# Sync to native
							 | 
						|
								echo "🔄 Syncing to native..."
							 | 
						|
								npx cap sync ios
							 | 
						|
								if [ $? -ne 0 ]; then
							 | 
						|
								    echo "❌ Error: Failed to sync to native!"
							 | 
						|
								    exit 1
							 | 
						|
								fi
							 | 
						|
								
							 | 
						|
								echo ""
							 | 
						|
								echo "✅ iOS test app setup complete!"
							 | 
						|
								echo ""
							 | 
						|
								echo "📋 Prerequisites check:"
							 | 
						|
								echo "- Xcode installed: $(command -v xcodebuild &> /dev/null && echo '✅' || echo '❌')"
							 | 
						|
								echo "- iOS Simulator available: $(xcrun simctl list devices &> /dev/null && echo '✅' || echo '❌')"
							 | 
						|
								echo ""
							 | 
						|
								echo "🚀 Next steps:"
							 | 
						|
								echo "1. Open Xcode: npx cap open ios"
							 | 
						|
								echo "2. Run on device/simulator: npx cap run ios"
							 | 
						|
								echo "3. Or test web version: npm run dev"
							 | 
						|
								echo ""
							 | 
						|
								echo "🔧 Troubleshooting:"
							 | 
						|
								echo "- If Xcode doesn't open, install it from the Mac App Store"
							 | 
						|
								echo "- If sync fails, check Xcode command line tools: xcode-select --install"
							 | 
						|
								echo "- For web testing, run: npm run dev"
							 | 
						|
								
							 |