Skip to content

Instantly share code, notes, and snippets.

@oliverspryn
Created November 12, 2021 13:39
Show Gist options
  • Save oliverspryn/ad2d3fe60cebbd2e645093d89d1c7776 to your computer and use it in GitHub Desktop.
Save oliverspryn/ad2d3fe60cebbd2e645093d89d1c7776 to your computer and use it in GitHub Desktop.
Dagger injecting the build type into the MainActivity
class MainActivity : AppCompatActivity() {
@Named(BuildModule.buildType)
@Inject
lateinit var buildType: String
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
DaggerMainComponent
.builder()
// Build some modules here
.build()
.inject()
if (buildType == "release") {
window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment