Repository navigation
refactor(receiver): 수신자 홈의 afternote 리소스 차용 해소 — 아이콘 core:ui 승격 (#926) #1061
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
89ddb2a
9bbf52c
84480a3
472f1be
6871ccf
69e88d4
3640732
4627bec
3b11d3b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package com.afternote.core.ui.icon | ||
|
|
||
| import androidx.annotation.DrawableRes | ||
| import com.afternote.core.ui.R | ||
|
|
||
| /** | ||
| * 애프터노트 **종류** 아이콘의 core 정본 (#926). | ||
| * | ||
| * 수신자 홈이 이 아이콘을 쓰는데, 종전에는 `feature:afternote:presentation` 의 `R` 을 직접 | ||
| * 빌려 왔다. 형제 feature 의 리소스를 가로지르는 참조라 두 모듈이 리소스 수준에서 묶인다. | ||
| * | ||
| * 종류는 도메인 개념이지만 **아이콘 선택은 표현**이라, 화면 사이에 오가는 값은 res id 가 | ||
| * 아니라 이 enum 이다. ViewModel 이 res id 를 들면 상태가 Android 리소스에 묶여 | ||
| * 단위 테스트에서도 리소스가 필요해진다. | ||
| */ | ||
| enum class AfternoteSourceIcon( | ||
| @param:DrawableRes val drawableResId: Int, | ||
| ) { | ||
| SocialNetwork(R.drawable.core_ui_afternote_social_pattern), | ||
| GalleryAndFiles(R.drawable.core_ui_afternote_gallery_pattern), | ||
| Memorial(R.drawable.core_ui_afternote_memorial_guideline), | ||
|
|
||
| /** 위 셋으로 갈리지 않는 종류 — 로고로 받는다. */ | ||
| Other(R.drawable.core_ui_afternote_logo), | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,8 +2,8 @@ package com.afternote.feature.receiver.presentation.home | |
|
|
||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import com.afternote.core.ui.icon.AfternoteSourceIcon | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [blocking] 같은 위반이 이 파일에도 있습니다 — import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import com.afternote.core.ui.icon.AfternoteSourceIcon
import com.afternote.core.ui.theme.AfternoteTheme
import com.afternote.feature.receiver.presentation.home.model.MindRecordSummary두 파일 다
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [blocking] (직전 리뷰 4번 — 아직 그대로입니다) import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import com.afternote.core.ui.icon.AfternoteSourceIcon
import com.afternote.core.ui.theme.AfternoteTheme
import com.afternote.feature.receiver.presentation.home.model.MindRecordSummary |
||
| import com.afternote.core.ui.theme.AfternoteTheme | ||
| import com.afternote.feature.receiver.presentation.home.model.AfternoteSourceIcon | ||
| import com.afternote.feature.receiver.presentation.home.model.MindRecordSummary | ||
| import com.afternote.feature.receiver.presentation.home.model.ReceiverHomeUiState | ||
| import com.afternote.feature.receiver.presentation.home.model.SenderMessage | ||
|
|
@@ -50,7 +50,7 @@ internal fun receiverHomeScreenSuccessScreenshot() { | |
| afternoteTotalCount = 5, | ||
| afternoteIcons = | ||
| listOf( | ||
| AfternoteSourceIcon(drawableResId = com.afternote.core.ui.R.drawable.core_ui_ic_tabler_search), | ||
| AfternoteSourceIcon.SocialNetwork, | ||
| ), | ||
| ), | ||
| onEvent = {}, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,8 +5,8 @@ import androidx.compose.runtime.Composable | |
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.compose.ui.unit.dp | ||
| import com.afternote.core.ui.icon.AfternoteSourceIcon | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [blocking] 이 import 가
import com.afternote.core.ui.icon.AfternoteSourceIcon
import com.afternote.core.ui.theme.AfternoteTheme(위반 위치가 |
||
| import com.afternote.core.ui.theme.AfternoteTheme | ||
| import com.afternote.feature.receiver.presentation.home.model.AfternoteSourceIcon | ||
| import com.android.tools.screenshot.PreviewTest | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [blocking] (직전 리뷰 4번 — 아직 그대로입니다) 같은 위반이 이 파일에도 남아 있습니다. import androidx.compose.ui.unit.dp
import com.afternote.core.ui.icon.AfternoteSourceIcon
import com.afternote.core.ui.theme.AfternoteTheme
import com.android.tools.screenshot.PreviewTest(ktlint 가 위반 위치를 |
||
|
|
||
| @PreviewTest | ||
|
|
@@ -18,8 +18,8 @@ internal fun afternoteSectionScreenshot() { | |
| totalCount = 5, | ||
| icons = | ||
| listOf( | ||
| AfternoteSourceIcon(drawableResId = com.afternote.core.ui.R.drawable.core_ui_ic_tabler_search), | ||
| AfternoteSourceIcon(drawableResId = com.afternote.core.ui.R.drawable.core_ui_ic_link), | ||
| AfternoteSourceIcon.SocialNetwork, | ||
| AfternoteSourceIcon.GalleryAndFiles, | ||
| ), | ||
| onGoClick = {}, | ||
| modifier = Modifier.padding(16.dp), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| package com.afternote.konsist | ||
|
|
||
| import com.lemonappdev.konsist.api.Konsist | ||
| import com.lemonappdev.konsist.api.ext.list.withPackage | ||
| import com.lemonappdev.konsist.api.verify.assertFalse | ||
| import org.junit.Test | ||
|
|
||
| /** | ||
| * 수신자 홈이 형제 feature 의 리소스를 빌려 쓰지 않는지 (#926). | ||
| * | ||
| * 종전에는 수신자 홈이 `feature:afternote:presentation` 의 `R` 을 직접 import 해 소셜 패턴 | ||
| * 아이콘을 그렸다. 리소스는 모듈 경계를 가장 조용히 넘는 의존이다 — 컴파일은 되고, | ||
| * 그림도 뜨고, 다른 모듈이 리소스를 지우거나 이름을 바꿀 때에야 드러난다. | ||
| * | ||
| * 아이콘의 정본은 `core:ui` 이고, 화면 사이에 오가는 값은 res id 가 아니라 | ||
| * `AfternoteSourceIcon` 이다. | ||
| */ | ||
| class ReceiverHomeResourceKonsistTest { | ||
| @Test | ||
| fun `수신자 홈은 다른 feature 의 R 을 참조하지 않는다`() { | ||
| Konsist | ||
| .scopeFromProject() | ||
| .files | ||
| .withPackage("com.afternote.feature.receiver.presentation.home..") | ||
| .assertFalse { file -> | ||
| file.imports.any { import -> FOREIGN_FEATURE_RESOURCE.matches(import.name) } || | ||
| // import 만 보면 FQN 참조가 그대로 빠져나간다 — 이 패키지의 screenshotTest 가 | ||
| // 실제로 `com.afternote.core.ui.R.drawable.…` 를 FQN 으로 쓰는 손버릇이라, | ||
| // 같은 손버릇으로 형제 feature 의 R 을 쓰면 가드가 침묵한다. 본문도 본다. | ||
| FOREIGN_FEATURE_RESOURCE_REFERENCE.containsMatchIn(file.text) | ||
| } | ||
| } | ||
|
|
||
| private companion object { | ||
| /** 수신자 자신이 아닌 feature 의 `R` (또는 그 하위 참조). */ | ||
| val FOREIGN_FEATURE_RESOURCE = | ||
| Regex("""^com\.afternote\.feature\.(?!receiver\.)[a-z]+\.presentation\.R(\..*)?$""") | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [normal] 가드가 import 문만 봅니다( // 이건 잡힌다
import com.afternote.feature.afternote.presentation.R as AfternoteFeatureR
// 이건 안 잡힌다 — import 가 없다
painterResource(com.afternote.feature.afternote.presentation.R.drawable.feature_afternote_img_logo)가정이 아니라 이 모듈에 이미 있는 코드 습관입니다 — 같은 패키지의 screenshotTest 두 파일이 지금도
|
||
|
|
||
| /** 같은 참조를 본문 어디서든 — FQN 으로 쓴 자리를 잡는다. 주석·문자열 오탐은 감수한다. */ | ||
| val FOREIGN_FEATURE_RESOURCE_REFERENCE = | ||
| Regex("""com\.afternote\.feature\.(?!receiver\.)[a-z]+\.presentation\.R\.""") | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[blocking] 이 타입이
feature:receiver:presentation의home.model에서 여기로 올라오면서 같은 모듈의 screenshotTest 소스셋이 따라오지 않았습니다.data class(drawableResId)→enum이라 import 경로뿐 아니라 생성자 호출도 함께 바뀌어야 하는데, 그쪽은 옛 형태 그대로입니다.본문 검증 목록이
assembleDebug·testDebugUnitTest·konsist:test로 끝나 screenshotTest 소스셋만 컴파일 범위 밖에 있었던 것으로 보입니다. 이 모듈은enableScreenshotTest가 켜져 있어 소스셋이 하나 더 있습니다 — 타입을 옮길 때는:feature:receiver:presentation:compileDebugScreenshotTestKotlin까지 걸어 두시면 같은 누락이 다시 안 납니다.