mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-23 05:25:31 +03:00
restrict to start a call when permission is missing
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
65e002fe98
commit
54552cdd87
4 changed files with 40 additions and 4 deletions
|
@ -2298,10 +2298,14 @@ class ChatController(args: Bundle) :
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun startACall(isVoiceOnlyCall: Boolean) {
|
private fun startACall(isVoiceOnlyCall: Boolean) {
|
||||||
ApplicationWideCurrentRoomHolder.getInstance().isDialing = true
|
if (currentConversation?.canStartCall == false && currentConversation?.hasCall == false) {
|
||||||
val callIntent = getIntentForCall(isVoiceOnlyCall)
|
Toast.makeText(context, R.string.startCallForbidden, Toast.LENGTH_LONG).show()
|
||||||
if (callIntent != null) {
|
} else {
|
||||||
startActivity(callIntent)
|
ApplicationWideCurrentRoomHolder.getInstance().isDialing = true
|
||||||
|
val callIntent = getIntentForCall(isVoiceOnlyCall)
|
||||||
|
if (callIntent != null) {
|
||||||
|
startActivity(callIntent)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,8 +92,12 @@ public class Conversation {
|
||||||
public Long lobbyTimer;
|
public Long lobbyTimer;
|
||||||
@JsonField(name = "lastReadMessage")
|
@JsonField(name = "lastReadMessage")
|
||||||
public int lastReadMessage;
|
public int lastReadMessage;
|
||||||
|
@JsonField(name = "hasCall")
|
||||||
|
public boolean hasCall;
|
||||||
@JsonField(name = "callFlag")
|
@JsonField(name = "callFlag")
|
||||||
public int callFlag;
|
public int callFlag;
|
||||||
|
@JsonField(name = "canStartCall")
|
||||||
|
public boolean canStartCall;
|
||||||
|
|
||||||
@JsonField(name = "canLeaveConversation")
|
@JsonField(name = "canLeaveConversation")
|
||||||
public Boolean canLeaveConversation;
|
public Boolean canLeaveConversation;
|
||||||
|
@ -259,10 +263,18 @@ public class Conversation {
|
||||||
return this.lastReadMessage;
|
return this.lastReadMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getHasCall() {
|
||||||
|
return hasCall;
|
||||||
|
}
|
||||||
|
|
||||||
public int getCallFlag() {
|
public int getCallFlag() {
|
||||||
return this.callFlag;
|
return this.callFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getCanStartCall() {
|
||||||
|
return canStartCall;
|
||||||
|
}
|
||||||
|
|
||||||
public Boolean getUnreadMentionDirect() {
|
public Boolean getUnreadMentionDirect() {
|
||||||
return unreadMentionDirect;
|
return unreadMentionDirect;
|
||||||
}
|
}
|
||||||
|
@ -370,10 +382,18 @@ public class Conversation {
|
||||||
this.lastReadMessage = lastReadMessage;
|
this.lastReadMessage = lastReadMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setHasCall(boolean hasCall) {
|
||||||
|
this.hasCall = hasCall;
|
||||||
|
}
|
||||||
|
|
||||||
public void setCallFlag(int callFlag) {
|
public void setCallFlag(int callFlag) {
|
||||||
this.callFlag = callFlag;
|
this.callFlag = callFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCanStartCall(boolean canStartCall) {
|
||||||
|
this.canStartCall = canStartCall;
|
||||||
|
}
|
||||||
|
|
||||||
public void setUnreadMentionDirect(Boolean unreadMentionDirect) {
|
public void setUnreadMentionDirect(Boolean unreadMentionDirect) {
|
||||||
this.unreadMentionDirect = unreadMentionDirect;
|
this.unreadMentionDirect = unreadMentionDirect;
|
||||||
}
|
}
|
||||||
|
@ -411,9 +431,15 @@ public class Conversation {
|
||||||
if (lastReadMessage != that.lastReadMessage) {
|
if (lastReadMessage != that.lastReadMessage) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (hasCall != that.hasCall) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (callFlag != that.callFlag) {
|
if (callFlag != that.callFlag) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (canStartCall != that.canStartCall) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!Objects.equals(roomId, that.roomId)) {
|
if (!Objects.equals(roomId, that.roomId)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -508,7 +534,9 @@ public class Conversation {
|
||||||
result = 31 * result + (lobbyState != null ? lobbyState.hashCode() : 0);
|
result = 31 * result + (lobbyState != null ? lobbyState.hashCode() : 0);
|
||||||
result = 31 * result + (lobbyTimer != null ? lobbyTimer.hashCode() : 0);
|
result = 31 * result + (lobbyTimer != null ? lobbyTimer.hashCode() : 0);
|
||||||
result = 31 * result + lastReadMessage;
|
result = 31 * result + lastReadMessage;
|
||||||
|
result = 31 * result + (hasCall ? 1 : 0);
|
||||||
result = 31 * result + callFlag;
|
result = 31 * result + callFlag;
|
||||||
|
result = 31 * result + (canStartCall ? 1 : 0);
|
||||||
result = 31 * result + (canLeaveConversation != null ? canLeaveConversation.hashCode() : 0);
|
result = 31 * result + (canLeaveConversation != null ? canLeaveConversation.hashCode() : 0);
|
||||||
result = 31 * result + (canDeleteConversation != null ? canDeleteConversation.hashCode() : 0);
|
result = 31 * result + (canDeleteConversation != null ? canDeleteConversation.hashCode() : 0);
|
||||||
result = 31 * result + (notificationCalls != null ? notificationCalls.hashCode() : 0);
|
result = 31 * result + (notificationCalls != null ? notificationCalls.hashCode() : 0);
|
||||||
|
@ -543,7 +571,9 @@ public class Conversation {
|
||||||
", lobbyState=" + lobbyState +
|
", lobbyState=" + lobbyState +
|
||||||
", lobbyTimer=" + lobbyTimer +
|
", lobbyTimer=" + lobbyTimer +
|
||||||
", lastReadMessage=" + lastReadMessage +
|
", lastReadMessage=" + lastReadMessage +
|
||||||
|
", hasCall=" + hasCall +
|
||||||
", callFlag=" + callFlag +
|
", callFlag=" + callFlag +
|
||||||
|
", canStartCall=" + canStartCall +
|
||||||
", canLeaveConversation=" + canLeaveConversation +
|
", canLeaveConversation=" + canLeaveConversation +
|
||||||
", canDeleteConversation=" + canDeleteConversation +
|
", canDeleteConversation=" + canDeleteConversation +
|
||||||
", notificationCalls=" + notificationCalls +
|
", notificationCalls=" + notificationCalls +
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/chat_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:animateLayoutChanges="true"
|
android:animateLayoutChanges="true"
|
||||||
|
|
|
@ -383,6 +383,7 @@
|
||||||
<string name="nc_reply_privately">Reply privately</string>
|
<string name="nc_reply_privately">Reply privately</string>
|
||||||
<string name="nc_delete_message">Delete</string>
|
<string name="nc_delete_message">Delete</string>
|
||||||
<string name="nc_delete_message_leaked_to_matterbridge">Message deleted successfully, but it might have been leaked to other services</string>
|
<string name="nc_delete_message_leaked_to_matterbridge">Message deleted successfully, but it might have been leaked to other services</string>
|
||||||
|
<string name="startCallForbidden">You are not allowed to start a call</string>
|
||||||
|
|
||||||
<string name="share">Share</string>
|
<string name="share">Share</string>
|
||||||
<string name="send_to">Send to</string>
|
<string name="send_to">Send to</string>
|
||||||
|
|
Loading…
Reference in a new issue