Last active
November 12, 2021 13:40
-
-
Save oliverspryn/9453334b4e8eb44a21c5bc945b56a26b to your computer and use it in GitHub Desktop.
Dagger providing static values on the Build and BuildConfig objects
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
@Module | |
class BuildModule { | |
companion object { | |
const val buildType = "com.example.dagger.modules.BuildModule.buildType" | |
const val debug = "com.example.dagger.modules.BuildModule.debug" | |
const val sdkVersion = "com.example.dagger.modules.BuildModule.sdkVersion" | |
} | |
@Provides | |
@Named(debug) | |
fun provideBuildConfigDebug() = BuildConfig.DEBUG | |
@Provides | |
@Named(buildType) | |
fun provideBuildConfigBuildType() = BuildConfig.BUILD_TYPE | |
@Provides | |
@Named(sdkVersion) | |
fun provideBuildSdkVersion() = Build.VERSION.SDK_INT | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment