新增对话
This commit is contained in:
@@ -2,12 +2,14 @@ package com.aiosman.riderpro.data
|
||||
|
||||
import com.aiosman.riderpro.AppState
|
||||
import com.aiosman.riderpro.data.api.ApiClient
|
||||
import com.aiosman.riderpro.data.api.AppConfig
|
||||
import com.aiosman.riderpro.data.api.ChangePasswordRequestBody
|
||||
import com.aiosman.riderpro.data.api.GoogleRegisterRequestBody
|
||||
import com.aiosman.riderpro.data.api.LoginUserRequestBody
|
||||
import com.aiosman.riderpro.data.api.RegisterMessageChannelRequestBody
|
||||
import com.aiosman.riderpro.data.api.RegisterRequestBody
|
||||
import com.aiosman.riderpro.data.api.ResetPasswordRequestBody
|
||||
import com.aiosman.riderpro.data.api.TrtcSignResponseBody
|
||||
import com.aiosman.riderpro.data.api.UpdateNoticeRequestBody
|
||||
import com.aiosman.riderpro.data.api.UpdateUserLangRequestBody
|
||||
import com.aiosman.riderpro.entity.AccountFavouriteEntity
|
||||
@@ -46,6 +48,8 @@ data class AccountProfile(
|
||||
val bio: String,
|
||||
// 主页背景图
|
||||
val banner: String?,
|
||||
// trtcUserId
|
||||
val trtcUserId: String,
|
||||
) {
|
||||
/**
|
||||
* 转换为Entity
|
||||
@@ -65,7 +69,8 @@ data class AccountProfile(
|
||||
return@let "${ApiClient.BASE_SERVER}$it"
|
||||
}
|
||||
null
|
||||
}
|
||||
},
|
||||
trtcUserId = trtcUserId
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -355,6 +360,13 @@ interface AccountService {
|
||||
* 更新用户额外信息
|
||||
*/
|
||||
suspend fun updateUserExtra(language: String, timeOffset: Int, timezone: String)
|
||||
|
||||
/**
|
||||
* 获取腾讯云TRTC签名
|
||||
*/
|
||||
suspend fun getMyTrtcSign(): TrtcSignResponseBody
|
||||
|
||||
suspend fun getAppConfig(): AppConfig
|
||||
}
|
||||
|
||||
class AccountServiceImpl : AccountService {
|
||||
@@ -490,4 +502,15 @@ class AccountServiceImpl : AccountService {
|
||||
ApiClient.api.updateUserExtra(UpdateUserLangRequestBody(language, timeOffset, timezone))
|
||||
}
|
||||
|
||||
override suspend fun getMyTrtcSign(): TrtcSignResponseBody {
|
||||
val resp = ApiClient.api.getChatSign()
|
||||
val body = resp.body() ?: throw ServiceException("Failed to get trtc sign")
|
||||
return body.data
|
||||
}
|
||||
|
||||
override suspend fun getAppConfig(): AppConfig {
|
||||
val resp = ApiClient.api.getAppConfig()
|
||||
val body = resp.body() ?: throw ServiceException("Failed to get app config")
|
||||
return body.data
|
||||
}
|
||||
}
|
||||
@@ -107,6 +107,18 @@ data class UpdateUserLangRequestBody(
|
||||
val timezone: String,
|
||||
)
|
||||
|
||||
data class TrtcSignResponseBody(
|
||||
@SerializedName("sig")
|
||||
val sig: String,
|
||||
@SerializedName("userId")
|
||||
val userId: String,
|
||||
)
|
||||
|
||||
data class AppConfig(
|
||||
@SerializedName("trtcAppId")
|
||||
val trtcAppId: Int,
|
||||
)
|
||||
|
||||
interface RiderProAPI {
|
||||
@POST("register")
|
||||
suspend fun register(@Body body: RegisterRequestBody): Response<Unit>
|
||||
@@ -300,4 +312,9 @@ interface RiderProAPI {
|
||||
@Body body: UpdateUserLangRequestBody
|
||||
): Response<Unit>
|
||||
|
||||
@GET("account/my/chat/sign")
|
||||
suspend fun getChatSign(): Response<DataContainer<TrtcSignResponseBody>>
|
||||
|
||||
@GET("app/info")
|
||||
suspend fun getAppConfig(): Response<DataContainer<AppConfig>>
|
||||
}
|
||||
Reference in New Issue
Block a user