Skip to content

[Fix] Explore - Main 연동 시 푸시알림 관련 버그 이슈#63

Merged
oungsi2000 merged 3 commits intodevelopfrom
fix/60
Mar 3, 2026
Merged

[Fix] Explore - Main 연동 시 푸시알림 관련 버그 이슈#63
oungsi2000 merged 3 commits intodevelopfrom
fix/60

Conversation

@oungsi2000
Copy link
Contributor

#️⃣ 이슈 번호

#60


🛠️ 작업 내용

  • Explore - Main 연동 시 푸시알림 관련 버그를 해결하였습니다
  • 이전에 올린 PR의 연장 작업입니다.

🙇🏻 중점 리뷰 요청

  • MainViewModel, NewsViewModel 이 MainScreen에 종속적인 구조입니다.
    때문에 탐색 화면 등에서는 푸시 알림 수신 시 정상 동작하지 않습니다 (MainViewModel, NewsViewModel 등이 없으므로)
  • 현재 앱 구조가 Splash -> Explore or Main 으로 진입점이 나뉘어짐에 따라 navController 만으로 앱을 정상 종료하기 어렵습니다.
    (SplashRoute의 backStack이 남아있으므로) 때문에 Activity로부터 앱 종료 트리거 람다를 받도록 변경했습니다.

📸 이미지 첨부 (Optional)

기존 `MainActivity`에서 관리하던 플랫폼 의존적 로직(권한, 위치, 버전 관리, 딥링크 처리 등)을 `Compose` 생명주기 내로 이전하고, `FestaBookAppGraph`를 통한 의존성 주입 구조를 개선했습니다.

- **MainActivity 및 DI 구조 리팩터링**
  - `MainActivity`에 집중되어 있던 `ViewModel` 생성 및 권한 요청 로직을 제거하고, `FestabookScreen`에서 `remember` 기반의 헬퍼 함수들을 사용하도록 변경했습니다.
  - `FestaBookAppGraph`에서 `NotificationPermissionManager`, `AppVersionManager` 등의 팩토리를 직접 제공하도록 수정하여 의존성 관리를 일원화했습니다.

- **플랫폼 관련 로직의 Composable 이관**
  - `rememberNotificationPermissionManager`: 알림 권한 상태에 따른 콜백(ViewModel 저장, 스낵바 표시 등)을 처리합니다.
  - `RememberDeepLinkHandler`: Intent를 통한 딥링크 이벤트를 감지하여 `NewsViewModel` 및 `MainViewModel`과 연동합니다.
  - `rememberAppVersionManager`, `rememberLocationSource` 등을 활용하여 `Activity` 의존성을 최소화했습니다.

- **네비게이션 및 ViewModel 주입 방식 개선**
  - `mainNavGraph`, `splashNavGraph`, `exploreNavGraph` 등에서 `ViewModel`을 직접 전달받는 대신 `appGraph`를 통해 필요한 시점에 `viewModel(factory = ...)`로 생성하도록 변경했습니다.
  - `MainScreen`에서 `SettingViewModel`과 `NotificationPermissionManager`를 연동하여 알림 설정 로직을 통합했습니다.

- **UI 및 상태 관리 개선**
  - `HomeScreen`에서 `SettingViewModel`의 이벤트를 구독하여 알림 권한 요청 및 성공 메시지 표시 로직을 구현했습니다.
  - `SnackBarManager`에 권한 거부 시 설정 화면 이동 기능을 포함한 `showPermissionDeniedSnackbar`를 추가했습니다.
  - `DeepLinkKeys`를 도입하여 딥링크 관련 상수 관리를 체계화했습니다.
딥링크를 통한 화면 이동 로직을 최상위 `FestabookScreen`에서 `MainScreen`으로 이전하고, `Activity` 종료 방식을 콜백 기반으로 구조화하여 제어 흐름을 개선했습니다.

- **딥링크 처리 로직 이전**:
    - `FestabookScreen`에 위치하던 `RememberDeepLinkHandler`와 관련 내비게이션 처리 함수(`handleNavigation`)를 `MainScreen`으로 이동했습니다.
    - 이를 통해 메인 화면 진입 시 공지사항 확장 및 뉴스 탭 이동 등의 딥링크 이벤트를 보다 적절한 생명주기 내에서 처리하도록 변경했습니다.

- **앱 종료 로직 개선**:
    - `MainActivity`에서 `finish()`를 호출하는 `onAppFinish` 콜백을 `FestabookScreen` 및 하위 내비게이션 그래프(`mainNavGraph`, `splashNavGraph`)로 전달하도록 수정했습니다.
    - 기존에 `festabookNavigator.popBackStack()`을 이용해 간접적으로 앱을 종료하던 방식을 명시적인 콜백 호출 방식으로 변경하여 안정성을 높였습니다.

- **기타 수정 사항**:
    - `MainActivity.newIntent` 호출 시 사용되는 플래그를 `FLAG_ACTIVITY_NEW_TASK` 및 `FLAG_ACTIVITY_CLEAR_TASK`로 변경하여 인텐트 발생 시 액티비티 스택을 초기화하도록 수정했습니다.
    - `FestabookScreen`에서 더 이상 직접 사용하지 않는 `NewsViewModel`과 `MainViewModel` 주입 로직을 제거했습니다.
@oungsi2000 oungsi2000 self-assigned this Mar 2, 2026
@oungsi2000 oungsi2000 added the Fix label Mar 2, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 2, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/60

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@etama123 etama123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

기존 버그가 잘 해결되었네요!
고생하셨습니다 ~!

Copy link
Contributor

@parkjiminnnn parkjiminnnn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen_recording_20260303_180017.mp4

Slack에서 언급했던 해당 내용만 확인 부탁드려요!
고생하셨습니다 밀러!

홈 화면의 첫 진입 다이얼로그에서 사용자가 알림 구독을 확인했을 때, 알림 설정 처리와 더불어 다이얼로그 표시 상태를 동기화하도록 로직을 개선했습니다.

- **`MainScreen.kt` 수정**:
    - `onSubscriptionConfirm` 콜백 내에 `mainViewModel.declineAlert()` 호출을 추가했습니다.
    - 이를 통해 사용자가 알림 구독을 승인하면 알림 설정(`settingViewModel`)이 업데이트됨과 동시에, 메인 뷰모델에서도 다이얼로그가 다시 표시되지 않도록 상태를 관리합니다.
@oungsi2000 oungsi2000 merged commit b1d5768 into develop Mar 3, 2026
3 checks passed
@oungsi2000 oungsi2000 deleted the fix/60 branch March 3, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants