diff --git a/CHANGELOG.md b/CHANGELOG.md index f9c89ce7..908b3d89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## Version 1.2.0 + +_2022-10-01_ + +- Add eBay sanitizer + ## Version 1.1.0 _2022-09-18_ diff --git a/app/build.gradle.kts b/app/build.gradle.kts index fd565bf0..97ef017e 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -37,8 +37,8 @@ android { applicationId = "com.svenjacobs.app.leon" minSdk = Android.minSdk targetSdk = Android.targetSdk - versionCode = 236 - versionName = "1.1.0" + versionCode = 237 + versionName = "1.2.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } @@ -123,6 +123,7 @@ dependencies { implementation(project(":feature-sanitizer-amazon")) implementation(project(":feature-sanitizer-amazon-smile")) implementation(project(":feature-sanitizer-aol-search")) + implementation(project(":feature-sanitizer-ebay")) implementation(project(":feature-sanitizer-empty-parameters")) implementation(project(":feature-sanitizer-facebook")) implementation(project(":feature-sanitizer-flipkart")) diff --git a/app/src/main/kotlin/com/svenjacobs/app/leon/startup/ComponentInitializer.kt b/app/src/main/kotlin/com/svenjacobs/app/leon/startup/ComponentInitializer.kt index 999a58ce..1e92a6dc 100644 --- a/app/src/main/kotlin/com/svenjacobs/app/leon/startup/ComponentInitializer.kt +++ b/app/src/main/kotlin/com/svenjacobs/app/leon/startup/ComponentInitializer.kt @@ -24,6 +24,7 @@ import com.svenjacobs.app.leon.feature.sanitizer.amazon.AmazonProductSanitizerRe import com.svenjacobs.app.leon.feature.sanitizer.amazon.AmazonSanitizerRegistration import com.svenjacobs.app.leon.feature.sanitizer.amazon.smile.AmazonSmileSanitizerRegistration import com.svenjacobs.app.leon.feature.sanitizer.aol.search.AolSearchSanitizerRegistration +import com.svenjacobs.app.leon.feature.sanitizer.ebay.EbaySanitizerRegistration import com.svenjacobs.app.leon.feature.sanitizer.emptyparameters.EmptyParametersSanitizerRegistration import com.svenjacobs.app.leon.feature.sanitizer.facebook.FacebookSanitizerRegistration import com.svenjacobs.app.leon.feature.sanitizer.flipkart.FlipkartSanitizerRegistration @@ -52,6 +53,7 @@ class ComponentInitializer : DistinctInitializer { AmazonSanitizerRegistration(), AmazonSmileSanitizerRegistration(), AolSearchSanitizerRegistration(), + EbaySanitizerRegistration(), EmptyParametersSanitizerRegistration(), FacebookSanitizerRegistration(), FlipkartSanitizerRegistration(), diff --git a/app/src/main/kotlin/com/svenjacobs/app/leon/ui/screens/settings/model/SettingsSanitizersScreenViewModel.kt b/app/src/main/kotlin/com/svenjacobs/app/leon/ui/screens/settings/model/SettingsSanitizersScreenViewModel.kt index 76e850cb..7a250a94 100644 --- a/app/src/main/kotlin/com/svenjacobs/app/leon/ui/screens/settings/model/SettingsSanitizersScreenViewModel.kt +++ b/app/src/main/kotlin/com/svenjacobs/app/leon/ui/screens/settings/model/SettingsSanitizersScreenViewModel.kt @@ -64,7 +64,7 @@ class SettingsSanitizersScreenViewModel( enabled = state.enabled, ) } - .sortedBy { it.name } + .sortedBy { it.name.lowercase() } .toImmutableList(), ) }.stateIn( diff --git a/app/src/main/play/release-notes/de-DE/default.txt b/app/src/main/play/release-notes/de-DE/default.txt index b32492f5..e38e731c 100644 --- a/app/src/main/play/release-notes/de-DE/default.txt +++ b/app/src/main/play/release-notes/de-DE/default.txt @@ -1,4 +1 @@ -- Reiniger für YouTube-Weiterleitungslinks hinzugefügt -- Reiniger für Amazon-Seiten, die keine Produktseiten sind, hinzugefügt -- Reiniger für Youtu.be Kurz-URLs hinzugefügt -- Die App kann als Browser registriert werden +- eBay Reiniger hinzugefügt diff --git a/app/src/main/play/release-notes/en-US/default.txt b/app/src/main/play/release-notes/en-US/default.txt index 01da9310..c43a3561 100644 --- a/app/src/main/play/release-notes/en-US/default.txt +++ b/app/src/main/play/release-notes/en-US/default.txt @@ -1,4 +1 @@ -- Add sanitizer for YouTube redirection links -- Add sanitizer for Amazon non-product pages -- Add Youtu.be short URL sanitizer -- Add feature to register app as a browser +- Add eBay sanitizer diff --git a/feature-sanitizer-ebay/build.gradle.kts b/feature-sanitizer-ebay/build.gradle.kts new file mode 100644 index 00000000..d549d145 --- /dev/null +++ b/feature-sanitizer-ebay/build.gradle.kts @@ -0,0 +1,26 @@ +/* + * Léon - The URL Cleaner + * Copyright (C) 2022 Sven Jacobs + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +plugins { + `feature-sanitizer` +} + +android { + namespace = "com.svenjacobs.app.leon.feature.sanitizer.ebay" + resourcePrefix("feat_sanitizer_ebay_") +} diff --git a/feature-sanitizer-ebay/src/main/AndroidManifest.xml b/feature-sanitizer-ebay/src/main/AndroidManifest.xml new file mode 100644 index 00000000..d11c06a2 --- /dev/null +++ b/feature-sanitizer-ebay/src/main/AndroidManifest.xml @@ -0,0 +1,19 @@ + + + diff --git a/feature-sanitizer-ebay/src/main/kotlin/com/svenjacobs/app/leon/feature/sanitizer/ebay/EbaySanitizer.kt b/feature-sanitizer-ebay/src/main/kotlin/com/svenjacobs/app/leon/feature/sanitizer/ebay/EbaySanitizer.kt new file mode 100644 index 00000000..5fcbf3a4 --- /dev/null +++ b/feature-sanitizer-ebay/src/main/kotlin/com/svenjacobs/app/leon/feature/sanitizer/ebay/EbaySanitizer.kt @@ -0,0 +1,26 @@ +/* + * Léon - The URL Cleaner + * Copyright (C) 2022 Sven Jacobs + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.svenjacobs.app.leon.feature.sanitizer.ebay + +import com.svenjacobs.app.leon.core.common.regex.RegexFactory +import com.svenjacobs.app.leon.core.domain.sanitizer.RegexSanitizer + +class EbaySanitizer : RegexSanitizer( + regex = RegexFactory.AllParameters, +) diff --git a/feature-sanitizer-ebay/src/main/kotlin/com/svenjacobs/app/leon/feature/sanitizer/ebay/EbaySanitizerRegistration.kt b/feature-sanitizer-ebay/src/main/kotlin/com/svenjacobs/app/leon/feature/sanitizer/ebay/EbaySanitizerRegistration.kt new file mode 100644 index 00000000..b8f132c6 --- /dev/null +++ b/feature-sanitizer-ebay/src/main/kotlin/com/svenjacobs/app/leon/feature/sanitizer/ebay/EbaySanitizerRegistration.kt @@ -0,0 +1,44 @@ +/* + * Léon - The URL Cleaner + * Copyright (C) 2022 Sven Jacobs + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.svenjacobs.app.leon.feature.sanitizer.ebay + +import android.content.Context +import com.svenjacobs.app.leon.core.domain.sanitizer.Sanitizer +import com.svenjacobs.app.leon.core.domain.sanitizer.SanitizerId +import com.svenjacobs.app.leon.core.domain.sanitizer.SanitizerRegistration + +class EbaySanitizerRegistration( + private val sanitizerProvider: () -> EbaySanitizer = { EbaySanitizer() }, +) : SanitizerRegistration { + + override val sanitizer: Sanitizer + get() = sanitizerProvider() + + override val id = SanitizerId("ebay") + + override val hasSettingsScreen = false + + override fun getName(context: Context) = context.getString(R.string.feat_sanitizer_ebay_name) + + override fun matchesDomain(input: String) = DOMAIN_REGEX.containsMatchIn(input) + + private companion object { + private val DOMAIN_REGEX = Regex("ebay\\..+/itm/") + } +} diff --git a/feature-sanitizer-ebay/src/main/res/values/strings.xml b/feature-sanitizer-ebay/src/main/res/values/strings.xml new file mode 100644 index 00000000..6bbbc79d --- /dev/null +++ b/feature-sanitizer-ebay/src/main/res/values/strings.xml @@ -0,0 +1,21 @@ + + + + eBay + diff --git a/feature-sanitizer-ebay/src/test/kotlin/com/svenjacobs/app/leon/feature/sanitizer/amazon/EbaySanitizerTest.kt b/feature-sanitizer-ebay/src/test/kotlin/com/svenjacobs/app/leon/feature/sanitizer/amazon/EbaySanitizerTest.kt new file mode 100644 index 00000000..b70d06fe --- /dev/null +++ b/feature-sanitizer-ebay/src/test/kotlin/com/svenjacobs/app/leon/feature/sanitizer/amazon/EbaySanitizerTest.kt @@ -0,0 +1,42 @@ +/* + * Léon - The URL Cleaner + * Copyright (C) 2022 Sven Jacobs + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.svenjacobs.app.leon.feature.sanitizer.amazon + +import com.svenjacobs.app.leon.feature.sanitizer.ebay.EbaySanitizer +import io.kotest.core.spec.style.WordSpec +import io.kotest.matchers.shouldBe + +class EbaySanitizerTest : WordSpec( + { + + "invoke" should { + + "remove all parameters from eBay article URL" { + val sanitizer = EbaySanitizer() + val result = sanitizer( + "https://www.ebay.de/itm/271784973135?mkcid=16&mkevt=1&mkrid=707-127654" + + "-2357-0&ssspo=rMbbkKXARCW&sssrc=2348624&ssuid=Bw-3_LUXSsm&widget_ver=art" + + "emis&media=MORE", + ) + + result shouldBe "https://www.ebay.de/itm/271784973135" + } + } + }, +) diff --git a/settings.gradle.kts b/settings.gradle.kts index d87edc1f..7bc8c04f 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -23,6 +23,7 @@ include( ":feature-sanitizer-amazon", ":feature-sanitizer-amazon-smile", ":feature-sanitizer-aol-search", + ":feature-sanitizer-ebay", ":feature-sanitizer-empty-parameters", ":feature-sanitizer-facebook", ":feature-sanitizer-flipkart",