mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-25 18:17:20 +00:00
fix send icon merge botch, encryption icons logic
// FREEBIE
This commit is contained in:
parent
d4ac0c077d
commit
7d5e66eb6e
@ -103,12 +103,9 @@ import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
|||||||
import org.whispersystems.textsecure.crypto.InvalidMessageException;
|
import org.whispersystems.textsecure.crypto.InvalidMessageException;
|
||||||
import org.whispersystems.textsecure.crypto.MasterCipher;
|
import org.whispersystems.textsecure.crypto.MasterCipher;
|
||||||
import org.whispersystems.textsecure.crypto.MasterSecret;
|
import org.whispersystems.textsecure.crypto.MasterSecret;
|
||||||
import org.whispersystems.textsecure.directory.Directory;
|
|
||||||
import org.whispersystems.textsecure.directory.NotInDirectoryException;
|
|
||||||
import org.whispersystems.textsecure.storage.RecipientDevice;
|
import org.whispersystems.textsecure.storage.RecipientDevice;
|
||||||
import org.whispersystems.textsecure.storage.Session;
|
import org.whispersystems.textsecure.storage.Session;
|
||||||
import org.whispersystems.textsecure.storage.SessionRecordV2;
|
import org.whispersystems.textsecure.storage.SessionRecordV2;
|
||||||
import org.whispersystems.textsecure.util.InvalidNumberException;
|
|
||||||
import org.whispersystems.textsecure.util.Util;
|
import org.whispersystems.textsecure.util.Util;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -678,25 +675,23 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initializeSecurity() {
|
private void initializeSecurity() {
|
||||||
|
|
||||||
TypedArray drawables = obtainStyledAttributes(SEND_ATTRIBUTES);
|
TypedArray drawables = obtainStyledAttributes(SEND_ATTRIBUTES);
|
||||||
if ((getRecipients() != null && getRecipients().isGroupRecipient()) ||
|
boolean isPushDestination = DirectoryHelper.isPushDestination(this, getRecipients());
|
||||||
(isSingleConversation() && Session.hasSession(this, masterSecret, getRecipients().getPrimaryRecipient())))
|
Recipient primaryRecipient = getRecipients() == null ? null : getRecipients().getPrimaryRecipient();
|
||||||
|
|
||||||
|
if (isPushDestination ||
|
||||||
|
(isSingleConversation() && Session.hasSession(this, masterSecret, primaryRecipient)))
|
||||||
{
|
{
|
||||||
this.isEncryptedConversation = true;
|
this.isEncryptedConversation = true;
|
||||||
this.isAuthenticatedConversation = Session.hasRemoteIdentityKey(this, masterSecret, getRecipients().getPrimaryRecipient());
|
this.isAuthenticatedConversation = Session.hasRemoteIdentityKey(this, masterSecret, primaryRecipient);
|
||||||
this.characterCalculator = new EncryptedCharacterCalculator();
|
this.characterCalculator = new EncryptedCharacterCalculator();
|
||||||
|
|
||||||
|
if (isPushDestination) sendButton.setImageDrawable(drawables.getDrawable(0));
|
||||||
|
else sendButton.setImageDrawable(drawables.getDrawable(1));
|
||||||
} else {
|
} else {
|
||||||
this.isEncryptedConversation = false;
|
this.isEncryptedConversation = false;
|
||||||
this.isAuthenticatedConversation = false;
|
this.isAuthenticatedConversation = false;
|
||||||
this.characterCalculator = new CharacterCalculator();
|
this.characterCalculator = new CharacterCalculator();
|
||||||
}
|
|
||||||
|
|
||||||
if (DirectoryHelper.isPushDestination(this, getRecipients())) {
|
|
||||||
sendButton.setImageDrawable(drawables.getDrawable(0));
|
|
||||||
} else if (isEncryptedConversation) {
|
|
||||||
sendButton.setImageDrawable(drawables.getDrawable(1));
|
|
||||||
} else {
|
|
||||||
sendButton.setImageDrawable(drawables.getDrawable(2));
|
sendButton.setImageDrawable(drawables.getDrawable(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,17 +83,25 @@ public class DirectoryHelper {
|
|||||||
if (recipients == null) {
|
if (recipients == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TextSecurePreferences.isPushRegistered(context)) {
|
if (!TextSecurePreferences.isPushRegistered(context)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!recipients.isSingleRecipient()) {
|
if (!recipients.isSingleRecipient()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recipients.isGroupRecipient()) {
|
if (recipients.isGroupRecipient()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String number = recipients.getPrimaryRecipient().getNumber();
|
final String number = recipients.getPrimaryRecipient().getNumber();
|
||||||
|
|
||||||
|
if (number == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
final String e164number = Util.canonicalizeNumber(context, number);
|
final String e164number = Util.canonicalizeNumber(context, number);
|
||||||
|
|
||||||
return Directory.getInstance(context).isActiveNumber(e164number);
|
return Directory.getInstance(context).isActiveNumber(e164number);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user