Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed to not include Firebase implementation on the iOS side #580

Merged
merged 6 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should make this class because iOS engineers will use this and won't notice if they use fake👀


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