From 86974a843749784a16c2996ae2a81e09e21063ec Mon Sep 17 00:00:00 2001 From: Mario Danic Date: Mon, 2 Sep 2019 11:55:37 +0200 Subject: [PATCH] Fix lobby check crash, fix user related crash, fix infinite lobby progress bar Signed-off-by: Mario Danic --- app/gplay/release/output.json | 1 + .../talk/controllers/ChatController.java | 44 +++++++++---------- .../json/conversations/Conversation.java | 2 +- app/src/main/res/layout/rv_item_contact.xml | 2 +- app/src/main/res/values/strings.xml | 5 --- 5 files changed, 23 insertions(+), 31 deletions(-) create mode 100644 app/gplay/release/output.json diff --git a/app/gplay/release/output.json b/app/gplay/release/output.json new file mode 100644 index 000000000..635bb6f37 --- /dev/null +++ b/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":{}}] \ No newline at end of file diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java index 00c8cfbaa..0b26e9484 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java +++ b/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.ViewGroup; import android.widget.AbsListView; -import android.widget.EditText; import android.widget.ImageButton; import android.widget.ProgressBar; import android.widget.RelativeLayout; @@ -266,18 +265,14 @@ public class ChatController extends BaseController implements MessagesListAdapte currentConversation = roomOverall.getOcs().getData(); - if (oldConversation == null) { - conversationName = currentConversation.getDisplayName(); - setTitle(); - setupMentionAutocomplete(); - } + conversationName = currentConversation.getDisplayName(); + setTitle(); + setupMentionAutocomplete(); 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(); } @@ -317,7 +312,7 @@ public class ChatController extends BaseController implements MessagesListAdapte if (roomId.equals(conversation.getRoomId())) { roomToken = conversation.getToken(); currentConversation = conversation; - checkLobbyState(false); + checkLobbyState(); checkReadOnlyState(); conversationName = conversation.getDisplayName(); setTitle(); @@ -488,7 +483,7 @@ public class ChatController extends BaseController implements MessagesListAdapte } if (currentConversation != null) { - checkLobbyState(false); + checkLobbyState(); } 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) { getRoomInfo(); @@ -548,7 +543,7 @@ public class ChatController extends BaseController implements MessagesListAdapte messageInputView.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()))); } else { conversationLobbyText.setText(R.string.nc_lobby_waiting); @@ -557,15 +552,16 @@ public class ChatController extends BaseController implements MessagesListAdapte lobbyView.setVisibility(View.GONE); messagesListView.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()); startPing(); - checkLobbyState(false); + checkLobbyState(); setupWebsocket(); @@ -988,7 +984,7 @@ public class ChatController extends BaseController implements MessagesListAdapte @Override public void onComplete() { - if (currentConversation.shouldShowLobby(conversationUser)) { + if (!currentConversation.shouldShowLobby(conversationUser)) { pullChatMessages(1); } } diff --git a/app/src/main/java/com/nextcloud/talk/models/json/conversations/Conversation.java b/app/src/main/java/com/nextcloud/talk/models/json/conversations/Conversation.java index fa752ca84..a3f26b0c9 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/conversations/Conversation.java +++ b/app/src/main/java/com/nextcloud/talk/models/json/conversations/Conversation.java @@ -114,7 +114,7 @@ public class Conversation { } 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) { diff --git a/app/src/main/res/layout/rv_item_contact.xml b/app/src/main/res/layout/rv_item_contact.xml index 847d72546..c55266533 100644 --- a/app/src/main/res/layout/rv_item_contact.xml +++ b/app/src/main/res/layout/rv_item_contact.xml @@ -38,7 +38,7 @@ android:tint="@color/colorPrimary" android:visibility="gone" /> - Guest User following a public link - This conversation is locked - File browser" Select files @@ -291,7 +289,4 @@ You are currently waiting in the lobby.\n This meeting is scheduled for %1$s. Manual - at - -