Skip to content

Commit

Permalink
Merge pull request #339 from apeun-gidaechi/feature/ict-fix
Browse files Browse the repository at this point in the history
Refactor/Edit Seugi
  • Loading branch information
wnsgur1 authored Oct 23, 2024
2 parents efce216 + 797552a commit 0324155
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 20 deletions.
1 change: 1 addition & 0 deletions data/core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ dependencies {
implementation(projects.local.room)
implementation(projects.network.meal)
implementation(projects.network.notification)
implementation(projects.network.timetable)

implementation(libs.kotlinx.collections.immutable)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.seugi.data.timetable.mapper
package com.seugi.data.core.mapper

import com.seugi.data.core.model.TimetableModel
import com.seugi.network.timetable.response.TimetableResponse
Expand Down
1 change: 1 addition & 0 deletions data/message/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencies {
implementation(projects.data.core)
implementation(projects.network.meal)
implementation(projects.network.notification)
implementation(projects.network.timetable)
implementation(projects.common)
implementation(projects.local.room)
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.seugi.data.message.mapper

import com.seugi.data.core.mapper.toModels
import com.seugi.data.core.model.TimetableModel
import com.seugi.data.message.model.MessageBotRawKeyword
import com.seugi.data.message.model.MessageBotRawKeywordInData
import com.seugi.data.message.model.MessageRoomEvent
import com.seugi.network.core.utiles.toResponse
import com.seugi.network.meal.response.MealResponse
import com.seugi.network.message.response.MessageRoomEventResponse
import com.seugi.network.notification.response.NotificationResponse
import com.seugi.network.timetable.response.TimetableResponse
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList

Expand Down Expand Up @@ -48,15 +48,15 @@ internal fun MessageRoomEventResponse.MessageParent.Message.toModel(userId: Long
)
}
"시간표" -> {
val botData = message.toResponse<MessageBotRawKeywordInData<List<TimetableModel>>>()
val botData = message.toResponse<MessageBotRawKeywordInData<List<TimetableResponse>>>()
MessageRoomEvent.MessageParent.BOT.Timetable(
id = id,
chatRoomId = chatRoomId,
type = type.toMessageType(),
userId = this.userId,
isFirst = true,
isLast = true,
message = botData.data.toImmutableList(),
message = botData.data.toModels().toImmutableList(),
messageStatus = messageStatus,
emoticon = emoticon,
eventList = eventList?.toImmutableList() ?: persistentListOf(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import com.seugi.common.model.Result
import com.seugi.common.model.asResult
import com.seugi.common.utiles.DispatcherType
import com.seugi.common.utiles.SeugiDispatcher
import com.seugi.data.core.mapper.toModels
import com.seugi.data.core.model.TimetableModel
import com.seugi.data.timetable.TimetableRepository
import com.seugi.data.timetable.mapper.toModels
import com.seugi.network.core.response.safeResponse
import com.seugi.network.timetable.TimetableDataSource
import javax.inject.Inject
Expand Down
32 changes: 21 additions & 11 deletions feature-main/home/src/main/java/com/seugi/home/HomeScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,15 @@ internal fun HomeCard(modifier: Modifier = Modifier, text: String, image: Painte
}

@Composable
internal fun HomeCard(modifier: Modifier = Modifier, text: String, onClickDetail: () -> Unit, image: Painter, colorFilter: ColorFilter? = null, content: @Composable () -> Unit) {
internal fun HomeCard(
modifier: Modifier = Modifier,
text: String,
onClickDetail: () -> Unit,
image: Painter,
colorFilter: ColorFilter? = null,
blockNav: Boolean = false,
content: @Composable () -> Unit,
) {
Column(
modifier = modifier
.padding(horizontal = 20.dp)
Expand All @@ -304,7 +312,7 @@ internal fun HomeCard(modifier: Modifier = Modifier, text: String, onClickDetail
modifier = Modifier
.bounceClick(
onClick = onClickDetail,
enabled = true,
enabled = !blockNav,
),
) {
Spacer(modifier = Modifier.width(16.dp))
Expand Down Expand Up @@ -334,15 +342,17 @@ internal fun HomeCard(modifier: Modifier = Modifier, text: String, onClickDetail
color = SeugiTheme.colors.black,
)
Spacer(modifier = Modifier.weight(1f))
Image(
modifier = Modifier
.size(24.dp)
.align(Alignment.CenterVertically),
painter = painterResource(id = R.drawable.ic_expand_right_line),
contentDescription = "상세보기",
colorFilter = ColorFilter.tint(SeugiTheme.colors.gray500),
)
Spacer(modifier = Modifier.width(12.dp))
if (!blockNav) {
Image(
modifier = Modifier
.size(24.dp)
.align(Alignment.CenterVertically),
painter = painterResource(id = R.drawable.ic_expand_right_line),
contentDescription = "상세보기",
colorFilter = ColorFilter.tint(SeugiTheme.colors.gray500),
)
Spacer(modifier = Modifier.width(12.dp))
}
}
Spacer(modifier = Modifier.height(12.dp))
Box(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ internal fun MealCard(uiState: CommonUiState<MealUiState>, onClickDetail: () ->
image = painterResource(id = R.drawable.ic_utensils_line),
colorFilter = ColorFilter.tint(SeugiTheme.colors.gray600),
onClickDetail = onClickDetail,
blockNav = true,
) {
when (uiState) {
is CommonUiState.Success -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ internal fun ScheduleCard(uiState: CommonUiState<ImmutableList<ScheduleModel>>)
onClickDetail = { /*TODO*/ },
image = painterResource(id = R.drawable.ic_calendar_line),
colorFilter = ColorFilter.tint(SeugiTheme.colors.gray600),
blockNav = true,
) {
when (uiState) {
is CommonUiState.Success -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ class CatSeugiDataSourceImpl @Inject constructor(
private val httpClient: HttpClient,
) : CatSeugiDataSource {
override suspend fun sendText(text: String): BaseResponse<String> = httpClient.post(SeugiUrl.AI) {
setBody(CatSeugiRequest(text))
setBody(
CatSeugiRequest(
message = text,
roomId = "67177e4ac6b844040200d65c",
),
)
contentType(ContentType.Application.Json)
}.body()
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.seugi.network.catseugi.request

data class CatSeugiRequest(
val text: String,
val message: String,
val roomId: String,
)
4 changes: 2 additions & 2 deletions network/core/src/main/java/com/seugi/network/core/SeugiUrl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package com.seugi.network.core

object SeugiUrl {
private const val BASE_URL = BuildConfig.BASE_URL
private const val AI_URL = BuildConfig.AI_URL
private const val AI_URL = "${BASE_URL}/ai"

const val WORKSPACE = "$BASE_URL/workspace"
const val FILE = "$BASE_URL/file"
const val AI = "$AI_URL/ai"
const val AI = "$BASE_URL/ai"
const val PROFILE = "$BASE_URL/profile"
const val OAUTH = "$BASE_URL/oauth"
const val SCHEDULE = "$BASE_URL/schedule"
Expand Down

0 comments on commit 0324155

Please sign in to comment.