-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into renovate/com.google.auth-google-auth-library…
…-oauth2-http-1.x
- Loading branch information
Showing
21 changed files
with
109 additions
and
99 deletions.
There are no files selected for viewing
This file contains 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
9 changes: 9 additions & 0 deletions
9
analytics/src/androidMain/kotlin/io/ashdavies/analytics/FirebaseAnalytics.android.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package io.ashdavies.analytics | ||
|
||
import com.google.firebase.analytics.ktx.analytics | ||
import com.google.firebase.analytics.logEvent | ||
import com.google.firebase.ktx.Firebase | ||
|
||
internal actual val firebaseAnalytics = RemoteAnalytics { name, block -> | ||
Firebase.analytics.logEvent(name) { block(ParametersBuilder(::param)) } | ||
} |
8 changes: 0 additions & 8 deletions
8
analytics/src/androidMain/kotlin/io/ashdavies/analytics/FirebaseAnalytics.kt
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
6 changes: 5 additions & 1 deletion
6
analytics/src/commonMain/kotlin/io/ashdavies/analytics/RemoteAnalytics.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
package io.ashdavies.analytics | ||
|
||
public fun interface RemoteAnalytics { | ||
public fun logEvent(name: String, parameters: Map<String, Any>?) | ||
public fun logEvent(name: String, block: ParametersBuilder.() -> Unit) | ||
} | ||
|
||
public fun interface ParametersBuilder { | ||
public fun param(key: String, value: String) | ||
} |
File renamed without changes.
This file contains 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
This file contains 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
11 changes: 0 additions & 11 deletions
11
conferences-app/src/jvmMain/kotlin/io/ashdavies/party/firebase/EmptyLocalConfigValue.kt
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
34 changes: 34 additions & 0 deletions
34
remote-config/src/androidMain/kotlin/io/ashdavies/config/FirebaseRemoteConfig.android.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package io.ashdavies.config | ||
|
||
import com.google.firebase.ktx.Firebase | ||
import com.google.firebase.remoteconfig.FirebaseRemoteConfigValue | ||
import com.google.firebase.remoteconfig.ktx.remoteConfig | ||
import com.google.firebase.remoteconfig.ktx.remoteConfigSettings | ||
|
||
private const val ONE_MINUTE_IN_SECONDS = 3600L | ||
|
||
@Suppress("ObjectPropertyName") | ||
private val _firebaseRemoteConfig by lazy { | ||
Firebase.remoteConfig.apply { | ||
val configSettings = remoteConfigSettings { | ||
minimumFetchIntervalInSeconds = ONE_MINUTE_IN_SECONDS | ||
} | ||
|
||
setConfigSettingsAsync(configSettings) | ||
fetchAndActivate() | ||
} | ||
} | ||
|
||
internal actual val firebaseRemoteConfig = object : RemoteConfig { | ||
override suspend fun <T : Any> getValue(key: String, transform: (RemoteConfigValue) -> T): T { | ||
return transform(remoteConfigValue(_firebaseRemoteConfig.getValue(key))) | ||
} | ||
} | ||
|
||
private fun remoteConfigValue(value: FirebaseRemoteConfigValue) = object : RemoteConfigValue { | ||
override fun asLong(): Long = value.asLong() | ||
override fun asDouble(): Double = value.asDouble() | ||
override fun asString(): String = value.asString() | ||
override fun asByteArray(): ByteArray = value.asByteArray() | ||
override fun asBoolean(): Boolean = value.asBoolean() | ||
} |
3 changes: 3 additions & 0 deletions
3
remote-config/src/commonMain/kotlin/io/ashdavies/config/FirebaseRemoteConfig.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package io.ashdavies.config | ||
|
||
internal expect val firebaseRemoteConfig: RemoteConfig |
19 changes: 0 additions & 19 deletions
19
remote-config/src/commonMain/kotlin/io/ashdavies/config/LazyRemoteConfig.kt
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
remote-config/src/commonMain/kotlin/io/ashdavies/config/LocalConfigValue.kt
This file was deleted.
Oops, something went wrong.
This file contains 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
3 changes: 2 additions & 1 deletion
3
remote-config/src/commonMain/kotlin/io/ashdavies/config/RemoteConfig.kt
This file contains 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
9 changes: 9 additions & 0 deletions
9
remote-config/src/commonMain/kotlin/io/ashdavies/config/RemoteConfigValue.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package io.ashdavies.config | ||
|
||
public interface RemoteConfigValue { | ||
public fun asLong(): Long | ||
public fun asDouble(): Double | ||
public fun asString(): String | ||
public fun asByteArray(): ByteArray | ||
public fun asBoolean(): Boolean | ||
} |
7 changes: 7 additions & 0 deletions
7
remote-config/src/jvmMain/kotlin/io/ashdavies/config/FirebaseRemoteConfig.jvm.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package io.ashdavies.config | ||
|
||
internal actual val firebaseRemoteConfig = object : RemoteConfig { | ||
override suspend fun <T : Any> getValue(key: String, transform: (RemoteConfigValue) -> T): T { | ||
TODO("Not yet implemented") | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
remote-config/src/jvmMain/kotlin/io/ashdavies/config/RemoteConfig.jvm.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package io.ashdavies.config | ||
|
||
public val RemoteConfig.Companion.Default: RemoteConfig | ||
get() = emptyRemoteConfig | ||
|
||
private val emptyRemoteConfig = object : RemoteConfig { | ||
override suspend fun <T : Any> getValue(key: String, transform: (RemoteConfigValue) -> T): T { | ||
return transform(EmptyLocalConfigValue) | ||
} | ||
} | ||
|
||
private object EmptyLocalConfigValue : RemoteConfigValue { | ||
override fun asLong() = 0L | ||
override fun asDouble() = 0.0 | ||
override fun asString() = "" | ||
override fun asByteArray() = byteArrayOf() | ||
override fun asBoolean() = false | ||
} |