Add new notification system.

This commit is contained in:
Cody Henthorne
2021-04-13 17:12:54 -04:00
committed by Greyson Parrelli
parent c8f17e2ab0
commit e796968d19
23 changed files with 2030 additions and 56 deletions

View File

@@ -244,9 +244,9 @@ public final class ConversationUtil {
/**
* @return A Person object representing the given Recipient
*/
@RequiresApi(CONVERSATION_SUPPORT_VERSION)
@RequiresApi(28)
@WorkerThread
private static @NonNull Person buildPerson(@NonNull Context context, @NonNull Recipient recipient) {
public static @NonNull Person buildPerson(@NonNull Context context, @NonNull Recipient recipient) {
return new Person.Builder()
.setKey(getShortcutId(recipient.getId()))
.setName(recipient.getDisplayName(context))

View File

@@ -1,5 +1,6 @@
package org.thoughtcrime.securesms.util;
import android.os.Build;
import android.text.TextUtils;
import androidx.annotation.NonNull;
@@ -75,6 +76,7 @@ public final class FeatureFlags {
private static final String MESSAGE_PROCESSOR_ALARM_INTERVAL = "android.messageProcessor.alarmIntervalMins";
private static final String MESSAGE_PROCESSOR_DELAY = "android.messageProcessor.foregroundDelayMs";
private static final String STORAGE_SYNC_V2 = "android.storageSyncV2.2";
private static final String NOTIFICATION_REWRITE = "android.notificationRewrite";
/**
* We will only store remote values for flags in this set. If you want a flag to be controllable
@@ -106,7 +108,8 @@ public final class FeatureFlags {
ANIMATED_STICKER_MIN_TOTAL_MEMORY,
MESSAGE_PROCESSOR_ALARM_INTERVAL,
MESSAGE_PROCESSOR_DELAY,
STORAGE_SYNC_V2
STORAGE_SYNC_V2,
NOTIFICATION_REWRITE
);
@VisibleForTesting
@@ -150,7 +153,8 @@ public final class FeatureFlags {
MESSAGE_PROCESSOR_ALARM_INTERVAL,
MESSAGE_PROCESSOR_DELAY,
GV1_FORCED_MIGRATE,
STORAGE_SYNC_V2
STORAGE_SYNC_V2,
NOTIFICATION_REWRITE
);
/**
@@ -342,6 +346,11 @@ public final class FeatureFlags {
return getBoolean(STORAGE_SYNC_V2, false);
}
/** Whether or not to use the new notification system. */
public static boolean useNewNotificationSystem() {
return getBoolean(NOTIFICATION_REWRITE, false) && Build.VERSION.SDK_INT >= 26;
}
/** Only for rendering debug info. */
public static synchronized @NonNull Map<String, Object> getMemoryValues() {
return new TreeMap<>(REMOTE_VALUES);