mirror of
https://github.com/NekoX-Dev/NekoX.git
synced 2024-12-11 20:09:27 +01:00
parent
6bba619de0
commit
4ab054520c
@ -15,6 +15,7 @@ import android.app.ActivityManager;
|
|||||||
import android.app.AlarmManager;
|
import android.app.AlarmManager;
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
import android.app.NotificationChannel;
|
import android.app.NotificationChannel;
|
||||||
|
import android.app.NotificationChannelGroup;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -270,6 +271,18 @@ public class NotificationsController extends BaseController {
|
|||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
FileLog.e(e);
|
FileLog.e(e);
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
String keyGroup = currentAccount + "group";
|
||||||
|
List<NotificationChannelGroup> list = systemNotificationManager.getNotificationChannelGroups();
|
||||||
|
for (NotificationChannelGroup group : list) {
|
||||||
|
String id = group.getId();
|
||||||
|
if (id.equals(keyGroup)) {
|
||||||
|
systemNotificationManager.deleteNotificationChannelGroup(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
FileLog.e(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -2449,6 +2462,11 @@ public class NotificationsController extends BaseController {
|
|||||||
} else {
|
} else {
|
||||||
notificationChannel.setSound(null, builder.build());
|
notificationChannel.setSound(null, builder.build());
|
||||||
}
|
}
|
||||||
|
TLRPC.User user = getUserConfig().getCurrentUser();
|
||||||
|
String keyGroup = currentAccount + "group";
|
||||||
|
NotificationChannelGroup notificationChannelGroup = new NotificationChannelGroup(keyGroup, UserObject.getUserName(user));
|
||||||
|
notificationChannel.setGroup(keyGroup);
|
||||||
|
systemNotificationManager.createNotificationChannelGroup(notificationChannelGroup);
|
||||||
systemNotificationManager.createNotificationChannel(notificationChannel);
|
systemNotificationManager.createNotificationChannel(notificationChannel);
|
||||||
preferences.edit().putString(key, channelId).putString(key + "_s", newSettingsHash).commit();
|
preferences.edit().putString(key, channelId).putString(key + "_s", newSettingsHash).commit();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user