Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preparations for UI Experiments #5627

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from

Conversation

malmstein
Copy link
Contributor

@malmstein malmstein commented Feb 10, 2025

Task/Issue URL: https://app.asana.com/0/488551667048375/1209289914504437

Description

Steps to test this PR

Enable Experimental UI

  • Install app in Internal flavour
  • Open Appearance screen
  • Verify “Enable Experimental UI” is visible
  • Toggle it on and restart the app
  • Verify has a pink tint
  • Open Appearance screen and toggle the experimental feature offf
  • Verify app is back to the original colors after restart

Enable Experimental UI

  • Install app in release flavour
  • Open Appearance screen
  • Verify “Enable Experimental UI” is not visible

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@malmstein malmstein marked this pull request as ready for review February 10, 2025 15:58
@malmstein malmstein requested a review from nalcalag as a code owner February 10, 2025 15:58
@malmstein malmstein force-pushed the feature/david/01-30-preparations_for_ui_experiments branch from 8c62cd4 to 33450e9 Compare February 11, 2025 16:54
Copy link
Contributor

@LukasPaczos LukasPaczos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to handle the DARK_EXPERIMENT value in

fun isDarkThemeEnabled(): Boolean {
return when (themingDataStore.theme) {
DuckDuckGoTheme.SYSTEM_DEFAULT -> {
val uiManager = getSystemService(Context.UI_MODE_SERVICE) as UiModeManager
when (uiManager.nightMode) {
UiModeManager.MODE_NIGHT_YES -> true
else -> false
}
}
DARK -> true
else -> false
}
}

@@ -89,6 +74,8 @@ fun AppCompatActivity.getThemeId(theme: DuckDuckGoTheme): Int {
return when (theme) {
SYSTEM_DEFAULT -> getSystemDefaultTheme()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getSystemDefaultTheme also needs to be updated to return either the regular or experiment themes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

During internal testing we only want to change Light / Dark. Users on system theming won’t be able to see the experimental colors.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds somewhat counter-intuitive for me. The new flag governs whether the experimental light/dark theme is applied, we shouldn't require from internal users any additional implicit steps. The default setting is the "system theme", and in the end it applies one of the light or dark themes, so in my opinion it should respect the experiment flag as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"we shouldn't require from internal users any additional implicit steps”. this is still to be decided, for now we will keep it simple and iterate in the project.

@malmstein malmstein force-pushed the feature/david/01-30-preparations_for_ui_experiments branch from 33450e9 to 115e825 Compare February 12, 2025 13:29
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more small change needed:

val currentTheme = theme.getOptionIndex()
RadioListAlertDialogBuilder(this)
.setTitle(R.string.settingsTheme)
.setOptions(
listOf(
R.string.settingsSystemTheme,
R.string.settingsLightTheme,
R.string.settingsDarkTheme,
),
currentTheme,
)

currentTheme should be mapped back to light/dark when experimental is provided. Otherwise, nothing is pre-selected when the experiment is enabled and radio menu opens.

Copy link
Contributor

@LukasPaczos LukasPaczos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the comments, let's merge and continue but please cut follow up tasks for:

if not addressed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants