Skip to content
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

Add Stripe resource prefix #6603

Merged
merged 5 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## XX.XX.XX - 2023-XX-XX

### All SDKs
* [CHANGED][6608](https://github.com/stripe/stripe-android/pull/6608) Added a `stripe` prefix to our string resources to avoid name conflicts.
* [CHANGED][6603](https://github.com/stripe/stripe-android/pull/6603) Added a `stripe` prefix to our resources to avoid name conflicts.
* [FIXED][6602](https://github.com/stripe/stripe-android/pull/6602) Fixed an issue which caused a compiler error (duplicate class) when including payments *and* identity SDKs.
* [FIXED][6611](https://github.com/stripe/stripe-android/pull/6611) Fixed an issue where countries might be filtered out on old Android versions (notably Kosovo).

Expand Down
3 changes: 3 additions & 0 deletions build-configuration/android-library.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ if (System.getenv("JITPACK")) {

android {
namespace STRIPE_ANDROID_NAMESPACE
resourcePrefix 'Stripe'

compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
minSdkVersion 21
targetSdkVersion rootProject.ext.compileSdkVersion
Expand Down
12 changes: 6 additions & 6 deletions camera-core/res/values/attrs.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="CameraView">
<resources xmlns:tools="http://schemas.android.com/tools">
<declare-styleable name="StripeCameraView">
<!--defines the shape, aspect ratio of the viewfinder-->
<attr name="viewFinderType" format="enum">
<attr name="stripeViewFinderType" format="enum">
Comment on lines +2 to +5
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ccen-stripe and @awush-stripe: It looks to me like these are only intended for internal use. Is that correct?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it is!, StripeCameraView is not supposed to be public

<!--viewFinder fills previewView, no background/hole drawn-->
<enum name="fill" value="0" />
<!--viewFinder has aspect ratio for credit card, a hole is drawn to highlight the viewfinder-->
Expand All @@ -13,11 +13,11 @@
<enum name="passport" value="3" />
</attr>
<!--defines the imageView of the border-->
<attr name="borderDrawable" format="reference" />
<attr name="stripeBorderDrawable" format="reference" />
</declare-styleable>

<declare-styleable name="ViewFinderBackground">
<attr name="backgroundColor" format="color" />
<declare-styleable name="StripeViewFinderBackground">
<attr name="stripeBackgroundColor" format="color" />
</declare-styleable>

</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import kotlin.math.roundToInt
* and [ScanFlow].
*
* Has the following styleable parameters to configure in xml
* [R.styleable.CameraView_viewFinderType] - a enum to decide the type of [ViewFinderType], which dictates the aspect ratio of [viewFinderWindowView].
* [R.styleable.CameraView_borderDrawable] - an optional reference for [viewFinderBorderView]'s drawable resource.
* [R.styleable.StripeCameraView_stripeViewFinderType] - a enum to decide the type of [ViewFinderType], which dictates the aspect ratio of [viewFinderWindowView].
* [R.styleable.StripeCameraView_stripeBorderDrawable] - an optional reference for [viewFinderBorderView]'s drawable resource.
*
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
Expand Down Expand Up @@ -123,13 +123,13 @@ class CameraView : ConstraintLayout {
private fun initFromXML(context: Context, attrs: AttributeSet? = null) {
context.withStyledAttributes(
attrs,
R.styleable.CameraView
R.styleable.StripeCameraView
) {
viewFinderType =
ViewFinderType.values()[getInt(R.styleable.CameraView_viewFinderType, 0)]
ViewFinderType.values()[getInt(R.styleable.StripeCameraView_stripeViewFinderType, 0)]
borderDrawable =
getResourceId(
R.styleable.CameraView_borderDrawable,
R.styleable.StripeCameraView_stripeBorderDrawable,
NO_BORDER
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ class ViewFinderBackground(

private val theme = context.theme
private val attributes =
theme.obtainStyledAttributes(attrs, R.styleable.ViewFinderBackground, 0, 0)
theme.obtainStyledAttributes(attrs, R.styleable.StripeViewFinderBackground, 0, 0)
private val backgroundColor =
attributes.getColor(
R.styleable.ViewFinderBackground_backgroundColor,
R.styleable.StripeViewFinderBackground_stripeBackgroundColor,
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
resources.getColor(R.color.stripeNotFoundBackground, theme)
} else {
Expand Down
2 changes: 1 addition & 1 deletion example/res/layout/dropdown_menu_popup_item.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/text"
android:drawablePadding="@dimen/card_brand_spinner_dropdown_drawable_padding"
android:drawablePadding="@dimen/stripe_card_brand_spinner_dropdown_drawable_padding"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
Expand Down
2 changes: 1 addition & 1 deletion example/res/layout/simple_payment_method_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:editable="false"
android:drawablePadding="@dimen/card_brand_spinner_dropdown_drawable_padding"
android:drawablePadding="@dimen/stripe_card_brand_spinner_dropdown_drawable_padding"
android:textSize="20sp" />

</com.google.android.material.textfield.TextInputLayout>
Expand Down
5 changes: 0 additions & 5 deletions financial-connections/res/values/dimens.xml

This file was deleted.

30 changes: 15 additions & 15 deletions financial-connections/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="consent_pane_tc">You agree to Stripe\'s <annotation clickable="terms">Terms</annotation> and <annotation clickable="privacy">Privacy Policy</annotation>. <annotation clickable="privacy_center">Learn more</annotation></string>
<string name="consent_pane_manual_entry"><annotation clickable="manual_entry">Enter account details manually instead</annotation></string>
<string name="consent_pane_manual_entry_microdeposits"><annotation clickable="manual_entry">Enter account details manually instead</annotation> (takes 1–2 business days)</string>
<string name="stripe_consent_pane_tc">You agree to Stripe\'s <annotation clickable="terms">Terms</annotation> and <annotation clickable="privacy">Privacy Policy</annotation>. <annotation clickable="privacy_center">Learn more</annotation></string>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These strings aren’t coming from Lokalize, so they weren’t updated as part of #6608. (cc @carlosmuvi: any plans to localize them?)

<string name="stripe_consent_pane_manual_entry"><annotation clickable="manual_entry">Enter account details manually instead</annotation></string>
<string name="stripe_consent_pane_manual_entry_microdeposits"><annotation clickable="manual_entry">Enter account details manually instead</annotation> (takes 1–2 business days)</string>
<string name="stripe_ok">OK</string>
<string name="stripe_prepane_title">Link with %1$s</string>
<string name="stripe_prepane_continue">Continue</string>
Expand Down Expand Up @@ -42,17 +42,17 @@
<string name="stripe_success_title">Success!</string>
<string name="stripe_search">Search</string>
<string name="stripe_account_picker_dropdown_hint">Choose one</string>
<string name="data_accessible_callout_stripe_direct"><annotation bold="accessible_data">Data accessible to Stripe: </annotation>%2$s. <annotation clickable="learn_more">Learn more</annotation></string>
<string name="data_accessible_callout_through_stripe"><annotation bold="accessible_data">Data accessible to %1$s: </annotation>%2$s through Stripe. <annotation clickable="learn_more">Learn more</annotation></string>
<string name="data_accessible_callout_through_stripe_no_business"><annotation bold="accessible_data">Data accessible to this business: </annotation>%2$s through Stripe. <annotation clickable="learn_more">Learn more</annotation></string>
<string name="data_accessible_callout_through_link"><annotation bold="accessible_data">Data accessible to %1$s: </annotation>%2$s through Link. <annotation clickable="learn_more">Learn more</annotation></string>
<string name="data_accessible_callout_through_link_no_business"><annotation bold="accessible_data">Data accessible to this business: </annotation>%2$s through Link. <annotation clickable="learn_more">Learn more</annotation></string>
<string name="data_accessible_type_accountdetails">account details</string>
<string name="data_accessible_type_balances">balances</string>
<string name="data_accessible_type_transactions">transactions</string>
<string name="data_accessible_type_ownership">account ownership details</string>
<string name="success_pane_done">Done</string>
<string name="success_pane_disconnect">You can <annotation clickable="disconnect">disconnect your account</annotation> any time.</string>
<string name="stripe_data_accessible_callout_stripe_direct"><annotation bold="accessible_data">Data accessible to Stripe: </annotation>%2$s. <annotation clickable="learn_more">Learn more</annotation></string>
<string name="stripe_data_accessible_callout_through_stripe"><annotation bold="accessible_data">Data accessible to %1$s: </annotation>%2$s through Stripe. <annotation clickable="learn_more">Learn more</annotation></string>
<string name="stripe_data_accessible_callout_through_stripe_no_business"><annotation bold="accessible_data">Data accessible to this business: </annotation>%2$s through Stripe. <annotation clickable="learn_more">Learn more</annotation></string>
<string name="stripe_data_accessible_callout_through_link"><annotation bold="accessible_data">Data accessible to %1$s: </annotation>%2$s through Link. <annotation clickable="learn_more">Learn more</annotation></string>
<string name="stripe_data_accessible_callout_through_link_no_business"><annotation bold="accessible_data">Data accessible to this business: </annotation>%2$s through Link. <annotation clickable="learn_more">Learn more</annotation></string>
<string name="stripe_data_accessible_type_accountdetails">account details</string>
<string name="stripe_data_accessible_type_balances">balances</string>
<string name="stripe_data_accessible_type_transactions">transactions</string>
<string name="stripe_data_accessible_type_ownership">account ownership details</string>
<string name="stripe_success_pane_done">Done</string>
<string name="stripe_success_pane_disconnect">You can <annotation clickable="disconnect">disconnect your account</annotation> any time.</string>
<string name="stripe_prepane_partner_callout">Stripe works with partners like %1$s to reliably offer access to thousands of financial institutions. <annotation clickable="privacy_center">Learn more</annotation></string>
<string name="stripe_account_picker_error_no_payment_method_title">No checking or savings account available</string>
<string name="stripe_account_picker_error_no_payment_method_desc">We found %1$s %2$s accounts but you can only link checking or savings to %3$s. Please try selecting another bank.</string>
Expand All @@ -78,7 +78,7 @@
<string name="stripe_manualentrysuccess_desc_descriptorcode">Expect a $0.01 deposit to the account ending in ••••%1$s in 1–2 business days and an email with additional instructions to verify your bank account.</string>
<string name="stripe_manualentrysuccess_desc_noaccount_descriptorcode">Expect a $0.01 deposit to your account in 1–2 business days and an email with additional instructions to verify your bank account.</string>
<string name="stripe_manualentrysuccess_table_title">••••%1$s BANK STATEMENT</string>
<string name="success_pane_link_more_accounts">Link another account</string>
<string name="stripe_success_pane_link_more_accounts">Link another account</string>
<plurals name="stripe_attachlinkedpaymentaccount_title">
<item quantity="one">Linking account</item>
<item quantity="other">Linking accounts</item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,15 @@ private fun AccessibleDataText(
text = TextResource.StringId(
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
null -> R.string.stripe_data_accessible_callout_through_link_no_business
else -> R.string.stripe_data_accessible_callout_through_link
}

model.isStripeDirect -> R.string.data_accessible_callout_stripe_direct
model.isStripeDirect -> R.string.stripe_data_accessible_callout_stripe_direct

else -> when (model.businessName) {
null -> R.string.data_accessible_callout_through_stripe_no_business
else -> R.string.data_accessible_callout_through_stripe
null -> R.string.stripe_data_accessible_callout_through_stripe_no_business
else -> R.string.stripe_data_accessible_callout_through_stripe
}
},
args = listOfNotNull(
Expand Down Expand Up @@ -212,12 +212,12 @@ private fun readableListOfPermissions(permissionsReadable: List<Int>): String =

private fun List<Permissions>.toStringRes(): List<Int> = mapNotNull {
when (it) {
Permissions.BALANCES -> R.string.data_accessible_type_balances
Permissions.OWNERSHIP -> R.string.data_accessible_type_ownership
Permissions.BALANCES -> R.string.stripe_data_accessible_type_balances
Permissions.OWNERSHIP -> R.string.stripe_data_accessible_type_ownership
Permissions.PAYMENT_METHOD,
Permissions.ACCOUNT_NUMBERS -> R.string.data_accessible_type_accountdetails
Permissions.ACCOUNT_NUMBERS -> R.string.stripe_data_accessible_type_accountdetails

Permissions.TRANSACTIONS -> R.string.data_accessible_type_transactions
Permissions.TRANSACTIONS -> R.string.stripe_data_accessible_type_transactions
Permissions.UNKNOWN -> null
}
}.distinct()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ internal fun ManualEntrySuccessContent(
modifier = Modifier
.fillMaxWidth()
) {
Text(text = stringResource(R.string.success_pane_done))
Text(text = stringResource(R.string.stripe_success_pane_done))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ private fun SuccessLoaded(
}
Spacer(modifier = Modifier.size(12.dp))
AnnotatedText(
text = TextResource.StringId(R.string.success_pane_disconnect),
text = TextResource.StringId(R.string.stripe_success_pane_disconnect),
onClickableTextClick = {
onDisconnectLinkClick()
uriHandler.openUri(disconnectUrl)
Expand Down Expand Up @@ -231,7 +231,7 @@ private fun SuccessLoadedFooter(
modifier = Modifier
.fillMaxWidth()
) {
Text(text = stringResource(R.string.success_pane_link_more_accounts))
Text(text = stringResource(R.string.stripe_success_pane_link_more_accounts))
}
Spacer(modifier = Modifier.size(8.dp))
}
Expand All @@ -241,7 +241,7 @@ private fun SuccessLoadedFooter(
modifier = Modifier
.fillMaxWidth()
) {
Text(text = stringResource(R.string.success_pane_done))
Text(text = stringResource(R.string.stripe_success_pane_done))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
android:viewportWidth="24"
android:width="16dp">
<path
android:fillColor="@color/plus_icon_tint"
android:fillColor="@color/stripe_plus_icon_tint"
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
</vector>
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
android:viewportWidth="16"
android:width="16dp">
<path
android:fillColor="@color/privacy_policy_icon_tint"
android:fillColor="@color/stripe_privacy_policy_icon_tint"
android:fillType="evenOdd"
android:pathData="M12.5,2H3.5C2.6716,2 2,2.6716 2,3.5V12.5C2,13.3284 2.6716,14 3.5,14H12.5C13.3284,14 14,13.3284 14,12.5V3.5C14,2.6716 13.3284,2 12.5,2ZM3.5,0.5C1.8432,0.5 0.5,1.8432 0.5,3.5V12.5C0.5,14.1569 1.8432,15.5 3.5,15.5H12.5C14.1569,15.5 15.5,14.1569 15.5,12.5V3.5C15.5,1.8432 14.1569,0.5 12.5,0.5H3.5Z" />
<path
android:fillColor="@color/privacy_policy_icon_tint"
android:fillColor="@color/stripe_privacy_policy_icon_tint"
android:pathData="M7,6.5C6.5858,6.5 6.25,6.8358 6.25,7.25C6.25,7.6642 6.5858,8 7,8H7.25V11.75C7.25,12.1642 7.5858,12.5 8,12.5C8.4142,12.5 8.75,12.1642 8.75,11.75V7.25C8.75,6.8358 8.4142,6.5 8,6.5H7Z" />
<path
android:fillColor="@color/privacy_policy_icon_tint"
android:fillColor="@color/stripe_privacy_policy_icon_tint"
android:pathData="M7,4.5C7,3.95 7.45,3.5 8,3.5C8.55,3.5 9,3.95 9,4.5C9,5.05 8.55,5.5 8,5.5C7.45,5.51 7,5.06 7,4.5Z" />
</vector>
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
android:viewportWidth="18"
android:width="16dp">
<path
android:fillColor="@color/time_estimate_icon_tint"
android:fillColor="@color/stripe_time_estimate_icon_tint"
android:pathData="M8.7471,5C8.7471,4.5858 8.4113,4.25 7.9971,4.25C7.5829,4.25 7.2471,4.5858 7.2471,5V9.5C7.2471,9.6017 7.2673,9.6987 7.304,9.7871C7.3406,9.8756 7.3948,9.9584 7.4667,10.0303L9.7167,12.2803C10.0096,12.5732 10.4845,12.5732 10.7774,12.2803C11.0703,11.9874 11.0703,11.5126 10.7774,11.2197L8.7471,9.1893V5Z" />
<path
android:fillColor="@color/time_estimate_icon_tint"
android:fillColor="@color/stripe_time_estimate_icon_tint"
android:fillType="evenOdd"
android:pathData="M8.0559,2.4902C4.4606,2.4907 1.5469,5.4048 1.5469,9.0002C1.5469,12.596 4.4611,15.5102 8.0569,15.5102C11.6526,15.5102 14.5669,12.596 14.5669,9.0002C14.5669,5.4158 11.6538,2.4997 8.0559,2.4902ZM0.0469,9.0002C0.0469,4.576 3.6326,0.9902 8.0569,0.9902H8.0587C12.4804,1.0013 16.0669,4.585 16.0669,9.0002C16.0669,13.4245 12.4811,17.0102 8.0569,17.0102C3.6326,17.0102 0.0469,13.4244 0.0469,9.0002Z" />
</vector>
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
Z"
android:trimPathStart="0"
android:trimPathEnd="0.5"
android:strokeColor="@color/viewfinder_border_center"
android:strokeColor="@color/stripe_viewfinder_border_center"
android:strokeWidth="5" />
</vector>
</aapt:attr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
L 7.5,197.5
a 5,5,0,0,1,-5,-5
Z"
android:strokeColor="@color/id_border_initial_color"
android:strokeWidth="@integer/view_finder_border_width"/>
android:strokeColor="@color/stripe_id_border_initial_color"
android:strokeWidth="@integer/stripe_view_finder_border_width"/>
</vector>
6 changes: 3 additions & 3 deletions identity/res/values-night/colors.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="plus_icon_tint">#F7FAFC</color>
<color name="privacy_policy_icon_tint">#F7FAFC</color>
<color name="time_estimate_icon_tint">#F7FAFC</color>
<color name="stripe_plus_icon_tint">#F7FAFC</color>
<color name="stripe_privacy_policy_icon_tint">#F7FAFC</color>
<color name="stripe_time_estimate_icon_tint">#F7FAFC</color>
</resources>
16 changes: 8 additions & 8 deletions identity/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="id_border_initial_color">#FFFFFF</color>
<color name="check_mark_background">#80FFFFFF</color>
<color name="error_exclamation_color">#88919E</color>
<color name="viewfinder_border_center">#5469D4</color>
<color name="stripe_id_border_initial_color">#FFFFFF</color>
<color name="stripe_check_mark_background">#80FFFFFF</color>
<color name="stripe_error_exclamation_color">#88919E</color>
<color name="stripe_viewfinder_border_center">#5469D4</color>

<color name="plus_icon_tint">#1C1C1E</color>
<color name="privacy_policy_icon_tint">#1C1C1E</color>
<color name="time_estimate_icon_tint">#1C1C1E</color>
<color name="stripe_plus_icon_tint">#1C1C1E</color>
<color name="stripe_privacy_policy_icon_tint">#1C1C1E</color>
<color name="stripe_time_estimate_icon_tint">#1C1C1E</color>

<color name="flash_mask_color">#FFFFFF</color>
<color name="stripe_flash_mask_color">#FFFFFF</color>

</resources>
Loading