-
-
Save phansier/e6f35e5f9616cbae2a524afcced9a564 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
@Module | |
class AppModule { | |
... | |
// when using @Singleton or other Dagger scope or not using Provider | |
// then link returned by get() will be cached by Dagger, то ссылка | |
@Provides | |
fun provideFeatureScanner(dependencies: ScannerFeatureDependencies): ScannerFeatureApi { | |
ScannerFeatureComponentHolder.init(dependencies) | |
return ScannerFeatureComponentHolder.get() | |
} | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
object PurchaseComponentHolder : ComponentHolder<PurchaseFeatureApi, PurchaseFeatureDependencies> { | |
private var purchaseComponentHolder: PurchaseComponent? = null | |
... | |
override fun get(): PurchaseFeatureApi { | |
checkNotNull(purchaseComponentHolder) { "PurchaseComponent was not initialized!" } | |
return purchaseComponentHolder!! | |
} | |
override fun reset() { | |
purchaseComponentHolder = null | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment