Skip to content

Commit

Permalink
Merge branch 'release/5.62.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
cmonfortep committed Aug 17, 2020
2 parents 79b30be + de154ca commit 8a0d4ff
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ class VariantManagerTest {
@Test
fun serpControlVariantHasExpectedWeightAndNoFeatures() {
val variant = variants.first { it.key == "sc" }
assertEqualsDouble(0.0, variant.weight)
assertEqualsDouble(1.0, variant.weight)
assertEquals(0, variant.features.size)
}

@Test
fun serpExperimentalVariantHasExpectedWeightAndNoFeatures() {
val variant = variants.first { it.key == "se" }
assertEqualsDouble(0.0, variant.weight)
assertEqualsDouble(1.0, variant.weight)
assertEquals(0, variant.features.size)
}

Expand Down Expand Up @@ -160,14 +160,14 @@ class VariantManagerTest {
@Test
fun inBrowserControlVariantHasExpectedWeightAndNoFeatures() {
val variant = variants.first { it.key == "zj" }
assertEqualsDouble(1.0, variant.weight)
assertEqualsDouble(0.0, variant.weight)
assertEquals(0, variant.features.size)
}

@Test
fun inBrowserSecondControlVariantHasExpectedWeightAndRemoveDay1And3NotificationsAndKillOnboardingFeatures() {
val variant = variants.first { it.key == "zk" }
assertEqualsDouble(1.0, variant.weight)
assertEqualsDouble(0.0, variant.weight)
assertEquals(2, variant.features.size)
assertTrue(variant.hasFeature(KillOnboarding))
assertTrue(variant.hasFeature(RemoveDay1AndDay3Notifications))
Expand All @@ -176,7 +176,7 @@ class VariantManagerTest {
@Test
fun inBrowserInAppUsageVariantHasExpectedWeightAndRemoveDay1And3NotificationsAndKillOnboardingAndInAppUsageFeatures() {
val variant = variants.first { it.key == "zl" }
assertEqualsDouble(1.0, variant.weight)
assertEqualsDouble(0.0, variant.weight)
assertEquals(3, variant.features.size)
assertTrue(variant.hasFeature(KillOnboarding))
assertTrue(variant.hasFeature(RemoveDay1AndDay3Notifications))
Expand Down
28 changes: 20 additions & 8 deletions app/src/main/java/com/duckduckgo/app/cta/ui/Cta.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.duckduckgo.app.cta.ui

import android.annotation.SuppressLint
import android.content.Context
import android.net.Uri
import android.view.View
Expand Down Expand Up @@ -212,21 +213,32 @@ sealed class DaxDialogCta(
appInstallStore
) {

@SuppressLint("StringFormatMatches")
@ExperimentalStdlibApi
override fun getDaxText(context: Context): String {
val percentage = networkPropertyPercentages[network]

return if (isFromSameNetworkDomain()) {
context.resources.getString(R.string.daxMainNetworkCtaText, network, percentage, network)
} else {
context.resources.getString(
R.string.daxMainNetworkOwnedCtaText,
Uri.parse(siteHost).baseHost?.removePrefix("m.")?.capitalize(Locale.getDefault()),
network,
network,
percentage,
network
)
val locale = Locale.getDefault()
if (locale != null && locale.language == "en") {
context.resources.getString(
R.string.daxMainNetworkOwnedCtaText,
network,
Uri.parse(siteHost).baseHost?.removePrefix("m."),
network
)
} else {
context.resources.getString(
R.string.daxMainNetworkOwnedCtaText,
Uri.parse(siteHost).baseHost?.removePrefix("m.")?.capitalize(Locale.getDefault()),
network,
network,
percentage,
network
)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ interface VariantManager {
val ACTIVE_VARIANTS = listOf(
// SERP variants. "sc" may also be used as a shared control for mobile experiments in
// the future if we can filter by app version
Variant(key = "sc", weight = 0.0, features = emptyList(), filterBy = { noFilter() }),
Variant(key = "se", weight = 0.0, features = emptyList(), filterBy = { noFilter() }),
Variant(key = "sc", weight = 1.0, features = emptyList(), filterBy = { noFilter() }),
Variant(key = "se", weight = 1.0, features = emptyList(), filterBy = { noFilter() }),

// Notification Drip Experiment
Variant(
Expand Down Expand Up @@ -93,15 +93,15 @@ interface VariantManager {
Variant(key = "zi", weight = 0.0, features = listOf(VariantFeature.SerpHeaderRemoval), filterBy = { noFilter() }),

// InAppUsage Experiments
Variant(key = "zj", weight = 1.0, features = emptyList(), filterBy = { isEnglishLocale() }),
Variant(key = "zj", weight = 0.0, features = emptyList(), filterBy = { isEnglishLocale() }),
Variant(
key = "zk",
weight = 1.0,
weight = 0.0,
features = listOf(VariantFeature.KillOnboarding, VariantFeature.RemoveDay1AndDay3Notifications),
filterBy = { isEnglishLocale() }),
Variant(
key = "zl",
weight = 1.0,
weight = 0.0,
features = listOf(VariantFeature.KillOnboarding, VariantFeature.InAppUsage, VariantFeature.RemoveDay1AndDay3Notifications),
filterBy = { isEnglishLocale() })

Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values/string-untranslated.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,7 @@
<!-- Dos Attack error-->
<string name="dosErrorMessage">Connection aborted. This website could be harmful to your device.</string>

<!-- Dax Dialog, this string has changed. We have to translate and replace it!! -->
<string name="daxMainNetworkOwnedCtaText">Heads up! Since %s owns %s, I can\'t stop them from seeing your activity here.&lt;br/&gt;&lt;br/&gt;But browse with me, and I can reduce what %s knows about you overall by blocking their trackers on lots of other sites.</string>

</resources>
1 change: 0 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@
<item quantity="other"><![CDATA[&#160;were trying to track you here. <br/><br/>I blocked it!<br/><br/> ☝️You can check the URL bar to see who is trying to track you when you visit a new site.️]]></item>
</plurals>
<string name="daxNonSerpCtaText"><![CDATA[As you tap and scroll, I\'ll block pesky trackers. <br/><br/>Go ahead — keep browsing!]]></string>
<string name="daxMainNetworkOwnedCtaText"><![CDATA[Heads up! %s is owned by %s.<br/><br/> %s\'s trackers lurk on about %s of top websites 😱 but don\'t worry!<br/><br/>I\'ll block %s from seeing your activity on those sites.]]></string>
<string name="daxMainNetworkCtaText"><![CDATA[Heads up! %s is a major tracking network.<br/><br/> Their trackers lurk on about %s of top sites 😱 but don\'t worry!<br/><br/>I\'ll block %s from seeing your activity on those sites.]]></string>

<!-- Download Confirmation -->
Expand Down
2 changes: 1 addition & 1 deletion app/version/version.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION=5.61.2
VERSION=5.62.0

0 comments on commit 8a0d4ff

Please sign in to comment.