Skip to content

Commit

Permalink
Merge pull request #580 from DroidKaigi/fix-firebase-dependencies
Browse files Browse the repository at this point in the history
Changed to not include Firebase implementation on the iOS side
  • Loading branch information
takahirom authored Aug 17, 2023
2 parents 03d98aa + a1621d5 commit 4e760ba
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 25 deletions.
2 changes: 1 addition & 1 deletion core/data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ kotlin {
implementation(libs.ktorKotlinxSerialization)
implementation(libs.ktorContentNegotiation)
implementation(libs.kermit)
implementation(libs.firebaseRemoteConfig)
}
}
val androidMain by getting {
Expand All @@ -33,6 +32,7 @@ kotlin {
implementation(libs.ktorClientOkHttp)
implementation(libs.okHttpLoggingInterceptor)
implementation(libs.okHttpLoggingInterceptor)
implementation(libs.firebaseRemoteConfig)
}
}
val iosMain by getting {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package io.github.droidkaigi.confsched2023.data.remoteconfig

import dev.gitlive.firebase.Firebase
import dev.gitlive.firebase.remoteconfig.get
import dev.gitlive.firebase.remoteconfig.remoteConfig

actual class DefaultRemoteConfigApi : RemoteConfigApi {

private val firebaseRemoteConfig = Firebase.remoteConfig

/**
* If you want to change the interval time to fetch, please change it here
*/
// init {
// CoroutineScope(Dispatchers.IO).launch {
// firebaseRemoteConfig.settings {
// minimumFetchIntervalInSeconds = 12 * 3600L
// }
// }
// }

actual override suspend fun getBoolean(key: String): Boolean {
firebaseRemoteConfig.fetchAndActivate()
return firebaseRemoteConfig[key]
}
}
Original file line number Diff line number Diff line change
@@ -1,26 +1,5 @@
package io.github.droidkaigi.confsched2023.data.remoteconfig

import dev.gitlive.firebase.Firebase
import dev.gitlive.firebase.remoteconfig.get
import dev.gitlive.firebase.remoteconfig.remoteConfig

class DefaultRemoteConfigApi : RemoteConfigApi {

private val firebaseRemoteConfig = Firebase.remoteConfig

/**
* If you want to change the interval time to fetch, please change it here
*/
// init {
// CoroutineScope(Dispatchers.IO).launch {
// firebaseRemoteConfig.settings {
// minimumFetchIntervalInSeconds = 12 * 3600L
// }
// }
// }

override suspend fun getBoolean(key: String): Boolean {
firebaseRemoteConfig.fetchAndActivate()
return firebaseRemoteConfig[key]
}
expect class DefaultRemoteConfigApi : RemoteConfigApi {
override suspend fun getBoolean(key: String): Boolean
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ class FakeRemoteConfigApi : RemoteConfigApi {
}

override suspend fun getBoolean(key: String): Boolean {
return status.getBoolean("key")
return status.getBoolean(key)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package io.github.droidkaigi.confsched2023.data.remoteconfig

import io.github.droidkaigi.confsched2023.data.remoteconfig.FakeRemoteConfigApi.Status.Default

actual class DefaultRemoteConfigApi : RemoteConfigApi {

actual override suspend fun getBoolean(key: String): Boolean {
return FakeRemoteConfigApi().apply {
setUp(Default)
}.getBoolean(key)
}
}

0 comments on commit 4e760ba

Please sign in to comment.