mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-22 04:59:34 +01:00
set calling/dialing state by ApplicationWideCurrentRoomHolder
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
78384e7b55
commit
d4d23c1855
@ -844,7 +844,7 @@ public class CallController extends BaseController {
|
|||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||||
@OnClick(R.id.callControlEnterPip)
|
@OnClick(R.id.callControlEnterPip)
|
||||||
void onToggleChatClick() {
|
void enterPipMode() {
|
||||||
((MagicCallActivity) getActivity()).enterPipMode();
|
((MagicCallActivity) getActivity()).enterPipMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1304,6 +1304,7 @@ public class CallController extends BaseController {
|
|||||||
setCallState(CallStatus.JOINED);
|
setCallState(CallStatus.JOINED);
|
||||||
|
|
||||||
ApplicationWideCurrentRoomHolder.getInstance().setInCall(true);
|
ApplicationWideCurrentRoomHolder.getInstance().setInCall(true);
|
||||||
|
ApplicationWideCurrentRoomHolder.getInstance().setDialing(false);
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(roomToken)) {
|
if (!TextUtils.isEmpty(roomToken)) {
|
||||||
NotificationUtils.INSTANCE.cancelExistingNotificationsForRoom(getApplicationContext(),
|
NotificationUtils.INSTANCE.cancelExistingNotificationsForRoom(getApplicationContext(),
|
||||||
@ -1581,6 +1582,7 @@ public class CallController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hangupNetworkCalls(shutDownView);
|
hangupNetworkCalls(shutDownView);
|
||||||
|
ApplicationWideCurrentRoomHolder.getInstance().setInCall(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hangupNetworkCalls(boolean shutDownView) {
|
private void hangupNetworkCalls(boolean shutDownView) {
|
||||||
|
@ -232,7 +232,6 @@ class ChatController(args: Bundle) :
|
|||||||
val roomId: String
|
val roomId: String
|
||||||
val voiceOnly: Boolean
|
val voiceOnly: Boolean
|
||||||
var isFirstMessagesProcessing = true
|
var isFirstMessagesProcessing = true
|
||||||
var isLeavingForConversation: Boolean = false
|
|
||||||
var wasDetached: Boolean = false
|
var wasDetached: Boolean = false
|
||||||
var emojiPopup: EmojiPopup? = null
|
var emojiPopup: EmojiPopup? = null
|
||||||
|
|
||||||
@ -1367,10 +1366,8 @@ class ChatController(args: Bundle) :
|
|||||||
activity?.findViewById<View>(R.id.toolbar)?.setOnClickListener { v -> showConversationInfoScreen() }
|
activity?.findViewById<View>(R.id.toolbar)?.setOnClickListener { v -> showConversationInfoScreen() }
|
||||||
}
|
}
|
||||||
|
|
||||||
isLeavingForConversation = false
|
|
||||||
ApplicationWideCurrentRoomHolder.getInstance().currentRoomId = roomId
|
ApplicationWideCurrentRoomHolder.getInstance().currentRoomId = roomId
|
||||||
ApplicationWideCurrentRoomHolder.getInstance().currentRoomToken = roomId
|
ApplicationWideCurrentRoomHolder.getInstance().currentRoomToken = roomId
|
||||||
ApplicationWideCurrentRoomHolder.getInstance().isInCall = false
|
|
||||||
ApplicationWideCurrentRoomHolder.getInstance().userInRoom = conversationUser
|
ApplicationWideCurrentRoomHolder.getInstance().userInRoom = conversationUser
|
||||||
|
|
||||||
val smileyButton = binding.messageInputView.findViewById<ImageButton>(R.id.smileyButton)
|
val smileyButton = binding.messageInputView.findViewById<ImageButton>(R.id.smileyButton)
|
||||||
@ -1434,11 +1431,6 @@ class ChatController(args: Bundle) :
|
|||||||
|
|
||||||
override fun onDetach(view: View) {
|
override fun onDetach(view: View) {
|
||||||
super.onDetach(view)
|
super.onDetach(view)
|
||||||
|
|
||||||
if (!isLeavingForConversation) {
|
|
||||||
// current room is still "active", we need the info
|
|
||||||
ApplicationWideCurrentRoomHolder.getInstance().clear()
|
|
||||||
}
|
|
||||||
eventBus?.unregister(this)
|
eventBus?.unregister(this)
|
||||||
|
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
@ -1448,9 +1440,10 @@ class ChatController(args: Bundle) :
|
|||||||
if (conversationUser != null &&
|
if (conversationUser != null &&
|
||||||
activity != null &&
|
activity != null &&
|
||||||
!activity?.isChangingConfigurations!! &&
|
!activity?.isChangingConfigurations!! &&
|
||||||
!isLeavingForConversation
|
!ApplicationWideCurrentRoomHolder.getInstance().isInCall &&
|
||||||
|
!ApplicationWideCurrentRoomHolder.getInstance().isDialing
|
||||||
) {
|
) {
|
||||||
// TODO: don't leave room when going back to call from PIP Mode!!
|
ApplicationWideCurrentRoomHolder.getInstance().clear()
|
||||||
wasDetached = true
|
wasDetached = true
|
||||||
leaveRoom()
|
leaveRoom()
|
||||||
}
|
}
|
||||||
@ -2121,7 +2114,7 @@ class ChatController(args: Bundle) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun startACall(isVoiceOnlyCall: Boolean) {
|
private fun startACall(isVoiceOnlyCall: Boolean) {
|
||||||
isLeavingForConversation = true
|
ApplicationWideCurrentRoomHolder.getInstance().isDialing = true
|
||||||
val callIntent = getIntentForCall(isVoiceOnlyCall)
|
val callIntent = getIntentForCall(isVoiceOnlyCall)
|
||||||
if (callIntent != null) {
|
if (callIntent != null) {
|
||||||
startActivity(callIntent)
|
startActivity(callIntent)
|
||||||
|
@ -28,6 +28,7 @@ public class ApplicationWideCurrentRoomHolder {
|
|||||||
private String currentRoomToken = "";
|
private String currentRoomToken = "";
|
||||||
private UserEntity userInRoom = new UserEntity();
|
private UserEntity userInRoom = new UserEntity();
|
||||||
private boolean inCall = false;
|
private boolean inCall = false;
|
||||||
|
private boolean isDialing = false;
|
||||||
private String session = "";
|
private String session = "";
|
||||||
|
|
||||||
public static ApplicationWideCurrentRoomHolder getInstance() {
|
public static ApplicationWideCurrentRoomHolder getInstance() {
|
||||||
@ -38,6 +39,7 @@ public class ApplicationWideCurrentRoomHolder {
|
|||||||
currentRoomId = "";
|
currentRoomId = "";
|
||||||
userInRoom = new UserEntity();
|
userInRoom = new UserEntity();
|
||||||
inCall = false;
|
inCall = false;
|
||||||
|
isDialing = false;
|
||||||
currentRoomToken = "";
|
currentRoomToken = "";
|
||||||
session = "";
|
session = "";
|
||||||
}
|
}
|
||||||
@ -74,6 +76,14 @@ public class ApplicationWideCurrentRoomHolder {
|
|||||||
this.inCall = inCall;
|
this.inCall = inCall;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isDialing() {
|
||||||
|
return isDialing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDialing(boolean dialing) {
|
||||||
|
isDialing = dialing;
|
||||||
|
}
|
||||||
|
|
||||||
public String getSession() {
|
public String getSession() {
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user