Skip to content

Commit

Permalink
Set serverAnonymisation more quickly (close #689)
Browse files Browse the repository at this point in the history
* Make OkHttpNetworkConnection serverAnon property public

* Remove outdated docstring

* Fix assignment

* Update java version and runner in build action
  • Loading branch information
mscwilson authored May 30, 2024
1 parent 07536ea commit a811ad9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 25 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push]

jobs:
test:
runs-on: macos-latest
runs-on: ubuntu-latest

strategy:
fail-fast: false
Expand All @@ -17,11 +17,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2

- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'

- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
Expand All @@ -30,7 +31,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "11"
java-version: "17"

- name: Run Tests
uses: reactivecircus/android-emulator-runner@v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ object Tracking {
@Composable
fun setup(namespace: String) : TrackerController {
// Replace this collector endpoint with your own
val networkConfig = NetworkConfiguration("https://23a6-82-26-43-253.ngrok.io", HttpMethod.POST)
val networkConfig = NetworkConfiguration("http://192.168.0.20:9090", HttpMethod.POST)
val trackerConfig = TrackerConfiguration("appID")
.logLevel(LogLevel.DEBUG)
.screenViewAutotracking(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,7 @@ class Emitter(
var bufferOption: BufferOption = EmitterDefaults.bufferOption
/**
* Whether the buffer should send events instantly or after the buffer has reached
* its limit. By default, this is set to BufferOption Default.
*
* @param option Set the BufferOption enum to Instant to send events upon creation.
* its limit.
*/
set(option) {
if (!isRunning.get()) {
Expand Down Expand Up @@ -303,19 +301,8 @@ class Emitter(
*/
set(serverAnonymisation) {
field = serverAnonymisation
if (!isCustomNetworkConnection && builderFinished) {
networkConnection = emitTimeout?.let {
OkHttpNetworkConnectionBuilder(uri, context)
.method(httpMethod)
.tls(tlsVersions)
.emitTimeout(it)
.customPostPath(customPostPath)
.client(client)
.cookieJar(cookieJar)
.serverAnonymisation(serverAnonymisation)
.requestHeaders(requestHeaders)
.build()
}
if (!isCustomNetworkConnection && builderFinished && networkConnection is OkHttpNetworkConnection) {
(networkConnection as OkHttpNetworkConnection).serverAnonymisation = serverAnonymisation
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class OkHttpNetworkConnection private constructor(builder: OkHttpNetworkConnecti
override val httpMethod: HttpMethod
private val emitTimeout: Int
private val customPostPath: String?
private val serverAnonymisation: Boolean
var serverAnonymisation: Boolean
private val requestHeaders: Map<String, String>?
private var client: OkHttpClient? = null
private val uriBuilder: Uri.Builder
Expand Down

0 comments on commit a811ad9

Please sign in to comment.