Skip to content

Commit

Permalink
Release dark mode in Financial Connections (#10177)
Browse files Browse the repository at this point in the history
  • Loading branch information
tillh-stripe authored Feb 14, 2025
1 parent 583dabd commit b7d0427
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 57 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## XX.XX.XX - 20XX-XX-XX

### Financial Connections
- [ADDED] Financial Connections now supports dark mode and will automatically adapt to the device's theme. [Learn more](https://docs.stripe.com/financial-connections/other-data-powered-products?platform=android#connections-customize-android) about configuring appearance settings.

## 21.4.2 - 2025-02-10
Bug fixes and improvements.

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ internal data class PlaygroundSettings(
ConfirmIntentSetting(),
NativeSetting(),
PermissionsSetting(),
DynamicAppearanceSetting(),
EmailSetting(),
CustomerIdSetting(),
StripeAccountIdSetting().takeIf { BuildConfig.TEST_ENVIRONMENT != "edge" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import androidx.compose.ui.unit.sp
import androidx.compose.ui.window.DialogWindowProvider
import androidx.core.view.WindowCompat
import androidx.navigation.compose.rememberNavController
import com.stripe.android.core.utils.FeatureFlags
import com.stripe.android.financialconnections.R
import com.stripe.android.financialconnections.ui.LocalNavHostController

Expand All @@ -39,8 +38,8 @@ internal enum class Theme {
val colors: FinancialConnectionsColors
@Composable
get() = when (this) {
DefaultLight -> if (useDarkMode) DarkThemeColors else Colors
LinkLight -> if (useDarkMode) InstantDebitsDarkModeColors else InstantDebitsColors
DefaultLight -> if (isSystemInDarkTheme()) DarkThemeColors else Colors
LinkLight -> if (isSystemInDarkTheme()) InstantDebitsDarkModeColors else InstantDebitsColors
}

val icon: Int
Expand Down Expand Up @@ -266,7 +265,7 @@ internal fun FinancialConnectionsTheme(
val window = findWindow()
val barColor = FinancialConnectionsTheme.colors.borderNeutral
if (!view.isInEditMode) {
val lightNavBar = !useDarkMode
val lightNavBar = !isSystemInDarkTheme()
SideEffect {
window?.let { window ->
val insets = WindowCompat.getInsetsController(window, view)
Expand All @@ -290,10 +289,6 @@ internal fun FinancialConnectionsTheme(
}
}

private val useDarkMode: Boolean
@Composable
get() = FeatureFlags.financialConnectionsDarkMode.isEnabled && isSystemInDarkTheme()

@Composable
private fun findWindow(): Window? =
(LocalView.current.parent as? DialogWindowProvider)?.window
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@ import com.android.ide.common.rendering.api.SessionParams
import com.android.resources.NightMode
import com.google.testing.junit.testparameterinjector.TestParameter
import com.google.testing.junit.testparameterinjector.TestParameterInjector
import com.stripe.android.core.utils.FeatureFlags
import com.stripe.android.financialconnections.getMetadata
import com.stripe.android.financialconnections.ui.LocalTopAppBarHost
import com.stripe.android.financialconnections.ui.theme.FinancialConnectionsTheme
import com.stripe.android.financialconnections.utils.TimeZoneRule
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
Expand Down Expand Up @@ -61,16 +58,6 @@ class PaparazziSampleScreenshotTest {
renderingMode = SessionParams.RenderingMode.SHRINK,
)

@Before
fun before() {
FeatureFlags.financialConnectionsDarkMode.setEnabled(true)
}

@After
fun after() {
FeatureFlags.financialConnectionsDarkMode.setEnabled(false)
}

@Test
fun preview_tests(
@TestParameter(valuesProvider = PreviewProvider::class) componentTestPreview: ComponentTestPreview,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ object FeatureFlags {
val nativeLinkEnabled = FeatureFlag("Native Link")
val nativeLinkAttestationEnabled = FeatureFlag("Native Link Attestation")
val instantDebitsIncentives = FeatureFlag("Instant Bank Payments Incentives")
val financialConnectionsDarkMode = FeatureFlag("Financial Connections Dark Mode")
}

@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
Expand Down

0 comments on commit b7d0427

Please sign in to comment.