Merge pull request #3491 from medici/feature/shuchi/TP-5441
TP-5441: Send username in chat-initiate api
This commit is contained in:
@@ -12,5 +12,7 @@ data class NaviChatInitiateRequest(
|
||||
@SerializedName("source")
|
||||
val source: String? = null,
|
||||
@SerializedName("source_id")
|
||||
val sourceId: String? = null
|
||||
val sourceId: String? = null,
|
||||
@SerializedName("user_name")
|
||||
val userName: String? = null
|
||||
)
|
||||
|
||||
@@ -20,12 +20,13 @@ class NaviChatRepository @Inject constructor(
|
||||
private val context: Context
|
||||
) : ResponseCallback() {
|
||||
|
||||
suspend fun initiateChat(source: String, sourceId: String) =
|
||||
suspend fun initiateChat(source: String, sourceId: String, userName: String) =
|
||||
apiResponseCallback(
|
||||
chatApiInterface.initiateChat(
|
||||
naviChatInitiateRequest = NaviChatInitiateRequest(
|
||||
source = source,
|
||||
sourceId = sourceId
|
||||
sourceId = sourceId,
|
||||
userName = userName
|
||||
)
|
||||
),
|
||||
context = context
|
||||
|
||||
@@ -298,7 +298,8 @@ class NaviChatFragment : ChatBaseFragment(), WidgetCallback, MessageOperation, T
|
||||
private fun initiateChat() {
|
||||
naviChatViewModel.initiateChat(
|
||||
source = naviChatSystemLocalData?.source ?: EMPTY,
|
||||
sourceId = naviChatSystemLocalData?.sourceId ?: EMPTY
|
||||
sourceId = naviChatSystemLocalData?.sourceId ?: EMPTY,
|
||||
userName = naviChatSystemLocalData?.currentUserName ?: EMPTY
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -43,11 +43,12 @@ class NaviChatViewModel @Inject constructor(
|
||||
var isNewChat: Boolean = false
|
||||
var totalItemsReceived: Int = 0
|
||||
|
||||
fun initiateChat(source: String, sourceId: String) {
|
||||
fun initiateChat(source: String, sourceId: String, userName: String) {
|
||||
viewModelScope.launch {
|
||||
val response = naviChatRepository.initiateChat(
|
||||
source = source,
|
||||
sourceId = sourceId
|
||||
sourceId = sourceId,
|
||||
userName = userName
|
||||
)
|
||||
if (response.error.isNull() && response.errors.isNullOrEmpty()) {
|
||||
_naviChatInitiateResponse.value = response.data!!
|
||||
|
||||
Reference in New Issue
Block a user