Skip to content

Commit

Permalink
Fix parsing issue (#4890)
Browse files Browse the repository at this point in the history
Task/Issue URL:
https://app.asana.com/0/488551667048375/1208032966372991/f

### Description
Removes the `settings` container object from the JSON model.

### Steps to test this PR
- [x] Fresh install `playDebug` from this branch
- [x] Go to “Settings” > “General"
- [x] Verify that the “Recently Visited Sites” option is shown

Passing tests
- [Autofill Feature Critical Path End-to-End
tests](https://github.com/duckduckgo/Android/actions/runs/10353975695) ✅
- [Privacy
Tests](https://github.com/duckduckgo/Android/actions/runs/10354131289) ✅
  • Loading branch information
joshliebe authored Aug 12, 2024
1 parent e3f45ee commit 3343338
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ package com.duckduckgo.adclick.impl.remoteconfig
import com.squareup.moshi.Json

data class AdClickAttributionFeatureModel(
@field:Json(name = "settings")
val settings: AdClickAttributionSettings,
)

data class AdClickAttributionSettings(
@field:Json(name = "linkFormats")
val linkFormats: List<AdClickAttributionLinkFormat>,
@field:Json(name = "allowlist")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ class AdClickAttributionFeatureSettingsStore @Inject constructor(
override fun store(jsonString: String) {
jsonAdapter.fromJson(jsonString)?.let {
adClickAttributionRepository.updateAll(
it.settings.linkFormats,
it.settings.allowlist,
it.settings.navigationExpiration,
it.settings.totalExpiration,
it.settings.heuristicDetection,
it.settings.domainDetection,
it.linkFormats,
it.allowlist,
it.navigationExpiration,
it.totalExpiration,
it.heuristicDetection,
it.domainDetection,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class AdClickAttributionAllowlistReferenceTest(private val testCase: TestCase) {
"reference_tests/adclickattribution/ad_click_attribution_reference.json",
)

val allowList: List<AdClickAttributionAllowlist>? = jsonAdapter.fromJson(jsonObject.toString())?.settings?.allowlist
val allowList: List<AdClickAttributionAllowlist>? = jsonAdapter.fromJson(jsonObject.toString())?.allowlist
allowList?.let { list ->
adClickAllowlist.addAll(
list.map {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class AdClickAttributionLinkFormatsReferenceTest(private val testCase: TestCase)
"reference_tests/adclickattribution/ad_click_attribution_reference.json",
)

val linkFormatList: List<AdClickAttributionLinkFormat>? = jsonAdapter.fromJson(jsonObject.toString())?.settings?.linkFormats
val linkFormatList: List<AdClickAttributionLinkFormat>? = jsonAdapter.fromJson(jsonObject.toString())?.linkFormats
linkFormatList?.let { list ->
adClickLinkFormats.addAll(
list.map {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,56 +1,52 @@
{
"state": "enabled",
"exceptions": [],
"settings": {
"linkFormats": [
{
"url": "duckduckgo.com/y.js",
"adDomainParameterName": "ad_domain",
"desc": "SERP Ads"
},
{
"url": "www.search-company.site/y.js",
"adDomainParameterName": "ad_domain",
"desc": "Test Domain"
},
{
"url": "www.search-company.example/y.js",
"adDomainParameterName": "ad_domain",
"desc": "Test Domain"
},
{
"url": "links.duckduckgo.com/m.js",
"adDomainParameterName": "ad_domain",
"desc": "Shopping Ads"
},
{
"url": "www.search-company.site/m.js",
"adDomainParameterName": "ad_domain",
"desc": "Test Domain"
},
{
"url": "www.search-company.example/m.js",
"adDomainParameterName": "ad_domain",
"desc": "Test Domain"
}
],
"allowlist": [
{
"blocklistEntry": "bing.com",
"host": "bat.bing.com"
},
{
"blocklistEntry": "ad-company.site",
"host": "convert.ad-company.site"
},
{
"blocklistEntry": "ad-company.example",
"host": "convert.ad-company.example"
}
],
"navigationExpiration": 1800,
"totalExpiration": 604800,
"heuristicDetection": "enabled",
"domainDetection": "enabled"
}
"linkFormats": [
{
"url": "duckduckgo.com/y.js",
"adDomainParameterName": "ad_domain",
"desc": "SERP Ads"
},
{
"url": "www.search-company.site/y.js",
"adDomainParameterName": "ad_domain",
"desc": "Test Domain"
},
{
"url": "www.search-company.example/y.js",
"adDomainParameterName": "ad_domain",
"desc": "Test Domain"
},
{
"url": "links.duckduckgo.com/m.js",
"adDomainParameterName": "ad_domain",
"desc": "Shopping Ads"
},
{
"url": "www.search-company.site/m.js",
"adDomainParameterName": "ad_domain",
"desc": "Test Domain"
},
{
"url": "www.search-company.example/m.js",
"adDomainParameterName": "ad_domain",
"desc": "Test Domain"
}
],
"allowlist": [
{
"blocklistEntry": "bing.com",
"host": "bat.bing.com"
},
{
"blocklistEntry": "ad-company.site",
"host": "convert.ad-company.site"
},
{
"blocklistEntry": "ad-company.example",
"host": "convert.ad-company.example"
}
],
"navigationExpiration": 1800,
"totalExpiration": 604800,
"heuristicDetection": "enabled",
"domainDetection": "enabled"
}

0 comments on commit 3343338

Please sign in to comment.