mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-23 17:48:50 +00:00
Fix NotificationChannel backup import.
We were recreating the channels before the database upgrade. We have to do it after. Fixes #8174
This commit is contained in:
@@ -67,6 +67,26 @@ public class NotificationChannels {
|
||||
onCreate(context, notificationManager);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recreates all notification channels for contacts with custom notifications enabled. Should be
|
||||
* safe to call repeatedly. Needs to be executed on a background thread.
|
||||
*/
|
||||
@WorkerThread
|
||||
public static void restoreContactNotificationChannels(@NonNull Context context) {
|
||||
if (!NotificationChannels.supported()) {
|
||||
return;
|
||||
}
|
||||
|
||||
RecipientDatabase db = DatabaseFactory.getRecipientDatabase(context);
|
||||
|
||||
try (RecipientDatabase.RecipientReader reader = db.getRecipientsWithNotificationChannels()) {
|
||||
Recipient recipient;
|
||||
while ((recipient = reader.getNext()) != null) {
|
||||
NotificationChannels.createChannelFor(context, recipient);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The channel ID for the default messages channel.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user