Skip to content

Commit ef34dd9

Browse files
authored
Merge branch 'develop' into feat/LoginUI
2 parents 5888e1a + 55a5933 commit ef34dd9

File tree

33 files changed

+278
-65
lines changed

33 files changed

+278
-65
lines changed

composeApp/src/commonMain/kotlin/com/nexters/emotia/di/Modules.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package com.nexters.emotia.di
33
import com.nexters.emotia.core.data.chatting.di.dataChatModule
44
import com.nexters.emotia.core.data.onboarding.di.dataOnboardingModule
55
import com.nexters.emotia.core.domain.onboarding.di.domainOnboardingModule
6-
6+
import com.nexters.emotia.core.platform.di.platformModule
77
import com.nexters.emotia.feature.main.di.featureModule
88
import com.nexters.emotia.network.di.coreNetworkModule
99
import org.koin.dsl.module
@@ -12,6 +12,7 @@ val appModule =
1212
module {
1313
includes(
1414
coreNetworkModule,
15+
platformModule,
1516
dataChatModule,
1617
dataOnboardingModule,
1718
domainOnboardingModule,

core/data/chatting/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ kotlin {
1717
implementation(libs.ktor.serialization.kotlinx.json)
1818
implementation(libs.ktor.logging)
1919
implementation(libs.koin.core)
20+
implementation(libs.kotlinx.datetime)
2021

2122
implementation(projects.core.network)
2223
implementation(projects.core.domain.chatting)
24+
implementation(projects.core.platform)
2325

2426
}
2527
iosMain.dependencies {

core/data/chatting/src/commonMain/kotlin/com/nexters/emotia/core/data/chatting/datasource/ChattingRemoteDataSource.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import com.nexters.emotia.network.dto.response.SendChatResponse
77
interface ChattingRemoteDataSource {
88
suspend fun createRoom(username: String): CreateRoomResponse
99
suspend fun sendChat(
10-
roomId: Int,
10+
roomId: String,
1111
message: String,
1212
): SendChatResponse
1313

core/data/chatting/src/commonMain/kotlin/com/nexters/emotia/core/data/chatting/datasource/ChattingRemoteDataSourceImpl.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ class ChattingRemoteDataSourceImpl(
1717
}
1818

1919
override suspend fun sendChat(
20-
roomId: Int,
20+
roomId: String,
2121
message: String,
2222
): SendChatResponse {
2323
return apiService.sendChat(
24-
chatRoomId = roomId.toString(),
24+
chatRoomId = roomId,
2525
message = message,
2626
)
2727
}

core/data/chatting/src/commonMain/kotlin/com/nexters/emotia/core/data/chatting/di/DataChatModule.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,9 @@ val dataChatModule =
1414
singleOf(::ChattingRemoteDataSourceImpl).bind<ChattingRemoteDataSource>()
1515

1616
// Repository 주입
17-
singleOf(::ChattingRepositoryImpl).bind<ChattingRepository>()
17+
single<ChattingRepository> {
18+
ChattingRepositoryImpl(
19+
remoteDataSource = get(),
20+
)
21+
}
1822
}

core/data/chatting/src/commonMain/kotlin/com/nexters/emotia/core/data/chatting/mapper/ChattingMapper.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ package com.nexters.emotia.core.data.chatting.mapper
33
import com.nexters.emotia.core.domain.chatting.entity.ChatMessage
44
import com.nexters.emotia.core.domain.chatting.entity.ChattingRoom
55
import com.nexters.emotia.core.domain.chatting.entity.Fairy
6+
import com.nexters.emotia.core.domain.chatting.entity.SenderType
67
import com.nexters.emotia.network.dto.response.CreateRoomResponse
78
import com.nexters.emotia.network.dto.response.FairyDto
89
import com.nexters.emotia.network.dto.response.GetFairiesResponse
910
import com.nexters.emotia.network.dto.response.SendChatResponse
11+
import kotlinx.datetime.Clock
1012

1113
fun CreateRoomResponse.toDomain(): ChattingRoom {
1214
val roomData = this.data ?: throw IllegalStateException("응답 데이터가 없습니다")
@@ -21,7 +23,9 @@ fun SendChatResponse.toDomain(): ChatMessage {
2123
val chatData = this.data ?: throw IllegalStateException("응답 데이터가 없습니다")
2224

2325
return ChatMessage(
24-
message = chatData.message
26+
message = chatData.message,
27+
senderType = SenderType.OTHER,
28+
timestamp = Clock.System.now().toEpochMilliseconds()
2529
)
2630
}
2731

core/data/chatting/src/commonMain/kotlin/com/nexters/emotia/core/data/chatting/repository/ChattingRepositoryImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class ChattingRepositoryImpl(
2525
}
2626
}
2727

28-
override suspend fun sendChat(roomId: Int, message: String): Result<ChatMessage> {
28+
override suspend fun sendChat(roomId: String, message: String): Result<ChatMessage> {
2929
return runCatching {
3030
val response = remoteDataSource.sendChat(roomId, message)
3131

3.27 MB
Loading
1.29 MB
Loading
912 KB
Loading

0 commit comments

Comments
 (0)