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

Week4 essential #9

Open
wants to merge 55 commits into
base: develop
Choose a base branch
from
Open

Week4 essential #9

wants to merge 55 commits into from

Conversation

1971123-seongmin
Copy link
Contributor

@1971123-seongmin 1971123-seongmin commented Nov 13, 2024

Related issue ๐Ÿ› 

Work Description โœ๏ธ

  • ์„œ๋ฒ„ ์ฃผ์†Œ ์ˆจ๊ธฐ๊ธฐ ์ˆจ๊ธฐ๊ธฐ
  • ์„œ๋ฒ„ ํ†ต์‹  ์„ธํŒ… (DI, Clean Architecture)
  • Token Interceptor (DataStore)
  • ์œ ์ € ๋“ฑ๋ก API ๊ตฌํ˜„
    • ํšŒ์›๊ฐ€์ž… ๋ทฐ ๊ตฌ์กฐ ๋ณ€๊ฒฝ(์ด๋ฉ”์ผ, ๋น„๋ฐ€๋ฒˆํ˜ธ -> username, password, hobby ์ž…๋ ฅํ•˜๋Š” ๊ตฌ์กฐ๋กœ ๋ณ€๊ฒฝ)
    • username, password, hobby๊ฐ€ ์กฐ๊ฑด์„ ๋งŒ์กฑํ•˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ(8์ž ์ดˆ๊ณผ์ธ ๊ฒฝ์šฐ) ํ† ์ŠคํŠธ ๋ฉ”์‹œ์ง€ ํ‘œ์‹œ
  • ๋กœ๊ทธ์ธ API ๊ตฌํ˜„
    • ๋กœ๊ทธ์ธ ๋ทฐ ๊ตฌ์กฐ ๋ณ€๊ฒฝ(์ด๋ฉ”์ผ, ๋น„๋ฐ€๋ฒˆํ˜ธ -> username, password ๋ฐ›๋Š” ๊ตฌ์กฐ๋กœ ๋ณ€๊ฒฝ)
    • (8์ž ์ดˆ๊ณผ์ธ ๊ฒฝ์šฐ) ํ† ์ŠคํŠธ ๋ฉ”์‹œ์ง€ ํ‘œ์‹œ
    • ๋กœ๊ทธ์ธ ์„ฑ๊ณต ์‹œ ์‘๋‹ต์œผ๋กœ ๋ฐ›๋Š” token๊ฐ’ ์ €์žฅ (ํ—ค๋”์— ์ธํ„ฐ์…‰ํ„ฐ๋กœ ๋„ฃ์Œ)
    • ๋กœ๊ทธ์ธ ์‹คํŒจ, ์„ฑ๊ณต ์•ˆ๋‚ด ํ† ์ŠคํŠธ ๋ฉ”์‹œ์ง€ ํ‘œ์‹œ
  • ๋‚ด ์ทจ๋ฏธ ์กฐํšŒ API ๊ตฌํ˜„
    • MY ๋ทฐ ๊ตฌ์กฐ ๋ณ€๊ฒฝ(์ด๋ฉ”์ผ -> ์ทจ๋ฏธ ํ‘œ์‹œ)

Screenshot ๐Ÿ“ธ

Toast ๋ฉ”์‹œ์ง€

Toast Message Screenshot

์ „์ฒด ์‹คํ–‰ ์˜์ƒ

Full Execution Video Screenshot

Uncompleted Tasks ๐Ÿ˜…

  • MVI ๊ตฌ์กฐ ์ ์šฉ

To Reviewers ๐Ÿ“ข

  • ๋กœ๊ทธ์ธ, ํšŒ์›๊ฐ€์ž… ํŽ˜์ด์ง€ MVI ์ ์šฉ
    • ๋‚˜๋จธ์ง€ ํ™”๋ฉด๋„ ์ถ”ํ›„ ์ ์šฉํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.
  • ํ˜„์žฌ ๋„ค๋น„๊ฒŒ์ด์…˜ ๋ฐฑ์Šคํƒ ๊ด€๋ฆฌ๊ฐ€ ์•ˆ๋˜์„œ ์ด ๋ถ€๋ถ„ ์ˆ˜์ •ํ•  ์˜ˆ์ •์ž…๋‹ˆ๋‹ค.

Copy link

@greedy0110 greedy0110 left a comment

Choose a reason for hiding this comment

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

๋„คํŠธ์›Œํฌ ์—ฐ๊ฒฐํ•˜๋Š” ์ž‘์—…, DI๋กœ ์˜์กด์„ฑ์„ ์ „๋‹ฌํ•˜๋Š” ๊ณผ์ •์—์„œ ํ•™์Šตํ•  ๊ฒƒ์ด ๋งŽ์œผ์…จ์„ ํ…๋ฐ ๊ณ ์ƒํ•˜์…จ์Šต๋‹ˆ๋‹ค ์„ฑ๋ฏผ๋‹˜

class GlobalApplication: Application() {
private lateinit var dataStore: InfoDataStore
private lateinit var dataStore: TokenManager

Choose a reason for hiding this comment

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

dataStore๋Š” ๋ฒ”์šฉ์ ์ธ ์ด๋ฆ„์ด์ง€๋งŒ, ์‹ค์ œ ํƒ€์ž…์€ token์„ ๊ด€๋ฆฌํ•˜๋Š” TokenManager๋กœ ๋น„๊ต์  ๊ตฌ์ฒด์  ํƒ€์ž…์ด๋„ค์š”. tokenManager๋กœ ๊ฐ€๋Š”๊ฑด ์–ด๋–จ๊นŒ ์‹ถ์Šต๋‹ˆ๋‹ค.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TokenManager๊ฐ€ ๋” ์ ์ ˆํ•œ ์ด๋ฆ„์ด๋„ค์š”. ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค

Comment on lines +51 to +63
@Provides
@Singleton
@Token
fun provideTokenInterceptor(tokenManager: TokenManager): AccessTokenInterceptor {
return AccessTokenInterceptor(tokenManager)
}

@Provides
@Singleton
fun provideOKHttpClient(
httpLoggingInterceptor: HttpLoggingInterceptor,
accessTokenInterceptor: AccessTokenInterceptor
): OkHttpClient =

Choose a reason for hiding this comment

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

token qualifier ์ง€์ •์ด ๋ฌด์˜๋ฏธ ํ•œ ์ƒํ™ฉ ๊ฐ™์Šต๋‹ˆ๋‹ค.
์‹ค์ œ๋กœ ์ง€๊ธˆ๋„ AccessTokenInterceptor ๊ฐ์ฒด๋Š” ๋”ฑ ํ•˜๋‚˜๋งŒ ์ œ๊ณตํ•˜๊ณ  ์žˆ์œผ๋ฏ€๋กœ, Token qualifier ์—†์ด ์ž˜ ์˜์กด์„ฑ์ด ๋“ค์–ด๊ฐ€๊ณ  ์žˆ๋Š” ๊ฑธ ๋ณผ ์ˆ˜ ์žˆ๋„ค์š”.

connectTimeout(30, TimeUnit.SECONDS)
readTimeout(30, TimeUnit.SECONDS)
writeTimeout(30, TimeUnit.SECONDS)
addInterceptor(httpLoggingInterceptor)

Choose a reason for hiding this comment

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

์‹ค์ œ ๋ฆด๋ฆฌ์ฆˆ ์ฝ”๋“œ์— ํฌํ•จ๋  ์ด์œ ๋Š” ์—†์œผ๋ฏ€๋กœ ๋””๋ฒ„๊ทธ ๋นŒ๋“œ์—๋งŒ ์ถ”๊ฐ€ํ•˜๋„๋ก ์ง€์ •ํ•จ์€ ์–ด๋–จ์ง€์š”?

Suggested change
addInterceptor(httpLoggingInterceptor)
if (BuildConfig.DEBUG) addInterceptor(httpLoggingInterceptor)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

๋””๋ฒ„๊ทธ ๋นŒ๋“œ์— ๋”ฐ๋กœ ์ง€์ •๊ฐ€๋Šฅํ•œ์ง€ ๋ชฐ๋ž๋Š”๋ฐ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

Copy link

@kamja0510 kamja0510 left a comment

Choose a reason for hiding this comment

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

์„ฑ๋ฏผ์”จ ์ ์  ๋”ฐ๋ผ์žก๊ธฐ ์–ด๋ ค์›Œ์ง€๋„ค์š” ใ…Ž
๊ทธ๋ƒฅ ๊ณผ์ œ๋งŒ ํ•œ๊ฒŒ ์•„๋‹ˆ๋ผ mvi ์ ์šฉ๋„ ํ•˜๊ณ  ๋…ธ๋ ฅํ•˜์‹ ๊ฒŒ ๋ณด์ด๋„ค์š”..
๊ทผ๋ฐ ์ค‘๊ฐ„์— ์ค„ ๊ณต๋ฐฑ ๋ถˆํŽธํ•œ๊ฑฐ ์ข€ ์žˆ์–ด์„œ ์ง€์€, ํ˜œ์Œํ•œํ…Œ ํ˜ผ๋‚˜์‹ค๋“ฏํ•˜๋„ค์š” ใ…Ž


@Serializable
data class BaseResponse<T>(
@SerialName("code")

Choose a reason for hiding this comment

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

์–ด์งœํ”ผ ๋ณ€์ˆ˜๋ช…๊ณผ json์˜ ๋ณ€์ˆ˜๋ช…์ด ๊ฐ™์€๋ฐ SerialName ์–ด๋…ธํ…Œ์ด์…˜์œผ๋กœ ๋ช…์‹œํ•˜๋Š”๊ฒŒ ๋‚˜์€ ๊ฒƒ์ธ๊ฐ€์š”?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

๋ณ€์ˆ˜๋ช…์ด ๋™์ผํ•˜๋ฉด ์ƒ๋žตํ•ด๋„ ๋˜๊ธดํ•œ๋ฐ ์ €๋Š” ๋˜‘๊ฐ™์•„๋„ ์Šต๊ด€์ ์œผ๋กœ ์“ฐ๋Š” ํŽธ์ด์—์š”.

@@ -0,0 +1,63 @@
package org.sopt.and.base

Choose a reason for hiding this comment

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

ํ˜น์‹œ base๋ผ๋Š” ํŒจํ‚ค์ง€๋Š” ์–ด๋–ค๊ฒƒ์„ ์˜๋ฏธํ•˜๋‚˜์š”?
mvi๋ฅผ ์ ์šฉํ•˜์‹œ๋ฉด์„œ ์ƒ๊ฒจ๋‚œ ๊ฒƒ์ธ๊ฐ€์š”?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

base ํŒจํ‚ค์ง€๋Š” ์ œ๊ฐ€ ์ฃผ๋กœ BaseViewModel, BaseResponse / BaseActivity, BaseFragment, BaseAdapter (์ด ์„ธ๊ฐœ๋Š” xml์—์„œ) ๋“ฑ base๋กœ ์ƒ์†๋ฐ›์•„ ์‚ฌ์šฉํ•˜๋Š” ๊ธฐ๋ฐ˜ ํด๋ž˜์Šค๋“ค์„ ๋ชจ์•„๋‘˜ ๋•Œ ์“ฐ๊ณ ์žˆ์–ด์š”


@Qualifier
@Retention(AnnotationRetention.BINARY)
annotation class MainServer

Choose a reason for hiding this comment

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

์‹ ๊ธฐํ•œ ๋ฌธ๋ฒ•.. ์–ด๋–ค ์˜๋„์ธ์ง€๋„ ์Šฌ์Šฌ ๋ชจ๋ฅด๊ฒ ๋„ค์š”..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

์˜์กด์„ฑ ์ฃผ์ž…์„ ์‚ฌ์šฉํ•˜๋‹ค ๋ณด๋ฉด ๊ตฌํ˜„์ฒด๋“ค์ด ์—ฌ๋Ÿฌ๊ฐœ ์ƒ๊ธฐ๋Š”๋ฐ ์ด๊ฒƒ๋“ค์„ ๊ตฌ๋ถ„ํ•˜๊ธฐ ์œ„ํ•œ ํƒœ๊ทธ, ์ด๋ฆ„์ด๋ผ๊ณ  ์ƒ๊ฐํ•˜์‹œ๋ฉด ๋˜์š”.
ex) ์Šคํ”„๋ง์„œ๋ฒ„ / ํŒŒ์ด์ฌ ์„œ๋ฒ„๋ฅผ ๊ตฌ๋ถ„ํ•  ๋•Œ (์–˜๋„ค๋“ค ์“ธ ๋•Œ ๋ฆฌํฌ์ง€ํ† ๋ฆฌ, ๋ฐ์ดํ„ฐ์†Œ์Šค ๋“ฑ ํด๋ž˜์Šค, ์ธํ„ฐํŽ˜์ด์Šค ๋“ฑ ํŒŒ์ผ์ด ๋‹ค๋ฅผ ํ…๋ฐ ์ด๊ฑธ ๋”ฐ๋กœ ๋ถ„๋ฆฌํ•˜์ง€ ์•Š๊ณ  ์‚ฌ์šฉํ•˜๋ฉด ๋ณต์žกํ•ด์š”)

}

companion object {
const val HEADER_AUTHORIZATION = "token"

Choose a reason for hiding this comment

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

์„ธ์‹ฌํ•˜๋„ค์š”..

import kotlinx.serialization.Serializable

@Serializable
data class UserLoginResponse(

Choose a reason for hiding this comment

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

์•„ํ•˜ ์„ฑ๊ณต์— ๋Œ€ํ•œ Response๋งŒ ๋‹ค๋ฃฐ DTO๋ฅผ ๋งŒ๋“œ์‹œ๊ณ  ์ œ๋„ˆ๋Ÿด ํƒ€์ž…์œผ๋กœ ์ฃผ์‹œ๋Š” ๊ฒƒ ๊ฐ™์€๋ฐ ํ•œ DTO์— ์„ฑ๊ณต ์‹คํŒจ ๋‘˜๋‹ค ๋“ค์–ด๊ฐˆ ์ˆ˜ ์žˆ๊ฒŒ ํ•˜๋Š” ๊ฑฐ ๋ณด๋‹ค ์œ ์ง€๋ณด์ˆ˜์—์„œ ์žฅ์ ์ด ์žˆ์–ด ์ด๋ ‡๊ฒŒ ํ•˜์‹ ๊ฑด๊ฐ€์š”?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

์งˆ๋ฌธ์„ ์ดํ•ด ๋ชปํ–ˆ๋Š”๋ฐ ์ข€ ๋” ํ’€์–ด์„œ ์„ค๋ช…ํ•ด์ฃผ์‹ค ์ˆ˜ ์žˆ์œผ์‹ค๊นŒ์š”? ใ… ใ… 

์˜ˆ๋Šฅ,
์• ๋‹ˆ,
ํ•ด์™ธ์‹œ๋ฆฌ์ฆˆ
enum class Movie(val description: String) {

Choose a reason for hiding this comment

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

์˜ค์˜ค์˜ค ๊น”๋”

import org.sopt.and.utils.showToastMsg

@Composable
fun SignInRoute (

Choose a reason for hiding this comment

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

๋ผ์šฐํŠธ(?)๋ฅผ ๋„์ž…ํ•˜์…จ๊ตฐ์š”

Copy link
Contributor Author

Choose a reason for hiding this comment

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

๋„ค๋น„๊ฒŒ์ด์…˜ ํŒŒ์ผ์—์„œ ์ง์ ‘ ์ด๊ฑธ ์ •์˜ํ•˜๋ฉด ๋„ˆ๋ฌด ๊ธธ์–ด์ง€๊ณ  ๋ณต์žกํ•ด์ ธ์„œ ๋ถ„๋ฆฌํ–ˆ์–ด์š”.

import org.sopt.and.presentation.utils.UiEvent
import org.sopt.and.presentation.utils.UiState

class SignInContract {

Choose a reason for hiding this comment

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

์ด๋Ÿฐ์‹์œผ๋กœ ๋ชจ์•„๋†“๊ตฐ์š”!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

MVI ์“ธ ๋•Œ ์ด๋Ÿฐ์‹์œผ๋กœ ๋ชจ์•„๋‘๊ณ  ์“ฐ๋”๋ผ๊ตฌ์š”.
์ €๋Š” MVI ๊ณต๋ถ€ํ•  ๋•Œ https://velog.io/@kkmtk00314/Android-Compose-MVI-%EC%A0%81%EC%9A%A9%ED%95%B4%EB%B3%B4%EA%B8%B0 ์—ฌ๊ธฐ๋ž‘ ๋‹ค๋ฅธ ๊นƒํ—ˆ๋ธŒ๊ฐ™์ด ์ฐธ๊ณ ํ•ด์„œ ํ–ˆ์–ด์š”.


companion object {
private val Context.infoDataStore: DataStore<Preferences> by preferencesDataStore(name = "info")
private val ACCESS_TOKEN_KEY = stringPreferencesKey("access_token")

Choose a reason for hiding this comment

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

๋ณดํ†ต ์œ ์ €์˜ ํ† ํฐ์œผ๋กœ ์“ฐ์ด๋ฉด access_token์ด๋ผ๊ณ  ๋„ค์ด๋ฐ์„ ํ•˜๋‚˜์š”?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

์ €๋Š” ํ‰์†Œ์— JWT ํ† ํฐ ์‚ฌ์šฉํ•  ๋•Œ ์ฃผ๋กœ ์‚ฌ์šฉํ•ด์„œ ๊ทธ๊ฒƒ ๋•Œ๋ฌธ์— ๋„ค์ด๋ฐ์„ ์ €๋ ‡๊ฒŒ ํ•œ ๊ฒƒ ๊ฐ™์•„์š”.

import android.content.Context
import android.widget.Toast

fun Context.showToastMsg(message: String, duration: Int = Toast.LENGTH_SHORT) {

Choose a reason for hiding this comment

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

์™€ ์ด๋ ‡๊ฒŒ ๋งŒ๋“ค๋ฉด context๋ฅผ ์•ˆ๋ฐ›๊ฒŒ ํ•˜๊ตฐ์š”

Copy link

@hyeeum hyeeum left a comment

Choose a reason for hiding this comment

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

์–ด๋Š๋ง 4์ฃผ์ฐจ๊นŒ์ง€ ์™”๋„ค์š”!! ์œ ์ฆˆ์ผ€์ด์Šค ์‚ฌ์šฉํ•˜์‹  ๊ฑฐ ๋ณด๊ณ .. ๊นœ๋†€.. ์ €๋„ ์•Œ๋ ค์ฃผ์„ธ์š” ์ € ์œ ์ฆˆ์ผ€์ด์Šค ๋ชฐ๋ผ์š” ์„œ๋ฒ„ํ†ต์‹ ์ด ์€๊ทผ ๊ณ ๋ คํ•ด์•ผํ•  ๊ฒŒ ๋งŽ์€๋ฐ ๊ณ ์ƒํ•˜์…จ์Šต๋‹ˆ๋‹ค : - )

Copy link

Choose a reason for hiding this comment

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

์„ฑ๋ฏผ๋‹˜๋„ ์œ ์ฆˆ์ผ€์ด์Šค๋ฅผ ์‚ฌ์šฉํ•˜์…จ๊ตฐ์š”.. ๋‹ค๋“ค ์™ค์ผ€ ์•„๋Š”๊ฒŒ ๋งŽ์•„์š”?

Choose a reason for hiding this comment

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

์ธ์ • ใ…  ๋จธ์ž„ ์™ค์ผ€ ์ž˜ํ•˜์„ธ์š”


@GET("/user/{no}/my-hobby")
suspend fun getOthersHobby(

Copy link

Choose a reason for hiding this comment

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

๊ณต๋ฐฑ ๋ฐœ์ƒ..!

Comment on lines +62 to +63
setState(currentState.copy(loginStatus = SignInContract.SignInStatus.FAILURE))
setEffect(SignInContract.Effect.ShowToast("๋กœ๊ทธ์ธ ์‹คํŒจ: ${exception.message}"))
Copy link

Choose a reason for hiding this comment

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

์‹คํŒจ์˜ ๊ฒฝ์šฐ๊นŒ์ง€ ์„ธ์‹ฌํ•˜๊ฒŒ ์‹ ๊ฒฝ์จ์ฃผ์…จ๋„ค์š” ์ข‹์•„์š” !!

import android.content.Context
import android.widget.Toast

fun Context.showToastMsg(message: String, duration: Int = Toast.LENGTH_SHORT) {
Copy link

Choose a reason for hiding this comment

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

ํ™•์žฅํ•จ์ˆ˜๊นŒ์ง€ ๋„˜ ์ข‹์•„์š”! ๊ทธ๋ฆฌ๊ณ  ํ•จ์ˆ˜๋ช…/๋ณ€์ˆ˜๋ช…์—์„œ ์ถ•์•ฝ์–ด๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฑด ์ง€์–‘ํ•ด๋ณด์•„์š”!
๋ฌผ๋ก  msg ๋ผ๋Š” ๋‹จ์–ด๋Š” ์šฐ๋ฆฌ๊ฐ€ ํ”ํ•˜๊ฒŒ ์‚ฌ์šฉํ•˜๋ฏ€๋กœ ์ด ์˜๋ฏธ๋ฅผ ์œ ์ถ”ํ•  ์ˆ˜ ์žˆ๊ธด ํ•˜๋‚˜, ํ˜‘์—…์„ ํ•  ๋•Œ ์ถ•์•ฝ์–ด๋ฅผ ์‚ฌ์šฉํ•˜๊ฒŒ ๋˜๋ฉฐ ๊ฐ€๋…์„ฑ์ด ๋–จ์–ด์งˆ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค :)

Copy link

@HAJIEUN02 HAJIEUN02 left a comment

Choose a reason for hiding this comment

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

MVI ์ ์šฉ๊นŒ์ง€..ใ„ทใ„ท
๋„ˆ๋ฌด ๋Š˜์—ˆ์–ด์š” ๋˜ ์ด ์งง์€ ์‹œ๊ฐ„์—ใ… ใ…œ!!
์™œ์ด๋ ‡๊ฒŒ ์šฐ๋ฆฌ ์ฝ”๋ฆฌ์กฐ๊ฐ€ ์ฒœ์žฌ์•ผ

dependencies {
dependencies {

implementation(libs.androidx.core.ktx)

Choose a reason for hiding this comment

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

androidx ๊ณ„์—ด ์นœ๊ตฌ๋“ค์„ bundles๋กœ ๋ฌถ์œผ๋ฉด ํ•œ ์ค„๋กœ ์ด ๋งŽ์€ ์นœ๊ตฌ๋“ค์„ ํ•œ๋ฒˆ์— ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ์„œ์š”! ๋ฒ„์ „ ์นดํƒˆ๋กœ๊ทธ์˜ bundles์— ๋Œ€ํ•ด ์•Œ์•„๋ณด์‹œ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š”!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

๋ชฐ๋ž๋˜ ๋‚ด์šฉ์ธ๋ฐ ๊ณต์œ ํ•ด ์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.


@Provides
@Singleton
fun provideTokenManager(@ApplicationContext context: Context): TokenManager {

Choose a reason for hiding this comment

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

๋ ˆํฌ์ง€ํ† ๋ฆฌ ๋ชจ๋“ˆ์— ๋“ค์–ด๊ฐ€๋Š” ๋‚ด์šฉ์ด๋Ÿฌ๋ฉด ํ† ํฐ๋งค๋‹ˆ์ € ๋„ค์ด๋ฐ์„ ๋ณ€๊ฒฝํ•˜๋Š” ๊ฒƒ๋„ ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š”! ์–ด๋–ค ์—ญํ• ์ธ์ง€ ์ง๊ด€์ ์œผ๋กœ ์™€๋‹ฟ์ง€ ์•Š๋Š” ๊ฒƒ ๊ฐ™์•„์šฉ

Copy link
Contributor Author

Choose a reason for hiding this comment

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

์›๋ž˜ ํ† ํฐ ๋ชจ๋“ˆ๋กœ ๋”ฐ๋กœ ์ €์žฅํ•ด๋‘๋Š”๋ฐ ๋ฆฌํฌ์ง€ํ† ๋ฆฌ ๋ชจ๋“ˆ์— ๋“ค์–ด๊ฐ€์žˆ๋„ค์š”.. ๋‹ค์Œ์— ์ˆ˜์ •ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค

Choose a reason for hiding this comment

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

์ธ์ • ใ…  ๋จธ์ž„ ์™ค์ผ€ ์ž˜ํ•˜์„ธ์š”

import org.sopt.and.data.service.AuthApi
import javax.inject.Inject

class AuthDataSourceImpl @Inject constructor(

Choose a reason for hiding this comment

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

@kamja0510 ์ด ๋ถ€๋ถ„์€ MVI๋ณด๋‹จ ํด๋ฆฐ์•„ํ‚คํ…์ฒ˜์™€ ํžํŠธ์— ๋Œ€ํ•ด ๊ณต๋ถ€ํ•ด๋ณด์‹œ๋ฉด ์ดํ•ด๋  ๊ฑฐ์—์š”!

override suspend fun getMyHobby(): Result<MyHobbyEntity> =
runCatching {
val response = userDataSource.getMyHobby()
response.result.mapperToMyHobbyEntity()

Choose a reason for hiding this comment

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

์ด ๋ถ€๋ถ„์€ ๊ผญ response ๋ณ€์ˆ˜๋ฅผ ๋งŒ๋“ค์ง€ ์•Š๊ณ  ํ•œ์ค„๋กœ ํ•ด๋„ ๊ดœ์ฐฎ์„ ๊ฒƒ ๊ฐ™์•„์š”! ํฌ๊ฒŒ ์‚ฌ์šฉ๋˜์ง€ ์•Š๋Š” ๋ณ€์ˆ˜๋ฅผ ๊ตณ์ด ์ •์˜ํ•  ํ•„์š”๋Š” ์—†์œผ๋‹ˆ๊นŒ์šฉ


interface AuthApi {

@POST("/user")

Choose a reason for hiding this comment

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

์ทจํ–ฅ์— ๋”ฐ๋ผ uri๋ฅผ ์ƒ์ˆ˜ํ™”ํ•˜๋Š” ๊ฒฝ์šฐ๋„ ์žˆ๋‹ต๋‹ˆ๋‹ค!
์ €๋„ ์›๋ž˜๋Š” ์‚ฌ์‹ค ํ•˜๋Š”๋ฐ ์ด๋ฒˆ์—” ๋ชปํ–ˆ์–ด์š”..


@PUT("/user")
suspend fun editUserInfo(

Choose a reason for hiding this comment

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

๊ณต๋ฐฑ ์žก์•„๋‚ด๊ธฐ ์‘ˆ

import org.sopt.and.domain.model.auth.UserIdEntity
import org.sopt.and.domain.model.auth.UserTokenEntity

object AuthMapper {

Choose a reason for hiding this comment

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

๋งคํผ๋ฅผ ์ด๋ ‡๊ฒŒ ํ•œ๊ตฐ๋ฐ์— ๋ชจ์•„๋‘์…จ๊ตฐ์š”
์ด๊ฒƒ๋‘ ์ข‹์€ ๋ฐฉ๋ฒ•์ด๋‹ค ์งฑ์ด๋‹น

ANIMATION("์• ๋‹ˆ"),
FOREIGN_SERIES("ํ•ด์™ธ์‹œ๋ฆฌ์ฆˆ");

fun getGenre(): String {

Choose a reason for hiding this comment

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

์™€ใ…œ ์งฑ์ด๋‹ค ์ฝ”๋ฆฌ ๋ฐ˜์˜ ์•ผ๋ฌด์ง€๊ฒŒ ํ•ด์ฃผ์…จ๋„ค์š” ํžˆํžˆ

@@ -28,7 +28,7 @@ fun BoxOverlayImage(
) {
Box(
modifier = modifier
.width(180.dp) // ๋น„์œจ๋กœ ์ˆ˜์ •
.width(180.dp)

Choose a reason for hiding this comment

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

๋น„์œจ๋กœ ์ˆ˜์ • ์•ˆํ•˜์…จ๋Š”๋ฐ ์™œ ํˆฌ๋‘ ์ง€์šฐ์‹ฌ!!
๊ธฐ๊ธฐ๋Œ€์‘์„ ์œ„ํ•ด LocalCinfiguration์„ ์‚ฌ์šฉํ•ด์„œ ์ˆ˜์ •ํ•ด๋ณด์…”์š”

Copy link
Contributor Author

Choose a reason for hiding this comment

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

์–ด๋–ป๊ฒŒ ํ• ์ง€ ๋ชจ๋ฅด๊ฒ ์–ด์„œ ์ผ๋‹จ ๋’€๋Š”๋ฐ ์•Œ๋ ค์ฃผ์‹ ๋Œ€๋กœ ํ•ด๋ณผ๊ฒŒ์š”. ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

Copy link
Contributor

@jihyunniiii jihyunniiii left a comment

Choose a reason for hiding this comment

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

์ˆ˜๊ณ ํ•˜์…จ์Šต๋‹ˆ๋‹ค!
ํ•ฉ์„ธ๋„ ํŒŒ์ด๋ต ~

import kotlinx.serialization.Serializable

@Serializable
data class BaseResponse<T>(
Copy link
Contributor

Choose a reason for hiding this comment

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

BaseResponse๋ฅผ ์ด๋Ÿฐ ํ˜•ํƒœ๋กœ ๊ฐ€์ ธ๊ฐ€์‹  ์ด์œ ๊ฐ€ ์žˆ๋‚˜ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค!

import org.sopt.and.domain.model.auth.UserIdEntity
import org.sopt.and.domain.model.auth.UserTokenEntity

object AuthMapper {
Copy link
Contributor

Choose a reason for hiding this comment

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

ํ•ด๋‹น mapper๋ฅผ domain์— ๋‘์‹  ์ด์œ ๊ฐ€ ์žˆ๋‚˜์š”?
์ด mapper๋Š” data ๋ ˆ์ด์–ด์— ์žˆ๋Š” model์„ ์ฐธ์กฐํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด domain ๋ ˆ์ด์–ด๊ฐ€ data ๋ ˆ์ด์–ด์— ์˜์กดํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.
์ด๋ ‡๊ฒŒ ๋˜๋ฉด ํด๋ฆฐ ์•„ํ‚คํ…์ฒ˜๋ฅผ ๋”ฐ๋ฅด์ง€ ์•Š๊ฒŒ ๋˜๊ฒ ์ฃ ?
์–ด๋–ค ์‹์œผ๋กœ ์ˆ˜์ •ํ•˜๋ฉด ์ข‹์„์ง€ ๊ณ ๋ฏผํ•ด๋ด…์‹œ๋‹ค!

@@ -0,0 +1,6 @@
package org.sopt.and.domain.model.auth

data class LoginUserEntity(
Copy link
Contributor

Choose a reason for hiding this comment

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

domain์˜ ๋ชจ๋ธ์„ ์ •์˜ํ•  ๋•Œ -Entity๋ผ๋Š” ๋„ค์ด๋ฐ์„ ์‚ฌ์šฉํ•˜์‹œ๋Š” ์ด์œ ๊ฐ€ ์žˆ๋‚˜์š”?

Comment on lines +20 to +22
init {
geyMyHobby()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

init ๋ธ”๋Ÿญ์€ ์–ด๋–ป๊ฒŒ ๋™์ž‘ํ• ๊นŒ์š”?
๊ทธ๋ฆฌ๊ณ  ์–ด๋–ค ๋กœ์ง๋“ค์„ ๋‹ด๋Š” ๊ฒƒ์ด ์ข‹์„๊นŒ์š”?

class TokenManager @Inject constructor(
@ApplicationContext private val context: Context
) {

Copy link
Contributor

Choose a reason for hiding this comment

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

companion object๋Š” ์ตœํ•˜๋‹จ์— ์ ์–ด์ฃผ์‹œ๋Š” ๊ฒƒ์ด ์ปจ๋ฒค์…˜์ž…๋‹ˆ๋‹ค.

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.

[Week4] 4์ฃผ์ฐจ ํ•„์ˆ˜๊ณผ์ œ
6 participants