스크립트 파일 정리 및 ios 빌드 스크립트 복구

This commit is contained in:
hansoo
2025-03-23 07:19:18 +09:00
parent db6cc7c005
commit 548a1cd5bd
12 changed files with 338 additions and 825 deletions

View File

@@ -1,5 +0,0 @@
#!/bin/bash
echo "스크립트 실행 시작: $(date)"
echo "스크립트 경로: $0"
echo "스크립트 실행 완료: $(date)"
exit 0

View File

@@ -1,38 +0,0 @@
#!/bin/bash
# 안드로이드 폰에 직접 설치할 APK 빌드 스크립트
echo "안드로이드 폰용 APK 빌드 시작: $(date)"
# 프로젝트 디렉토리로 이동
cd "$(dirname "$0")"
# 1. 웹 앱 빌드 (이미 했다면 스킵 가능)
echo "웹 앱 빌드 중..."
npm run build
# 2. Capacitor에 웹 코드 복사
echo "Capacitor에 웹 코드 복사 중..."
npx cap copy android
# 3. 안드로이드 디버그 APK 빌드
echo "안드로이드 APK 빌드 중..."
cd android
./gradlew assembleDebug
# 4. APK 파일 위치 확인
APK_PATH="app/build/outputs/apk/debug/app-debug.apk"
if [ -f "$APK_PATH" ]; then
echo "APK 빌드 성공!"
echo "APK 파일 위치: $(pwd)/$APK_PATH"
# 홈 디렉토리로 APK 복사
cp "$APK_PATH" ~/zellyy-finance-debug.apk
echo "APK를 홈 디렉토리에 복사했습니다: ~/zellyy-finance-debug.apk"
echo "이제 다음 방법으로 안드로이드 폰에 설치할 수 있습니다:"
echo "1. USB 케이블로 폰을 연결하고 파일 전송"
echo "2. 이메일이나 메신저로 APK 파일 전송"
echo "3. adb 명령어 사용: adb install ~/zellyy-finance-debug.apk"
else
echo "APK 빌드 실패. 오류를 확인하세요."
fi

338
build-ios.sh Normal file
View File

@@ -0,0 +1,338 @@
#!/bin/bash
# iOS 앱 빌드 스크립트 (디버그 및 릴리즈 버전)
# 사용법: ./build-ios.sh
# 색상 정의
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# 프로젝트 디렉토리로 이동
cd "$(dirname "$0")"
# 빌드 타입 선택 메뉴
echo -e "${YELLOW}Zellyy Finance iOS 앱 빌드 스크립트${NC}"
echo -e "${YELLOW}=============================${NC}"
echo -e "빌드 타입을 선택하세요:"
echo -e "1) 디버그 빌드 (개발 및 테스트용)"
echo -e "2) 릴리즈 빌드 (App Store 배포용)"
echo -e "3) 종료"
echo -n "선택 (1-3): "
read -r CHOICE
case $CHOICE in
1)
BUILD_TYPE="debug"
CONFIGURATION="Debug"
;;
2)
BUILD_TYPE="release"
CONFIGURATION="Release"
;;
3)
echo -e "${YELLOW}빌드를 취소합니다.${NC}"
exit 0
;;
*)
echo -e "${RED}잘못된 선택입니다. 빌드를 취소합니다.${NC}"
exit 1
;;
esac
# 현재 버전 및 빌드 번호 가져오기
MARKETING_VERSION=$(grep -A 1 "MARKETING_VERSION" ios/App/App.xcodeproj/project.pbxproj | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' | head -1)
CURRENT_PROJECT_VERSION=$(grep -A 1 "CURRENT_PROJECT_VERSION" ios/App/App.xcodeproj/project.pbxproj | grep -o '[0-9]\+' | head -1)
echo -e "${YELLOW}현재 마케팅 버전: ${MARKETING_VERSION}${NC}"
echo -e "${YELLOW}현재 빌드 번호: ${CURRENT_PROJECT_VERSION}${NC}"
# 빌드 넘버 입력 받기
echo -e "${YELLOW}새 빌드 번호를 입력하세요 (현재: ${CURRENT_PROJECT_VERSION}):${NC}"
read -r BUILD_NUMBER
# 빌드 넘버 유효성 검사
if ! [[ "$BUILD_NUMBER" =~ ^[0-9]+$ ]]; then
echo -e "${RED}유효하지 않은 빌드 번호입니다. 숫자만 입력해주세요.${NC}"
exit 1
fi
# 릴리즈 빌드인 경우 마케팅 버전 업데이트 여부 확인
if [[ "$BUILD_TYPE" == "release" ]]; then
echo -e "${YELLOW}마케팅 버전을 업데이트하시겠습니까? 현재 버전: ${MARKETING_VERSION} (y/n)${NC}"
read -r UPDATE_VERSION
if [[ "$UPDATE_VERSION" == "y" || "$UPDATE_VERSION" == "Y" ]]; then
echo -e "${YELLOW}새 마케팅 버전을 입력하세요 (형식: x.y.z):${NC}"
read -r NEW_MARKETING_VERSION
# 마케팅 버전 유효성 검사
if ! [[ "$NEW_MARKETING_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo -e "${RED}유효하지 않은 마케팅 버전입니다. x.y.z 형식으로 입력해주세요.${NC}"
exit 1
fi
echo -e "${GREEN}마케팅 버전이 ${NEW_MARKETING_VERSION}(으)로 업데이트됩니다.${NC}"
# 마케팅 버전 업데이트
sed -i '' "s/MARKETING_VERSION = $MARKETING_VERSION;/MARKETING_VERSION = $NEW_MARKETING_VERSION;/g" ios/App/App.xcodeproj/project.pbxproj
MARKETING_VERSION=$NEW_MARKETING_VERSION
fi
fi
echo -e "${YELLOW}Zellyy Finance iOS 앱 빌드 시작 (${BUILD_TYPE}, 마케팅 버전: ${MARKETING_VERSION}, 빌드 번호: ${BUILD_NUMBER}): $(date)${NC}"
# 빌드 번호 업데이트
echo -e "${YELLOW}project.pbxproj 파일 업데이트 중...${NC}"
sed -i '' "s/CURRENT_PROJECT_VERSION = $CURRENT_PROJECT_VERSION;/CURRENT_PROJECT_VERSION = $BUILD_NUMBER;/g" ios/App/App.xcodeproj/project.pbxproj
if [ $? -ne 0 ]; then
echo -e "${RED}project.pbxproj 업데이트 실패. 빌드 프로세스를 중단합니다.${NC}"
exit 1
fi
echo -e "${GREEN}빌드 번호가 ${BUILD_NUMBER}(으)로 업데이트되었습니다.${NC}"
# 1. 웹 앱 빌드
echo -e "${YELLOW}1. 웹 앱 빌드 중...${NC}"
npm run build
if [ $? -ne 0 ]; then
echo -e "${RED}웹 앱 빌드 실패. 빌드 프로세스를 중단합니다.${NC}"
exit 1
fi
echo -e "${GREEN}웹 앱 빌드 완료${NC}"
# 2. Capacitor에 웹 코드 복사 및 동기화
echo -e "${YELLOW}2. Capacitor에 웹 코드 동기화 중...${NC}"
npx cap sync ios
if [ $? -ne 0 ]; then
echo -e "${RED}Capacitor 동기화 실패. 빌드 프로세스를 중단합니다.${NC}"
exit 1
fi
echo -e "${GREEN}Capacitor 동기화 완료${NC}"
# 3. iOS 앱 빌드
echo -e "${YELLOW}3. iOS 빌드 시작 (${BUILD_TYPE})...${NC}"
# 빌드 타입에 따라 다른 명령어 실행
cd ios/App
if [ "$BUILD_TYPE" = "debug" ]; then
# 디버그 빌드
echo -e "${YELLOW}빌드 대상을 선택하세요:${NC}"
echo -e "1) 시뮬레이터용 빌드"
echo -e "2) 실제 기기용 빌드"
echo -n "선택 (1-2): "
read -r TARGET_CHOICE
case $TARGET_CHOICE in
1)
# 시뮬레이터용 빌드
echo -e "${YELLOW}시뮬레이터용 빌드 시작...${NC}"
xcodebuild -workspace App.xcworkspace -scheme App -configuration Debug -sdk iphonesimulator -derivedDataPath build
if [ $? -ne 0 ]; then
echo -e "${RED}디버그 빌드 실패. 오류를 확인하세요.${NC}"
exit 1
fi
echo -e "${GREEN}시뮬레이터용 빌드 성공!${NC}"
echo -e "앱 파일 위치: $(pwd)/build/Build/Products/Debug-iphonesimulator/App.app"
# 시뮬레이터 실행 여부 확인
echo -e "${YELLOW}iOS 시뮬레이터에서 앱을 실행하시겠습니까? (y/n)${NC}"
read -r RUN_SIMULATOR
if [ "$RUN_SIMULATOR" = "y" ] || [ "$RUN_SIMULATOR" = "Y" ]; then
# 사용 가능한 시뮬레이터 목록 표시
echo -e "${YELLOW}사용 가능한 시뮬레이터:${NC}"
xcrun simctl list devices available | grep -v "unavailable" | grep "^ "
echo -e "${YELLOW}시뮬레이터 이름을 입력하세요 (예: iPhone 15):${NC}"
read -r SIMULATOR_NAME
# 시뮬레이터 UDID 가져오기
SIMULATOR_UDID=$(xcrun simctl list devices available | grep "$SIMULATOR_NAME" | grep -o -E '[A-Za-z0-9\-]{36}' | head -1)
if [ -z "$SIMULATOR_UDID" ]; then
echo -e "${RED}시뮬레이터를 찾을 수 없습니다. 정확한 이름을 입력하세요.${NC}"
exit 1
fi
# 시뮬레이터 실행
echo -e "${YELLOW}시뮬레이터 실행 중...${NC}"
open -a Simulator --args -CurrentDeviceUDID "$SIMULATOR_UDID"
# 앱 설치 및 실행
xcrun simctl install "$SIMULATOR_UDID" "$(pwd)/build/Build/Products/Debug-iphonesimulator/App.app"
xcrun simctl launch "$SIMULATOR_UDID" "io.ionic.starter"
echo -e "${GREEN}앱이 시뮬레이터에서 실행 중입니다.${NC}"
fi
;;
2)
# 실제 기기용 빌드
echo -e "${YELLOW}실제 기기용 빌드 시작...${NC}"
# 개발자 계정 정보 입력
echo -e "${YELLOW}Apple 개발자 계정 이메일을 입력하세요:${NC}"
read -r APPLE_ID
# 연결된 기기 확인
echo -e "${YELLOW}연결된 iOS 기기 확인 중...${NC}"
CONNECTED_DEVICES=$(xcrun xctrace list devices 2>/dev/null | grep -v "Simulator" | grep -v "===" | grep -v "^$" | grep -v "Devices" | sed 's/ (.*)//')
if [ -z "$CONNECTED_DEVICES" ]; then
echo -e "${RED}연결된 iOS 기기가 없습니다. 기기를 연결하고 다시 시도하세요.${NC}"
exit 1
fi
echo -e "${YELLOW}연결된 기기:${NC}"
echo "$CONNECTED_DEVICES"
echo -e "${YELLOW}빌드 및 설치할 기기 이름을 정확히 입력하세요:${NC}"
read -r DEVICE_NAME
# 프로비저닝 프로파일 자동 관리 옵션으로 빌드
echo -e "${YELLOW}디버그 빌드 및 기기 설치 중...${NC}"
xcodebuild -workspace App.xcworkspace -scheme App -configuration Debug -destination "name=$DEVICE_NAME" -allowProvisioningUpdates -derivedDataPath build
if [ $? -ne 0 ]; then
echo -e "${RED}디버그 빌드 실패. 오류를 확인하세요.${NC}"
echo -e "${YELLOW}가능한 원인:${NC}"
echo "1. 개발자 계정이 유효하지 않거나 로그인되지 않음"
echo "2. 프로비저닝 프로파일이 없거나 유효하지 않음"
echo "3. 기기가 개발자 계정에 등록되지 않음"
echo "4. 기기 이름을 정확히 입력하지 않음"
echo -e "${YELLOW}해결 방법:${NC}"
echo "1. Xcode에서 수동으로 프로젝트를 열고 계정 설정 확인"
echo "2. Xcode > Settings > Accounts에서 Apple ID 로그인 확인"
echo "3. 기기를 개발자 계정에 등록 (Xcode > Window > Devices and Simulators)"
exit 1
fi
echo -e "${GREEN}디버그 빌드 및 기기 설치 성공!${NC}"
echo -e "${YELLOW}앱이 '$DEVICE_NAME' 기기에 설치되었습니다.${NC}"
# IPA 파일 생성 (선택 사항)
echo -e "${YELLOW}디버그용 IPA 파일을 생성하시겠습니까? (y/n)${NC}"
read -r CREATE_IPA
if [ "$CREATE_IPA" = "y" ] || [ "$CREATE_IPA" = "Y" ]; then
echo -e "${YELLOW}디버그용 IPA 파일 생성 중...${NC}"
# 임시 exportOptions.plist 생성
cat > exportOptionsDebug.plist << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>development</string>
<key>signingStyle</key>
<string>automatic</string>
<key>stripSwiftSymbols</key>
<false/>
</dict>
</plist>
EOF
# 아카이브 생성
xcodebuild -workspace App.xcworkspace -scheme App -configuration Debug clean archive -archivePath "build/App-Debug.xcarchive" -allowProvisioningUpdates
if [ $? -ne 0 ]; then
echo -e "${RED}아카이브 생성 실패. 오류를 확인하세요.${NC}"
rm exportOptionsDebug.plist
exit 1
fi
# IPA 파일 생성
xcodebuild -exportArchive -archivePath "build/App-Debug.xcarchive" -exportOptionsPlist exportOptionsDebug.plist -exportPath "build/export-debug" -allowProvisioningUpdates
if [ $? -ne 0 ]; then
echo -e "${RED}IPA 파일 생성 실패. 오류를 확인하세요.${NC}"
rm exportOptionsDebug.plist
exit 1
fi
rm exportOptionsDebug.plist
DEBUG_IPA_PATH="build/export-debug/App.ipa"
DEBUG_DEST_PATH="$HOME/Dev/zellyy-finance-ios-debug.ipa"
if [ -f "$DEBUG_IPA_PATH" ]; then
echo -e "${GREEN}디버그용 IPA 파일 생성 성공!${NC}"
echo -e "IPA 파일 위치: $(pwd)/$DEBUG_IPA_PATH"
# 홈 디렉토리로 IPA 복사
cp "$DEBUG_IPA_PATH" "$DEBUG_DEST_PATH"
echo -e "${GREEN}IPA를 홈 디렉토리에 복사했습니다: $DEBUG_DEST_PATH${NC}"
echo -e "${YELLOW}다음 방법으로 다른 기기에 설치할 수 있습니다:${NC}"
echo "1. Apple Configurator 2 앱 사용"
echo "2. 기기 등록 및 프로비저닝 프로파일이 있는 경우 iTunes로 설치"
echo "3. TestFlight를 통한 배포 (App Store Connect에 업로드 필요)"
else
echo -e "${RED}IPA 파일 생성 실패. 오류를 확인하세요.${NC}"
fi
fi
;;
*)
echo -e "${RED}잘못된 선택입니다. 빌드를 취소합니다.${NC}"
exit 1
;;
esac
elif [ "$BUILD_TYPE" = "release" ]; then
# 릴리즈 빌드
echo -e "${YELLOW}App Store 배포용 아카이브 생성 중...${NC}"
# 개발자 계정 정보 입력
echo -e "${YELLOW}Apple 개발자 계정 이메일을 입력하세요:${NC}"
read -r APPLE_ID
# 아카이브 생성
xcodebuild -workspace App.xcworkspace -scheme App -configuration Release clean archive -archivePath "build/App.xcarchive" -allowProvisioningUpdates
if [ $? -ne 0 ]; then
echo -e "${RED}아카이브 생성 실패. 오류를 확인하세요.${NC}"
exit 1
fi
echo -e "${GREEN}아카이브 생성 성공!${NC}"
echo -e "아카이브 위치: $(pwd)/build/App.xcarchive"
# IPA 파일 생성
echo -e "${YELLOW}IPA 파일 생성 중...${NC}"
xcodebuild -exportArchive -archivePath "build/App.xcarchive" -exportOptionsPlist exportOptions.plist -exportPath "build/export" -allowProvisioningUpdates
if [ $? -ne 0 ]; then
echo -e "${RED}IPA 파일 생성 실패. 오류를 확인하세요.${NC}"
exit 1
fi
IPA_PATH="build/export/App.ipa"
DEST_PATH="$HOME/Dev/zellyy-finance-ios.ipa"
if [ -f "$IPA_PATH" ]; then
echo -e "${GREEN}IPA 파일 생성 성공!${NC}"
echo -e "IPA 파일 위치: $(pwd)/$IPA_PATH"
# 홈 디렉토리로 IPA 복사
cp "$IPA_PATH" "$DEST_PATH"
echo -e "${GREEN}IPA를 홈 디렉토리에 복사했습니다: $DEST_PATH${NC}"
echo -e "${YELLOW}다음 단계:${NC}"
echo "1. App Store Connect에 로그인: https://appstoreconnect.apple.com"
echo "2. 앱 > 젤리의 적자탈출 > iOS 앱 > 빌드 섹션으로 이동"
echo "3. Transporter 앱을 사용하여 IPA 파일 업로드: $DEST_PATH"
echo "4. 검토 과정이 완료될 때까지 기다리기 (보통 몇 시간에서 24시간 소요)"
else
echo -e "${RED}IPA 파일 생성 실패. 오류를 확인하세요.${NC}"
exit 1
fi
else
echo -e "${RED}지원되지 않는 빌드 타입입니다: $BUILD_TYPE${NC}"
echo -e "${YELLOW}사용법: ./build-ios.sh${NC}"
exit 1
fi
echo -e "${GREEN}빌드 프로세스 완료: $(date)${NC}"

View File

@@ -1,38 +0,0 @@
#!/bin/bash
# 모든 스크립트 파일 정리 스크립트
echo "모든 불필요한 스크립트 파일 정리 중..."
# 프로젝트 디렉토리로 이동
cd "$(dirname "$0")"
# 유지할 스크립트 파일 목록
KEEP_FILES=(
"fix-splash-screen-final.sh"
"restore-previous-splash.sh"
"cleanup-all-scripts.sh"
)
# 모든 .sh 파일 찾기
for script in *.sh; do
# 유지할 파일인지 확인
keep=false
for keep_file in "${KEEP_FILES[@]}"; do
if [ "$script" = "$keep_file" ]; then
keep=true
break
fi
done
# 유지할 파일이 아니면 삭제
if [ "$keep" = false ]; then
echo "삭제: $script"
rm -f "$script"
else
echo "유지: $script"
fi
done
echo "정리 완료!"
echo "남은 스크립트 파일:"
ls -la *.sh

View File

@@ -1,28 +0,0 @@
#!/bin/bash
# iOS 백업 파일 정리 스크립트
echo "iOS 백업 파일 정리 중..."
# 프로젝트 디렉토리로 이동
cd "$(dirname "$0")"
# 백업 디렉토리 목록
BACKUP_DIRS=(
"ios_backup_20250319_215301"
"ios_backup_final_20250319_220935"
"ios.bak.20250319204258"
)
# 백업 디렉토리 삭제
for dir in "${BACKUP_DIRS[@]}"; do
if [ -d "$dir" ]; then
echo "삭제: $dir"
rm -rf "$dir"
fi
done
# .bak 파일 찾아서 삭제
echo "백업(.bak) 파일 삭제 중..."
find . -name "*.bak" -type f -print -delete
echo "정리 완료!"

View File

@@ -1,70 +0,0 @@
#!/bin/bash
# 안드로이드 스플래시 화면 지연 문제 해결 스크립트
echo "안드로이드 스플래시 화면 지연 문제 해결 중..."
# 프로젝트 디렉토리로 이동
cd "$(dirname "$0")"
# 1. capacitor.config.ts 수정
echo "capacitor.config.ts 수정 중..."
cat > "capacitor.config.ts" << 'EOL'
import { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
appId: 'com.lovable.zellyfinance',
appName: '젤리의 적자탈출',
webDir: 'dist',
server: {
androidScheme: 'https',
iosScheme: 'https',
cleartext: true
},
plugins: {
SplashScreen: {
launchShowDuration: 1000,
launchAutoHide: true,
backgroundColor: "#FFFFFF",
androidSplashResourceName: "splash",
androidScaleType: "CENTER_CROP",
showSpinner: false,
splashFullScreen: false,
splashImmersive: false
},
Keyboard: {
resize: "body",
style: "dark",
resizeOnFullScreen: true
}
},
ios: {
scheme: "App"
}
};
export default config;
EOL
echo "capacitor.config.ts 수정 완료"
# 2. App.tsx 수정
echo "App.tsx 수정 중..."
APP_TSX="src/App.tsx"
# App.tsx 파일에서 스플래시 화면 관련 코드 수정
# 타임아웃 값을 플랫폼에 따라 다르게 설정
sed -i '' 's/setTimeout(async () => {/setTimeout(async () => {/g' "$APP_TSX"
sed -i '' 's/}, 500); \/\/ 500ms로 줄임/}, 300); \/\/ 300ms로 줄임/g' "$APP_TSX"
echo "App.tsx 수정 완료"
# 3. 웹 앱 빌드
echo "웹 앱 빌드 중..."
npm run build
# 4. Capacitor 업데이트
echo "Capacitor 업데이트 중..."
npx cap copy android
echo "안드로이드 스플래시 화면 지연 문제 해결 완료!"
echo "이제 Android Studio에서 앱을 빌드하고 실행하세요."
echo "npx cap open android"

View File

@@ -1,317 +0,0 @@
#!/bin/bash
# 스플래시 화면 표시 시간 강제 설정 스크립트
echo "스플래시 화면 표시 시간 강제 설정 중..."
# 프로젝트 디렉토리로 이동
cd "$(dirname "$0")"
# 1. 기존 Capacitor 스플래시 플러그인 비활성화하고 네이티브 스플래시 사용
echo "Capacitor 스플래시 설정 수정 중..."
cat > capacitor.config.ts << 'EOL'
import { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
appId: 'com.lovable.zellyfinance',
appName: '젤리의 적자탈출',
webDir: 'dist',
server: {
androidScheme: 'https',
iosScheme: 'https',
cleartext: true
},
plugins: {
SplashScreen: {
launchShowDuration: 0,
launchAutoHide: false,
backgroundColor: "#FFFFFF",
androidSplashResourceName: "splash",
androidScaleType: "CENTER_CROP",
showSpinner: false,
splashFullScreen: true,
splashImmersive: false
},
Keyboard: {
resize: "body",
style: "dark",
resizeOnFullScreen: true
}
},
ios: {
scheme: "App",
contentInset: "always",
allowsLinkPreview: false,
scrollEnabled: true,
limitsNavigationsToAppBoundDomains: true,
backgroundColor: "#F2F2F2"
}
};
export default config;
EOL
# 2. AppDelegate.swift 수정 - 스플래시 화면 직접 제어
echo "AppDelegate.swift 수정 중..."
APP_DELEGATE="ios/App/App/AppDelegate.swift"
if [ -f "$APP_DELEGATE" ]; then
# 백업 생성
cp "$APP_DELEGATE" "${APP_DELEGATE}.bak_force"
# AppDelegate.swift 내용 교체 - 스플래시 화면 직접 제어
cat > "$APP_DELEGATE" << 'EOL'
import UIKit
import Capacitor
import WebKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var splashView: UIView?
var startTime: Date?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// 시작 시간 기록
startTime = Date()
// 배경색 설정
self.window?.backgroundColor = UIColor(red: 0.95, green: 0.95, blue: 0.95, alpha: 1.0)
// 웹뷰 캐시 설정 최적화
let websiteDataTypes = NSSet(array: [WKWebsiteDataTypeDiskCache, WKWebsiteDataTypeMemoryCache])
let date = Date(timeIntervalSince1970: 0)
WKWebsiteDataStore.default().removeData(ofTypes: websiteDataTypes as! Set<String>, modifiedSince: date, completionHandler:{ })
// 웹뷰 설정 최적화
let webViewConfig = WKWebViewConfiguration()
webViewConfig.allowsInlineMediaPlayback = true
webViewConfig.suppressesIncrementalRendering = false
webViewConfig.allowsAirPlayForMediaPlayback = true
webViewConfig.mediaTypesRequiringUserActionForPlayback = []
// 스플래시 화면 감지 설정
NotificationCenter.default.addObserver(self,
selector: #selector(handleWebViewDidLoad),
name: NSNotification.Name(rawValue: "capacitorWebViewDidLoad"),
object: nil)
return true
}
@objc func handleWebViewDidLoad() {
// 웹뷰 로드 완료 시 스플래시 화면 제거 (최소 10초 이상 표시)
let minimumSplashTime: TimeInterval = 10.0
if let startTime = startTime {
let timeElapsed = Date().timeIntervalSince(startTime)
let remainingTime = max(0, minimumSplashTime - timeElapsed)
DispatchQueue.main.asyncAfter(deadline: .now() + remainingTime) {
// 스플래시 화면 제거 요청
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "removeSplashScreen"), object: nil)
}
}
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
// Called when the app was launched with a url. Feel free to add additional processing here,
// but if you want the App API to support tracking app url opens, make sure to keep this call
return ApplicationDelegateProxy.shared.application(app, open: url, options: options)
}
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
// Called when the app was launched with an activity, including Universal Links.
// Feel free to add additional processing here, but if you want the App API to support
// tracking app url opens, make sure to keep this call
return ApplicationDelegateProxy.shared.application(application, continue: userActivity, restorationHandler: restorationHandler)
}
}
EOL
fi
# 3. ViewController.swift 수정 - 스플래시 화면 직접 제어
echo "ViewController.swift 수정 중..."
VIEWCONTROLLER="ios/App/App/ViewController.swift"
if [ -f "$VIEWCONTROLLER" ]; then
# 백업 생성
cp "$VIEWCONTROLLER" "${VIEWCONTROLLER}.bak_force"
# ViewController.swift 내용 교체 - 스플래시 화면 직접 제어
cat > "$VIEWCONTROLLER" << 'EOL'
import UIKit
import Capacitor
import WebKit
class ViewController: CAPBridgeViewController {
private var splashView: UIView?
private var splashRemoved = false
override func viewDidLoad() {
super.viewDidLoad()
// 배경색 설정 - 밝은 회색
self.view.backgroundColor = UIColor(red: 0.95, green: 0.95, blue: 0.95, alpha: 1.0)
self.webView?.backgroundColor = UIColor(red: 0.95, green: 0.95, blue: 0.95, alpha: 1.0)
// 스플래시 뷰 생성
setupSplashView()
// 웹뷰 로드 완료 감지
NotificationCenter.default.addObserver(self, selector: #selector(webViewDidFinishLoad), name: NSNotification.Name(rawValue: "capacitorWebViewDidLoad"), object: nil)
// 스플래시 화면 제거 요청 감지
NotificationCenter.default.addObserver(self, selector: #selector(removeSplashScreenRequested), name: NSNotification.Name(rawValue: "removeSplashScreen"), object: nil)
// 최대 표시 시간 설정 (15초 후 강제 제거)
DispatchQueue.main.asyncAfter(deadline: .now() + 15.0) {
self.removeSplashScreen()
}
}
private func setupSplashView() {
// 스플래시 뷰 생성
splashView = UIView(frame: self.view.bounds)
splashView?.backgroundColor = UIColor.white
// 스플래시 이미지 추가
let imageView = UIImageView(image: UIImage(named: "Splash"))
imageView.contentMode = .scaleAspectFit
imageView.translatesAutoresizingMaskIntoConstraints = false
if let splashView = splashView {
self.view.addSubview(splashView)
splashView.addSubview(imageView)
NSLayoutConstraint.activate([
imageView.centerXAnchor.constraint(equalTo: splashView.centerXAnchor),
imageView.centerYAnchor.constraint(equalTo: splashView.centerYAnchor),
imageView.widthAnchor.constraint(equalToConstant: 200),
imageView.heightAnchor.constraint(equalToConstant: 200)
])
}
}
@objc private func webViewDidFinishLoad() {
// 웹뷰 로드 완료 시 AppDelegate에 알림
// (AppDelegate에서 최소 표시 시간 계산 후 제거 요청)
print("웹뷰 로드 완료")
}
@objc private func removeSplashScreenRequested() {
// 스플래시 화면 제거 요청 수신
removeSplashScreen()
}
private func removeSplashScreen() {
if !splashRemoved && splashView != nil {
splashRemoved = true
print("스플래시 화면 제거 중...")
UIView.animate(withDuration: 0.8, animations: {
self.splashView?.alpha = 0
}, completion: { _ in
self.splashView?.removeFromSuperview()
self.splashView = nil
print("스플래시 화면 제거 완료")
})
}
}
override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
// 웹뷰 배경색 설정
self.webView?.backgroundColor = UIColor(red: 0.95, green: 0.95, blue: 0.95, alpha: 1.0)
self.webView?.scrollView.backgroundColor = UIColor(red: 0.95, green: 0.95, blue: 0.95, alpha: 1.0)
self.webView?.isOpaque = false
}
}
EOL
fi
# 4. index.html 수정 - 웹뷰 로드 완료 알림 지연
echo "index.html 수정 중..."
INDEX_HTML="ios/App/App/public/index.html"
if [ -f "$INDEX_HTML" ]; then
# 백업 생성
cp "$INDEX_HTML" "${INDEX_HTML}.bak_force"
# 웹뷰 로드 완료 알림 코드 수정 - 지연 추가
sed -i '' '/<\/head>/i\
<style>\
body, html {\
background-color: #F2F2F2 !important;\
margin: 0;\
padding: 0;\
height: 100%;\
width: 100%;\
}\
</style>\
<script>\
document.addEventListener("DOMContentLoaded", function() {\
// 배경색 설정\
document.body.style.backgroundColor = "#F2F2F2";\
\
// 스플래시 화면을 더 오래 표시하기 위해 지연 추가\
setTimeout(function() {\
console.log("웹뷰 로드 완료 알림 전송");\
if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.bridge) {\
window.webkit.messageHandlers.bridge.postMessage({\
type: "notification",\
name: "capacitorWebViewDidLoad"\
});\
} else if (window.capacitor) {\
var event = new CustomEvent("capacitorWebViewDidLoad");\
document.dispatchEvent(event);\
}\
}, 3000); // 3초 지연\
});\
</script>' "$INDEX_HTML"
fi
# 5. Info.plist 수정 - 스플래시 화면 관련 설정
echo "Info.plist 수정 중..."
INFO_PLIST="ios/App/App/Info.plist"
if [ -f "$INFO_PLIST" ]; then
# 백업 생성
cp "$INFO_PLIST" "${INFO_PLIST}.bak_force"
# UIApplicationExitsOnSuspend 설정 제거 (만약 있다면)
/usr/libexec/PlistBuddy -c "Delete :UIApplicationExitsOnSuspend" "$INFO_PLIST" 2>/dev/null || true
# 콘솔 로그 활성화
/usr/libexec/PlistBuddy -c "Add :OS_ACTIVITY_MODE string disable" "$INFO_PLIST" 2>/dev/null || true
fi
# 6. Capacitor 설정 동기화
echo "Capacitor 설정 동기화 중..."
npx cap sync ios
echo "완료! 이제 Xcode에서 다시 빌드하세요."
echo "스플래시 화면이 최소 10초 이상 표시되도록 설정했습니다."

View File

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

View File

@@ -1,37 +0,0 @@
#!/bin/bash
# 앱 재빌드 스크립트
echo "앱 재빌드 시작: $(date)"
# 프로젝트 디렉토리로 이동
cd "$(dirname "$0")"
# 최신 코드 가져오기
echo "최신 코드 가져오기..."
git pull
# 의존성 설치
echo "의존성 설치 중..."
npm install
# 웹 앱 빌드
echo "웹 앱 빌드 중..."
npm run build
# Capacitor 웹 코드 복사
echo "Capacitor에 웹 코드 복사 중..."
npx cap copy
# iOS 앱 빌드 (Xcode 필요)
echo "iOS 앱 빌드 중..."
npx cap open ios
echo "앱 재빌드 완료!"
echo "iOS 앱을 빌드하려면 Xcode에서 다음 단계를 수행하세요:"
echo "1. Product > Clean Build Folder"
echo "2. Product > Build"
echo "3. Product > Run (시뮬레이터나 기기에서 테스트)"
# 안드로이드 앱 빌드 (Android Studio 필요)
# echo "안드로이드 앱 빌드 중..."
# npx cap open android

View File

@@ -1,292 +0,0 @@
#!/bin/bash
# 이전 스플래시 화면 설정으로 복원하는 스크립트
echo "이전 스플래시 화면 설정으로 복원 중..."
# 프로젝트 디렉토리로 이동
cd "$(dirname "$0")"
# 1. ViewController.swift 복원
echo "ViewController.swift 복원 중..."
VIEWCONTROLLER="ios/App/App/ViewController.swift"
if [ -f "${VIEWCONTROLLER}.bak_duration" ]; then
# 백업에서 복원
cp "${VIEWCONTROLLER}.bak_duration" "$VIEWCONTROLLER"
echo "ViewController.swift를 이전 버전으로 복원했습니다."
else
# 백업이 없는 경우 직접 작성
cat > "$VIEWCONTROLLER" << 'EOL'
import UIKit
import Capacitor
import WebKit
class ViewController: CAPBridgeViewController {
private var splashView: UIView?
override func viewDidLoad() {
super.viewDidLoad()
// 스플래시 뷰 생성
setupSplashView()
// 웹뷰 로드 완료 감지
NotificationCenter.default.addObserver(self, selector: #selector(webViewDidFinishLoad), name: NSNotification.Name(rawValue: "capacitorWebViewDidLoad"), object: nil)
}
private func setupSplashView() {
// 스플래시 뷰 생성
splashView = UIView(frame: self.view.bounds)
splashView?.backgroundColor = UIColor.white
// 스플래시 이미지 추가
let imageView = UIImageView(image: UIImage(named: "Splash"))
imageView.contentMode = .scaleAspectFit
imageView.translatesAutoresizingMaskIntoConstraints = false
if let splashView = splashView {
self.view.addSubview(splashView)
splashView.addSubview(imageView)
NSLayoutConstraint.activate([
imageView.centerXAnchor.constraint(equalTo: splashView.centerXAnchor),
imageView.centerYAnchor.constraint(equalTo: splashView.centerYAnchor),
imageView.widthAnchor.constraint(equalToConstant: 200),
imageView.heightAnchor.constraint(equalToConstant: 200)
])
}
}
@objc private func webViewDidFinishLoad() {
// 웹뷰 로드 완료 시 스플래시 화면 제거 (2초 후)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
UIView.animate(withDuration: 0.3, animations: {
self.splashView?.alpha = 0
}, completion: { _ in
self.splashView?.removeFromSuperview()
self.splashView = nil
})
}
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
// 웹뷰 로드 시작 시 스크립트 실행 (최대 2초 후 스플래시 제거)
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) {
if self.splashView != nil && self.splashView?.alpha == 1 {
UIView.animate(withDuration: 0.3, animations: {
self.splashView?.alpha = 0
}, completion: { _ in
self.splashView?.removeFromSuperview()
self.splashView = nil
})
}
}
}
}
EOL
echo "ViewController.swift를 재생성했습니다."
fi
# 2. AppDelegate.swift 복원
echo "AppDelegate.swift 복원 중..."
APP_DELEGATE="ios/App/App/AppDelegate.swift"
if [ -f "${APP_DELEGATE}.bak_bgcolor" ]; then
# 백업에서 복원
cp "${APP_DELEGATE}.bak_bgcolor" "$APP_DELEGATE"
echo "AppDelegate.swift를 이전 버전으로 복원했습니다."
else
# 백업이 없는 경우 직접 작성
cat > "$APP_DELEGATE" << 'EOL'
import UIKit
import Capacitor
import WebKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// 웹뷰 캐시 설정 최적화
let websiteDataTypes = NSSet(array: [WKWebsiteDataTypeDiskCache, WKWebsiteDataTypeMemoryCache])
let date = Date(timeIntervalSince1970: 0)
WKWebsiteDataStore.default().removeData(ofTypes: websiteDataTypes as! Set<String>, modifiedSince: date, completionHandler:{ })
// 웹뷰 설정 최적화
let webViewConfig = WKWebViewConfiguration()
webViewConfig.allowsInlineMediaPlayback = true
webViewConfig.suppressesIncrementalRendering = false
webViewConfig.allowsAirPlayForMediaPlayback = true
webViewConfig.mediaTypesRequiringUserActionForPlayback = []
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
// Called when the app was launched with a url. Feel free to add additional processing here,
// but if you want the App API to support tracking app url opens, make sure to keep this call
return ApplicationDelegateProxy.shared.application(app, open: url, options: options)
}
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
// Called when the app was launched with an activity, including Universal Links.
// Feel free to add additional processing here, but if you want the App API to support
// tracking app url opens, make sure to keep this call
return ApplicationDelegateProxy.shared.application(application, continue: userActivity, restorationHandler: restorationHandler)
}
}
EOL
echo "AppDelegate.swift를 재생성했습니다."
fi
# 3. capacitor.config.ts 복원
echo "capacitor.config.ts 복원 중..."
if [ -f "capacitor.config.ts.bak" ]; then
# 백업에서 복원
cp "capacitor.config.ts.bak" "capacitor.config.ts"
echo "capacitor.config.ts를 이전 버전으로 복원했습니다."
else
# 백업이 없는 경우 직접 작성
cat > "capacitor.config.ts" << 'EOL'
import { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
appId: 'com.lovable.zellyfinance',
appName: '젤리의 적자탈출',
webDir: 'dist',
server: {
androidScheme: 'https',
iosScheme: 'https',
cleartext: true
},
plugins: {
SplashScreen: {
launchShowDuration: 3000,
launchAutoHide: true,
backgroundColor: "#FFFFFF",
androidSplashResourceName: "splash",
androidScaleType: "CENTER_CROP",
showSpinner: false,
splashFullScreen: false,
splashImmersive: false
},
Keyboard: {
resize: "body",
style: "dark",
resizeOnFullScreen: true
}
},
ios: {
scheme: "App"
}
};
export default config;
EOL
echo "capacitor.config.ts를 재생성했습니다."
fi
# 4. index.html 복원 (웹뷰 로드 완료 알림 코드 제거)
echo "index.html 복원 중..."
INDEX_HTML="ios/App/App/public/index.html"
if [ -f "${INDEX_HTML}.bak_bgcolor" ]; then
# 백업에서 복원
cp "${INDEX_HTML}.bak_bgcolor" "$INDEX_HTML"
echo "index.html을 이전 버전으로 복원했습니다."
else
echo "index.html 백업을 찾을 수 없습니다. 수동으로 확인이 필요합니다."
fi
# 5. Info.plist 복원
echo "Info.plist 복원 중..."
INFO_PLIST="ios/App/App/Info.plist"
if [ -f "${INFO_PLIST}.bak_force" ]; then
# 백업에서 복원
cp "${INFO_PLIST}.bak_force" "$INFO_PLIST"
echo "Info.plist를 이전 버전으로 복원했습니다."
else
echo "Info.plist 백업을 찾을 수 없습니다. 수동으로 확인이 필요합니다."
fi
# 6. LaunchScreen.storyboard 복원
echo "LaunchScreen.storyboard 복원 중..."
cat > ios/App/App/Base.lproj/LaunchScreen.storyboard << 'EOL'
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17126"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Splash" translatesAutoresizingMaskIntoConstraints="NO" id="hLz-g1-Xcm">
<rect key="frame" x="87.5" y="233.5" width="200" height="200"/>
<constraints>
<constraint firstAttribute="width" constant="200" id="Zmm-k7-Wvl"/>
<constraint firstAttribute="height" constant="200" id="zrV-nL-Fgq"/>
</constraints>
</imageView>
</subviews>
<viewLayoutGuide key="safeArea" id="Bcu-3y-fUS"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="hLz-g1-Xcm" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="Jgv-Jh-bz9"/>
<constraint firstItem="hLz-g1-Xcm" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="YPE-Yx-CnE"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
<resources>
<image name="Splash" width="200" height="200"/>
</resources>
</document>
EOL
# 7. Capacitor 설정 동기화
echo "Capacitor 설정 동기화 중..."
npx cap sync ios
echo "완료! 이제 Xcode에서 다시 빌드하세요."