Skip to content

Commit

Permalink
Merge pull request #13 from plaidev/android-1
Browse files Browse the repository at this point in the history
[android] set request headers and record experiments data
  • Loading branch information
RyosukeCla authored Mar 19, 2024
2 parents 42b2fdc + d6fe69f commit 2eabe94
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion android/nativebrik/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group = "com.nativebrik"
version = "0.0.5"
version = "0.0.6"

android {
namespace = "com.nativebrik.sdk"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ internal class ContainerImpl(
experimentId = experimentId,
variantId = variantId
))
this.databaseRepository.appendExperimentHistory(experimentId)
val componentId = extractComponentId(variant) ?: return Result.failure(NotFoundException())
val component = this.componentRepository.fetchComponent(experimentId, componentId).getOrElse {
return Result.failure(it)
Expand All @@ -139,6 +140,7 @@ internal class ContainerImpl(
experimentId = experimentId,
variantId = variantId
))
this.databaseRepository.appendExperimentHistory(experimentId)
val componentId = extractComponentId(variant) ?: return Result.failure(NotFoundException())
val component = this.componentRepository.fetchComponent(experimentId, componentId).getOrElse {
return Result.failure(it)
Expand All @@ -158,6 +160,7 @@ internal class ContainerImpl(
experimentId = experimentId,
variantId = variantId
))
this.databaseRepository.appendExperimentHistory(experimentId)
return Result.success(variant)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ internal class HttpRequestRepositoryImpl(): HttpRequestRepository {
val body = req.body ?: ""
setBody(connection, body)
}
req.headers?.forEach { header ->
val name = header.name ?: return@forEach
connection.setRequestProperty(name, header.value ?: "")
}

val response: String = connectAndGetResponse(connection).getOrElse {
return@withContext Result.failure(it)
Expand Down
2 changes: 1 addition & 1 deletion android/nativebrik/src/main/java/com/nativebrik/sdk/sdk.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import com.nativebrik.sdk.data.user.NativebrikUser
import com.nativebrik.sdk.remoteconfig.RemoteConfigLoadingState
import com.nativebrik.sdk.schema.UIBlock

const val VERSION = "0.0.5"
const val VERSION = "0.0.6"

data class Endpoint(
val cdn: String = "https://cdn.nativebrik.com",
Expand Down

0 comments on commit 2eabe94

Please sign in to comment.