mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 20:15:21 +00:00
parent
003787e4a6
commit
1fd8025cb5
@ -121,6 +121,7 @@ import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.concurrent.ListenableFuture;
|
||||
import org.thoughtcrime.securesms.util.concurrent.SettableFuture;
|
||||
import org.whispersystems.libaxolotl.InvalidMessageException;
|
||||
import org.whispersystems.textsecure.api.util.InvalidNumberException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
@ -772,7 +773,8 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
}
|
||||
|
||||
return new Pair<>(capabilities.getTextCapability() == Capability.SUPPORTED,
|
||||
capabilities.getVoiceCapability() == Capability.SUPPORTED);
|
||||
capabilities.getVoiceCapability() == Capability.SUPPORTED &&
|
||||
!isSelfConversation());
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
return new Pair<>(false, false);
|
||||
@ -1112,6 +1114,20 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isSelfConversation() {
|
||||
try {
|
||||
if (!TextSecurePreferences.isPushRegistered(this)) return false;
|
||||
if (!recipients.isSingleRecipient()) return false;
|
||||
if (recipients.getPrimaryRecipient().isGroupRecipient()) return false;
|
||||
|
||||
return Util.canonicalizeNumber(this, recipients.getPrimaryRecipient().getNumber())
|
||||
.equals(TextSecurePreferences.getLocalNumber(this));
|
||||
} catch (InvalidNumberException e) {
|
||||
Log.w(TAG, e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isGroupConversation() {
|
||||
return getRecipients() != null &&
|
||||
(!getRecipients().isSingleRecipient() || getRecipients().isGroupRecipient());
|
||||
|
Loading…
Reference in New Issue
Block a user