Notification improvements

This commit is contained in:
M66B
2019-11-12 10:57:26 +01:00
parent 3951e656cc
commit e883ef4cd5
4 changed files with 36 additions and 22 deletions

View File

@@ -737,6 +737,7 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
account.deleteNotificationChannel(context);
if (account.notify)
if (jaccount.has("channel")) {
NotificationChannelGroup group = new NotificationChannelGroup("group." + account.id, account.name);
@@ -789,12 +790,15 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
account.move_to = folder.id;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
String channelId = EntityFolder.getNotificationChannelId(folder.id);
nm.deleteNotificationChannel(channelId);
if (jfolder.has("channel")) {
NotificationChannelGroup group = new NotificationChannelGroup("group." + account.id, account.name);
nm.createNotificationChannelGroup(group);
JSONObject jchannel = (JSONObject) jfolder.get("channel");
jchannel.put("id", EntityFolder.getNotificationChannelId(folder.id));
jchannel.put("id", channelId);
jchannel.put("group", group.getId());
nm.createNotificationChannel(channelFromJSON(context, jchannel));
@@ -928,6 +932,10 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
JSONArray jchannels = jimport.getJSONArray("channels");
for (int i = 0; i < jchannels.length(); i++) {
JSONObject jchannel = (JSONObject) jchannels.get(i);
String channelId = jchannel.getString("id");
nm.deleteNotificationChannel(channelId);
nm.createNotificationChannel(channelFromJSON(context, jchannel));
Log.i("Imported contact channel=" + jchannel);