|
| 1 | +/** |
| 2 | + * Copyright 2021 Hadi Lashkari Ghouchani |
| 3 | +
|
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | +
|
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | +package com.hadilq.guidomia.featureflags.impl |
| 17 | + |
| 18 | +import com.github.hadilq.commandku.api.* |
| 19 | +import com.github.hadilq.commandku.impl.CommandExecutorImpl |
| 20 | +import com.github.hadilq.commandku.impl.CommandKU |
| 21 | +import com.hadilq.guidomia.di.api.AppScope |
| 22 | +import com.hadilq.guidomia.di.api.SingleIn |
| 23 | +import com.squareup.anvil.annotations.ContributesTo |
| 24 | +import dagger.Binds |
| 25 | +import dagger.Module |
| 26 | +import dagger.Provides |
| 27 | + |
| 28 | + |
| 29 | +@ContributesTo(AppScope::class) |
| 30 | +@Module |
| 31 | +abstract class CommandKuModule { |
| 32 | + |
| 33 | + @Binds |
| 34 | + abstract fun commandRegister(commandKU: CommandKU): CommandRegister |
| 35 | + |
| 36 | + @Binds |
| 37 | + abstract fun commandResultRegister(commandKU: CommandKU): CommandResultRegister |
| 38 | + |
| 39 | + @Binds |
| 40 | + abstract fun commandShooter(commandKU: CommandKU): CommandShooter |
| 41 | + |
| 42 | + @Binds |
| 43 | + abstract fun commandResultShooter(commandKU: CommandKU): CommandResultShooter |
| 44 | + |
| 45 | + @Binds |
| 46 | + abstract fun commandExecutor(commandExecutorImpl: CommandExecutorImpl): CommandExecutor |
| 47 | + |
| 48 | + companion object { |
| 49 | + @Provides |
| 50 | + @SingleIn(AppScope::class) |
| 51 | + fun commandKU(): CommandKU = CommandKU() |
| 52 | + |
| 53 | + @Provides |
| 54 | + @SingleIn(AppScope::class) |
| 55 | + fun commandExecutorImpl( |
| 56 | + commandShooter: CommandShooter, |
| 57 | + commandResultRegister: CommandResultRegister, |
| 58 | + ): CommandExecutorImpl = CommandExecutorImpl(commandShooter, commandResultRegister) |
| 59 | + } |
| 60 | +} |
0 commit comments