Skip to content

Commit

Permalink
[CHORE] #47-ktlint 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
l5x5l committed Aug 24, 2024
1 parent 5828d92 commit 023621e
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import kotlin.coroutines.EmptyCoroutineContext
@SuppressLint("ComposableNaming")
@Composable
fun <T> Flow<T>.collectAsEffect(
context : CoroutineContext = EmptyCoroutineContext,
block : (T) -> Unit
context: CoroutineContext = EmptyCoroutineContext,
block: (T) -> Unit,
) {
LaunchedEffect(Unit) {
onEach(block).flowOn(context).launchIn(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@ interface EventFlow<out T> : Flow<T> {

interface MutableEventFlow<T> : EventFlow<T>, FlowCollector<T>

@Suppress("FunctionName")
fun <T> MutableEventFlow(
replay: Int = EventFlow.DEFAULT_REPLAY
replay: Int = EventFlow.DEFAULT_REPLAY,
): MutableEventFlow<T> = EventFlowImpl(replay)

fun <T> MutableEventFlow<T>.asEventFlow(): EventFlow<T> = ReadOnlyEventFlow(this)

private class ReadOnlyEventFlow<T>(flow: EventFlow<T>) : EventFlow<T> by flow

private class EventFlowImpl<T>(
replay: Int
replay: Int,
) : MutableEventFlow<T> {

private val flow: MutableSharedFlow<EventFlowSlot<T>> = MutableSharedFlow(replay = replay)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fun LoadingProgress(modifier: Modifier = Modifier) {
CircularProgressIndicator(
modifier = Modifier.width(64.dp),
color = PokitTheme.colors.brand,
trackColor = PokitTheme.colors.borderTertiary,
trackColor = PokitTheme.colors.borderTertiary
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import pokitmons.pokit.core.ui.theme.PokitTheme

@Composable
fun PokitToast(
modifier : Modifier = Modifier,
text : String,
modifier: Modifier = Modifier,
text: String,
onClick: (() -> Unit)? = null,
onClickClose: () -> Unit = {},
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import pokitmons.pokit.core.ui.theme.PokitTheme
fun EmptyPokki(
modifier: Modifier = Modifier,
title: String,
sub: String
sub: String,
) {
Box(
modifier = modifier,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import pokitmons.pokit.core.ui.theme.PokitTheme
@Composable
fun ErrorPokki(
modifier: Modifier = Modifier,
pokkiSize : Dp = 180.dp,
pokkiSize: Dp = 180.dp,
title: String,
sub: String,
onClickRetry: (() -> Unit)? = null
onClickRetry: (() -> Unit)? = null,
) {
Box(
modifier = modifier,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import pokitmons.pokit.core.ui.theme.PokitTheme


@Preview(showBackground = true)
@Composable
private fun Preview() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,13 @@ class AddPokitViewModel @Inject constructor(

val isCreate = (pokitId == null)
if (isCreate) {
PokitUpdateEvent.createPokit(PokitArg(id = response.result, title = currentPokitName, imageUrl = state.pokitImage?.url ?: "", imageId = pokitImageId))
PokitUpdateEvent.createPokit(
PokitArg(id = response.result, title = currentPokitName, imageUrl = state.pokitImage?.url ?: "", imageId = pokitImageId)
)
} else {
PokitUpdateEvent.updatePokit(PokitArg(id = pokitId ?: 0, title = currentPokitName, imageUrl = state.pokitImage?.url ?: "", imageId = pokitImageId))
PokitUpdateEvent.updatePokit(
PokitArg(id = pokitId ?: 0, title = currentPokitName, imageUrl = state.pokitImage?.url ?: "", imageId = pokitImageId)
)
}

postSideEffect(AddPokitSideEffect.OnNavigationBack)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import pokitmons.pokit.domain.model.pokit.Pokit as DomainPokit
class PokitViewModel @Inject constructor(
private val getPokitsUseCase: GetPokitsUseCase,
private val getLinksUseCase: GetLinksUseCase,
private val deletePokitUseCase: DeletePokitUseCase
private val deletePokitUseCase: DeletePokitUseCase,
) : ViewModel() {

private fun initLinkUpdateEventDetector() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ fun RemindScreen(

val showTotalEmpty by remember {
derivedStateOf {
todayContentsState == NetworkState.IDLE
&& todayContents.value.size < 5
&& unreadContentsState == NetworkState.IDLE
&& unreadContents.value.isEmpty()
todayContentsState == NetworkState.IDLE &&
todayContents.value.size < 5 &&
unreadContentsState == NetworkState.IDLE &&
unreadContents.value.isEmpty()
}
}

Expand Down Expand Up @@ -125,7 +125,7 @@ fun RemindScreen(
RemindSection(title = "오늘 이 링크는 어때요?") {
Spacer(modifier = Modifier.height(12.dp))

when(todayContentsState) {
when (todayContentsState) {
NetworkState.IDLE -> {
if (todayContents.value.isEmpty()) {
ErrorPokki(
Expand Down Expand Up @@ -212,7 +212,7 @@ fun RemindScreen(
RemindSection(title = "즐겨찾기 링크만 모았어요") {
Spacer(modifier = Modifier.height(12.dp))

when(bookmarkContentState) {
when (bookmarkContentState) {
NetworkState.IDLE -> {
if (bookmarkContents.value.isEmpty()) {
EmptyPokki(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@ class RemindViewModel @Inject constructor(
val unReadContents: StateFlow<List<RemindResult>>
get() = _unReadContents.asStateFlow()

private val _unReadContentNetworkState : MutableStateFlow<NetworkState> = MutableStateFlow(NetworkState.IDLE)
private val _unReadContentNetworkState: MutableStateFlow<NetworkState> = MutableStateFlow(NetworkState.IDLE)
val unreadContentNetworkState = _unReadContentNetworkState.asStateFlow()

private var _todayContents: MutableStateFlow<List<RemindResult>> = MutableStateFlow(emptyList())
val todayContents: StateFlow<List<RemindResult>>
get() = _todayContents.asStateFlow()

private val _todayContentsNetworkState : MutableStateFlow<NetworkState> = MutableStateFlow(NetworkState.IDLE)
private val _todayContentsNetworkState: MutableStateFlow<NetworkState> = MutableStateFlow(NetworkState.IDLE)
val todayContentsNetworkState = _todayContentsNetworkState.asStateFlow()

private var _bookmarkContents: MutableStateFlow<List<RemindResult>> = MutableStateFlow(emptyList())
val bookmarkContents: StateFlow<List<RemindResult>>
get() = _bookmarkContents.asStateFlow()

private val _bookmarkContentsNetworkState : MutableStateFlow<NetworkState> = MutableStateFlow(NetworkState.IDLE)
private val _bookmarkContentsNetworkState: MutableStateFlow<NetworkState> = MutableStateFlow(NetworkState.IDLE)
val bookmarkContentsNetworkState = _bookmarkContentsNetworkState.asStateFlow()

private val _currentSelectedLink = MutableStateFlow<Link?>(null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ private fun Preview() {
modifier = Modifier.fillMaxSize()
) {
SignUpSuccessScreen {

}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ fun PokitDetailScreen(
)
}
}

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,11 @@ fun SearchScreen(
if (state.step == SearchScreenStep.RESULT) {
when {
(linkPagingState == SimplePagingState.LOADING_INIT) -> {
LoadingProgress(modifier = Modifier
.fillMaxWidth()
.weight(1f))
LoadingProgress(
modifier = Modifier
.fillMaxWidth()
.weight(1f)
)
}
(linkPagingState == SimplePagingState.FAILURE_INIT) -> {
ErrorPokki(
Expand Down

0 comments on commit 023621e

Please sign in to comment.