diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt index e6ca884d7..b47f38cbe 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt +++ b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt @@ -2298,10 +2298,14 @@ class ChatController(args: Bundle) : } private fun startACall(isVoiceOnlyCall: Boolean) { - ApplicationWideCurrentRoomHolder.getInstance().isDialing = true - val callIntent = getIntentForCall(isVoiceOnlyCall) - if (callIntent != null) { - startActivity(callIntent) + if (currentConversation?.canStartCall == false && currentConversation?.hasCall == false) { + Toast.makeText(context, R.string.startCallForbidden, Toast.LENGTH_LONG).show() + } else { + ApplicationWideCurrentRoomHolder.getInstance().isDialing = true + val callIntent = getIntentForCall(isVoiceOnlyCall) + if (callIntent != null) { + startActivity(callIntent) + } } } diff --git a/app/src/main/java/com/nextcloud/talk/models/json/conversations/Conversation.java b/app/src/main/java/com/nextcloud/talk/models/json/conversations/Conversation.java index 1405de884..880c37bd1 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/conversations/Conversation.java +++ b/app/src/main/java/com/nextcloud/talk/models/json/conversations/Conversation.java @@ -92,8 +92,12 @@ public class Conversation { public Long lobbyTimer; @JsonField(name = "lastReadMessage") public int lastReadMessage; + @JsonField(name = "hasCall") + public boolean hasCall; @JsonField(name = "callFlag") public int callFlag; + @JsonField(name = "canStartCall") + public boolean canStartCall; @JsonField(name = "canLeaveConversation") public Boolean canLeaveConversation; @@ -259,10 +263,18 @@ public class Conversation { return this.lastReadMessage; } + public boolean getHasCall() { + return hasCall; + } + public int getCallFlag() { return this.callFlag; } + public boolean getCanStartCall() { + return canStartCall; + } + public Boolean getUnreadMentionDirect() { return unreadMentionDirect; } @@ -370,10 +382,18 @@ public class Conversation { this.lastReadMessage = lastReadMessage; } + public void setHasCall(boolean hasCall) { + this.hasCall = hasCall; + } + public void setCallFlag(int callFlag) { this.callFlag = callFlag; } + public void setCanStartCall(boolean canStartCall) { + this.canStartCall = canStartCall; + } + public void setUnreadMentionDirect(Boolean unreadMentionDirect) { this.unreadMentionDirect = unreadMentionDirect; } @@ -411,9 +431,15 @@ public class Conversation { if (lastReadMessage != that.lastReadMessage) { return false; } + if (hasCall != that.hasCall) { + return false; + } if (callFlag != that.callFlag) { return false; } + if (canStartCall != that.canStartCall) { + return false; + } if (!Objects.equals(roomId, that.roomId)) { return false; } @@ -508,7 +534,9 @@ public class Conversation { result = 31 * result + (lobbyState != null ? lobbyState.hashCode() : 0); result = 31 * result + (lobbyTimer != null ? lobbyTimer.hashCode() : 0); result = 31 * result + lastReadMessage; + result = 31 * result + (hasCall ? 1 : 0); result = 31 * result + callFlag; + result = 31 * result + (canStartCall ? 1 : 0); result = 31 * result + (canLeaveConversation != null ? canLeaveConversation.hashCode() : 0); result = 31 * result + (canDeleteConversation != null ? canDeleteConversation.hashCode() : 0); result = 31 * result + (notificationCalls != null ? notificationCalls.hashCode() : 0); @@ -543,7 +571,9 @@ public class Conversation { ", lobbyState=" + lobbyState + ", lobbyTimer=" + lobbyTimer + ", lastReadMessage=" + lastReadMessage + + ", hasCall=" + hasCall + ", callFlag=" + callFlag + + ", canStartCall=" + canStartCall + ", canLeaveConversation=" + canLeaveConversation + ", canDeleteConversation=" + canDeleteConversation + ", notificationCalls=" + notificationCalls + diff --git a/app/src/main/res/layout/controller_chat.xml b/app/src/main/res/layout/controller_chat.xml index 413e56ffb..afa24a63c 100644 --- a/app/src/main/res/layout/controller_chat.xml +++ b/app/src/main/res/layout/controller_chat.xml @@ -23,6 +23,7 @@ Reply privately Delete Message deleted successfully, but it might have been leaked to other services + You are not allowed to start a call Share Send to