This commit is contained in:
Niels Andriesse 2019-08-28 16:07:20 +10:00
parent 3b8847ca21
commit 517d4e94c5

View File

@ -1933,7 +1933,12 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
} }
private void setBlockedUserState(Recipient recipient, boolean isSecureText, boolean isDefaultSms) { private void setBlockedUserState(Recipient recipient, boolean isSecureText, boolean isDefaultSms) {
if (recipient.isBlocked()) { if (recipient.isGroupRecipient() && (recipient.getName().equals("Loki News") || recipient.getName().equals("Loki Messenger Updates"))) {
unblockButton.setVisibility(View.GONE);
composePanel.setVisibility(View.GONE);
makeDefaultSmsButton.setVisibility(View.GONE);
registerButton.setVisibility(View.GONE);
} else if (recipient.isBlocked()) {
unblockButton.setVisibility(View.VISIBLE); unblockButton.setVisibility(View.VISIBLE);
composePanel.setVisibility(View.GONE); composePanel.setVisibility(View.GONE);
makeDefaultSmsButton.setVisibility(View.GONE); makeDefaultSmsButton.setVisibility(View.GONE);
@ -2131,23 +2136,14 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
} }
private void updateInputPanel() { private void updateInputPanel() {
Recipient recipient = DatabaseFactory.getThreadDatabase(this).getRecipientForThreadId(threadId); boolean hasPendingFriendRequest = DatabaseFactory.getLokiThreadDatabase(this).hasPendingFriendRequest(threadId);
boolean isGroup = recipient.isGroupRecipient(); inputPanel.setEnabled(!hasPendingFriendRequest);
if (isGroup) { int hintID = hasPendingFriendRequest ? R.string.activity_conversation_pending_friend_request_hint : R.string.activity_conversation_default_hint;
boolean isRSSFeed = recipient.getName().equals("Loki News") || recipient.getName().equals("Loki Messenger Updates"); // TODO: This is just a temporary hack and should be removed ASAP inputPanel.setHint(getResources().getString(hintID));
inputPanel.setEnabled(!isRSSFeed); if (!hasPendingFriendRequest) {
String hint = isRSSFeed ? "Input disabled" : "New Message"; inputPanel.composeText.requestFocus();
inputPanel.setHint(hint); InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
} else { inputMethodManager.showSoftInput(inputPanel.composeText, 0);
boolean hasPendingFriendRequest = DatabaseFactory.getLokiThreadDatabase(this).hasPendingFriendRequest(threadId);
inputPanel.setEnabled(!hasPendingFriendRequest);
int hintID = hasPendingFriendRequest ? R.string.activity_conversation_pending_friend_request_hint : R.string.activity_conversation_default_hint;
inputPanel.setHint(getResources().getString(hintID));
if (!hasPendingFriendRequest) {
inputPanel.composeText.requestFocus();
InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
inputMethodManager.showSoftInput(inputPanel.composeText, 0);
}
} }
} }