mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
Exclude the user's own number from notifyNewUsers
Closes #5229 // FREEBIE
This commit is contained in:
parent
156c5c6e09
commit
72064d8827
@ -1189,17 +1189,11 @@ 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;
|
||||
}
|
||||
return Util.isOwnNumber(this, recipients.getPrimaryRecipient().getNumber());
|
||||
}
|
||||
|
||||
private boolean isGroupConversation() {
|
||||
|
@ -255,7 +255,6 @@ public class MessageSender {
|
||||
}
|
||||
|
||||
private static boolean isSelfSend(Context context, Recipients recipients) {
|
||||
try {
|
||||
if (!TextSecurePreferences.isPushRegistered(context)) {
|
||||
return false;
|
||||
}
|
||||
@ -268,12 +267,7 @@ public class MessageSender {
|
||||
return false;
|
||||
}
|
||||
|
||||
String e164number = Util.canonicalizeNumber(context, recipients.getPrimaryRecipient().getNumber());
|
||||
return TextSecurePreferences.getLocalNumber(context).equals(e164number);
|
||||
} catch (InvalidNumberException e) {
|
||||
Log.w("MessageSender", e);
|
||||
return false;
|
||||
}
|
||||
return Util.isOwnNumber(context, recipients.getPrimaryRecipient().getNumber());
|
||||
}
|
||||
|
||||
private static boolean isPushDestination(Context context, String destination) {
|
||||
|
@ -216,7 +216,7 @@ public class DirectoryHelper {
|
||||
if (!TextSecurePreferences.isNewContactsNotificationEnabled(context)) return;
|
||||
|
||||
for (String newUser : newUsers) {
|
||||
if (!SessionUtil.hasSession(context, masterSecret, newUser)) {
|
||||
if (!SessionUtil.hasSession(context, masterSecret, newUser) && !Util.isOwnNumber(context, newUser)) {
|
||||
IncomingJoinedMessage message = new IncomingJoinedMessage(newUser);
|
||||
Pair<Long, Long> smsAndThreadId = DatabaseFactory.getSmsDatabase(context).insertMessageInbox(message);
|
||||
|
||||
|
@ -184,6 +184,16 @@ public class Util {
|
||||
else return canonicalizeNumber(context, number);
|
||||
}
|
||||
|
||||
public static boolean isOwnNumber(Context context, String number) {
|
||||
try {
|
||||
String e164number = canonicalizeNumber(context, number);
|
||||
return TextSecurePreferences.getLocalNumber(context).equals(e164number);
|
||||
} catch (InvalidNumberException e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static byte[] readFully(InputStream in) throws IOException {
|
||||
ByteArrayOutputStream bout = new ByteArrayOutputStream();
|
||||
byte[] buffer = new byte[4096];
|
||||
|
Loading…
Reference in New Issue
Block a user