mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-09 22:04:24 +01:00
add unbind-conversation capability
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
parent
01b80a0753
commit
1670ff181f
@ -169,6 +169,7 @@ import com.nextcloud.talk.ui.recyclerview.MessageSwipeCallback
|
||||
import com.nextcloud.talk.utils.ApiUtils
|
||||
import com.nextcloud.talk.utils.AudioUtils
|
||||
import com.nextcloud.talk.utils.CapabilitiesUtil
|
||||
import com.nextcloud.talk.utils.CapabilitiesUtil.hasSpreedFeatureCapability
|
||||
import com.nextcloud.talk.utils.CapabilitiesUtil.retentionOfEventRooms
|
||||
import com.nextcloud.talk.utils.CapabilitiesUtil.retentionOfInstantMeetingRoom
|
||||
import com.nextcloud.talk.utils.CapabilitiesUtil.retentionOfSIPRoom
|
||||
@ -668,7 +669,11 @@ class ChatActivity :
|
||||
}
|
||||
}
|
||||
|
||||
if (currentConversation?.objectType == ConversationEnums.ObjectType.EVENT) {
|
||||
if (currentConversation?.objectType == ConversationEnums.ObjectType.EVENT && hasSpreedFeatureCapability(
|
||||
conversationUser?.capabilities!!.spreedCapability!!,
|
||||
SpreedFeatures.UNBIND_CONVERSATION
|
||||
)
|
||||
) {
|
||||
val eventEndTimeStamp = currentConversation?.objectId?.split("#")[1]?.toLong()
|
||||
val currentTimeStamp = (System.currentTimeMillis() / 1000).toLong()
|
||||
val retentionPeriod = retentionOfEventRooms(spreedCapabilities)
|
||||
@ -678,7 +683,11 @@ class ChatActivity :
|
||||
}
|
||||
}
|
||||
|
||||
if (currentConversation?.objectType == ConversationEnums.ObjectType.PHONE) {
|
||||
if (currentConversation?.objectType == ConversationEnums.ObjectType.PHONE && hasSpreedFeatureCapability(
|
||||
conversationUser?.capabilities!!.spreedCapability!!,
|
||||
SpreedFeatures.UNBIND_CONVERSATION
|
||||
)
|
||||
) {
|
||||
val retentionPeriod = retentionOfSIPRoom(spreedCapabilities)
|
||||
val systemMessage = currentConversation?.lastMessage?.systemMessageType
|
||||
if (retentionPeriod != 0 && (
|
||||
@ -690,7 +699,11 @@ class ChatActivity :
|
||||
}
|
||||
}
|
||||
|
||||
if (currentConversation?.objectType == ConversationEnums.ObjectType.INSTANT_MEETING) {
|
||||
if (currentConversation?.objectType == ConversationEnums.ObjectType.INSTANT_MEETING && hasSpreedFeatureCapability(
|
||||
conversationUser?.capabilities!!.spreedCapability!!,
|
||||
SpreedFeatures.UNBIND_CONVERSATION
|
||||
)
|
||||
) {
|
||||
val retentionPeriod = retentionOfInstantMeetingRoom(spreedCapabilities)
|
||||
val systemMessage = currentConversation?.lastMessage?.systemMessageType
|
||||
if (retentionPeriod != 0 && (
|
||||
@ -1232,7 +1245,7 @@ class ChatActivity :
|
||||
}
|
||||
}
|
||||
|
||||
fun deleteConversationDialog(context: Context) {
|
||||
fun deleteConversationDialog(context: Context) {
|
||||
val dialogBuilder = MaterialAlertDialogBuilder(context)
|
||||
.setIcon(
|
||||
viewThemeUtils.dialog
|
||||
|
@ -808,7 +808,7 @@ class ChatViewModel @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
fun unbindRoom(credentials: String, baseUrl: String, roomToken: String) {
|
||||
fun unbindRoom(credentials: String, baseUrl: String, roomToken: String) {
|
||||
viewModelScope.launch {
|
||||
try {
|
||||
val response = chatNetworkDataSource.unbindRoom(credentials, baseUrl, roomToken)
|
||||
|
@ -449,7 +449,7 @@ object ApiUtils {
|
||||
return "$baseUrl$OCS_API_VERSION/cloud/users/search/by-phone"
|
||||
}
|
||||
|
||||
fun getUrlForUnbindingRoom(baseUrl: String, roomToken: String): String {
|
||||
fun getUrlForUnbindingRoom(baseUrl: String, roomToken: String): String {
|
||||
return "$baseUrl/ocs/v2.php/apps/spreed/api/v4/room/$roomToken/object"
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,8 @@ enum class SpreedFeatures(val value: String) {
|
||||
BAN_V1("ban-v1"),
|
||||
EDIT_MESSAGES_NOTE_TO_SELF("edit-messages-note-to-self"),
|
||||
ARCHIVE_CONVERSATIONS("archived-conversations-v2"),
|
||||
CONVERSATION_CREATION_ALL("conversation-creation-all")
|
||||
CONVERSATION_CREATION_ALL("conversation-creation-all"),
|
||||
UNBIND_CONVERSATION("unbind-conversation")
|
||||
}
|
||||
|
||||
@Suppress("TooManyFunctions")
|
||||
|
@ -521,7 +521,7 @@ How to translate with transifex:
|
||||
leaked to other services</string>
|
||||
<string name="startCallForbidden">You are not allowed to start a call</string>
|
||||
<string name="nc_last_moderator_leaving_room_warning">You need to promote a new moderator before you can leave the conversation</string>
|
||||
<string name="nc_room_retention">Room was retained successfully</string>
|
||||
<string name="nc_room_retention">Room is retained successfully</string>
|
||||
|
||||
<string name="share">Share</string>
|
||||
<string name="send_to">Send to</string>
|
||||
|
Loading…
Reference in New Issue
Block a user