Skip to content

[Feature] 레거시 MainActivity를 NewMainActivity로 교체#1533

Merged
kongwoojin merged 15 commits into
developfrom
feature/1496-replace-main
Jul 17, 2026
Merged

[Feature] 레거시 MainActivity를 NewMainActivity로 교체#1533
kongwoojin merged 15 commits into
developfrom
feature/1496-replace-main

Conversation

@kongwoojin

@kongwoojin kongwoojin commented Jul 15, 2026

Copy link
Copy Markdown
Member

PR 개요

PR 체크리스트

  • Code convention을 잘 지켰나요?
  • Lint check를 수행하였나요?
  • Assignees를 추가했나요?

작업사항

  • 버그 수정
  • 신규 기능
  • 코드 스타일 수정 (포맷팅 등)
  • 리팩토링 (기능 수정 X, API 수정 X)
  • 기타

작업사항의 상세한 설명

  • 레거시 MainActivity와 NewMainActivity를 삭제하고, 새 메인 구현을 ui.main.activity.MainActivity로 교체했습니다.
  • 프로필 화면의 로그인 리다이렉트 딥링크를 koin://newmain/navigation → koin://main/navigation으로 수정했습니다.
  • 키워드 알림(koin://keyword?id=) 탭 시 ArticleActivity 대신 메인의 게시판 탭에서 게시글 상세가 열리도록 변경했습니다.
  • koin://article/navigation 딥링크 intent-filter를 ArticleActivity에서 MainActivity로 이전했습니다.
  • 게시판 탭에서 목록이 아닌 화면(상세/키워드/검색)에서는 바텀 내비게이션을 숨기도록 했습니다.
  • 비로그인시 설정 진입이 가능하도록 수정했습니다.

논의 사항

  • feature/article 삭제해야합니다.

스크린샷

추가내용

  • develop, sprint 브랜치를 향하고 있습니다
  • production 브랜치를 향하고 있습니다

Summary by CodeRabbit

  • 새로운 기능
    • 메인 화면 하단 내비게이션 연동이 정비되어 홈/카테고리/알림/프로필 이동이 더 일관됩니다.
    • 아티클 딥링크가 메인 화면을 통해 아티클 상세로 바로 연결됩니다.
    • 읽지 않은 알림 여부가 메인 화면에 반영됩니다.
  • 버그 수정
    • 비로그인 상태에서도 프로필의 설정 이동이 원활해지고, 필요할 때만 로그인 안내가 표시됩니다.
    • 앱 시작 및 외부 링크 이동 흐름을 메인 화면 중심으로 안정화했습니다.
  • 호환성/보안
    • 일부 아티클 화면의 외부 직접 호출 경로를 제한했습니다.

@kongwoojin kongwoojin self-assigned this Jul 15, 2026
@kongwoojin
kongwoojin requested a review from a team as a code owner July 15, 2026 20:02
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

기존 NewMainActivity와 아티클 액티비티 중심 흐름을 MainActivity 기반 하단 네비게이션으로 통합했습니다. 아티클 딥링크, 프래그먼트 패키지, 네비게이션 인자와 메인 뷰모델 구조가 함께 갱신되었습니다.

Changes

메인 네비게이션 통합

Layer / File(s) Summary
메인 액티비티와 진입 라우팅
koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt, koin/src/main/java/in/koreatech/koin/ui/splash/SplashActivity.kt, koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt, koin/src/main/java/in/koreatech/koin/navigation/SchemeType.kt, feature/article/src/main/AndroidManifest.xml, koin/src/main/AndroidManifest.xml
MainActivity가 하단 네비게이션과 아티클 딥링크를 처리하며, Splash 및 드로어의 아티클 진입이 MainActivity로 전달됩니다. ArticleActivity는 외부에 노출되지 않습니다.
네비게이션 그래프와 프래그먼트 계약
koin/src/main/res/navigation/nav_graph_main.xml, koin/src/main/java/in/koreatech/koin/ui/main/fragment/*
프래그먼트 경로를 ui.main으로 변경하고, ArticleFragment에 fragment 유형·아티클 ID·보드 ID 인자를 추가했습니다.
메인 뷰모델 상태 통합
koin/src/main/java/in/koreatech/koin/ui/main/viewmodel/MainActivityViewModel.kt
메인 뷰모델의 의존성을 축소하고 읽지 않은 알림 상태, 디바이스 토큰 갱신 및 하단 네비게이션 표시 상태를 추가했습니다.
프로필 딥링크와 설정 이동
feature/home/src/main/java/in/koreatech/koin/feature/home/profile/*
프로필 딥링크 상수명을 변경하고, 비로그인 상태에서도 설정 이동 콜백을 호출하도록 변경했습니다.
정적 분석 기준 갱신
koin/detekt-baseline.xml
변경된 클래스의 Detekt baseline 항목을 갱신했습니다.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SplashActivity
  participant MainActivity
  participant NavController
  participant ArticleFragment
  SplashActivity->>MainActivity: koin://article/navigation 전달
  MainActivity->>NavController: 아티클 목적지와 인자 전달
  NavController->>ArticleFragment: ArticleFragment 표시
  ArticleFragment->>NavController: 상세 또는 키워드 화면 이동
Loading

Possibly related PRs

Suggested labels: koin project, refactor

Suggested reviewers: ttrr1007, jaeyoung290, kym-p

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.76% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ⚠️ Warning 제목은 MainActivity를 NewMainActivity로 교체했다고 말하지만, 실제로는 둘을 통합해 ui.main.activity.MainActivity로 옮기는 변경입니다. 제목을 '레거시 MainActivity와 NewMainActivity를 ui.main.activity.MainActivity로 통합'처럼 실제 변경을 반영하게 수정하세요.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/1496-replace-main

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.

@bcsd-b-bot bcsd-b-bot Bot added the ci:passed label Jul 16, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
koin/src/main/java/in/koreatech/koin/ui/splash/SplashActivity.kt (1)

209-223: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

외부 딥링크 진입 시 게시글 ID 유실 문제 수정

현재 코드는 하드코딩된 "koin://article/navigation".toUri() 만을 사용하여 MainActivity로 인텐트를 전달하고 있습니다.
이로 인해 사용자가 외부(예: 웹)에서 특정 게시글 딥링크를 탭하여 진입한 경우, 기존 intent.data에 존재하던 id 값이 유실되어 게시글 상세 화면으로 이동하지 않고 게시판 목록에 머무르는 버그가 발생합니다. 원본 URI에서 id를 추출하여 새 딥링크에 article_idfragment 파라미터로 함께 구성해 주어야 합니다.

🐛 제안하는 수정안
     private fun gotoArticleActivityOrDelay(state: TokenState) {
         lifecycleScope.launch {
             delay()
             val intent = Intent(this@SplashActivity, MainActivity::class.java).apply {
-                data = "koin://article/navigation".toUri()
+                val articleId = this@SplashActivity.intent.data?.getQueryParameter("id")
+                val uriBuilder = Uri.parse("koin://article/navigation").buildUpon()
+                if (articleId != null) {
+                    uriBuilder.appendQueryParameter("fragment", "article_detail")
+                    uriBuilder.appendQueryParameter("article_id", articleId)
+                }
+                data = uriBuilder.build()
             }
             startActivity(intent)
             overridePendingTransition(R.anim.fade, R.anim.hold)
🤖 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 `@koin/src/main/java/in/koreatech/koin/ui/splash/SplashActivity.kt` around
lines 209 - 223, Update gotoArticleActivityOrDelay so the MainActivity intent
preserves an external article deep link: extract the original intent.data id,
then include it as the article_id and fragment parameters when constructing the
koin://article/navigation URI. Keep the existing navigation behavior for links
without an id and continue using the resulting URI as the intent data.
🧹 Nitpick comments (4)
koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt (1)

642-645: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

String.toUri() 확장 함수 사용 권장

SonarCloud 정적 분석의 제안과 같이, 코틀린 환경에서의 가독성을 높이기 위해 Uri.parse() 대신 KTX 확장 함수인 .toUri() 사용을 고려해 보세요. (참고: SplashActivity에서는 이미 .toUri()를 일관되게 사용하고 있습니다)

✨ 제안하는 수정안
-        val intent = Intent(Intent.ACTION_VIEW).apply {
-            data = Uri.parse("koin://article/navigation")
-            `package` = packageName
-        }
+        val intent = Intent(Intent.ACTION_VIEW).apply {
+            data = "koin://article/navigation".toUri()
+            `package` = packageName
+        }
🤖 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
`@koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt`
around lines 642 - 645, Update the Intent construction in
KoinNavigationDrawerActivity to replace Uri.parse with the Kotlin KTX
String.toUri() extension for the article navigation URI, preserving the existing
URI value and packageName assignment.

Source: Linters/SAST tools

koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt (1)

76-80: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

권한 결과 처리 조건문의 역전된 논리 주석 수정

permissionGrantedfalse인 경우(권한 거부됨) if (!permissionGranted) 조건은 true가 되어 해당 블록이 실행됩니다. 그러나 주석은 handle permission granted(권한 허용됨)로 역전되어 작성되어 있습니다. 혼동을 방지하기 위해 긍정문으로 수정하거나 주석을 올바르게 변경해 주세요.

💡 제안하는 수정안
-            if (!permissionGranted) {
-                // handle permission granted
-            } else {
-                // handle permission denied
-            }
+            if (permissionGranted) {
+                // handle permission granted
+            } else {
+                // handle permission denied
+            }
🤖 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 `@koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt` around
lines 76 - 80, Correct the permission-result comments in the conditional around
permissionGranted: the !permissionGranted branch must describe denied
permission, while the else branch must describe granted permission. Keep the
existing condition and control flow unchanged.
koin/src/main/java/in/koreatech/koin/ui/main/viewmodel/MainActivityViewModel.kt (1)

53-57: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low value

CancellationException 처리 추가 권장

코루틴 내에서 Exception을 포괄적으로 catch하면 코루틴 취소 시 발생하는 CancellationException까지 무시하게 될 수 있습니다. 구조화된 동시성(Structured Concurrency)을 유지하기 위해 CancellationException은 다시 던지도록(rethrow) 처리하는 것을 권장합니다.

♻️ 제안하는 수정안
             try {
                 updateDeviceTokenUseCase()
             } catch (e: Exception) {
+                if (e is CancellationException) throw e
                 Timber.e("Failed Update Fcm Token : ${e.message}")
             }
🤖 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
`@koin/src/main/java/in/koreatech/koin/ui/main/viewmodel/MainActivityViewModel.kt`
around lines 53 - 57, Update the exception handling around
updateDeviceTokenUseCase in MainActivityViewModel so CancellationException is
caught separately and rethrown, while retaining the existing Timber.e logging
for other exceptions.
koin/src/main/java/in/koreatech/koin/ui/main/fragment/ArticleFragment.kt (1)

96-96: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

뷰모델을 통한 바텀 네비게이션 가시성 제어 권장

현재 (activity as? MainActivity)로 액티비티에 직접 접근하여 바텀 네비게이션을 제어하고 있습니다. 프래그먼트와 액티비티 간의 결합도를 낮추기 위해, 공유 뷰모델(MainActivityViewModel)에 가시성 상태를 두고 액티비티에서 이를 관찰하여 제어하는 방식을 권장합니다.

🤖 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 `@koin/src/main/java/in/koreatech/koin/ui/main/fragment/ArticleFragment.kt` at
line 96, Update ArticleFragment’s bottom-navigation visibility flow to stop
calling MainActivity.setBottomNavigationVisible directly. Store the
isArticleList visibility state in the shared MainActivityViewModel, then have
MainActivity observe that state and control the bottom navigation accordingly,
preserving the existing visibility behavior.
🤖 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 `@koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt`:
- Line 158: Override MainActivity.onNewIntent to receive intents delivered while
the existing activity instance is running, call setIntent with the new intent,
and invoke the existing handleIntent flow so deep links and push notifications
trigger the same navigation as onCreate.
- Around line 108-115: Update the bottom navigation listener setup around
setupWithNavController and setOnItemSelectedListener so reselect events
explicitly invoke the same navigation logging flow. Override
setOnItemReselectedListener while preserving the default NavController reselect
behavior, including popUpTo and state restoration, and avoid duplicating or
bypassing the existing navigation handling.

---

Outside diff comments:
In `@koin/src/main/java/in/koreatech/koin/ui/splash/SplashActivity.kt`:
- Around line 209-223: Update gotoArticleActivityOrDelay so the MainActivity
intent preserves an external article deep link: extract the original intent.data
id, then include it as the article_id and fragment parameters when constructing
the koin://article/navigation URI. Keep the existing navigation behavior for
links without an id and continue using the resulting URI as the intent data.

---

Nitpick comments:
In `@koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt`:
- Around line 76-80: Correct the permission-result comments in the conditional
around permissionGranted: the !permissionGranted branch must describe denied
permission, while the else branch must describe granted permission. Keep the
existing condition and control flow unchanged.

In `@koin/src/main/java/in/koreatech/koin/ui/main/fragment/ArticleFragment.kt`:
- Line 96: Update ArticleFragment’s bottom-navigation visibility flow to stop
calling MainActivity.setBottomNavigationVisible directly. Store the
isArticleList visibility state in the shared MainActivityViewModel, then have
MainActivity observe that state and control the bottom navigation accordingly,
preserving the existing visibility behavior.

In
`@koin/src/main/java/in/koreatech/koin/ui/main/viewmodel/MainActivityViewModel.kt`:
- Around line 53-57: Update the exception handling around
updateDeviceTokenUseCase in MainActivityViewModel so CancellationException is
caught separately and rethrown, while retaining the existing Timber.e logging
for other exceptions.

In
`@koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt`:
- Around line 642-645: Update the Intent construction in
KoinNavigationDrawerActivity to replace Uri.parse with the Kotlin KTX
String.toUri() extension for the article navigation URI, preserving the existing
URI value and packageName assignment.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 329e7acf-bfe0-44a8-a387-05755c63ebe4

📥 Commits

Reviewing files that changed from the base of the PR and between 3319538 and 59b2053.

📒 Files selected for processing (18)
  • feature/article/src/main/AndroidManifest.xml
  • feature/home/src/main/java/in/koreatech/koin/feature/home/profile/Constant.kt
  • feature/home/src/main/java/in/koreatech/koin/feature/home/profile/ProfileScreen.kt
  • koin/detekt-baseline.xml
  • koin/src/main/AndroidManifest.xml
  • koin/src/main/java/in/koreatech/koin/navigation/SchemeType.kt
  • koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt
  • koin/src/main/java/in/koreatech/koin/ui/main/fragment/ArticleFragment.kt
  • koin/src/main/java/in/koreatech/koin/ui/main/fragment/CategoryFragment.kt
  • koin/src/main/java/in/koreatech/koin/ui/main/fragment/HomeFragment.kt
  • koin/src/main/java/in/koreatech/koin/ui/main/fragment/NotificationFragment.kt
  • koin/src/main/java/in/koreatech/koin/ui/main/fragment/ProfileFragment.kt
  • koin/src/main/java/in/koreatech/koin/ui/main/viewmodel/MainActivityViewModel.kt
  • koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt
  • koin/src/main/java/in/koreatech/koin/ui/newmain/ArticleHostViewModel.kt
  • koin/src/main/java/in/koreatech/koin/ui/newmain/NewMainActivity.kt
  • koin/src/main/java/in/koreatech/koin/ui/splash/SplashActivity.kt
  • koin/src/main/res/navigation/nav_graph_main.xml
💤 Files with no reviewable changes (2)
  • koin/src/main/java/in/koreatech/koin/ui/newmain/ArticleHostViewModel.kt
  • koin/src/main/java/in/koreatech/koin/ui/newmain/NewMainActivity.kt

@bcsd-b-bot bcsd-b-bot Bot added ci:passed and removed ci:passed labels Jul 16, 2026
Comment thread koin/src/main/java/in/koreatech/koin/ui/main/fragment/ArticleFragment.kt Outdated
Comment thread koin/src/main/java/in/koreatech/koin/ui/main/fragment/ArticleFragment.kt Outdated
@github-actions
github-actions Bot requested a review from KYM-P July 16, 2026 14:23

@KYM-P KYM-P left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

오.. article 이동 구현까지...

@JaeYoung290 JaeYoung290 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

수고 많으셨습니다.

@sonarqubecloud

Copy link
Copy Markdown

@kongwoojin
kongwoojin merged commit 18487b8 into develop Jul 17, 2026
24 checks passed
@kongwoojin
kongwoojin deleted the feature/1496-replace-main branch July 17, 2026 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants