Provide NotificationController via dependency injection

This commit is contained in:
cketti 2018-07-04 18:20:58 +02:00
parent f2b3f5b7cb
commit c195e46222
3 changed files with 11 additions and 2 deletions

View file

@ -16,6 +16,7 @@ import com.fsck.k9.mail.ssl.LocalKeyStore
import com.fsck.k9.mailstore.mailStoreModule
import com.fsck.k9.message.extractors.extractorModule
import com.fsck.k9.message.html.htmlModule
import com.fsck.k9.notification.coreNotificationModule
import com.fsck.k9.power.DeviceIdleManager
import com.fsck.k9.service.BootReceiver
import com.fsck.k9.service.MailService
@ -39,7 +40,8 @@ object Core : KoinComponent {
mailStoreModule,
backendModule,
extractorModule,
htmlModule
htmlModule,
coreNotificationModule
)
/**

View file

@ -139,7 +139,7 @@ public class MessagingController {
public static synchronized MessagingController getInstance(Context context) {
if (inst == null) {
Context appContext = context.getApplicationContext();
NotificationController notificationController = NotificationController.newInstance(appContext);
NotificationController notificationController = DI.get(NotificationController.class);
Contacts contacts = Contacts.getInstance(context);
TransportProvider transportProvider = TransportProvider.getInstance();
AccountStatsCollector accountStatsCollector = new DefaultAccountStatsCollector(context);

View file

@ -0,0 +1,7 @@
package com.fsck.k9.notification
import org.koin.dsl.module.applicationContext
val coreNotificationModule = applicationContext {
bean { NotificationController.newInstance(get()) }
}