-
Notifications
You must be signed in to change notification settings - Fork 894
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/5.202.0' into main
- Loading branch information
Showing
221 changed files
with
6,172 additions
and
784 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
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
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
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
43 changes: 43 additions & 0 deletions
43
...-impl/src/test/java/com/duckduckgo/app/anr/ndk/NativeCrashFeatureMultiProcessStoreTest.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,43 @@ | ||
package com.duckduckgo.app.anr.ndk | ||
|
||
import com.duckduckgo.common.test.CoroutineTestRule | ||
import com.duckduckgo.data.store.api.FakeSharedPreferencesProvider | ||
import com.duckduckgo.feature.toggles.api.Toggle | ||
import com.squareup.moshi.Moshi | ||
import kotlinx.coroutines.test.runTest | ||
import org.junit.Assert | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class NativeCrashFeatureMultiProcessStoreTest { | ||
|
||
@get:Rule var coroutineRule = CoroutineTestRule() | ||
|
||
private val store = NativeCrashFeatureMultiProcessStore( | ||
coroutineRule.testScope, | ||
coroutineRule.testDispatcherProvider, | ||
FakeSharedPreferencesProvider(), | ||
Moshi.Builder().build(), | ||
) | ||
|
||
@Test | ||
fun `test set value`() = runTest { | ||
val expected = Toggle.State(enable = true) | ||
store.set("key", expected) | ||
|
||
Assert.assertEquals(expected, store.get("key")) | ||
} | ||
|
||
@Test | ||
fun `test get missing value`() = runTest { | ||
Assert.assertNull(store.get("key")) | ||
} | ||
|
||
@Test | ||
fun `test get when value is not present`() { | ||
val expected = Toggle.State(enable = true) | ||
store.set("key", expected) | ||
|
||
Assert.assertNull(store.get("wrong key")) | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
...vil-annotations/src/main/java/com/duckduckgo/anvil/annotations/ContributesActivePlugin.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,63 @@ | ||
/* | ||
* 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.anvil.annotations | ||
|
||
import kotlin.reflect.KClass | ||
|
||
/** | ||
* Anvil annotation to contribute plugins into an Active Plugin Point. | ||
* Active plugins are also guarded by remote feature flags | ||
* | ||
* This annotation is the counterpart of [ContributesActivePluginPoint] | ||
* | ||
* Usage: | ||
* ```kotlin | ||
* @ContributesActivePlugin(SomeDaggerScope::class) | ||
* class MyPluginImpl : MyPlugin { | ||
* | ||
* } | ||
* | ||
* interface MyPlugin : ActivePlugin {...} | ||
* ``` | ||
*/ | ||
@Target(AnnotationTarget.CLASS) | ||
@Retention(AnnotationRetention.RUNTIME) | ||
annotation class ContributesActivePlugin( | ||
/** The scope in which to include this contributed PluginPoint */ | ||
val scope: KClass<*>, | ||
|
||
/** | ||
* This is the type of the plugin the annotated class is extending from | ||
* This is a required member to help the code generation. | ||
*/ | ||
val boundType: KClass<*>, | ||
|
||
/** | ||
* The default value of remote feature flag. | ||
* Default is true (ie. enabled) | ||
*/ | ||
val defaultActiveValue: Boolean = true, | ||
|
||
/** | ||
* The priority for the plugin. | ||
* Lower priority values mean the associated plugin comes first in the list of plugins. | ||
* | ||
* This is equivalent to the [PriorityKey] annotation we use with [ContributesMultibinding] for normal plugins. | ||
* The [ContributesActivePlugin] coalesce both | ||
*/ | ||
val priority: Int = 0, | ||
) |
Oops, something went wrong.