-
Notifications
You must be signed in to change notification settings - Fork 0
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
State 와 Event 분리 #147
State 와 Event 분리 #147
Changes from all commits
aa095d7
92ceee4
6eb0956
aa7bc40
2ce7c32
ac54f22
f7cc9a4
5d63529
4a1a4ce
221b5ba
11b057d
ddb11aa
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,11 @@ | ||
package com.nexters.bandalart.android.core.network.di | ||
|
||
import javax.inject.Qualifier | ||
|
||
@Qualifier | ||
@Retention(AnnotationRetention.BINARY) | ||
annotation class BandalartApi | ||
|
||
@Qualifier | ||
@Retention(AnnotationRetention.BINARY) | ||
annotation class LoginApi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.nexters.bandalart.android.core.ui | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.LaunchedEffect | ||
import androidx.compose.ui.platform.LocalLifecycleOwner | ||
import androidx.lifecycle.Lifecycle | ||
import androidx.lifecycle.repeatOnLifecycle | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.withContext | ||
|
||
// https://www.youtube.com/watch?v=njchj9d_Lf8&t=1218s | ||
@Composable | ||
fun <T> ObserveAsEvents(flow: Flow<T>, onEvent: (T) -> Unit) { | ||
val lifecycleOwner = LocalLifecycleOwner.current | ||
LaunchedEffect(flow, lifecycleOwner.lifecycle) { | ||
lifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) { | ||
withContext(Dispatchers.Main.immediate) { | ||
flow.collect(onEvent) | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.nexters.bandalart.android.core.ui | ||
|
||
import android.content.Context | ||
import androidx.annotation.StringRes | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.res.stringResource | ||
|
||
sealed class UiText { | ||
data class DirectString(val value: String) : UiText() | ||
|
||
class StringResource( | ||
@StringRes val resId: Int, | ||
vararg val args: Any, | ||
) : UiText() | ||
|
||
@Composable | ||
fun asString() = when (this) { | ||
is DirectString -> value | ||
is StringResource -> stringResource(resId, *args) | ||
} | ||
|
||
fun asString(context: Context) = when (this) { | ||
is DirectString -> value | ||
is StringResource -> context.getString(resId, *args) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,16 +8,16 @@ import androidx.compose.ui.text.font.FontFamily | |
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.unit.TextUnit | ||
import com.nexters.bandalart.android.core.ui.extension.nonScaleSp | ||
import com.nexters.bandalart.android.core.ui.nonScaleSp | ||
import com.nexters.bandalart.android.core.designsystem.theme.pretendard | ||
|
||
@Composable | ||
fun FixedSizeText( | ||
text: String, | ||
modifier: Modifier = Modifier, | ||
color: Color, | ||
fontSize: TextUnit, | ||
fontWeight: FontWeight, | ||
modifier: Modifier = Modifier, | ||
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. 요거들이 이동하게 된 이유는 무엇인가용 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. 내가 예전에 작업할때 해당 문서를 참고해서 modifier 를 최상단 파라미터로 올렸었는데, 문서를 내가 잘 못 이해 했던거 였음
와 같이 default value가 없는, 반드시 함수를 사용할 때 해당 파라미터를 명시해줘야하는 것들 다음에 modifier를 선언해주는 것을 권장하드라구 |
||
fontFamily: FontFamily = pretendard, | ||
letterSpacing: TextUnit = TextUnit.Unspecified, | ||
textAlign: TextAlign? = null, | ||
|
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.
소규모 프로젝트에서는 쓸일이 없는가 싶다가도 이럴 때 한번씩 나온단 말이지 ㄷㄷ
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.
@nAmed Annotation -> @qualifier Annotation 으로 변경
저거 왜 commit name이 @nAmed 로 안되어있고 @nAmed 로 되어있지.. 무튼 하드 코딩으로 provider 를 분류하는게 안정성 면에서 별로인것 같다는 생각이 들어
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.
아 @ 뒤에 바로 대문자를 쓰면 저렇게 변하나보네 @ Named로 써도 그러네