mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-18 21:28:54 +00:00
Skip importing channels without group
This commit is contained in:
parent
0d2bd37772
commit
fe615f022a
1 changed files with 11 additions and 7 deletions
|
@ -35,6 +35,7 @@ import android.os.Build;
|
|||
import android.os.DeadSystemException;
|
||||
import android.os.Handler;
|
||||
import android.os.RemoteException;
|
||||
import android.text.TextUtils;
|
||||
import android.view.OrientationEventListener;
|
||||
import android.webkit.CookieManager;
|
||||
|
||||
|
@ -375,6 +376,12 @@ public class ApplicationEx extends Application {
|
|||
for (int c = 0; c < jchannels.length(); c++) {
|
||||
JSONObject jchannel = (JSONObject) jchannels.get(c);
|
||||
|
||||
// Legacy
|
||||
if (!jchannel.has("group") ||
|
||||
jchannel.isNull("group") ||
|
||||
TextUtils.isEmpty(jchannel.getString("group")))
|
||||
continue;
|
||||
|
||||
String id = jchannel.getString("id");
|
||||
if (nm.getNotificationChannel(id) == null) {
|
||||
NotificationChannel channel = new NotificationChannel(
|
||||
|
@ -382,12 +389,10 @@ public class ApplicationEx extends Application {
|
|||
jchannel.getString("name"),
|
||||
jchannel.getInt("importance"));
|
||||
|
||||
if (jchannel.has("group") && !jchannel.isNull("group")) {
|
||||
String groupName = jchannel.getString("group");
|
||||
NotificationChannelGroup group = new NotificationChannelGroup(groupName, groupName);
|
||||
nm.createNotificationChannelGroup(group);
|
||||
channel.setGroup(groupName);
|
||||
}
|
||||
String groupName = jchannel.getString("group");
|
||||
NotificationChannelGroup group = new NotificationChannelGroup(groupName, groupName);
|
||||
nm.createNotificationChannelGroup(group);
|
||||
channel.setGroup(groupName);
|
||||
|
||||
if (jchannel.has("description") && !jchannel.isNull("description"))
|
||||
channel.setDescription(jchannel.getString("description"));
|
||||
|
@ -407,7 +412,6 @@ public class ApplicationEx extends Application {
|
|||
channel.enableVibration(jchannel.getBoolean("vibrate"));
|
||||
|
||||
Log.i("Creating channel=" + channel);
|
||||
nm.deleteNotificationChannel(id);
|
||||
nm.createNotificationChannel(channel);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue