Created
November 12, 2021 13:39
-
-
Save oliverspryn/ad2d3fe60cebbd2e645093d89d1c7776 to your computer and use it in GitHub Desktop.
Dagger injecting the build type into the MainActivity
This file contains hidden or 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
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