Fake that we’re still in a room when visiting conversation info

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-12-17 19:31:18 +01:00
parent c25a8b0fed
commit da779190ed
2 changed files with 11 additions and 2 deletions

View File

@ -173,6 +173,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
private static final byte CONTENT_TYPE_SYSTEM_MESSAGE = 1; private static final byte CONTENT_TYPE_SYSTEM_MESSAGE = 1;
private boolean wasDetached; private boolean wasDetached;
private boolean isStartingACall;
public ChatController(Bundle args) { public ChatController(Bundle args) {
super(args); super(args);
@ -511,6 +512,8 @@ public class ChatController extends BaseController implements MessagesListAdapte
joinRoomWithPassword(); joinRoomWithPassword();
} }
} }
isStartingACall = false;
} }
@Override @Override
@ -519,7 +522,9 @@ public class ChatController extends BaseController implements MessagesListAdapte
if (conversationUser.hasSpreedCapabilityWithName("no-ping") if (conversationUser.hasSpreedCapabilityWithName("no-ping")
&& getActivity() != null && !getActivity().isChangingConfigurations()) { && getActivity() != null && !getActivity().isChangingConfigurations()) {
wasDetached = true; wasDetached = true;
leaveRoom(); if (!isStartingACall) {
leaveRoom();
}
} }
} }
@ -1015,11 +1020,13 @@ public class ChatController extends BaseController implements MessagesListAdapte
if (!isVoiceOnlyCall) { if (!isVoiceOnlyCall) {
Intent videoCallIntent = getIntentForCall(false); Intent videoCallIntent = getIntentForCall(false);
if (videoCallIntent != null) { if (videoCallIntent != null) {
isStartingACall = true;
startActivity(videoCallIntent); startActivity(videoCallIntent);
} }
} else { } else {
Intent voiceCallIntent = getIntentForCall(true); Intent voiceCallIntent = getIntentForCall(true);
if (voiceCallIntent != null) { if (voiceCallIntent != null) {
isStartingACall = true;
startActivity(voiceCallIntent); startActivity(voiceCallIntent);
} }
} }

View File

@ -118,7 +118,7 @@ public class ConversationInfoController extends BaseController {
private FlexibleAdapter<AbstractFlexibleItem> adapter; private FlexibleAdapter<AbstractFlexibleItem> adapter;
private List<AbstractFlexibleItem> recyclerViewItems = new ArrayList<>(); private List<AbstractFlexibleItem> recyclerViewItems = new ArrayList<>();
public ConversationInfoController(Bundle args) { ConversationInfoController(Bundle args) {
super(args); super(args);
setHasOptionsMenu(true); setHasOptionsMenu(true);
NextcloudTalkApplication.getSharedApplication().getComponentApplication().inject(this); NextcloudTalkApplication.getSharedApplication().getComponentApplication().inject(this);
@ -192,6 +192,8 @@ public class ConversationInfoController extends BaseController {
userItem.setEnabled(!participant.getSessionId().equals("0")); userItem.setEnabled(!participant.getSessionId().equals("0"));
if (!TextUtils.isEmpty(participant.getUserId()) && participant.getUserId().equals(conversationUser.getUserId())) { if (!TextUtils.isEmpty(participant.getUserId()) && participant.getUserId().equals(conversationUser.getUserId())) {
ownUserItem = userItem; ownUserItem = userItem;
userItem.getModel().setSessionId("-1");
userItem.setEnabled(true);
} else { } else {
recyclerViewItems.add(userItem); recyclerViewItems.add(userItem);
} }