mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 22:29:09 +00:00
join 1:1 conversation with replacement user
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
parent
9a481aefc8
commit
cadb12cd0f
@ -51,6 +51,7 @@ import androidx.activity.OnBackPressedCallback
|
||||
import androidx.activity.result.ActivityResult
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.appcompat.view.ContextThemeWrapper
|
||||
import androidx.cardview.widget.CardView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.FileProvider
|
||||
import androidx.core.content.PermissionChecker
|
||||
@ -1126,16 +1127,28 @@ class ChatActivity :
|
||||
}
|
||||
|
||||
if (uiState.userAbsence.replacementUserDisplayName != null) {
|
||||
var imageUri = Uri.parse(ApiUtils.getUrlForAvatar(conversationUser?.baseUrl, uiState.userAbsence
|
||||
.replacementUserId, false))
|
||||
var imageUri = Uri.parse(
|
||||
ApiUtils.getUrlForAvatar(
|
||||
conversationUser?.baseUrl,
|
||||
uiState.userAbsence
|
||||
.replacementUserId,
|
||||
false
|
||||
)
|
||||
)
|
||||
if (DisplayUtils.isDarkModeOn(context)) {
|
||||
imageUri = Uri.parse(ApiUtils.getUrlForAvatarDarkTheme(conversationUser?.baseUrl, uiState
|
||||
.userAbsence
|
||||
.replacementUserId, false))
|
||||
imageUri = Uri.parse(
|
||||
ApiUtils.getUrlForAvatarDarkTheme(
|
||||
conversationUser?.baseUrl,
|
||||
uiState
|
||||
.userAbsence
|
||||
.replacementUserId,
|
||||
false
|
||||
)
|
||||
)
|
||||
}
|
||||
binding.outOfOfficeContainer.findViewById<TextView>(R.id.absenceReplacement).text = context.resources.getString(R.string.user_absence_replacement)
|
||||
binding.outOfOfficeContainer.findViewById<ImageView>(R.id.replacement_user_avatar)
|
||||
.load(imageUri){
|
||||
.load(imageUri) {
|
||||
transformations(CircleCropTransformation())
|
||||
placeholder(R.drawable.account_circle_96dp)
|
||||
error(R.drawable.account_circle_96dp)
|
||||
@ -1143,11 +1156,13 @@ class ChatActivity :
|
||||
}
|
||||
binding.outOfOfficeContainer.findViewById<TextView>(R.id.replacement_user_name).text =
|
||||
uiState.userAbsence.replacementUserDisplayName
|
||||
|
||||
} else {
|
||||
binding.outOfOfficeContainer.findViewById<TextView>(R.id.absenceReplacement).visibility = View.GONE
|
||||
}
|
||||
binding.outOfOfficeContainer.findViewById<TextView>(R.id.userAbsenceLongMessage).text = uiState.userAbsence.message
|
||||
binding.outOfOfficeContainer.findViewById<CardView>(R.id.avatar_chip).setOnClickListener {
|
||||
joinOneToOneConversation(uiState.userAbsence.replacementUserId!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3917,6 +3932,24 @@ class ChatActivity :
|
||||
startActivity(shareIntent)
|
||||
}
|
||||
|
||||
fun joinOneToOneConversation(userId: String) {
|
||||
val apiVersion =
|
||||
ApiUtils.getConversationApiVersion(conversationUser!!, intArrayOf(ApiUtils.API_V4, 1))
|
||||
val retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(
|
||||
apiVersion,
|
||||
conversationUser?.baseUrl!!,
|
||||
"1",
|
||||
"users",
|
||||
userId,
|
||||
null
|
||||
)
|
||||
chatViewModel.createRoom(
|
||||
credentials!!,
|
||||
retrofitBucket.url!!,
|
||||
retrofitBucket.queryMap!!
|
||||
)
|
||||
}
|
||||
|
||||
companion object {
|
||||
val TAG = ChatActivity::class.simpleName
|
||||
private const val CONTENT_TYPE_CALL_STARTED: Byte = 1
|
||||
|
@ -608,7 +608,7 @@ object ApiUtils {
|
||||
return "${getUrlForRoom(version, baseUrl, token)}/archive"
|
||||
}
|
||||
|
||||
fun getUrlForOutOfOffice(baseUrl: String, userId: String): String {
|
||||
fun getUrlForOutOfOffice(baseUrl: String, userId: String): String {
|
||||
return "$baseUrl$OCS_API_VERSION/apps/dav/api/v1/outOfOffice/$userId/now"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user