purchases-android icon indicating copy to clipboard operation
purchases-android copied to clipboard

[Customer Center] Problem with theming colors (dark theme)

Open augusto-carmo-mesa opened this issue 6 months ago • 4 comments

Describe the bug For some reason, the color of the text in buttons of dialogs opened via Customer Center are hard to read due to their color. It happens for dark theme.

Light Theme Example:

Image

Dark Theme Example:

Image

Here's the code I'm using to display the Customer Center inside an Activity:

import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme

// ...

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    enableEdgeToEdge()

    configureWindowInsets(
        statusBarDarkIcons = !isDarkTheme(),
        navigationBarDarkIcons = !isDarkTheme()
    )

    setContent {
        var isCustomerCenterVisible by remember { mutableStateOf(true) }

        LaunchedEffect(key1 = isCustomerCenterVisible) {
            if (!isCustomerCenterVisible) {
                onBackPressedDispatcher.onBackPressed()
            }
        }

        val colorScheme = if (isSystemInDarkTheme()) {
            darkColorScheme()
        } else {
            lightColorScheme()
        }
        MaterialTheme(colorScheme = colorScheme) {
            if (isCustomerCenterVisible) {
                CustomerCenter(
                    modifier = Modifier
                        .fillMaxSize(),
                    onDismiss = {
                        isCustomerCenterVisible = false
                    }
                )
            }
        }
    }
}

// ...

Obs.: This time around I can't use startActivity(ShowCustomerCenter().createIntent(requireContext(), Unit)). I have to use the composable version one.

  1. Environment
    1. Platform: Android
    2. SDK version: 8.19.2
    3. OS version: API 34
    4. Android Studio version: Android Studio Meerkat Feature Drop | 2024.3.2 Patch 1
    5. How widespread is the issue. Percentage of devices affected: 100%

augusto-carmo-mesa avatar Jun 09 '25 13:06 augusto-carmo-mesa

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

RCGitBot avatar Jun 09 '25 13:06 RCGitBot

Thank you for reporting @augusto-carmo-mesa

I am looking into it because I can definitely see weird behavior. Those buttons are not respecting the colors set in the Theme at all

vegaro avatar Jun 09 '25 16:06 vegaro

@augusto-carmo-mesa ok, I found the answer to this. The buttons in the restore alert dialog will use whatever is set as accent color in the RevenueCat dashboard. We set that accent color as primary in the theme internally, so it will be used in other buttons in the Customer Center, like the Feedback survey ones, although this ones are not TextButtons but Buttons with a background.

Image

vegaro avatar Jun 09 '25 16:06 vegaro

Reopened issue. It was closed due to a failing automation. Sorry about that.

ajpallares avatar Sep 22 '25 07:09 ajpallares