改包名com.aiosman.ravenow

This commit is contained in:
2024-11-17 20:07:42 +08:00
parent 914cfca6be
commit 074244c0f8
168 changed files with 897 additions and 970 deletions

View File

@@ -0,0 +1,42 @@
package com.aiosman.ravenow.data
import com.aiosman.ravenow.data.api.ApiClient
import com.aiosman.ravenow.data.api.UpdateChatNotificationRequestBody
import com.aiosman.ravenow.entity.ChatNotification
interface ChatService {
suspend fun getChatNotifications(
targetTrtcId: String
): ChatNotification?
suspend fun updateChatNotification(
targetUserId: Int,
strategy: String
): ChatNotification
}
class ChatServiceImpl : ChatService {
override suspend fun getChatNotifications(
targetTrtcId: String
): ChatNotification? {
val resp = ApiClient.api.getChatNotification(targetTrtcId)
if (resp.isSuccessful) {
return resp.body()?.data
}
return null
}
override suspend fun updateChatNotification(
targetUserId: Int,
strategy: String
): ChatNotification {
val resp = ApiClient.api.updateChatNotification(UpdateChatNotificationRequestBody(
targetUserId = targetUserId,
strategy = strategy
))
if (resp.isSuccessful) {
return resp.body()?.data!!
}
throw Exception("update chat notification failed")
}
}