Skip to content

Commit

Permalink
Add Facebook query parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
svenjacobs committed Jun 3, 2021
1 parent ac42eef commit 8880825
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 16 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Version 0.4.0

_2021-06-03_

- Add Facebook query parameters

## Version 0.3.0

_2021-05-24_
Expand Down
5 changes: 2 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ android {
applicationId = "com.svenjacobs.app.leon"
minSdk = 21
targetSdk = 30
versionCode = 223
versionName = "0.3.0"
versionCode = 224
versionName = "0.4.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

Expand Down Expand Up @@ -96,7 +96,6 @@ android {

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
useIR = true
freeCompilerArgs = listOf(
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-Xopt-in=kotlin.RequiresOptIn"
Expand Down
20 changes: 13 additions & 7 deletions app/src/main/java/com/svenjacobs/app/leon/domain/Defaults.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,28 @@

package com.svenjacobs.app.leon.domain

import com.svenjacobs.app.leon.domain.model.Sanitizer.QueryParameterSanitizer
import com.svenjacobs.app.leon.domain.model.Sanitizer.RegexSanitizer
import com.svenjacobs.app.leon.domain.model.Sanitizer.RegexSanitizer.Companion.regexForParameterPrefix

object Defaults {

val SANITIZERS = listOf(
QueryParameterSanitizer(
parameterName = "wt_mc",
name = "wt_mc",
description = "Webtrekk",
RegexSanitizer(
regex = regexForParameterPrefix("wt"),
name = "wt_*",
description = "Webtrekk (wt_*)",
isDefault = true,
),
RegexSanitizer(
regex = "[?&](?:ga|utm)_[^=]*=.[^&]*",
regex = regexForParameterPrefix("ga|utm"),
name = "ga_* & utm_*",
description = "Urchin Tracking Module (Google Analytics)",
description = "Google Analytics (ga_*, utm_*)",
isDefault = true,
),
RegexSanitizer(
regex = regexForParameterPrefix("fb"),
name = "fb_*",
description = "Facebook (fb_*)",
isDefault = true,
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,11 @@ sealed class Sanitizer(

override fun withEnabled(isEnabled: Boolean) =
copy(isEnabled = isEnabled)

companion object {

fun regexForParameterPrefix(prefix: String): String =
"[?&](?:$prefix)_[^=]*=.[^&]*"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class Migrations @Inject constructor(
suspend fun migrate() {
val prevVersionCode = dataStoreManager.versionCode.first()

if (prevVersionCode <= VERSION_0_1_0) {
Timber.d("Performing migration from version 0.1.0")
if (prevVersionCode <= VERSION_0_3_0) {
Timber.d("Performing migration from version <= 0.3.0")

// Removing all default sanitizers because they have changed
cleanerRepository.getSanitizers().first().forEach { sanitizer ->
Expand All @@ -45,6 +45,6 @@ class Migrations @Inject constructor(
}

private companion object {
private const val VERSION_0_1_0 = 203
private const val VERSION_0_3_0 = 223
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private fun Item(
modifier = Modifier.padding(16.dp)
) {
Text(
sanitizer.name,
sanitizer.description ?: sanitizer.name,
modifier = Modifier.weight(2F),
)
Switch(
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/play/release-notes/de-DE/default.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Erstes Beta-Release
Facebook-Parameter hinzugefügt
2 changes: 1 addition & 1 deletion app/src/main/play/release-notes/en-US/default.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
First beta release
Add Facebook query parameters

0 comments on commit 8880825

Please sign in to comment.