-
Notifications
You must be signed in to change notification settings - Fork 912
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
190 changed files
with
6,666 additions
and
981 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 0 additions & 93 deletions
93
ad-click/ad-click-impl/src/main/java/com/duckduckgo/adclick/impl/AdClickAttributionPlugin.kt
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
...ck/ad-click-impl/src/main/java/com/duckduckgo/adclick/impl/AdClickFeatureTogglesPlugin.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...-impl/src/main/java/com/duckduckgo/adclick/impl/remoteconfig/AdClickAttributionFeature.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (c) 2024 DuckDuckGo | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.duckduckgo.adclick.impl.remoteconfig | ||
|
||
import com.duckduckgo.anvil.annotations.ContributesRemoteFeature | ||
import com.duckduckgo.di.scopes.AppScope | ||
import com.duckduckgo.feature.toggles.api.Toggle | ||
|
||
@ContributesRemoteFeature( | ||
scope = AppScope::class, | ||
featureName = "adClickAttribution", | ||
settingsStore = AdClickAttributionFeatureSettingsStore::class, | ||
) | ||
/** | ||
* This is the class that represents the adClickAttribution feature flags. | ||
*/ | ||
interface AdClickAttributionFeature { | ||
/** | ||
* @return `true` when the remote config has the global "adClickAttribution" feature flag enabled | ||
* If the remote feature is not present defaults to `false` | ||
*/ | ||
@Toggle.DefaultValue(false) | ||
fun self(): Toggle | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...n/java/com/duckduckgo/adclick/impl/remoteconfig/AdClickAttributionFeatureSettingsStore.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (c) 2024 DuckDuckGo | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.duckduckgo.adclick.impl.remoteconfig | ||
|
||
import com.duckduckgo.di.scopes.AppScope | ||
import com.duckduckgo.feature.toggles.api.FeatureSettings | ||
import com.duckduckgo.feature.toggles.api.RemoteFeatureStoreNamed | ||
import com.squareup.anvil.annotations.ContributesBinding | ||
import com.squareup.moshi.JsonAdapter | ||
import com.squareup.moshi.Moshi | ||
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory | ||
import javax.inject.Inject | ||
|
||
@ContributesBinding(AppScope::class) | ||
@RemoteFeatureStoreNamed(AdClickAttributionFeature::class) | ||
class AdClickAttributionFeatureSettingsStore @Inject constructor( | ||
private val adClickAttributionRepository: AdClickAttributionRepository, | ||
) : FeatureSettings.Store { | ||
|
||
private val jsonAdapter by lazy { buildJsonAdapter() } | ||
|
||
override fun store(jsonString: String) { | ||
jsonAdapter.fromJson(jsonString)?.let { | ||
adClickAttributionRepository.updateAll( | ||
it.linkFormats, | ||
it.allowlist, | ||
it.navigationExpiration, | ||
it.totalExpiration, | ||
it.heuristicDetection, | ||
it.domainDetection, | ||
) | ||
} | ||
} | ||
|
||
private fun buildJsonAdapter(): JsonAdapter<AdClickAttributionFeatureModel> { | ||
val moshi = Moshi.Builder().add(KotlinJsonAdapterFactory()).build() | ||
return moshi.adapter(AdClickAttributionFeatureModel::class.java) | ||
} | ||
} |
Oops, something went wrong.