Skip to content
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

Step1: 장바구니 목록 구성 #48

Open
wants to merge 7 commits into
base: ironelder
Choose a base branch
from

Conversation

ironelder
Copy link

  • 장바구니 목록 화면을 제작했습니다.

ironelder and others added 7 commits August 19, 2024 08:13
 - 상품을 가운데로 정렬
 - 각 상품간의 Space 적용
 - 상단의 TopBar 추가
 - Text의 Weight 및 가격에 자동으로 원을 붙이도록 추가
 - 이미지가 랜덤한 이미지가 나오도록 주소 값 변경
 - stringResource를 사용하기 위하여 string value를 추가하였습니다
 - 배경 색을 얻기 위한 Theme 컬러 얻어오는 부분 분리
 - stringResource 적용
 - 배경 및 글자에 테마 적용
 - 랜덤 이미지 주소 변경
 - Product의 가격을 Int로 변경
Copy link

@namjackson namjackson left a comment

Choose a reason for hiding this comment

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

안녕하세요 진혁님!
장바구니 미션 잘부탁드려요 :)
1단계 잘구현해주셨습니다!
몇가지 코멘트 남겼으니, 확인해주세요 :)

implementation("io.coil-kt:coil-compose:2.7.0")

//glide
implementation("com.github.bumptech.glide:compose:1.0.0-beta01")

Choose a reason for hiding this comment

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

glide compose는 아직 beta이군요, 평소에도 glide compose를 활용하시는 편이신가요?

그러나, 이번 과제에서는 glide를 사용하지 않는거 같아요 :)
지워주셔도 좋을거같네요!

import nextstep.shoppingcart.ui.theme.ShoppingCartTheme

class MainActivity : ComponentActivity() {
@OptIn(ExperimentalMaterial3Api::class)
override fun onCreate(savedInstanceState: Bundle?) {

Choose a reason for hiding this comment

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

onCreate가 너무 비대해졌네요!
컴포즈 관련된 코드는 분리해보면 어떨까요?

Comment on lines +43 to +56
val trustAllCerts = arrayOf<TrustManager>(object : X509TrustManager {
override fun checkClientTrusted(chain: Array<out X509Certificate>?, authType: String?) {}
override fun checkServerTrusted(chain: Array<out X509Certificate>?, authType: String?) {}
override fun getAcceptedIssuers(): Array<X509Certificate> = arrayOf()
})

val sslContext = SSLContext.getInstance("SSL").apply {
init(null, trustAllCerts, SecureRandom())
}

val okHttpClient = OkHttpClient.Builder()
.sslSocketFactory(sslContext.socketFactory, trustAllCerts[0] as X509TrustManager)
.hostnameVerifier { _, _ -> true }
.build()

Choose a reason for hiding this comment

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

ssl 관련 설정을 하신 이유가 있나요?
불필요해보이는거 같아요!


@OptIn(ExperimentalGlideComposeApi::class)
@Composable
fun ShoppingItemView(product: Product) {

Choose a reason for hiding this comment

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

기존 XML 기반에 View 와는 구분하기위해, 컴포즈에선 보통 ~View라고 네이밍 짓지 않고 있어요
View라는 네이밍 보다는 ShoppingItem만 사용하셔도 좋을거같아요!

Comment on lines +63 to +67
modifier = Modifier
.fillMaxWidth()
.wrapContentHeight()
.padding(5.dp)
.background(colorScheme.background),

Choose a reason for hiding this comment

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

ShoppingItemView에 Modifier를 파라미터로 넘겨주는것과
내부에 선언한것은 어떤 차이가 있을까요?
재활용이나 프리뷰 측면에서도 고민해봐도 좋을거같네요!

Comment on lines +78 to +79
onState = { state ->
when (state) {

Choose a reason for hiding this comment

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

onState를 사용하신 이유가 있을까요?
사용하지 않는 코드 같아요!

Greeting("Android")
Scaffold(
topBar = {
TopAppBar(

Choose a reason for hiding this comment

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

컴포넌트를 나누는 본인만의 규칙을 고민해보는건 어떨까요?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants