-
Notifications
You must be signed in to change notification settings - Fork 907
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show on App Launch: Add additional tests (#5000)
Task/Issue URL: https://app.asana.com/0/1207908166761516/1208156273709083/f ### Description Adds some additional tests for the BrowserViewModel and the ShowOnAppLaunch store ### Steps to test this PR N/A ### UI changes N/A
- Loading branch information
1 parent
606fe1c
commit 621d02e
Showing
14 changed files
with
531 additions
and
37 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
53 changes: 53 additions & 0 deletions
53
.../com/duckduckgo/app/generalsettings/showonapplaunch/ShowOnAppLaunchStateReporterPlugin.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.app.generalsettings.showonapplaunch | ||
|
||
import com.duckduckgo.app.generalsettings.showonapplaunch.model.ShowOnAppLaunchOption | ||
import com.duckduckgo.app.generalsettings.showonapplaunch.store.ShowOnAppLaunchOptionDataStore | ||
import com.duckduckgo.app.statistics.api.BrowserFeatureStateReporterPlugin | ||
import com.duckduckgo.app.statistics.pixels.Pixel.PixelParameter | ||
import com.duckduckgo.common.utils.DispatcherProvider | ||
import com.duckduckgo.di.scopes.AppScope | ||
import com.squareup.anvil.annotations.ContributesBinding | ||
import com.squareup.anvil.annotations.ContributesMultibinding | ||
import javax.inject.Inject | ||
import kotlinx.coroutines.flow.first | ||
import kotlinx.coroutines.runBlocking | ||
|
||
interface ShowOnAppLaunchReporterPlugin | ||
|
||
@ContributesMultibinding( | ||
scope = AppScope::class, | ||
boundType = BrowserFeatureStateReporterPlugin::class, | ||
) | ||
@ContributesBinding(scope = AppScope::class, boundType = ShowOnAppLaunchReporterPlugin::class) | ||
class ShowOnAppLaunchStateReporterPlugin | ||
@Inject | ||
constructor( | ||
private val dispatcherProvider: DispatcherProvider, | ||
private val showOnAppLaunchOptionDataStore: ShowOnAppLaunchOptionDataStore, | ||
) : ShowOnAppLaunchReporterPlugin, BrowserFeatureStateReporterPlugin { | ||
|
||
override fun featureStateParams(): Map<String, String> { | ||
val option = | ||
runBlocking(dispatcherProvider.io()) { | ||
showOnAppLaunchOptionDataStore.optionFlow.first() | ||
} | ||
val dailyPixelValue = ShowOnAppLaunchOption.getDailyPixelValue(option) | ||
return mapOf(PixelParameter.LAUNCH_SCREEN to dailyPixelValue) | ||
} | ||
} |
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
Oops, something went wrong.