Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-06-24 20:49:15 +02:00
Родитель fe0ada0dbe
Коммит a2de1bfd9d
1 изменённых файлов: 5 добавлений и 14 удалений

Просмотреть файл

@ -20,6 +20,7 @@
package com.nextcloud.talk.receivers;
import android.app.NotificationChannelGroup;
import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.Context;
@ -29,15 +30,11 @@ import android.content.pm.PackageManager;
import android.os.Build;
import android.util.Log;
import com.nextcloud.talk.R;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.models.database.UserEntity;
import com.nextcloud.talk.utils.NotificationUtils;
import com.nextcloud.talk.utils.database.user.UserUtils;
import com.nextcloud.talk.utils.preferences.AppPreferences;
import java.util.zip.CRC32;
import javax.inject.Inject;
import autodagger.AutoInjector;
@ -67,17 +64,11 @@ public class PackageReplacedReceiver extends BroadcastReceiver {
if (notificationManager != null) {
CRC32 crc32;
UserEntity userEntity;
String groupName;
for (Object userEntityObject : userUtils.getUsers()) {
crc32 = new CRC32();
userEntity = (UserEntity) userEntityObject;
groupName = String.format(context.getResources().getString(R.string
.nc_notification_channel), userEntity.getDisplayName(), userEntity.getBaseUrl());
crc32.update(groupName.getBytes());
notificationManager.deleteNotificationChannelGroup(Long.toString(crc32.getValue()));
for (NotificationChannelGroup notificationChannelGroup : notificationManager
.getNotificationChannelGroups()) {
notificationManager.deleteNotificationChannelGroup(notificationChannelGroup.getId());
}
notificationManager.deleteNotificationChannel(NotificationUtils.NOTIFICATION_CHANNEL_CALLS);
notificationManager.deleteNotificationChannel(NotificationUtils.NOTIFICATION_CHANNEL_MESSAGES);