Skip to content

Commit

Permalink
changes for code review
Browse files Browse the repository at this point in the history
clean readme to just includ Android and cpu ach
make InternalEvaluationRequest data class as internal
make readFlags method to be inline
change test main.go to call .a file instead of .so

Signed-off-by: Fachry Maulana Muhsinin <[email protected]>
  • Loading branch information
Fachry Maulana Muhsinin committed Dec 26, 2024
1 parent c5c3658 commit 4dd514d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
13 changes: 2 additions & 11 deletions flipt-client-kotlin-android/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,8 @@ When in streaming mode, the SDK will connect to the Flipt server and open a pers

This SDK currently supports the following OSes/architectures:

- Linux x86_64
- Linux x86_64 (musl)
- Linux arm64
- Linux arm64 (musl)
- MacOS x86_64
- MacOS arm64
- Windows x86_64

### Glibc vs Musl

Most Linux distributions use [Glibc](https://en.wikipedia.org/wiki/Glibc), but some distributions like Alpine Linux use [Musl](https://en.wikipedia.org/wiki/Musl). If you are using Alpine Linux, you will need to install the `musl` version of the client.
- Android x86_64
- Android arm64

## Usage

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class FliptEvaluationClient(namespace: String, options: ClientOptions) {


@Serializable
data class InternalEvaluationRequest(
internal data class InternalEvaluationRequest(
@SerialName("flag_key") val flagKey: String,
@SerialName("entity_id") val entityId: String,
@SerialName("context") val context: Map<String, String>
Expand Down Expand Up @@ -185,14 +185,10 @@ class FliptEvaluationClient(namespace: String, options: ClientOptions) {

fun listFlags(): ArrayList<Flag>? {
val value = CLibrary.INSTANCE.listFlags(engine)
val resp = readFlags(value)
val resp = json.decodeFromString<Result<ArrayList<Flag>>>(value)
return resp.result ?: throw EvaluationException(resp.errorMessage ?: "Unknown Error")
}

fun readFlags(ptr: String): Result<ArrayList<Flag>> {
return json.decodeFromString<Result<ArrayList<Flag>>>(ptr)
}

fun close() {
CLibrary.INSTANCE.destroyEngine(engine)
}
Expand Down
2 changes: 1 addition & 1 deletion test/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ func kotlinAndroidTests(ctx context.Context, root *dagger.Container, t *testCase
WithDirectory("/src", t.dir.Directory("flipt-client-kotlin-android"), dagger.ContainerWithDirectoryOpts{
Exclude: []string{"./.idea/", ".gradle/", "build/"},
}).
WithFile(fmt.Sprintf("/src/main/cpp/libs/%s/libfliptengine.so", path), t.test.File(libFile)).
WithFile(fmt.Sprintf("/src/main/cpp/libs/%s/libfliptengine.a", path), t.test.File(libFile)).
WithServiceBinding("flipt", t.flipt.WithExec(nil).AsService()).
WithEnvVariable("FLIPT_URL", "http://flipt:8080").
WithEnvVariable("FLIPT_AUTH_TOKEN", "secret").
Expand Down

0 comments on commit 4dd514d

Please sign in to comment.