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

Set serverAnonymisation more quickly #689

Merged
merged 4 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
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 = true
mscwilson marked this conversation as resolved.
Show resolved Hide resolved
}
}

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
Loading