discord-jadx/app/src/main/java/androidx/browser/trusted/NotificationApiHelperForO.java

33 lines
1.3 KiB
Java

package androidx.browser.trusted;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
@RestrictTo({RestrictTo.Scope.LIBRARY})
public class NotificationApiHelperForO {
private NotificationApiHelperForO() {
}
@Nullable
@RequiresApi(26)
public static Notification copyNotificationOntoChannel(Context context, NotificationManager notificationManager, Notification notification, String str, String str2) {
notificationManager.createNotificationChannel(new NotificationChannel(str, str2, 3));
if (notificationManager.getNotificationChannel(str).getImportance() == 0) {
return null;
}
Notification.Builder recoverBuilder = Notification.Builder.recoverBuilder(context, notification);
recoverBuilder.setChannelId(str);
return recoverBuilder.build();
}
@RequiresApi(26)
public static boolean isChannelEnabled(NotificationManager notificationManager, String str) {
NotificationChannel notificationChannel = notificationManager.getNotificationChannel(str);
return notificationChannel == null || notificationChannel.getImportance() != 0;
}
}