mirror of https://github.com/M66B/FairEmail.git
Check channel importance on import
This commit is contained in:
parent
20047afc41
commit
c9201c2da4
|
@ -198,10 +198,15 @@ class NotificationHelper {
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||||
static NotificationChannel channelFromJSON(Context context, JSONObject jchannel) throws JSONException {
|
static NotificationChannel channelFromJSON(Context context, JSONObject jchannel) throws JSONException {
|
||||||
|
int importance = jchannel.getInt("importance");
|
||||||
|
if (importance < NotificationManager.IMPORTANCE_MIN ||
|
||||||
|
importance > NotificationManager.IMPORTANCE_MAX)
|
||||||
|
importance = NotificationManager.IMPORTANCE_DEFAULT;
|
||||||
|
|
||||||
NotificationChannel channel = new NotificationChannel(
|
NotificationChannel channel = new NotificationChannel(
|
||||||
jchannel.getString("id"),
|
jchannel.getString("id"),
|
||||||
jchannel.getString("name"),
|
jchannel.getString("name"),
|
||||||
jchannel.getInt("importance"));
|
importance);
|
||||||
|
|
||||||
String group = jchannel.optString("group");
|
String group = jchannel.optString("group");
|
||||||
if (!TextUtils.isEmpty(group))
|
if (!TextUtils.isEmpty(group))
|
||||||
|
|
Loading…
Reference in New Issue