浏览代码

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

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 6 年之前
父节点
当前提交
da779190ed

+ 8 - 1
app/src/main/java/com/nextcloud/talk/controllers/ChatController.java

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

+ 3 - 1
app/src/main/java/com/nextcloud/talk/controllers/ConversationInfoController.java

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