fix: 안드로이드 소셜 로그인 실패 수정 (Firebase 연결 + Apple 버튼 미노출) - #328
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Discord 스레드 연동용 메타데이터입니다. discord-pr-bot 워크플로가 자동 생성하며, 수정·삭제하면 PR 과 Discord 알림 연동이 끊깁니다. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughApple 로그인의 비-iOS 방어 로직을 추가하고, Android 웹뷰에서 Apple 버튼을 숨기며, 네이티브 로그인 결과 메시지를 window와 document 양쪽에서 처리하도록 변경했습니다. Changes소셜 로그인 플랫폼 대응
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant LoginPage
participant LoginButtons
participant useSocialLogin
participant WebBridge
participant useNativeLoginResult
LoginPage->>LoginButtons: showAppleLogin 전달
LoginButtons->>useSocialLogin: 소셜 로그인 요청
useSocialLogin->>WebBridge: 비-iOS Apple 오류 메시지 전송
WebBridge->>useNativeLoginResult: 로그인 결과 메시지 전달
useNativeLoginResult->>useNativeLoginResult: 성공 또는 실패 처리
Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/app/eas.json`:
- Around line 14-17: The development and preview EAS profiles are missing the
environment setting, so they may not receive the required Firebase file
variables and can fail during preinstall/prebuild. Update the app EAS
configuration so the development and preview entries in eas.json explicitly set
the correct environment like the production profile, and make sure the
corresponding file variables are registered for those environments to match the
fallback logic in app.config.ts.
In `@apps/app/package.json`:
- Around line 12-13: The eas-build-pre-install script in package.json swallows
cp failures because both file-copy checks are chained with semicolons, so a
failing cp can still end with exit 0 if the later block succeeds. Update the
script so failures in either GOOGLE_SERVICES_JSON or GOOGLE_SERVICE_INFO_PLIST
copy path immediately fail the whole pre-install step, using the existing
eas-build-pre-install command and its cp/if logic to preserve a nonzero exit
status on any copy error.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: eab49d5c-6d62-485f-882b-c18cedf3ac94
📒 Files selected for processing (6)
apps/app/app.jsonapps/app/eas.jsonapps/app/hooks/useSocialLogin.tsapps/app/package.jsonapps/web/src/app/login/_components/LoginButtons.tsxapps/web/src/app/login/page.tsx
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/web/src/hooks/useWebBridgeMessage.ts (1)
47-54: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
window/document리스너 등록 로직 중복 - 공유 유틸로 추출 권장.두 훅이 "iOS는 window, Android는 document에 message 이벤트를 dispatch한다"는 동일한 근본 배경으로 거의 동일한 등록/해제/캐스팅 코드를 각각 구현하고 있습니다. 공유 훅(예:
useMessageListener또는useWebBridgeTarget)으로 추출하면 향후 플랫폼별 dispatch 방식이 바뀔 때 한 곳만 수정하면 됩니다.
apps/web/src/hooks/useWebBridgeMessage.ts#L47-L54:window/document리스너 등록·해제 및EventListener캐스팅 로직을 공유 헬퍼로 추출.apps/web/src/hooks/useNativeLoginResult.ts#L45-L51: 동일한 공유 헬퍼를 재사용하도록 변경.♻️ 공유 헬퍼 예시
// apps/web/src/hooks/useMessageListener.ts export function useMessageListener(handler: (event: MessageEvent) => void, deps: unknown[]) { useEffect(() => { /** RN → 웹 메시지는 iOS 에선 window, Android 에선 document 에 dispatch 된다 (react-native-webview 동작) */ window.addEventListener('message', handler); document.addEventListener('message', handler as EventListener); return () => { window.removeEventListener('message', handler); document.removeEventListener('message', handler as EventListener); }; // eslint-disable-next-line react-hooks/exhaustive-deps }, deps); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/src/hooks/useWebBridgeMessage.ts` around lines 47 - 54, Extract the duplicated window/document message listener registration, cleanup, and EventListener casting into a shared useMessageListener or equivalent helper. Update apps/web/src/hooks/useWebBridgeMessage.ts lines 47-54 to use the helper, and update apps/web/src/hooks/useNativeLoginResult.ts lines 45-51 to reuse it; keep each hook’s existing handler and dependency behavior unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@apps/web/src/hooks/useWebBridgeMessage.ts`:
- Around line 47-54: Extract the duplicated window/document message listener
registration, cleanup, and EventListener casting into a shared
useMessageListener or equivalent helper. Update
apps/web/src/hooks/useWebBridgeMessage.ts lines 47-54 to use the helper, and
update apps/web/src/hooks/useNativeLoginResult.ts lines 45-51 to reuse it; keep
each hook’s existing handler and dependency behavior unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 56ec3593-3ea3-48cb-8098-18786d802973
📒 Files selected for processing (2)
apps/web/src/hooks/useNativeLoginResult.tsapps/web/src/hooks/useWebBridgeMessage.ts
| "production": { | ||
| "autoIncrement": true | ||
| "autoIncrement": true, | ||
| "environment": "production" |
There was a problem hiding this comment.
디버깅 하다가 커밋에 따라 들어갔네 제거 완~
| "web": "expo start --web", | ||
| "lint": "expo lint" | ||
| "lint": "expo lint", | ||
| "eas-build-pre-install": "if [ -n \"$GOOGLE_SERVICES_JSON\" ]; then cp \"$GOOGLE_SERVICES_JSON\" ./google-services.json; fi; if [ -n \"$GOOGLE_SERVICE_INFO_PLIST\" ]; then cp \"$GOOGLE_SERVICE_INFO_PLIST\" ./GoogleService-Info.plist; fi" |
There was a problem hiding this comment.
eas cloud에서 자동으로 주입될거라 스크립트 필요없다 ~!
| /** RN → 웹 메시지는 iOS 에선 window, Android 에선 document 에 dispatch 된다 (react-native-webview 동작) */ | ||
| window.addEventListener('message', handler); | ||
| return () => window.removeEventListener('message', handler); | ||
| document.addEventListener('message', handler as EventListener); | ||
| return () => { | ||
| window.removeEventListener('message', handler); | ||
| document.removeEventListener('message', handler as EventListener); | ||
| }; |
There was a problem hiding this comment.
오 여기는 따로 이벤트리스너를 붙이네??? 이거 useWebBridgeMessage 사용하는 쪽으로 통합하면 좋을듯
# Conflicts: # apps/web/src/app/login/_components/LoginButtons.tsx
* ix: 안드로이드 소셜 로그인 실패 수정 (Firebase 연결 + Apple 버튼 미노출) * fix: Android 웹뷰에서 RN 메시지 유실 수정 (document 리스너 추가) * chore: eas.json 중복 environment 설정 제거 * chore: google services 파일 주입 중복 설정 제거 (app.config.ts 로 일원화) * refactor: useNativeLoginResult 를 useWebBridgeMessage 로 통합 --------- Co-authored-by: Jung Sun A <amber0809@naver.com>
작업 요약
google-services.json을 EAS file 환경변수로 관리하고 빌드 시 자동 주입되도록 연결합니다작업 세부 내용
배경 — 원인 3가지
google-services.json부재DEVELOPER_ERROR즉시 실패카카오는 개발자 콘솔에 Android 플랫폼(패키지명 + 키 해시) 등록으로 처리 — 담당자 진행 중.
1. Firebase / Google 콘솔 등록 (완료)
day.no30s.piki) 등록 + EAS 업로드 키 SHA-1/SHA-256 지문 등록google-services.json검증 완료 — 패키지명 일치 / Android client (certificate_hash) 포함 / Web client 가 기존EXPO_PUBLIC_GOOGLE_WEB_CLIENT_ID와 일치2. 빌드 연결 — EAS file 환경변수 방식
Google 설정 파일 2종은 gitignore 를 유지하고 (레포에 커밋 X), EAS file 환경변수로 관리합니다.
GOOGLE_SERVICES_JSON,GOOGLE_SERVICE_INFO_PLIST(file 타입, production)package.json의eas-build-pre-install훅이 빌드 시 파일을 프로젝트 경로로 복사app.json에android.googleServicesFile/ios.googleServicesFile명시 참조eas.jsonproduction 프로필에"environment": "production"명시 (env 변수 매칭 보장)3. Apple 로그인 안드로이드 미노출
login/page.tsx(RSC) 에서 User-Agent 로 Android 웹뷰 판별 →showAppleLoginprop 전달 (서버 판별이라 깜빡임/hydration mismatch 없음)LoginButtons는 Android 웹뷰에서만 Apple 버튼 미노출 — 일반 Android 브라우저는 웹 OAuth 라 정상 동작하므로 유지useSocialLogin에도 방어 가드 추가 — Android 에서 apple 요청이 와도 iOS 전용 모듈 호출 전에 안내 에러 반환검증
google-services.json구조 검증 (패키지명 / cert_hash ↔ EAS 업로드 키 SHA-1 일치)expo prebuild -p android로 gradle plugin + json 반영 확인check-types·lint, apptsc통과참고
eas build --platform android)연관 이슈
closes #327
Summary by CodeRabbit
새로운 기능
버그 수정