79284880

Date: 2024-12-16 13:56:08
Score: 0.5
Natty:
Report link

I now found a solution. I don't know if it is the right way, but it works.

@Module
@InstallIn(SingletonComponent::class)
object AlarmModule {
    @Provides
    @Singleton
    fun provideAddDayReminderNotificationSingleton(
        notificationUseCases: NotificationUseCases,
        dayUseCases: DayUseCases
    ): AddDayReminderNotification {
        return AddDayReminderNotification(notificationUseCases, dayUseCases)
    }
}

@AndroidEntryPoint
class AlarmReceiver : BroadcastReceiver() {

    @Inject
    lateinit var addDayReminderNotificationSingleton: AddDayReminderNotification
...
}

@Singleton
class AddDayReminderNotification(
    private val notificationUseCases: NotificationUseCases,
    private val dayUseCases: DayUseCases
) {
...
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: SkAppCoding