Greetings, folks. Here RescheduleAlarmWorker and AlarmWorker factories are provided by the ClockWork...
t
Greetings, folks. Here RescheduleAlarmWorker and AlarmWorker factories are provided by the ClockWorkerFactory class. And the issue is that the ClockWorkerFactory class only adds the first factory to its delegate when initializing itself, but it does not add the second factory.
Copy code
@HiltAndroidApp
class ClockApplication : Application(), Configuration.Provider {

    @Inject lateinit var clockWorkerFactory: ClockWorkerFactory
    override fun getWorkManagerConfiguration(): Configuration =
        Configuration.Builder()
            .setMinimumLoggingLevel(android.util.Log.DEBUG)
            .setWorkerFactory(clockWorkerFactory)
            .build()
}
@Singleton
class ClockWorkerFactory @Inject constructor(
    alarmRepository: AlarmRepository,
    scheduleAlarmManager: ScheduleAlarmManager,
    alarmNotificationHelper: AlarmNotificationHelper,
    mediaPlayerHelper: MediaPlayerHelper,
) : DelegatingWorkerFactory() {
    init {
        addFactory(RescheduleAlarmWorkerFactory(alarmRepository, scheduleAlarmManager))
        addFactory(AlarmWorkerFactory(alarmRepository, alarmNotificationHelper, mediaPlayerHelper))
    }
}