Skip to content

Conversation

@sport0102
Copy link

No description provided.

@sport0102 sport0102 added the Review Needed 리뷰어의 리뷰가 필요한 경우 label Dec 19, 2019
@sport0102 sport0102 changed the title 리뷰 부탁드립니당! HW-1 RxJava 로 네이버 영화검색 앱 만들기 Dec 20, 2019
Copy link

@preludezdev preludezdev left a comment

Choose a reason for hiding this comment

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

안녕하세요 선민님,
부족하지만 열심히 리뷰 해봤습니다.
저도 모르는 부분이 많아 나머지 궁금한점은 스터디 때 같이 얘기해보면 좋을 것 같아요 :D

@sport0102 sport0102 changed the title HW-1 RxJava 로 네이버 영화검색 앱 만들기 코인 앱 만들기 Feb 8, 2020
Copy link

@preludezdev preludezdev left a comment

Choose a reason for hiding this comment

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

안녕하세요 선민님
부족하지만... 일단 보면서 바로 보이는 것들만 리뷰 달아보았습니다
나머지는 우석님께 맡길게요.
그럼 내일 뵐게요~~
(내일 코루틴 세미나 기대할게요 :D)

Comment on lines 20 to 24
/**
* Returns the content, even if it's already been handled.
*/
fun peekContent(): T = content
} No newline at end of file

Choose a reason for hiding this comment

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

Event 클래스 아래에

/**
 * An [Observer] for [Event]s, simplifying the pattern of checking if the [Event]'s content has
 * already been handled.
 *
 * [onEventUnhandledContent] is *only* called if the [Event]'s contents has not been handled.
 */
class EventObserver<T>(private val onEventUnhandledContent: (T) -> Unit) : Observer<Event<T>> {
    override fun onChanged(event: Event<T>?) {
        event?.getContentIfNotHandled()?.let {
            onEventUnhandledContent(it)
        }
    }
}

추가하시면 데이터 옵저빙할 때 getContentIfNotHandled() 안쓰고 더 간편하게 코드 작성하실 수 있을거에요 :)

Copy link
Author

Choose a reason for hiding this comment

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

42a1d75
완료

Comment on lines 1 to 10
package com.study.myapplication.api

import com.study.myapplication.api.model.BithumbTickerResponse
import retrofit2.http.GET

interface BithumbApi {

@GET("public/ticker/all_krw")
suspend fun getTickerInfo(): BithumbTickerResponse
} No newline at end of file

Choose a reason for hiding this comment

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

api 패키지는 데이터 레이어 안으로 넣으셔도 될거같아요 :)

Copy link
Author

Choose a reason for hiding this comment

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

03e4616
완료

Comment on lines 1 to 13
package com.study.myapplication.base

import android.os.Bundle
import android.widget.Toast
import androidx.annotation.LayoutRes
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.lifecycle.ViewModel
import com.study.myapplication.BR


abstract class BaseActivity<B : ViewDataBinding, VM : ViewModel>(

Choose a reason for hiding this comment

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

마찬가지로 Base 패키지는 프레젠테이션 안으로 넣어주셔도 좋을거 같아요

Copy link
Author

@sport0102 sport0102 Feb 9, 2020

Choose a reason for hiding this comment

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

9b41bf2
완료

Comment on lines 1 to 16
package com.study.myapplication.di

import com.study.myapplication.feature.compare.CompareCoinViewModel
import org.koin.androidx.viewmodel.dsl.viewModel
import org.koin.dsl.module

fun getAppModule() = module {
viewModel {
CompareCoinViewModel(
get(),
get(),
get(),
get()
)
}
} No newline at end of file
Copy link

@preludezdev preludezdev Feb 8, 2020

Choose a reason for hiding this comment

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

지금은 레이어 분리를 모듈단위가 아니고 패키지 단위로 하고 있어서 di 가 하나에 다 있는데 공부하는 거니까 패키지로 분리하더라도 di 는 각 레이어 패키지마다 있으면 좋을 것 같습니다

Copy link
Author

Choose a reason for hiding this comment

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

b92296b
완료

Comment on lines 1 to 15
package com.study.myapplication.ext

import android.widget.ImageView
import androidx.databinding.BindingAdapter
import com.bumptech.glide.Glide


@BindingAdapter("bind:imageUrl")
fun ImageView.bindImageUrl(imageUrl: String?) {
imageUrl?.let {
Glide.with(this.context)
.load(it)
.into(this)
}
} No newline at end of file

Choose a reason for hiding this comment

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

마찬가지로 ext 패키지도 프레젠테이션 레이어로 고고

Copy link
Author

Choose a reason for hiding this comment

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

ae80fce
완료

Comment on lines 1 to 11
package com.study.myapplication.feature.compare

import android.os.Bundle
import androidx.lifecycle.Observer
import com.study.myapplication.R
import com.study.myapplication.base.BaseActivity
import com.study.myapplication.databinding.ActivityCompareCoinBinding
import org.koin.androidx.viewmodel.ext.android.viewModel

class CompareCoinActivity :
BaseActivity<ActivityCompareCoinBinding, CompareCoinViewModel>(R.layout.activity_compare_coin) {

Choose a reason for hiding this comment

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

이 패키지는 프레젠테이션 레이어가 되면 될거같아요

Copy link
Author

Choose a reason for hiding this comment

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

435468b
완료

Comment on lines 1 to 6
package com.study.myapplication.utils

import kotlin.math.abs

object StringUtil {

Choose a reason for hiding this comment

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

모듈단위로 분리했다고 가정하면 유틸을 모아둔 패키지도 각 레이어마다 있게 될거같아요

Copy link
Author

Choose a reason for hiding this comment

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

b598a32
완료

Comment on lines 17 to 32
package com.study.myapplication.data.source

import com.study.myapplication.domain.entity.Market
import com.study.myapplication.domain.entity.Ticker

interface CoinRepository {

suspend fun getUpbitMarket(): List<Market>

suspend fun getUpbitCoin(marketList: List<Market>): Map<String, Ticker>

suspend fun getBithumbCoin(): Map<String, Ticker>

suspend fun getCoinOneCoin(): Map<String, Ticker>

} No newline at end of file

Choose a reason for hiding this comment

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

레포지토리 인터페이스는 도메인 레이어에 있어야됩니당
(지금은 자기자신만 알아야할 도메인이 데이터 레이어에 있는 인터페이스를 알고있는 구조에요)
image

Copy link
Author

@sport0102 sport0102 Feb 9, 2020

Choose a reason for hiding this comment

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

9470fe5
완료

NackUn pushed a commit to NackUn/RxJavaStudy that referenced this pull request Feb 8, 2020
GongSulMin(공설민) 공간입니다.
@wswon wswon self-requested a review February 8, 2020 18:23
setupKoin(
this,
getNetworkModule(
"https://api.upbit.com",
Copy link
Contributor

Choose a reason for hiding this comment

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

상수나 string resource로 사용하면 좀 더 좋지 않을까요?

Copy link
Author

Choose a reason for hiding this comment

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

ad79f3d
완료

binding.run(action)
}

fun toastM(message: String) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fun toastM(message: String) {
protected fun toastM(message: String) {

상속하는 activity에서만 접근하는 함수라면 이렇게 제한해주면 좀 더 좋지않을까 생각해봤습니다!

Copy link
Author

Choose a reason for hiding this comment

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

1b06fb5
완료

Comment on lines 32 to 39
single(named("upbitApi")) {
Retrofit.Builder()
.client(get())
.addConverterFactory(get())
.baseUrl(upbitUrl)
.build()
.create(UpbitApi::class.java)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

    single<UpbitApi> {
        Retrofit.Builder()
            .client(get())
            .addConverterFactory(get())
            .baseUrl(upbitUrl)
            .build()
            .create(UpbitApi::class.java)
    }

매번 name으로 접근하는 것 보다는 타입을 지정해서 접근한다면,
get할때 name을 넣어주지 않아도 되도록 만들 수 있지 않을까 생각합니다.

Copy link
Author

Choose a reason for hiding this comment

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

Retrofit도 잘라서 만들 것

Copy link
Author

Choose a reason for hiding this comment

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

05eebd8
완료

package com.study.myapplication.feature.compare.model

data class CompareCoinInfo(
var coinName: String? = null,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
var coinName: String? = null,
val coinName: String = "",

not null type을 사용하는게 좀 더 좋지 않을까요?

Copy link
Author

Choose a reason for hiding this comment

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

6861f30
완료

Comment on lines 56 to 63
val upbitTickerList = try {
upbitTickerList.await()
} catch (e: Exception) {
Log.d("CompareCoinViewModel", "${e.message}")
_isDataLoadingError.value = Event("업비트 데이터 로딩 에러 발생" to true)
_isDataLoading.value = false
mapOf<String, Ticker>()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Exception에 대한 handling을 try ~ catch 를 통해 viewmodel 에서 보다는 model에서 하고,
결과를 내려받는 것이 역할에 맞는것이 아닐까? 하고 생각해봤습니다.
viewmodel 에서 데이터를 로딩하는 것에 대한 판단을 하고있는 것으로 보여서요

Copy link
Author

Choose a reason for hiding this comment

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

repository에 있으면 좋겠다

Copy link
Author

Choose a reason for hiding this comment

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

Result 클래스로 리턴을 받아라

Copy link
Author

Choose a reason for hiding this comment

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

entity에는 id를 넣어라 UUID.Rand~~ 함수를 하면된다

Copy link
Author

Choose a reason for hiding this comment

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

이거는 좀 적용하는데 시간이 걸릴 것 같습니다 추후에 적용해서 다시 올리겠습니다

Comment on lines 83 to 90
_coinList.postValue(
getCompareCoinList(
upbitTickerList,
bithumbTickerList,
coinOneTickerList
)
)
_isDataLoading.value = false
Copy link
Contributor

Choose a reason for hiding this comment

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

이부분에서 아래의 _isDataLoading.value 에서는 postValue가 아닌 value를 사용하고 있는데
그렇다면 위의 _coinList도 value로 처리해도 되지않을까요?

Copy link
Author

Choose a reason for hiding this comment

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

5eeaa7f
완료

Copy link
Contributor

@wswon wswon left a comment

Choose a reason for hiding this comment

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

부족하지만 리뷰 남겨보았습니다 🤗

@wswon wswon added Answer Needed PR담당자의 응답이 필요한 경우 and removed Review Needed 리뷰어의 리뷰가 필요한 경우 labels Feb 8, 2020
@sport0102 sport0102 added Review Needed 리뷰어의 리뷰가 필요한 경우 and removed Answer Needed PR담당자의 응답이 필요한 경우 labels Feb 9, 2020
Copy link
Contributor

@wswon wswon left a comment

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

Review Needed 리뷰어의 리뷰가 필요한 경우

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants