Rename NotificationChannelUtils to NotificationChannelManager
This commit is contained in:
parent
bb87dcc931
commit
05c091212c
18 changed files with 21 additions and 21 deletions
|
@ -33,7 +33,7 @@ class AuthenticationErrorNotifications {
|
|||
String text = resourceProvider.authenticationErrorBody(account.getDescription());
|
||||
|
||||
NotificationCompat.Builder builder = notificationHelper
|
||||
.createNotificationBuilder(account, NotificationChannelUtils.ChannelType.MISCELLANEOUS)
|
||||
.createNotificationBuilder(account, NotificationChannelManager.ChannelType.MISCELLANEOUS)
|
||||
.setSmallIcon(resourceProvider.getIconWarning())
|
||||
.setWhen(System.currentTimeMillis())
|
||||
.setAutoCancel(true)
|
||||
|
|
|
@ -54,7 +54,7 @@ abstract class BaseNotifications {
|
|||
|
||||
protected NotificationCompat.Builder createAndInitializeNotificationBuilder(Account account) {
|
||||
return notificationHelper.createNotificationBuilder(account,
|
||||
NotificationChannelUtils.ChannelType.MESSAGES)
|
||||
NotificationChannelManager.ChannelType.MESSAGES)
|
||||
.setSmallIcon(getNewMailNotificationIcon())
|
||||
.setColor(account.getChipColor())
|
||||
.setWhen(System.currentTimeMillis())
|
||||
|
|
|
@ -32,7 +32,7 @@ class CertificateErrorNotifications {
|
|||
String text = resourceProvider.certificateErrorBody();
|
||||
|
||||
NotificationCompat.Builder builder = notificationHelper
|
||||
.createNotificationBuilder(account, NotificationChannelUtils.ChannelType.MISCELLANEOUS)
|
||||
.createNotificationBuilder(account, NotificationChannelManager.ChannelType.MISCELLANEOUS)
|
||||
.setSmallIcon(resourceProvider.getIconWarning())
|
||||
.setWhen(System.currentTimeMillis())
|
||||
.setAutoCancel(true)
|
||||
|
|
|
@ -7,7 +7,7 @@ val coreNotificationModule = applicationContext {
|
|||
bean { NotificationController(get(), get(), get(), get(), get()) }
|
||||
bean { NotificationManagerCompat.from(get()) }
|
||||
bean { NotificationHelper(get(), get(), get()) }
|
||||
bean { NotificationChannelUtils(get(), get()) }
|
||||
bean { NotificationChannelManager(get(), get()) }
|
||||
bean { CertificateErrorNotifications(get(), get(), get()) }
|
||||
bean { AuthenticationErrorNotifications(get(), get(), get()) }
|
||||
bean { SyncNotifications(get(), get(), get()) }
|
||||
|
|
|
@ -89,7 +89,7 @@ class LockScreenNotification {
|
|||
String title = resourceProvider.newMessagesTitle(newMessages);
|
||||
|
||||
return notificationHelper.createNotificationBuilder(account,
|
||||
NotificationChannelUtils.ChannelType.MESSAGES)
|
||||
NotificationChannelManager.ChannelType.MESSAGES)
|
||||
.setSmallIcon(resourceProvider.getIconNewMail())
|
||||
.setColor(account.getChipColor())
|
||||
.setNumber(unreadCount)
|
||||
|
|
|
@ -11,7 +11,7 @@ import com.fsck.k9.Account
|
|||
import com.fsck.k9.Preferences
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
class NotificationChannelUtils(private val context: Context, private val preferences: Preferences) {
|
||||
class NotificationChannelManager(private val context: Context, private val preferences: Preferences) {
|
||||
|
||||
enum class ChannelType {
|
||||
MESSAGES, MISCELLANEOUS
|
|
@ -11,7 +11,7 @@ import com.fsck.k9.K9
|
|||
class NotificationHelper(
|
||||
private val context: Context,
|
||||
private val notificationManager: NotificationManagerCompat,
|
||||
private val channelUtils: NotificationChannelUtils
|
||||
private val channelUtils: NotificationChannelManager
|
||||
) {
|
||||
fun configureNotification(
|
||||
builder: NotificationCompat.Builder,
|
||||
|
@ -64,7 +64,7 @@ class NotificationHelper(
|
|||
|
||||
fun createNotificationBuilder(
|
||||
account: Account,
|
||||
channelType: NotificationChannelUtils.ChannelType
|
||||
channelType: NotificationChannelManager.ChannelType
|
||||
): NotificationCompat.Builder {
|
||||
return NotificationCompat.Builder(context,
|
||||
channelUtils.getChannelIdFor(account, channelType))
|
||||
|
|
|
@ -34,7 +34,7 @@ class SendFailedNotifications {
|
|||
account, notificationId);
|
||||
|
||||
NotificationCompat.Builder builder = notificationHelper
|
||||
.createNotificationBuilder(account, NotificationChannelUtils.ChannelType.MISCELLANEOUS)
|
||||
.createNotificationBuilder(account, NotificationChannelManager.ChannelType.MISCELLANEOUS)
|
||||
.setSmallIcon(resourceProvider.getIconWarning())
|
||||
.setWhen(System.currentTimeMillis())
|
||||
.setAutoCancel(true)
|
||||
|
|
|
@ -38,7 +38,7 @@ class SyncNotifications {
|
|||
account, outboxFolder, notificationId);
|
||||
|
||||
NotificationCompat.Builder builder = notificationHelper.createNotificationBuilder(account,
|
||||
NotificationChannelUtils.ChannelType.MISCELLANEOUS)
|
||||
NotificationChannelManager.ChannelType.MISCELLANEOUS)
|
||||
.setSmallIcon(resourceProvider.getIconSendingMail())
|
||||
.setWhen(System.currentTimeMillis())
|
||||
.setOngoing(true)
|
||||
|
@ -77,7 +77,7 @@ class SyncNotifications {
|
|||
account, folderServerId, notificationId);
|
||||
|
||||
NotificationCompat.Builder builder = notificationHelper.createNotificationBuilder(account,
|
||||
NotificationChannelUtils.ChannelType.MISCELLANEOUS)
|
||||
NotificationChannelManager.ChannelType.MISCELLANEOUS)
|
||||
.setSmallIcon(resourceProvider.getIconCheckingMail())
|
||||
.setWhen(System.currentTimeMillis())
|
||||
.setOngoing(true)
|
||||
|
|
|
@ -116,7 +116,7 @@ public class AuthenticationErrorNotificationsTest extends RobolectricTest {
|
|||
when(notificationHelper.getContext()).thenReturn(RuntimeEnvironment.application);
|
||||
when(notificationHelper.getNotificationManager()).thenReturn(notificationManager);
|
||||
when(notificationHelper.createNotificationBuilder(any(Account.class),
|
||||
any(NotificationChannelUtils.ChannelType.class)))
|
||||
any(NotificationChannelManager.ChannelType.class)))
|
||||
.thenReturn(builder);
|
||||
|
||||
return notificationHelper;
|
||||
|
|
|
@ -112,7 +112,7 @@ public class BaseNotificationsTest {
|
|||
private NotificationHelper createFakeNotificationHelper() {
|
||||
Builder builder = MockHelper.mockBuilder(Builder.class);
|
||||
NotificationHelper notificationHelper = mock(NotificationHelper.class);
|
||||
when(notificationHelper.createNotificationBuilder(any(Account.class), any(NotificationChannelUtils
|
||||
when(notificationHelper.createNotificationBuilder(any(Account.class), any(NotificationChannelManager
|
||||
.ChannelType.class))).thenReturn(builder);
|
||||
when(notificationHelper.getAccountName(any(Account.class))).thenReturn(ACCOUNT_NAME);
|
||||
return notificationHelper;
|
||||
|
|
|
@ -116,7 +116,7 @@ public class CertificateErrorNotificationsTest extends RobolectricTest {
|
|||
when(notificationHelper.getContext()).thenReturn(RuntimeEnvironment.application);
|
||||
when(notificationHelper.getNotificationManager()).thenReturn(notificationManager);
|
||||
when(notificationHelper.createNotificationBuilder(any(Account.class),
|
||||
any(NotificationChannelUtils.ChannelType.class)))
|
||||
any(NotificationChannelManager.ChannelType.class)))
|
||||
.thenReturn(builder);
|
||||
|
||||
return notificationHelper;
|
||||
|
|
|
@ -224,7 +224,7 @@ public class DeviceNotificationsTest extends RobolectricTest {
|
|||
NotificationHelper notificationHelper = mock(NotificationHelper.class);
|
||||
when(notificationHelper.getContext()).thenReturn(context);
|
||||
when(notificationHelper.getAccountName(any(Account.class))).thenReturn(ACCOUNT_NAME);
|
||||
when(notificationHelper.createNotificationBuilder(any(Account.class), any(NotificationChannelUtils
|
||||
when(notificationHelper.createNotificationBuilder(any(Account.class), any(NotificationChannelManager
|
||||
.ChannelType.class))).thenAnswer(new Answer<Builder>() {
|
||||
private int invocationCount = 0;
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ public class LockScreenNotificationTest extends RobolectricTest {
|
|||
NotificationHelper notificationHelper = mock(NotificationHelper.class);
|
||||
when(notificationHelper.getContext()).thenReturn(context);
|
||||
when(notificationHelper.getAccountName(any(Account.class))).thenReturn(ACCOUNT_NAME);
|
||||
when(notificationHelper.createNotificationBuilder(any(Account.class), any(NotificationChannelUtils
|
||||
when(notificationHelper.createNotificationBuilder(any(Account.class), any(NotificationChannelManager
|
||||
.ChannelType.class))).thenReturn(builder);
|
||||
|
||||
return notificationHelper;
|
||||
|
|
|
@ -92,7 +92,7 @@ public class SendFailedNotificationsTest extends RobolectricTest {
|
|||
when(notificationHelper.getContext()).thenReturn(RuntimeEnvironment.application);
|
||||
when(notificationHelper.getNotificationManager()).thenReturn(notificationManager);
|
||||
when(notificationHelper.createNotificationBuilder(any(Account.class),
|
||||
any(NotificationChannelUtils.ChannelType.class)))
|
||||
any(NotificationChannelManager.ChannelType.class)))
|
||||
.thenReturn(builder);
|
||||
|
||||
return notificationHelper;
|
||||
|
|
|
@ -124,7 +124,7 @@ public class SyncNotificationsTest extends RobolectricTest {
|
|||
when(notificationHelper.getContext()).thenReturn(RuntimeEnvironment.application);
|
||||
when(notificationHelper.getNotificationManager()).thenReturn(notificationManager);
|
||||
when(notificationHelper.createNotificationBuilder(any(Account.class),
|
||||
any(NotificationChannelUtils.ChannelType.class)))
|
||||
any(NotificationChannelManager.ChannelType.class)))
|
||||
.thenReturn(builder);
|
||||
when(notificationHelper.getAccountName(any(Account.class))).thenReturn(ACCOUNT_NAME);
|
||||
|
||||
|
|
|
@ -230,7 +230,7 @@ public class WearNotificationsTest extends RobolectricTest {
|
|||
|
||||
private NotificationHelper createNotificationHelper(Context context, Builder builder) {
|
||||
NotificationHelper notificationHelper = mock(NotificationHelper.class);
|
||||
when(notificationHelper.createNotificationBuilder(any(Account.class), any(NotificationChannelUtils
|
||||
when(notificationHelper.createNotificationBuilder(any(Account.class), any(NotificationChannelManager
|
||||
.ChannelType.class))).thenReturn(builder);
|
||||
when(notificationHelper.getAccountName(account)).thenReturn(ACCOUNT_NAME);
|
||||
when(notificationHelper.getContext()).thenReturn(context);
|
||||
|
|
|
@ -50,7 +50,7 @@ import com.fsck.k9.helper.ParcelableUtil;
|
|||
import com.fsck.k9.mailstore.Folder;
|
||||
import com.fsck.k9.mailstore.SearchStatusManager;
|
||||
import com.fsck.k9.mailstore.StorageManager;
|
||||
import com.fsck.k9.notification.NotificationChannelUtils;
|
||||
import com.fsck.k9.notification.NotificationChannelManager;
|
||||
import com.fsck.k9.preferences.StorageEditor;
|
||||
import com.fsck.k9.search.LocalSearch;
|
||||
import com.fsck.k9.search.SearchAccount;
|
||||
|
@ -165,7 +165,7 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
|
|||
protected final SearchStatusManager searchStatusManager = DI.get(SearchStatusManager.class);
|
||||
private StorageManager.StorageListener mStorageListener = new StorageListenerImplementation();
|
||||
private final Preferences preferences = DI.get(Preferences.class);
|
||||
private final NotificationChannelUtils channelUtils = DI.get(NotificationChannelUtils.class);
|
||||
private final NotificationChannelManager channelUtils = DI.get(NotificationChannelManager.class);
|
||||
|
||||
private ActionBar actionBar;
|
||||
private ActionBarDrawerToggle drawerToggle;
|
||||
|
|
Loading…
Reference in a new issue