Просмотр исходного кода

Fix lobby check crash, fix user related crash, fix infinite lobby progress bar

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 5 лет назад
Родитель
Сommit
86974a8437

+ 1 - 0
app/gplay/release/output.json

@@ -0,0 +1 @@
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":109,"versionName":"7.0.0beta1","enabled":true,"outputFile":"app-gplay-release.apk","fullName":"gplayRelease","baseName":"gplay-release"},"path":"app-gplay-release.apk","properties":{}}]

+ 20 - 24
app/src/main/java/com/nextcloud/talk/controllers/ChatController.java

@@ -42,7 +42,6 @@ import android.view.MenuItem;
 import android.view.View;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.ViewGroup;
 import android.widget.AbsListView;
 import android.widget.AbsListView;
-import android.widget.EditText;
 import android.widget.ImageButton;
 import android.widget.ImageButton;
 import android.widget.ProgressBar;
 import android.widget.ProgressBar;
 import android.widget.RelativeLayout;
 import android.widget.RelativeLayout;
@@ -266,18 +265,14 @@ public class ChatController extends BaseController implements MessagesListAdapte
 
 
                         currentConversation = roomOverall.getOcs().getData();
                         currentConversation = roomOverall.getOcs().getData();
 
 
-                        if (oldConversation == null) {
-                            conversationName = currentConversation.getDisplayName();
-                            setTitle();
-                            setupMentionAutocomplete();
-                        }
+                        conversationName = currentConversation.getDisplayName();
+                        setTitle();
+                        setupMentionAutocomplete();
 
 
                         checkReadOnlyState();
                         checkReadOnlyState();
-                        if (oldConversation == null || (!oldConversation.getLobbyState().equals(currentConversation.getLobbyState()) || !oldConversation.getLobbyTimer().equals(currentConversation.getLobbyTimer()))) {
-                            checkLobbyState(oldConversation != null && (!oldConversation.getLobbyState().equals(currentConversation.getLobbyState())));
-                        }
+                        checkLobbyState();
 
 
-                        if (oldConversation == null) {
+                        if (oldConversation == null || oldConversation.getRoomId() == null) {
                             joinRoomWithPassword();
                             joinRoomWithPassword();
                         }
                         }
 
 
@@ -317,7 +312,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
                             if (roomId.equals(conversation.getRoomId())) {
                             if (roomId.equals(conversation.getRoomId())) {
                                 roomToken = conversation.getToken();
                                 roomToken = conversation.getToken();
                                 currentConversation = conversation;
                                 currentConversation = conversation;
-                                checkLobbyState(false);
+                                checkLobbyState();
                                 checkReadOnlyState();
                                 checkReadOnlyState();
                                 conversationName = conversation.getDisplayName();
                                 conversationName = conversation.getDisplayName();
                                 setTitle();
                                 setTitle();
@@ -488,7 +483,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
         }
         }
 
 
         if (currentConversation != null) {
         if (currentConversation != null) {
-            checkLobbyState(false);
+            checkLobbyState();
         }
         }
 
 
         if (adapterWasNull) {
         if (adapterWasNull) {
@@ -535,8 +530,8 @@ public class ChatController extends BaseController implements MessagesListAdapte
         }
         }
     }
     }
 
 
-    private void checkLobbyState(boolean lobbyStateChanged) {
-        if (currentConversation != null) {
+    private void checkLobbyState() {
+        if (currentConversation != null && currentConversation.isLobbyViewApplicable(conversationUser)) {
 
 
             if (!checkingLobbyStatus) {
             if (!checkingLobbyStatus) {
                 getRoomInfo();
                 getRoomInfo();
@@ -548,7 +543,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
                 messageInputView.setVisibility(View.GONE);
                 messageInputView.setVisibility(View.GONE);
                 loadingProgressBar.setVisibility(View.GONE);
                 loadingProgressBar.setVisibility(View.GONE);
 
 
-                if (currentConversation.getLobbyTimer() != null && currentConversation.getLobbyTimer() != 0) {
+                if (currentConversation.getLobbyTimer() != null && currentConversation.getLobbyTimer() != 0L) {
                     conversationLobbyText.setText(String.format(getResources().getString(R.string.nc_lobby_waiting_with_date), DateUtils.INSTANCE.getLocalDateStringFromTimestampForLobby(currentConversation.getLobbyTimer())));
                     conversationLobbyText.setText(String.format(getResources().getString(R.string.nc_lobby_waiting_with_date), DateUtils.INSTANCE.getLocalDateStringFromTimestampForLobby(currentConversation.getLobbyTimer())));
                 } else {
                 } else {
                     conversationLobbyText.setText(R.string.nc_lobby_waiting);
                     conversationLobbyText.setText(R.string.nc_lobby_waiting);
@@ -557,15 +552,16 @@ public class ChatController extends BaseController implements MessagesListAdapte
                 lobbyView.setVisibility(View.GONE);
                 lobbyView.setVisibility(View.GONE);
                 messagesListView.setVisibility(View.VISIBLE);
                 messagesListView.setVisibility(View.VISIBLE);
                 messageInput.setVisibility(View.VISIBLE);
                 messageInput.setVisibility(View.VISIBLE);
-                if (lobbyStateChanged) {
-                    loadingProgressBar.setVisibility(View.VISIBLE);
-                    if (isFirstMessagesProcessing) {
-                        pullChatMessages(0);
-                    } else {
-                        pullChatMessages(1);
-                    }
+                if (isFirstMessagesProcessing) {
+                    pullChatMessages(0);
+                } else {
+                    pullChatMessages(1);
                 }
                 }
             }
             }
+        } else {
+            lobbyView.setVisibility(View.GONE);
+            messagesListView.setVisibility(View.VISIBLE);
+            messageInput.setVisibility(View.VISIBLE);
         }
         }
     }
     }
 
 
@@ -764,7 +760,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
                             ApplicationWideCurrentRoomHolder.getInstance().setSession(currentCall.getSessionId());
                             ApplicationWideCurrentRoomHolder.getInstance().setSession(currentCall.getSessionId());
                             startPing();
                             startPing();
 
 
-                            checkLobbyState(false);
+                            checkLobbyState();
 
 
                             setupWebsocket();
                             setupWebsocket();
 
 
@@ -988,7 +984,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
 
 
                             @Override
                             @Override
                             public void onComplete() {
                             public void onComplete() {
-                                if (currentConversation.shouldShowLobby(conversationUser)) {
+                                if (!currentConversation.shouldShowLobby(conversationUser)) {
                                     pullChatMessages(1);
                                     pullChatMessages(1);
                                 }
                                 }
                             }
                             }

+ 1 - 1
app/src/main/java/com/nextcloud/talk/models/json/conversations/Conversation.java

@@ -114,7 +114,7 @@ public class Conversation {
     }
     }
 
 
     public boolean shouldShowLobby(UserEntity conversationUser) {
     public boolean shouldShowLobby(UserEntity conversationUser) {
-        return getLobbyState().equals(LobbyState.LOBBY_STATE_MODERATORS_ONLY) && !canModerate(conversationUser);
+        return LobbyState.LOBBY_STATE_MODERATORS_ONLY.equals(getLobbyState()) && !canModerate(conversationUser);
     }
     }
 
 
     public boolean isLobbyViewApplicable(UserEntity conversationUser) {
     public boolean isLobbyViewApplicable(UserEntity conversationUser) {

+ 1 - 1
app/src/main/res/layout/rv_item_contact.xml

@@ -38,7 +38,7 @@
         android:tint="@color/colorPrimary"
         android:tint="@color/colorPrimary"
         android:visibility="gone" />
         android:visibility="gone" />
 
 
-    <EmojiTextView
+    <androidx.emoji.widget.EmojiTextView
         android:id="@+id/name_text"
         android:id="@+id/name_text"
         android:layout_width="match_parent"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_height="wrap_content"

+ 0 - 5
app/src/main/res/values/strings.xml

@@ -273,8 +273,6 @@
     <string name="nc_guest">Guest</string>
     <string name="nc_guest">Guest</string>
     <string name="nc_following_link">User following a public link</string>
     <string name="nc_following_link">User following a public link</string>
 
 
-    <string name="nc_readonly_hint">This conversation is locked</string>
-
     <!-- Browser component -->
     <!-- Browser component -->
     <string name="nc_file_browser">File browser"</string>
     <string name="nc_file_browser">File browser"</string>
     <string name="nc_select_files">Select files</string>
     <string name="nc_select_files">Select files</string>
@@ -291,7 +289,4 @@
     <string name="nc_lobby_waiting_with_date">You are currently waiting in the lobby.\n This
     <string name="nc_lobby_waiting_with_date">You are currently waiting in the lobby.\n This
         meeting is scheduled for %1$s.</string>
         meeting is scheduled for %1$s.</string>
     <string name="nc_manual">Manual</string>
     <string name="nc_manual">Manual</string>
-    <string name="nc_at">at</string>
-
-
 </resources>
 </resources>