Skip to content

Commit

Permalink
added multiplatform buildkonfig
Browse files Browse the repository at this point in the history
  • Loading branch information
DatL4g committed Apr 11, 2024
1 parent b427b55 commit f10a3fc
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 43 deletions.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ plugins {
alias(libs.plugins.cocoapods) apply false
alias(libs.plugins.compose) apply false
alias(libs.plugins.crashlytics) apply false
alias(libs.plugins.konfig) apply false
alias(libs.plugins.multiplatform) apply false
alias(libs.plugins.moko.resources) apply false
alias(libs.plugins.sekret) apply false
Expand Down
10 changes: 10 additions & 0 deletions composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import com.codingfeline.buildkonfig.compiler.FieldSpec
import com.mikepenz.aboutlibraries.plugin.DuplicateMode
import com.mikepenz.aboutlibraries.plugin.DuplicateRule
import org.jetbrains.compose.ExperimentalComposeLibrary
Expand All @@ -9,6 +10,7 @@ plugins {
alias(libs.plugins.multiplatform)
alias(libs.plugins.android.application)
alias(libs.plugins.compose)
alias(libs.plugins.konfig)
alias(libs.plugins.moko.resources)
alias(libs.plugins.sekret)
alias(libs.plugins.serialization)
Expand All @@ -32,6 +34,14 @@ aboutLibraries {
excludeFields = arrayOf("generated")
}

buildkonfig {
packageName = artifact

defaultConfigs {
buildConfigField(FieldSpec.Type.STRING, "packageName", artifact)
}
}

sekret {
properties {
enabled.set(true)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import androidx.datastore.core.DataStoreFactory
import androidx.datastore.core.okio.OkioStorage
import coil3.ImageLoader
import coil3.request.allowHardware
import dev.datlag.aniflow.BuildKonfig
import dev.datlag.aniflow.Sekret
import dev.datlag.aniflow.firebase.FirebaseFactory
import dev.datlag.aniflow.firebase.initialize
import dev.datlag.aniflow.getPackageName
import dev.datlag.aniflow.other.Constants
import dev.datlag.aniflow.other.StateSaver
import dev.datlag.aniflow.settings.DataStoreUserSettings
Expand Down Expand Up @@ -65,20 +65,20 @@ actual object PlatformModule {
if (StateSaver.sekretLibraryLoaded) {
FirebaseFactory.initialize(
context = instance<Context>(),
projectId = Sekret.firebaseProject(getPackageName()),
applicationId = Sekret.firebaseAndroidApplication(getPackageName())!!,
apiKey = Sekret.firebaseAndroidApiKey(getPackageName())!!,
projectId = Sekret.firebaseProject(BuildKonfig.packageName),
applicationId = Sekret.firebaseAndroidApplication(BuildKonfig.packageName)!!,
apiKey = Sekret.firebaseAndroidApiKey(BuildKonfig.packageName)!!,
googleAuthProvider = instanceOrNull()
)
} else {
FirebaseFactory.Empty
}
}
bindSingleton(Constants.Sekret.ANILIST_CLIENT_ID) {
Sekret.anilistClientId(getPackageName()) ?: ""
Sekret.anilistClientId(BuildKonfig.packageName) ?: ""
}
bindSingleton(Constants.Sekret.ANILIST_CLIENT_SECRET) {
Sekret.anilistClientSecret(getPackageName()) ?: ""
Sekret.anilistClientSecret(BuildKonfig.packageName) ?: ""
}
bindSingleton {
val app: Context = instance()
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,20 @@ actual object PlatformModule {
}
bindSingleton<FirebaseFactory> {
FirebaseFactory.initialize(
projectId = firebaseProject(getPackageName()),
applicationId = firebaseIosApplication(getPackageName()),
apiKey = firebaseIosApiKey(getPackageName()),
projectId = firebaseProject(BuildKonfig.packageName),
applicationId = firebaseIosApplication(BuildKonfig.packageName),
apiKey = firebaseIosApiKey(BuildKonfig.packageName),
googleAuthProvider = instanceOrNull()
)
}
bindEagerSingleton<IosCodeAuthFlowFactory> {
IosCodeAuthFlowFactory()
}
bindSingleton(Constants.Sekret.ANILIST_CLIENT_ID) {
anilistClientId(getPackageName())
anilistClientId(BuildKonfig.packageName)
}
bindSingleton(Constants.Sekret.ANILIST_CLIENT_SECRET) {
anilistClientSecret(getPackageName())
anilistClientSecret(BuildKonfig.packageName)
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ aboutlibraries = "11.1.0"
activity = "1.8.2"
android = "8.2.2"
android-core = "1.12.0"
android-credentials = "1.3.0-alpha01"
android-credentials = "1.3.0-alpha02"
apollo = "4.0.0-beta.4"
appcompat = "1.6.1"
coil = "3.0.0-alpha06"
compose = "1.6.1"
complete-kotlin = "1.1.0"
coroutines = "1.8.0"
crashlytics-plugin = "2.9.9"
datastore = "1.1.0-beta02"
datastore = "1.1.0-rc01"
datetime = "0.5.0"
decompose = "3.0.0-alpha09"
desugar = "2.0.4"
Expand All @@ -30,6 +30,7 @@ kasechange = "1.4.1"
kmpalette = "3.1.0"
kodein = "7.21.2"
kolor = "1.4.4"
konfig = "0.15.1"
kotlin = "1.9.22"
ksp = "1.9.22-1.0.17"
ktor = "2.3.9"
Expand Down Expand Up @@ -116,6 +117,7 @@ cocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotli
compose = { id = "org.jetbrains.compose", version.ref = "compose" }
complete-kotlin = { id = "com.louiscad.complete-kotlin", version.ref = "complete-kotlin" }
crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "crashlytics-plugin" }
konfig = { id = "com.codingfeline.buildkonfig", version.ref = "konfig" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
ktorfit = { id = "de.jensklingenberg.ktorfit", version.ref = "ktorfit" }
moko-resources = { id = "dev.icerock.mobile.multiplatform-resources", version.ref = "moko-resources" }
Expand Down

0 comments on commit f10a3fc

Please sign in to comment.