-
Notifications
You must be signed in to change notification settings - Fork 659
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
[FC] Fix Accessible data callout copy logic #6375
Changes from 5 commits
b0e60af
28f329a
c75dff0
cb234e6
ceaacfc
52c6b66
e4133f5
327838c
70e3ede
9120565
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,16 +141,21 @@ private fun AccessibleDataText( | |
val permissionsReadable = remember(model.permissions) { model.permissions.toStringRes() } | ||
AnnotatedText( | ||
text = TextResource.StringId( | ||
value = when (model.isStripeDirect) { | ||
true -> when (model.businessName) { | ||
null -> R.string.data_accessible_callout_through_stripe_no_business | ||
else -> R.string.data_accessible_callout_through_stripe | ||
value = when { | ||
model.isNetworking -> when (model.businessName) { | ||
null -> R.string.data_accessible_callout_through_link_no_business | ||
else -> R.string.data_accessible_callout_through_link | ||
} | ||
|
||
false -> when (model.businessName) { | ||
model.isStripeDirect -> when (model.businessName) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for iOS there is no conditional around businessName for isStripeDirect There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure if it can happen, but let's leave it just in case? 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh! yeah this is wrong then. Updating it, thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
null -> R.string.data_accessible_callout_no_business | ||
else -> R.string.data_accessible_callout | ||
} | ||
|
||
else -> when (model.businessName) { | ||
null -> R.string.data_accessible_callout_through_stripe_no_business | ||
else -> R.string.data_accessible_callout_through_stripe | ||
} | ||
}, | ||
args = listOfNotNull( | ||
model.businessName, | ||
|
@@ -221,6 +226,7 @@ internal data class AccessibleDataCalloutModel( | |
val businessName: String?, | ||
val permissions: List<Permissions>, | ||
val isStripeDirect: Boolean, | ||
val isNetworking: Boolean, | ||
val dataPolicyUrl: String | ||
) { | ||
|
||
|
@@ -229,6 +235,7 @@ internal data class AccessibleDataCalloutModel( | |
AccessibleDataCalloutModel( | ||
businessName = ConsentTextBuilder.getBusinessName(manifest), | ||
permissions = manifest.permissions, | ||
isNetworking = manifest.isNetworkingUserFlow ?: false, | ||
isStripeDirect = manifest.isStripeDirect ?: false, | ||
dataPolicyUrl = FinancialConnectionsUrlResolver.getDataPolicyUrl(manifest) | ||
) | ||
|
@@ -249,7 +256,8 @@ internal fun AccessibleDataCalloutPreview() { | |
Permissions.TRANSACTIONS, | ||
Permissions.ACCOUNT_NUMBERS | ||
), | ||
isStripeDirect = true, | ||
isNetworking = false, | ||
isStripeDirect = false, | ||
dataPolicyUrl = "" | ||
), | ||
onLearnMoreClick = {} | ||
|
@@ -271,62 +279,78 @@ internal fun AccessibleDataCalloutWithManyAccountsPreview() { | |
Permissions.OWNERSHIP, | ||
Permissions.TRANSACTIONS | ||
), | ||
isStripeDirect = true, | ||
isStripeDirect = false, | ||
isNetworking = false, | ||
dataPolicyUrl = "" | ||
), | ||
accounts = listOf( | ||
PartnerAccount( | ||
authorization = "Authorization", | ||
institutionName = "Random bank", | ||
category = FinancialConnectionsAccount.Category.CASH, | ||
id = "id1", | ||
name = "Account 1 - no acct numbers", | ||
_allowSelection = true, | ||
allowSelectionMessage = "", | ||
subcategory = FinancialConnectionsAccount.Subcategory.CHECKING, | ||
supportedPaymentMethodTypes = emptyList() | ||
), | ||
PartnerAccount( | ||
authorization = "Authorization", | ||
category = FinancialConnectionsAccount.Category.CASH, | ||
id = "id2", | ||
name = "Account 2 - no acct numbers", | ||
_allowSelection = true, | ||
allowSelectionMessage = "", | ||
subcategory = FinancialConnectionsAccount.Subcategory.SAVINGS, | ||
supportedPaymentMethodTypes = emptyList() | ||
), | ||
PartnerAccount( | ||
authorization = "Authorization", | ||
category = FinancialConnectionsAccount.Category.CASH, | ||
id = "id3", | ||
name = "Account 3 - no acct numbers", | ||
_allowSelection = true, | ||
allowSelectionMessage = "", | ||
subcategory = FinancialConnectionsAccount.Subcategory.SAVINGS, | ||
supportedPaymentMethodTypes = emptyList() | ||
accounts = partnerAccountsForPreview(), | ||
institution = FinancialConnectionsInstitution( | ||
id = "id", | ||
name = "name", | ||
url = "url", | ||
featured = true, | ||
icon = null, | ||
logo = null, | ||
featuredOrder = null, | ||
mobileHandoffCapable = false | ||
), | ||
onLearnMoreClick = {} | ||
) | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
@Suppress("LongMethod") | ||
internal fun AccessibleDataCalloutStripeDirectPreview() { | ||
FinancialConnectionsPreview { | ||
AccessibleDataCalloutWithAccounts( | ||
AccessibleDataCalloutModel( | ||
businessName = "My business", | ||
permissions = listOf( | ||
Permissions.PAYMENT_METHOD, | ||
Permissions.BALANCES, | ||
Permissions.OWNERSHIP, | ||
Permissions.TRANSACTIONS | ||
), | ||
PartnerAccount( | ||
authorization = "Authorization", | ||
category = FinancialConnectionsAccount.Category.CASH, | ||
id = "id4", | ||
name = "Account 4 - no acct numbers", | ||
_allowSelection = true, | ||
allowSelectionMessage = "", | ||
subcategory = FinancialConnectionsAccount.Subcategory.SAVINGS, | ||
supportedPaymentMethodTypes = emptyList() | ||
isStripeDirect = true, | ||
isNetworking = false, | ||
dataPolicyUrl = "" | ||
), | ||
accounts = partnerAccountsForPreview(), | ||
institution = FinancialConnectionsInstitution( | ||
id = "id", | ||
name = "name", | ||
url = "url", | ||
featured = true, | ||
icon = null, | ||
logo = null, | ||
featuredOrder = null, | ||
mobileHandoffCapable = false | ||
), | ||
onLearnMoreClick = {} | ||
) | ||
} | ||
} | ||
@Preview | ||
@Composable | ||
@Suppress("LongMethod") | ||
internal fun AccessibleDataCalloutNetworkingPreview() { | ||
FinancialConnectionsPreview { | ||
AccessibleDataCalloutWithAccounts( | ||
AccessibleDataCalloutModel( | ||
businessName = "My business", | ||
permissions = listOf( | ||
Permissions.PAYMENT_METHOD, | ||
Permissions.BALANCES, | ||
Permissions.OWNERSHIP, | ||
Permissions.TRANSACTIONS | ||
), | ||
PartnerAccount( | ||
authorization = "Authorization", | ||
category = FinancialConnectionsAccount.Category.CASH, | ||
id = "id5", | ||
name = "Account 5 - no acct numbers", | ||
_allowSelection = true, | ||
allowSelectionMessage = "", | ||
subcategory = FinancialConnectionsAccount.Subcategory.SAVINGS, | ||
supportedPaymentMethodTypes = emptyList() | ||
) | ||
isStripeDirect = false, | ||
isNetworking = true, | ||
dataPolicyUrl = "" | ||
), | ||
accounts = partnerAccountsForPreview(), | ||
institution = FinancialConnectionsInstitution( | ||
id = "id", | ||
name = "name", | ||
|
@@ -342,6 +366,61 @@ internal fun AccessibleDataCalloutWithManyAccountsPreview() { | |
} | ||
} | ||
|
||
@Composable | ||
private fun partnerAccountsForPreview() = listOf( | ||
PartnerAccount( | ||
authorization = "Authorization", | ||
institutionName = "Random bank", | ||
category = FinancialConnectionsAccount.Category.CASH, | ||
id = "id1", | ||
name = "Account 1 - no acct numbers", | ||
_allowSelection = true, | ||
allowSelectionMessage = "", | ||
subcategory = FinancialConnectionsAccount.Subcategory.CHECKING, | ||
supportedPaymentMethodTypes = emptyList() | ||
), | ||
PartnerAccount( | ||
authorization = "Authorization", | ||
category = FinancialConnectionsAccount.Category.CASH, | ||
id = "id2", | ||
name = "Account 2 - no acct numbers", | ||
_allowSelection = true, | ||
allowSelectionMessage = "", | ||
subcategory = FinancialConnectionsAccount.Subcategory.SAVINGS, | ||
supportedPaymentMethodTypes = emptyList() | ||
), | ||
PartnerAccount( | ||
authorization = "Authorization", | ||
category = FinancialConnectionsAccount.Category.CASH, | ||
id = "id3", | ||
name = "Account 3 - no acct numbers", | ||
_allowSelection = true, | ||
allowSelectionMessage = "", | ||
subcategory = FinancialConnectionsAccount.Subcategory.SAVINGS, | ||
supportedPaymentMethodTypes = emptyList() | ||
), | ||
PartnerAccount( | ||
authorization = "Authorization", | ||
category = FinancialConnectionsAccount.Category.CASH, | ||
id = "id4", | ||
name = "Account 4 - no acct numbers", | ||
_allowSelection = true, | ||
allowSelectionMessage = "", | ||
subcategory = FinancialConnectionsAccount.Subcategory.SAVINGS, | ||
supportedPaymentMethodTypes = emptyList() | ||
), | ||
PartnerAccount( | ||
authorization = "Authorization", | ||
category = FinancialConnectionsAccount.Category.CASH, | ||
id = "id5", | ||
name = "Account 5 - no acct numbers", | ||
_allowSelection = true, | ||
allowSelectionMessage = "", | ||
subcategory = FinancialConnectionsAccount.Subcategory.SAVINGS, | ||
supportedPaymentMethodTypes = emptyList() | ||
) | ||
) | ||
|
||
@Preview | ||
@Composable | ||
internal fun AccessibleDataCalloutWithMultipleAccountsPreview() { | ||
|
@@ -356,6 +435,7 @@ internal fun AccessibleDataCalloutWithMultipleAccountsPreview() { | |
Permissions.TRANSACTIONS | ||
), | ||
isStripeDirect = true, | ||
isNetworking = false, | ||
dataPolicyUrl = "" | ||
), | ||
accounts = listOf( | ||
|
@@ -413,6 +493,7 @@ internal fun AccessibleDataCalloutWithOneAccountPreview() { | |
Permissions.TRANSACTIONS | ||
), | ||
isStripeDirect = true, | ||
isNetworking = false, | ||
dataPolicyUrl = "" | ||
), | ||
accounts = listOf( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is debatable and likely doesn't cause an issue unless we do things like making the link underline, but the annotation itself contains a space:
so if annotation did underline, the space would have an underline
(again, likely not a legit issue, just calling it out in case there could be issues)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a good point, fixed it! e4133f5