Skip to content

Commit

Permalink
Merge branch 'master' into set-default-via-backend
Browse files Browse the repository at this point in the history
  • Loading branch information
amk-stripe authored Feb 18, 2025
2 parents 0c72ca7 + 2e9fa4f commit 6bbb03a
Show file tree
Hide file tree
Showing 532 changed files with 1,398 additions and 478 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
9 changes: 6 additions & 3 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ workflows:
timeout: 1200
inputs:
- content: ./gradlew paymentsheet-example:executeScreenshotTests -Precord -Pandroid.testInstrumentationRunnerArguments.package=com.stripe.android.screenshot -Dorg.gradle.jvmargs="--add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.nio.channels=ALL-UNNAMED --add-exports java.base/sun.nio.ch=ALL-UNNAMED"
- script@1:
inputs:
- content: asdf install ruby 3.2.4
- script@1:
title: Check updated screenshots
inputs:
Expand Down Expand Up @@ -325,6 +328,9 @@ workflows:
after_run:
- conclude_all
steps:
- script@1:
inputs:
- content: asdf install ruby 3.2.4
- script@1:
inputs:
- content: ruby scripts/dependencies/update_transitive_dependencies.rb
Expand Down Expand Up @@ -386,9 +392,6 @@ workflows:
-no-boot-anim
prepare_all:
steps:
- script@1:
inputs:
- content: asdf install ruby 3.2.4
- activate-ssh-key@4:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@8: { }
Expand Down
16 changes: 9 additions & 7 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ext.versions = [
androidGradlePlugin : '8.7.1',
androidTest : '1.6.1',
androidTestJunit : '1.2.1',
androidTestOrchestrator : '1.5.0',
androidTestOrchestrator : '1.5.1',
androidTestRunner : '1.6.2',
androidTestTruth : '1.6.0',
androidxActivity : '1.8.2',
Expand Down Expand Up @@ -50,9 +50,10 @@ ext.versions = [
ktlint : '0.48.2',
leakCanary : '2.14',
material : '1.12.0',
mockito : '5.13.0',
mockito : '5.15.2',
mockitoInline : '5.2.0',
mockitoKotlin : '5.4.0',
moshi : '1.15.2',
nimbusJwt : '9.46',
okhttp : '4.12.0',
okio : '3.9.1',
Expand All @@ -64,16 +65,16 @@ ext.versions = [
playServicesTfLite : '16.0.1',
playServicesWallet : '19.4.0',
playIntegrity : '1.4.0',
retrofit : '2.9.0',
robolectric : '4.13',
retrofit : '2.11.0',
robolectric : '4.14.1',
shot : '6.1.0',
showkase : '1.0.0-beta18',
stripe3ds2 : '6.2.0',
tensorflowLite : '2.11.0',
tensorflowLiteSupport : '0.4.3',
testParameterInjector : '1.17',
testParameterInjector : '1.18',
truth : '1.4.4',
turbine : '1.1.0',
turbine : '1.2.0',
uiAutomator : '2.3.0',
workManager : '2.9.0',
zxing : '3.5.2',
Expand Down Expand Up @@ -183,6 +184,7 @@ ext.libs = [
leakCanary : "com.squareup.leakcanary:leakcanary-android:${versions.leakCanary}",
loggingInterceptor : "com.squareup.okhttp3:logging-interceptor:${versions.okhttp}",
material : "com.google.android.material:material:${versions.material}",
moshiKotlinCodegen : "com.squareup.moshi:moshi-kotlin-codegen:${versions.moshi}",
nimbusJwt : "com.nimbusds:nimbus-jose-jwt:${versions.nimbusJwt}",
okio : "com.squareup.okio:okio:${versions.okio}",
payButtonCompose : "com.google.pay.button:compose-pay-button:${versions.payButtonCompose}",
Expand All @@ -191,7 +193,7 @@ ext.libs = [
playIntegrity : "com.google.android.play:integrity:${versions.playIntegrity}",
retrofit : "com.squareup.retrofit2:retrofit:${versions.retrofit}",
retrofitGsonConverter : "com.squareup.retrofit2:converter-gson:${versions.retrofit}",
retrofitKotlinSerializationConverter: "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:${versions.kotlinSerializationConverter}",
retrofitKotlinSerializationConverter: "com.squareup.retrofit2:converter-kotlinx-serialization:${versions.retrofit}",
retrofitMoshiConverter : "com.squareup.retrofit2:converter-moshi:${versions.retrofit}",
showkase : "com.airbnb.android:showkase:${versions.showkase}",
showkaseAnnotation : "com.airbnb.android:showkase-annotation:${versions.showkase}",
Expand Down
8 changes: 4 additions & 4 deletions example/dependencies/dependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1042,9 +1042,9 @@
+--- com.google.android.material:material:1.12.0 (*)
+--- com.google.android.gms:play-services-wallet:19.4.0 (*)
+--- com.squareup.okio:okio:3.9.1 (*)
+--- com.squareup.retrofit2:retrofit:2.9.0
+--- com.squareup.retrofit2:retrofit:2.11.0
| \--- com.squareup.okhttp3:okhttp:3.14.9 -> 4.12.0 (*)
+--- com.squareup.retrofit2:converter-gson:2.9.0
| +--- com.squareup.retrofit2:retrofit:2.9.0 (*)
| \--- com.google.code.gson:gson:2.8.5 -> 2.11.0 (*)
+--- com.squareup.retrofit2:converter-gson:2.11.0
| +--- com.squareup.retrofit2:retrofit:2.11.0 (*)
| \--- com.google.code.gson:gson:2.10.1 -> 2.11.0 (*)
\--- org.jetbrains.kotlin:kotlin-parcelize-runtime:2.0.21 (*)
10 changes: 5 additions & 5 deletions financial-connections-example/dependencies/dependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1069,11 +1069,11 @@
| | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.21 -> 1.9.10 (*)
| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.21 -> 1.9.10 (*)
+--- com.google.android.material:material:1.12.0 (*)
+--- com.squareup.retrofit2:retrofit:2.9.0
+--- com.squareup.retrofit2:retrofit:2.11.0
| \--- com.squareup.okhttp3:okhttp:3.14.9 -> 4.12.0 (*)
+--- com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:1.0.0
| +--- com.squareup.retrofit2:retrofit:2.9.0 (*)
| +--- org.jetbrains.kotlinx:kotlinx-serialization-core:1.5.0 -> 1.7.3 (*)
| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.10 -> 1.9.10 (*)
+--- com.squareup.retrofit2:converter-kotlinx-serialization:2.11.0
| +--- com.squareup.retrofit2:retrofit:2.11.0 (*)
| +--- org.jetbrains.kotlinx:kotlinx-serialization-core:1.6.3 -> 1.7.3 (*)
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.9.23 -> 2.0.21 (*)
+--- org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3 (*)
\--- com.google.zxing:core:3.5.2
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.stripe.android.financialconnections.example.data

import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory
import kotlinx.serialization.json.Json
import okhttp3.Interceptor
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import okhttp3.Response
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import retrofit2.converter.kotlinx.serialization.asConverterFactory
import java.net.SocketTimeoutException
import java.util.concurrent.TimeUnit

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
25 changes: 25 additions & 0 deletions financial-connections/res/drawable-night/stripe_link_logo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="60dp"
android:height="20dp"
android:viewportWidth="60"
android:viewportHeight="20">
<path
android:pathData="M30.1,3.064C30.1,2.124 30.892,1.36 31.824,1.36C32.756,1.36 33.548,2.128 33.548,3.064C33.548,4 32.784,4.788 31.824,4.788C30.864,4.788 30.1,4.024 30.1,3.064Z"
android:fillColor="#FFFFFF"/>
<path
android:pathData="M24.984,1.6H27.984V18.4H24.984V1.6Z"
android:fillColor="#FFFFFF"/>
<path
android:pathData="M33.34,6.4H30.316V18.4H33.34V6.4Z"
android:fillColor="#FFFFFF"/>
<path
android:pathData="M55.08,11.992C57.356,10.592 58.904,8.508 59.516,6.396H56.492C55.704,8.412 53.896,9.928 51.908,10.572V1.596H48.884V18.396H51.908V13.4C54.216,13.976 56.04,15.972 56.664,18.396H59.708C59.244,15.852 57.504,13.472 55.08,11.992Z"
android:fillColor="#FFFFFF"/>
<path
android:pathData="M38.7,7.744C39.492,6.692 41.036,6.08 42.288,6.08C44.624,6.08 46.556,7.788 46.56,10.368V18.396H43.536V11.036C43.536,9.976 43.064,8.752 41.532,8.752C39.732,8.752 38.696,10.348 38.696,12.216V18.404H35.672V6.408H38.7V7.744Z"
android:fillColor="#FFFFFF"/>
<path
android:pathData="M20,10C20,15.523 15.523,20 10,20C4.477,20 0,15.523 0,10C0,4.477 4.477,0 10,0C15.523,0 20,4.477 20,10ZM6.456,4H9.54C10.3,6.32 12.416,8.336 15.02,8.744V11.252C12.42,11.664 10.304,13.68 9.54,16H6.456C7.056,13.492 8.804,11.348 11,10C8.808,8.652 7.056,6.508 6.456,4Z"
android:fillColor="#FFFFFF"
android:fillType="evenOdd"/>
</vector>
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,9 @@ private fun PrePaneContent(
modifier = Modifier.padding(horizontal = 24.dp),
text = TextResource.Text(fromHtml(bodyItem.content)),
onClickableTextClick = onClickableTextClick,
defaultStyle = typography.bodyMedium
defaultStyle = typography.bodyMedium.copy(
color = colors.textDefault,
),
)
}
}
Expand Down Expand Up @@ -513,7 +515,7 @@ internal fun PartnerAuthDrawerPreview(
state: SharedPartnerAuthState
) {
FinancialConnectionsPreview {
Box(modifier = Modifier.background(Color.White)) {
Box(modifier = Modifier.background(colors.background)) {
SharedPartnerAuthContent(
state = state,
inModal = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ internal fun GenericBody(
text = TextResource.Text(fromHtml(entry.text)),
onClickableTextClick = onClickableTextClick,
defaultStyle = font.copy(
textAlign = entry.alignment.toComposeTextAlign()
textAlign = entry.alignment.toComposeTextAlign(),
color = colors.textDefault,
),
modifier = Modifier.padding(horizontal = 24.dp),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ private fun NoResultsTile(
onClickableTextClick = { onManualEntryClick() },
defaultStyle = typography.bodyMedium.copy(
textAlign = TextAlign.Center,
color = colors.textDefault
),
annotationStyles = mapOf(
StringAnnotation.CLICKABLE to typography.bodyMediumEmphasized.toSpanStyle().copy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ private fun ResendCodeSection(
AnnotatedText(
text = TextResource.StringId(R.string.stripe_link_stepup_verification_resend_code),
maxLines = 1,
defaultStyle = typography.labelMedium,
defaultStyle = typography.labelMediumEmphasized.copy(
color = colors.textAction,
),
annotationStyles = mapOf(
StringAnnotation.CLICKABLE to typography.labelMediumEmphasized
.toSpanStyle()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ internal val Neutral900 = Color(0xff21252C)

// Attention
internal val Attention50 = Color(0xFFFEF9DA)
internal val Attention50Dark = Color(0xFF400A00)
internal val Attention100Dark = Color(0xFF302514)
internal val Attention300 = Color(0xFFF7870F)

// Feedback
Expand Down Expand Up @@ -84,7 +84,7 @@ internal data class FinancialConnectionsColors(
internal fun ColorsPreview() {
FinancialConnectionsPreview {
Column(
modifier = Modifier.background(Color.White)
modifier = Modifier.background(colors.background)
) {
ColorPreview("background", colors.background)
ColorPreview("backgroundSecondary", colors.backgroundSecondary)
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 @@ -87,7 +86,7 @@ private val DarkThemeColors = FinancialConnectionsColors(
icon = Neutral25,
borderNeutral = Neutral100Dark,
spinnerNeutral = Neutral200,
warningLight = Attention50Dark,
warningLight = Attention100Dark,
warning = Attention300,
primary = Brand500,
primaryAccent = Neutral0,
Expand Down Expand Up @@ -133,7 +132,7 @@ private val InstantDebitsDarkModeColors = FinancialConnectionsColors(
icon = Neutral25,
borderNeutral = Neutral100Dark,
spinnerNeutral = Neutral200,
warningLight = Attention50Dark,
warningLight = Attention100Dark,
warning = Attention300,
primary = LinkGreen200,
primaryAccent = LinkGreen900,
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 @@ -7,10 +7,10 @@ import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.tooling.preview.Preview
import com.stripe.android.financialconnections.ui.FinancialConnectionsPreview
import com.stripe.android.financialconnections.ui.theme.FinancialConnectionsTheme.colors
import com.stripe.android.financialconnections.ui.theme.FinancialConnectionsTheme.typography

@Immutable
Expand All @@ -34,7 +34,7 @@ internal data class FinancialConnectionsTypography(
internal fun TypePreview() {
FinancialConnectionsPreview {
Column(
modifier = Modifier.background(Color.White)
modifier = Modifier.background(colors.background)
) {
Text(
text = "Heading XLarge",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import app.cash.paparazzi.Paparazzi
import com.airbnb.android.showkase.models.Showkase
import com.airbnb.android.showkase.models.ShowkaseBrowserComponent
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.financialconnections.getMetadata
Expand Down Expand Up @@ -42,6 +43,12 @@ class PaparazziSampleScreenshotTest {
PIXEL_C(DeviceConfig.PIXEL_C),
}

@Suppress("Unused")
enum class SystemAppearance(val nightMode: NightMode) {
Light(nightMode = NightMode.NOTNIGHT),
Dark(nightMode = NightMode.NIGHT),
}

@get:Rule
val timeZoneRule = TimeZoneRule()

Expand All @@ -55,10 +62,12 @@ class PaparazziSampleScreenshotTest {
fun preview_tests(
@TestParameter(valuesProvider = PreviewProvider::class) componentTestPreview: ComponentTestPreview,
@TestParameter baseDeviceConfig: BaseDeviceConfig,
@TestParameter systemAppearance: SystemAppearance,
) {
paparazzi.unsafeUpdateConfig(
baseDeviceConfig.deviceConfig.copy(
softButtons = false,
nightMode = systemAppearance.nightMode,
)
)
paparazzi.snapshot {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 6bbb03a

Please sign in to comment.