-
Notifications
You must be signed in to change notification settings - Fork 664
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix incorrect Link inline signup background (#7785)
* Fix incorrect Link inline signup background * Update screenshots
- Loading branch information
1 parent
55992bd
commit c07c528
Showing
8 changed files
with
63 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ package com.stripe.android.link.ui.inline | |
|
||
import androidx.annotation.RestrictTo | ||
import androidx.compose.animation.AnimatedVisibility | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
|
@@ -25,7 +24,6 @@ import androidx.compose.runtime.getValue | |
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.ExperimentalComposeUiApi | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.platform.LocalFocusManager | ||
import androidx.compose.ui.platform.LocalSoftwareKeyboardController | ||
|
@@ -47,7 +45,6 @@ import com.stripe.android.link.ui.ErrorMessage | |
import com.stripe.android.link.ui.ErrorText | ||
import com.stripe.android.link.ui.LinkTerms | ||
import com.stripe.android.link.ui.signup.SignUpState | ||
import com.stripe.android.uicore.StripeTheme | ||
import com.stripe.android.uicore.elements.EmailConfig | ||
import com.stripe.android.uicore.elements.NameConfig | ||
import com.stripe.android.uicore.elements.PhoneNumberController | ||
|
@@ -63,9 +60,7 @@ import com.stripe.android.uicore.stripeShapes | |
@Composable | ||
private fun PreviewInitial() { | ||
DefaultLinkTheme { | ||
Surface( | ||
color = Color.Red, | ||
) { | ||
Surface { | ||
LinkOptionalInlineSignup( | ||
sectionController = SectionController(null, emptyList()), | ||
emailController = EmailConfig.createController(""), | ||
|
@@ -85,9 +80,7 @@ private fun PreviewInitial() { | |
@Composable | ||
private fun PreviewFilledOut() { | ||
DefaultLinkTheme { | ||
Surface( | ||
color = Color.Red, | ||
) { | ||
Surface { | ||
LinkOptionalInlineSignup( | ||
sectionController = SectionController(null, emptyList()), | ||
emailController = EmailConfig.createController("[email protected]"), | ||
|
@@ -162,88 +155,84 @@ private fun LinkOptionalInlineSignup( | |
CompositionLocalProvider( | ||
LocalContentAlpha provides if (enabled) ContentAlpha.high else ContentAlpha.disabled | ||
) { | ||
StripeTheme { | ||
Column( | ||
modifier = modifier.background(color = MaterialTheme.stripeColors.component), | ||
Column(modifier) { | ||
val sectionError by sectionController.error.collectAsState(null) | ||
|
||
Section( | ||
title = null, | ||
error = sectionError?.errorMessage?.let { stringResource(it) }, | ||
) { | ||
val sectionError by sectionController.error.collectAsState(null) | ||
EmailCollection( | ||
enabled = enabled, | ||
emailController = emailController, | ||
signUpState = signUpState, | ||
) | ||
|
||
Section( | ||
title = null, | ||
error = sectionError?.errorMessage?.let { stringResource(it) }, | ||
AnimatedVisibility( | ||
visible = signUpState != SignUpState.InputtingPhoneOrName && errorMessage != null, | ||
) { | ||
EmailCollection( | ||
enabled = enabled, | ||
emailController = emailController, | ||
signUpState = signUpState, | ||
ErrorText( | ||
text = errorMessage | ||
?.getMessage(LocalContext.current.resources) | ||
.orEmpty(), | ||
modifier = Modifier.fillMaxWidth() | ||
) | ||
} | ||
|
||
AnimatedVisibility( | ||
visible = signUpState != SignUpState.InputtingPhoneOrName && errorMessage != null, | ||
) { | ||
ErrorText( | ||
text = errorMessage | ||
?.getMessage(LocalContext.current.resources) | ||
.orEmpty(), | ||
modifier = Modifier.fillMaxWidth() | ||
AnimatedVisibility(visible = signUpState == SignUpState.InputtingPhoneOrName) { | ||
Column(modifier = Modifier.fillMaxWidth()) { | ||
Divider( | ||
color = MaterialTheme.stripeColors.componentDivider, | ||
thickness = MaterialTheme.stripeShapes.borderStrokeWidth.dp, | ||
modifier = Modifier.padding( | ||
horizontal = MaterialTheme.stripeShapes.borderStrokeWidth.dp | ||
) | ||
) | ||
} | ||
|
||
AnimatedVisibility(visible = signUpState == SignUpState.InputtingPhoneOrName) { | ||
Column(modifier = Modifier.fillMaxWidth()) { | ||
Divider( | ||
color = MaterialTheme.stripeColors.componentDivider, | ||
thickness = MaterialTheme.stripeShapes.borderStrokeWidth.dp, | ||
modifier = Modifier.padding( | ||
horizontal = MaterialTheme.stripeShapes.borderStrokeWidth.dp | ||
) | ||
PhoneNumberElementUI( | ||
enabled = enabled, | ||
controller = phoneNumberController, | ||
requestFocusWhenShown = phoneNumberController.initialPhoneNumber.isEmpty(), | ||
imeAction = if (requiresNameCollection) { | ||
ImeAction.Next | ||
} else { | ||
ImeAction.Done | ||
} | ||
) | ||
|
||
Divider( | ||
color = MaterialTheme.stripeColors.componentDivider, | ||
thickness = MaterialTheme.stripeShapes.borderStrokeWidth.dp, | ||
modifier = Modifier.padding( | ||
horizontal = MaterialTheme.stripeShapes.borderStrokeWidth.dp | ||
) | ||
) | ||
|
||
PhoneNumberElementUI( | ||
if (requiresNameCollection) { | ||
TextField( | ||
textFieldController = nameController, | ||
imeAction = ImeAction.Done, | ||
enabled = enabled, | ||
controller = phoneNumberController, | ||
requestFocusWhenShown = phoneNumberController.initialPhoneNumber.isEmpty(), | ||
imeAction = if (requiresNameCollection) { | ||
ImeAction.Next | ||
} else { | ||
ImeAction.Done | ||
} | ||
) | ||
} | ||
|
||
Divider( | ||
color = MaterialTheme.stripeColors.componentDivider, | ||
thickness = MaterialTheme.stripeShapes.borderStrokeWidth.dp, | ||
modifier = Modifier.padding( | ||
horizontal = MaterialTheme.stripeShapes.borderStrokeWidth.dp | ||
) | ||
AnimatedVisibility(visible = errorMessage != null) { | ||
ErrorText( | ||
text = errorMessage | ||
?.getMessage(LocalContext.current.resources) | ||
.orEmpty(), | ||
modifier = Modifier.fillMaxWidth() | ||
) | ||
|
||
if (requiresNameCollection) { | ||
TextField( | ||
textFieldController = nameController, | ||
imeAction = ImeAction.Done, | ||
enabled = enabled, | ||
) | ||
} | ||
|
||
AnimatedVisibility(visible = errorMessage != null) { | ||
ErrorText( | ||
text = errorMessage | ||
?.getMessage(LocalContext.current.resources) | ||
.orEmpty(), | ||
modifier = Modifier.fillMaxWidth() | ||
) | ||
} | ||
} | ||
} | ||
} | ||
|
||
LinkTerms( | ||
isOptional = true, | ||
modifier = Modifier.padding(top = 4.dp), | ||
textAlign = TextAlign.Start, | ||
) | ||
} | ||
|
||
LinkTerms( | ||
isOptional = true, | ||
modifier = Modifier.padding(top = 4.dp), | ||
textAlign = TextAlign.Start, | ||
) | ||
} | ||
} | ||
} | ||
|
Binary file modified
BIN
+26 KB
(120%)
...enshot.TestPaymentSheetScreenshots_testPaymentSheetCustomPrimaryButtonLabel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+26.3 KB
(120%)
....android.screenshot.TestPaymentSheetScreenshots_testPaymentSheetNewCustomer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+15 Bytes
(100%)
...creenshot.TestPaymentSheetScreenshots_testPaymentSheetNewCustomerAppearance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+22.6 KB
(120%)
...roid.screenshot.TestPaymentSheetScreenshots_testPaymentSheetNewCustomerDark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+12 Bytes
(100%)
...nshot.TestPaymentSheetScreenshots_testPaymentSheetNewCustomerDarkAppearance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+19.9 KB
(110%)
...hot.TestPaymentSheetScreenshots_testPaymentSheetPrimaryButtonAppearanceDark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+23.8 KB
(120%)
...ot.TestPaymentSheetScreenshots_testPaymentSheetPrimaryButtonAppearanceLight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.