Don't issue new user notification if secure session exists

Fixes #4800
// FREEBIE
This commit is contained in:
Moxie Marlinspike 2015-12-04 12:12:48 -08:00
parent ef5a0a0ff3
commit 8a3762b337

View File

@ -15,6 +15,8 @@ import android.util.Pair;
import org.thoughtcrime.securesms.ApplicationContext;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.crypto.MasterSecret;
import org.thoughtcrime.securesms.crypto.SessionUtil;
import org.thoughtcrime.securesms.crypto.storage.TextSecureSessionStore;
import org.thoughtcrime.securesms.database.DatabaseFactory;
import org.thoughtcrime.securesms.database.NotInDirectoryException;
import org.thoughtcrime.securesms.database.TextSecureDirectory;
@ -212,11 +214,13 @@ public class DirectoryHelper {
@NonNull List<String> newUsers)
{
for (String newUser : newUsers) {
if (!SessionUtil.hasSession(context, masterSecret, newUser)) {
IncomingJoinedMessage message = new IncomingJoinedMessage(newUser);
Pair<Long, Long> smsAndThreadId = DatabaseFactory.getSmsDatabase(context).insertMessageInbox(message);
MessageNotifier.updateNotification(context, masterSecret, smsAndThreadId.second);
}
}
}
private static Optional<Account> getOrCreateAccount(Context context) {
AccountManager accountManager = AccountManager.get(context);