mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
451ea1dbad
Instead we're handling sound and vibration alerts separately. It allows us to dynamically change the 'signal' flag turning on and off sounds on Android O+ without posting into different channels for loud and silent notifications. This way we keep the grouped notification view instead of falling back to the pre API 23 summary notificatoin view.
53 lines
1.3 KiB
Java
53 lines
1.3 KiB
Java
package org.thoughtcrime.securesms.notifications;
|
|
|
|
import android.content.Context;
|
|
import android.os.Build;
|
|
|
|
public class MessageNotifierCompat {
|
|
|
|
public static final int NO_VISIBLE_CHAT_ID = -1;
|
|
static final int SUMMARY_NOTIFICATION_ID = 1338;
|
|
static final String EXTRA_REMOTE_REPLY = "extra_remote_reply";
|
|
|
|
|
|
private static IMessageNotifier instance;
|
|
|
|
public static void init(Context context) {
|
|
if (instance != null) {
|
|
return;
|
|
}
|
|
|
|
if (Build.VERSION.SDK_INT < 23) {
|
|
instance = new MessageNotifierPreApi23(context);
|
|
} else {
|
|
instance = new MessageNotifierApi23(context);
|
|
}
|
|
}
|
|
|
|
public static void playSendSound() {
|
|
instance.playSendSound();
|
|
}
|
|
|
|
public static void updateNotification(int chatId, int messageId) {
|
|
instance.updateNotification(chatId, messageId);
|
|
}
|
|
|
|
public static void updateVisibleChat(int chatId) {
|
|
instance.updateVisibleChat(chatId);
|
|
}
|
|
|
|
public static void onNotificationPrivacyChanged() {
|
|
instance.onNotificationPrivacyChanged();
|
|
}
|
|
|
|
static void removeNotifications(int[] chatIds) {
|
|
instance.removeNotifications(chatIds);
|
|
|
|
}
|
|
static void removeNotifications(int chatId) {
|
|
instance.removeNotifications(chatId);
|
|
}
|
|
|
|
|
|
}
|