Inject Preferences into MessagingController
This commit is contained in:
parent
02b7e5a2ee
commit
b87521ade4
3 changed files with 26 additions and 3 deletions
|
@ -1,11 +1,30 @@
|
|||
package com.fsck.k9.controller
|
||||
|
||||
import android.content.Context
|
||||
import com.fsck.k9.CoreResourceProvider
|
||||
import com.fsck.k9.Preferences
|
||||
import com.fsck.k9.backend.BackendManager
|
||||
import com.fsck.k9.helper.Contacts
|
||||
import com.fsck.k9.mailstore.LocalStoreProvider
|
||||
import com.fsck.k9.notification.NotificationController
|
||||
import com.fsck.k9.notification.NotificationStrategy
|
||||
import org.koin.core.qualifier.named
|
||||
import org.koin.dsl.module
|
||||
|
||||
val controllerModule = module {
|
||||
single {
|
||||
MessagingController(get(), get(), get(), get(), get(), get(), get(), get(), get(named("controllerExtensions")))
|
||||
MessagingController(
|
||||
get<Context>(),
|
||||
get<NotificationController>(),
|
||||
get<NotificationStrategy>(),
|
||||
get<LocalStoreProvider>(),
|
||||
get<Contacts>(),
|
||||
get<UnreadMessageCountProvider>(),
|
||||
get<CoreResourceProvider>(),
|
||||
get<BackendManager>(),
|
||||
get<Preferences>(),
|
||||
get(named("controllerExtensions"))
|
||||
)
|
||||
}
|
||||
single<UnreadMessageCountProvider> { DefaultUnreadMessageCountProvider(get(), get(), get(), get()) }
|
||||
}
|
||||
|
|
|
@ -121,6 +121,7 @@ public class MessagingController {
|
|||
private final NotificationStrategy notificationStrategy;
|
||||
private final LocalStoreProvider localStoreProvider;
|
||||
private final BackendManager backendManager;
|
||||
private final Preferences preferences;
|
||||
|
||||
private final Thread controllerThread;
|
||||
|
||||
|
@ -145,7 +146,7 @@ public class MessagingController {
|
|||
NotificationStrategy notificationStrategy,
|
||||
LocalStoreProvider localStoreProvider, Contacts contacts,
|
||||
UnreadMessageCountProvider unreadMessageCountProvider, CoreResourceProvider resourceProvider,
|
||||
BackendManager backendManager, List<ControllerExtension> controllerExtensions) {
|
||||
BackendManager backendManager, Preferences preferences, List<ControllerExtension> controllerExtensions) {
|
||||
this.context = context;
|
||||
this.notificationController = notificationController;
|
||||
this.notificationStrategy = notificationStrategy;
|
||||
|
@ -154,6 +155,7 @@ public class MessagingController {
|
|||
this.unreadMessageCountProvider = unreadMessageCountProvider;
|
||||
this.resourceProvider = resourceProvider;
|
||||
this.backendManager = backendManager;
|
||||
this.preferences = preferences;
|
||||
|
||||
controllerThread = new Thread(new Runnable() {
|
||||
@Override
|
||||
|
|
|
@ -139,9 +139,11 @@ public class MessagingControllerTest extends K9RobolectricTest {
|
|||
MockitoAnnotations.initMocks(this);
|
||||
appContext = RuntimeEnvironment.application;
|
||||
|
||||
Preferences preferences = Preferences.getPreferences(appContext);
|
||||
|
||||
controller = new MessagingController(appContext, notificationController, notificationStrategy,
|
||||
localStoreProvider, contacts,
|
||||
unreadMessageCountProvider, mock(CoreResourceProvider.class), backendManager,
|
||||
unreadMessageCountProvider, mock(CoreResourceProvider.class), backendManager, preferences,
|
||||
Collections.<ControllerExtension>emptyList());
|
||||
|
||||
configureAccount();
|
||||
|
|
Loading…
Reference in a new issue