diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 67fa6f9..752417f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -46,6 +46,12 @@ jobs: env: KEYCHAIN_NAME: ${{ secrets.KEYCHAIN_NAME }} KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} + + - name: Setting Xcconfig + run: | + echo "NAVER_OCR_KEY = $NAVER_OCR_KEY" > Projects/App/Resources/APIKey.xcconfig + env: + NAVER_OCR_KEY: ${{secrets.NAVER_OCR_KEY}} - name: Tuist generate run: tuist generate diff --git a/.gitignore b/.gitignore index 520c564..ed421b7 100644 --- a/.gitignore +++ b/.gitignore @@ -77,3 +77,4 @@ Moneymong.app.dSYM.zip *.ipa fastlane/report.xml fastlane/README.md +Projects/App/Resources/APIKey.xcconfig diff --git a/Projects/App/Project.swift b/Projects/App/Project.swift index 63e2417..908fdd0 100644 --- a/Projects/App/Project.swift +++ b/Projects/App/Project.swift @@ -11,7 +11,11 @@ let project = Project( .marketingVersion("1.2.1") .swiftVersion("5.7") .currentProjectVersion("10") - .appleGenericVersioningSystem() + .appleGenericVersioningSystem(), + configurations: [ + .debug(name: .debug, xcconfig: "Resources/APIKey.xcconfig"), + .release(name: .release, xcconfig: "Resources/APIKey.xcconfig") + ] ), targets: [ Target( @@ -35,6 +39,7 @@ let project = Project( ] ], "UIUserInterfaceStyle": "Light", + "NAVER_OCR_KEY": "$(NAVER_OCR_KEY)", "CFBundleShortVersionString": "$(MARKETING_VERSION)", "CFBundleVersion": "$(CURRENT_PROJECT_VERSION)", "UILaunchStoryboardName": "LaunchScreen", diff --git a/Projects/Core/Core/Sources/Network/APIs/LedgerAPI/Repository/LedgerAPI.swift b/Projects/Core/Core/Sources/Network/APIs/LedgerAPI/Repository/LedgerAPI.swift index 6367f3b..46858ec 100644 --- a/Projects/Core/Core/Sources/Network/APIs/LedgerAPI/Repository/LedgerAPI.swift +++ b/Projects/Core/Core/Sources/Network/APIs/LedgerAPI/Repository/LedgerAPI.swift @@ -109,9 +109,10 @@ extension LedgerAPI: TargetType { case .uploadImage: return ["Content-Type": "multipart/form-data"] case .deleteImage: return ["Content-Type": "application/json"] case .receiptOCR: + let key = Bundle.main.infoDictionary?["NAVER_OCR_KEY"] as? String return [ "Content-Type": "multipart/form-data", - "X-OCR-SECRET": "WUdRdW9Ld0FobXRIaVRnYmNBY3NYVVhDdkhDR1lRcHQ=" + "X-OCR-SECRET": key ?? "" ] default: return ["Content-Type": "application/json;charset=UTF-8"] } diff --git a/Projects/Feature/Ledger/Sources/Scene/Ledger/Creaters/Scan/Components/CameraView.swift b/Projects/Feature/Ledger/Sources/Scene/Ledger/Creaters/Scan/Components/CameraView.swift index a0f575e..37c0012 100644 --- a/Projects/Feature/Ledger/Sources/Scene/Ledger/Creaters/Scan/Components/CameraView.swift +++ b/Projects/Feature/Ledger/Sources/Scene/Ledger/Creaters/Scan/Components/CameraView.swift @@ -43,7 +43,7 @@ final class CameraView: UIView { func setupCamera() throws { // 사용 가능한 카메라 중 후면 카메라를 선택 - guard let backCamera = AVCaptureDevice.default(for: .video), + guard let backCamera = AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .back), let input = try? AVCaptureDeviceInput(device: backCamera) else { throw MoneyMongError.appError(.cameraAccess, errorMessage: "설정에서 카메라 접근을 허용해주세요!") } @@ -63,12 +63,31 @@ final class CameraView: UIView { // 프리뷰 레이어 설정 videoPreviewLayer.session = captureSession + // 자동 초점 조절 + try configureCameraFocus(backCamera) + // 세션 시작 DispatchQueue.main.async { self.captureSession.startRunning() } } + private func configureCameraFocus(_ camera: AVCaptureDevice) throws { + try camera.lockForConfiguration() + + // 연속 자동 초점 모드 설정 + if camera.isFocusModeSupported(.continuousAutoFocus) { + camera.focusMode = .continuousAutoFocus + } + + // 연속 자동 노출 모드 설정 + if camera.isExposureModeSupported(.continuousAutoExposure) { + camera.exposureMode = .continuousAutoExposure + } + + camera.unlockForConfiguration() + } + var takePhoto: Binder { return Binder(self) { owner, _ in guard let delegate = owner.delegate else { diff --git a/Projects/Feature/Ledger/Sources/Scene/Ledger/Creaters/Scan/ScanCreater/CreateOCRLedgerVC.swift b/Projects/Feature/Ledger/Sources/Scene/Ledger/Creaters/Scan/ScanCreater/CreateOCRLedgerVC.swift index af27b9f..9ecff6c 100644 --- a/Projects/Feature/Ledger/Sources/Scene/Ledger/Creaters/Scan/ScanCreater/CreateOCRLedgerVC.swift +++ b/Projects/Feature/Ledger/Sources/Scene/Ledger/Creaters/Scan/ScanCreater/CreateOCRLedgerVC.swift @@ -146,7 +146,8 @@ final class CreateOCRLedgerVC: UIViewController, View { .alignItems(.center) .justifyContent(.center) .height(deviceHeight * 0.175) - } + }.backgroundColor(.black) + cameraView.addSubview(captureImageView) view.addSubview(topContainer) topContainer.addSubview(topGuideLine) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 44f0ae3..d9ac5ff 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -41,6 +41,9 @@ platform :ios do # 테스트 플라이트 업로드 desc "Push to TestFlight" lane :tf do |options| + + ENV["FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT"] = "120" + # 앱스토어 커넥트 키 연결 app_store_connect_api_key( key_id: "#{FASTLANE_API_KEY_ID}",