mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-08 23:19:55 +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.ActivityResult
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
import androidx.appcompat.view.ContextThemeWrapper
|
import androidx.appcompat.view.ContextThemeWrapper
|
||||||
|
import androidx.cardview.widget.CardView
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.content.FileProvider
|
import androidx.core.content.FileProvider
|
||||||
import androidx.core.content.PermissionChecker
|
import androidx.core.content.PermissionChecker
|
||||||
@ -1126,16 +1127,28 @@ class ChatActivity :
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (uiState.userAbsence.replacementUserDisplayName != null) {
|
if (uiState.userAbsence.replacementUserDisplayName != null) {
|
||||||
var imageUri = Uri.parse(ApiUtils.getUrlForAvatar(conversationUser?.baseUrl, uiState.userAbsence
|
var imageUri = Uri.parse(
|
||||||
.replacementUserId, false))
|
ApiUtils.getUrlForAvatar(
|
||||||
|
conversationUser?.baseUrl,
|
||||||
|
uiState.userAbsence
|
||||||
|
.replacementUserId,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
)
|
||||||
if (DisplayUtils.isDarkModeOn(context)) {
|
if (DisplayUtils.isDarkModeOn(context)) {
|
||||||
imageUri = Uri.parse(ApiUtils.getUrlForAvatarDarkTheme(conversationUser?.baseUrl, uiState
|
imageUri = Uri.parse(
|
||||||
.userAbsence
|
ApiUtils.getUrlForAvatarDarkTheme(
|
||||||
.replacementUserId, false))
|
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<TextView>(R.id.absenceReplacement).text = context.resources.getString(R.string.user_absence_replacement)
|
||||||
binding.outOfOfficeContainer.findViewById<ImageView>(R.id.replacement_user_avatar)
|
binding.outOfOfficeContainer.findViewById<ImageView>(R.id.replacement_user_avatar)
|
||||||
.load(imageUri){
|
.load(imageUri) {
|
||||||
transformations(CircleCropTransformation())
|
transformations(CircleCropTransformation())
|
||||||
placeholder(R.drawable.account_circle_96dp)
|
placeholder(R.drawable.account_circle_96dp)
|
||||||
error(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 =
|
binding.outOfOfficeContainer.findViewById<TextView>(R.id.replacement_user_name).text =
|
||||||
uiState.userAbsence.replacementUserDisplayName
|
uiState.userAbsence.replacementUserDisplayName
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
binding.outOfOfficeContainer.findViewById<TextView>(R.id.absenceReplacement).visibility = View.GONE
|
binding.outOfOfficeContainer.findViewById<TextView>(R.id.absenceReplacement).visibility = View.GONE
|
||||||
}
|
}
|
||||||
binding.outOfOfficeContainer.findViewById<TextView>(R.id.userAbsenceLongMessage).text = uiState.userAbsence.message
|
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)
|
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 {
|
companion object {
|
||||||
val TAG = ChatActivity::class.simpleName
|
val TAG = ChatActivity::class.simpleName
|
||||||
private const val CONTENT_TYPE_CALL_STARTED: Byte = 1
|
private const val CONTENT_TYPE_CALL_STARTED: Byte = 1
|
||||||
|
@ -608,7 +608,7 @@ object ApiUtils {
|
|||||||
return "${getUrlForRoom(version, baseUrl, token)}/archive"
|
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"
|
return "$baseUrl$OCS_API_VERSION/apps/dav/api/v1/outOfOffice/$userId/now"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user