Add per-contact notification channels.

Fixes #8119
Fixes #8121
Fixes #8122
This commit is contained in:
Greyson Parrelli
2018-08-16 09:47:43 -07:00
parent e23fd9d491
commit e9b85a10a6
20 changed files with 609 additions and 68 deletions

View File

@@ -5,7 +5,7 @@ import android.content.Context;
import org.thoughtcrime.securesms.crypto.MasterSecret;
import org.thoughtcrime.securesms.database.DatabaseFactory;
import org.thoughtcrime.securesms.database.RecipientDatabase;
import org.thoughtcrime.securesms.database.RecipientDatabase.BlockedReader;
import org.thoughtcrime.securesms.database.RecipientDatabase.RecipientReader;
import org.thoughtcrime.securesms.dependencies.InjectableType;
import org.thoughtcrime.securesms.jobmanager.JobParameters;
import org.thoughtcrime.securesms.jobmanager.requirements.NetworkRequirement;
@@ -45,18 +45,20 @@ public class MultiDeviceBlockedUpdateJob extends MasterSecretJob implements Inje
throws IOException, UntrustedIdentityException
{
RecipientDatabase database = DatabaseFactory.getRecipientDatabase(context);
BlockedReader reader = database.readerForBlocked(database.getBlocked());
List<String> blocked = new LinkedList<>();
Recipient recipient;
try (RecipientReader reader = database.readerForBlocked(database.getBlocked())) {
List<String> blocked = new LinkedList<>();
while ((recipient = reader.getNext()) != null) {
if (!recipient.isGroupRecipient()) {
blocked.add(recipient.getAddress().serialize());
Recipient recipient;
while ((recipient = reader.getNext()) != null) {
if (!recipient.isGroupRecipient()) {
blocked.add(recipient.getAddress().serialize());
}
}
}
messageSender.sendMessage(SignalServiceSyncMessage.forBlocked(new BlockedListMessage(blocked)));
messageSender.sendMessage(SignalServiceSyncMessage.forBlocked(new BlockedListMessage(blocked)));
}
}
@Override

View File

@@ -136,7 +136,7 @@ public class PushDecryptJob extends ContextJob {
if (TextSecurePreferences.getNeedsSqlCipherMigration(context)) {
Log.w(TAG, "Skipping job, waiting for sqlcipher migration...");
NotificationManagerCompat.from(context).notify(494949,
new NotificationCompat.Builder(context, NotificationChannels.MESSAGES)
new NotificationCompat.Builder(context, NotificationChannels.getMessagesChannel(context))
.setSmallIcon(R.drawable.icon_notification)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setCategory(NotificationCompat.CATEGORY_MESSAGE)