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

Add Stripe resource prefix #6603

merged 5 commits into from
Apr 28, 2023

Conversation

tillh-stripe
Copy link
Collaborator

@tillh-stripe tillh-stripe commented Apr 26, 2023

Summary

This pull request makes sure that our resources use a stripe_ prefix to avoid conflicts with resources of the host application. This is a follow-up for #6608 that fetched our updated strings from Lokalize.

Motivation

Resolves #6531

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Before After
before screenshot after screenshot

Changelog

@github-actions
Copy link
Contributor

github-actions bot commented Apr 26, 2023

Diffuse output:

OLD: paymentsheet-example-release-master.apk (signature: V1, V2)
NEW: paymentsheet-example-release-pr.apk (signature: V1, V2)

          │            compressed            │           uncompressed           
          ├───────────┬───────────┬──────────┼───────────┬───────────┬──────────
 APK      │ old       │ new       │ diff     │ old       │ new       │ diff     
──────────┼───────────┼───────────┼──────────┼───────────┼───────────┼──────────
      dex │   3.3 MiB │   3.3 MiB │    +18 B │   7.3 MiB │   7.3 MiB │    +32 B 
     arsc │   2.1 MiB │   2.1 MiB │   -440 B │   2.1 MiB │   2.1 MiB │   -440 B 
 manifest │   4.6 KiB │   4.6 KiB │     -2 B │  22.3 KiB │  22.3 KiB │      0 B 
      res │ 866.9 KiB │ 868.9 KiB │ +1.9 KiB │   1.3 MiB │   1.3 MiB │ +6.4 KiB 
   native │   2.6 MiB │   2.6 MiB │      0 B │     6 MiB │     6 MiB │      0 B 
    asset │     3 MiB │     3 MiB │     +3 B │     3 MiB │     3 MiB │     +3 B 
    other │ 199.5 KiB │ 199.6 KiB │   +114 B │ 446.8 KiB │ 446.8 KiB │    +10 B 
──────────┼───────────┼───────────┼──────────┼───────────┼───────────┼──────────
    total │    12 MiB │    12 MiB │ +1.6 KiB │  20.2 MiB │  20.2 MiB │ +6.1 KiB 

 DEX     │ old   │ new   │ diff        
─────────┼───────┼───────┼─────────────
   files │     1 │     1 │ 0           
 strings │ 35775 │ 35775 │ 0 (+6 -6)   
   types │ 11811 │ 11811 │ 0 (+0 -0)   
 classes │  9923 │  9923 │ 0 (+0 -0)   
 methods │ 52686 │ 52686 │ 0 (+22 -22) 
  fields │ 33486 │ 33486 │ 0 (+61 -61) 

 ARSC    │ old  │ new  │ diff         
─────────┼──────┼──────┼──────────────
 configs │  291 │  291 │  0           
 entries │ 6914 │ 6910 │ -4 (+93 -97)
APK
     compressed      │     uncompressed     │                                                                  
──────────┬──────────┼───────────┬──────────┤                                                                  
 size     │ diff     │ size      │ diff     │ path                                                             
──────────┼──────────┼───────────┼──────────┼──────────────────────────────────────────────────────────────────
          │ -1.4 KiB │           │   -3 KiB │ - res/k61.xml                                                    
  1.2 KiB │ +1.2 KiB │   2.5 KiB │ +2.5 KiB │ + res/4K1.xml                                                    
          │ -1.2 KiB │           │ -3.9 KiB │ - res/7k.xml                                                     
  1.2 KiB │ +1.2 KiB │   3.9 KiB │ +3.9 KiB │ + res/R4.xml                                                     
          │ -1.2 KiB │           │ -3.7 KiB │ - res/Q0.xml                                                     
          │ -1.1 KiB │           │ -2.5 KiB │ - res/OJ.xml                                                     
  1.1 KiB │ +1.1 KiB │   3.2 KiB │ +3.2 KiB │ + res/Ip.xml                                                     
  1.2 KiB │   +1 KiB │   3.7 KiB │ +3.6 KiB │ ∆ res/-A.xml                                                     
  1,001 B │ +1,001 B │   2.8 KiB │ +2.8 KiB │ + res/XB.xml                                                     
          │   -994 B │           │ -2.8 KiB │ - res/AE.xml                                                     
    952 B │   +952 B │   2.5 KiB │ +2.5 KiB │ + res/9N.xml                                                     
          │   -947 B │           │ -2.5 KiB │ - res/5d.xml                                                     
  1.4 KiB │   +937 B │     3 KiB │ +2.1 KiB │ ∆ res/k6.xml                                                     
    917 B │   +917 B │   1.6 KiB │ +1.6 KiB │ + res/-y.xml                                                     
          │   -917 B │           │ -1.6 KiB │ - res/0U.xml                                                     
    375 B │   -897 B │     548 B │ -1.9 KiB │ ∆ res/4K.xml                                                     
    878 B │   +878 B │   2.3 KiB │ +2.3 KiB │ + res/6i.xml                                                     
          │   -877 B │           │ -2.3 KiB │ - res/Fs.xml                                                     
    855 B │   +855 B │   1.4 KiB │ +1.4 KiB │ + res/u41.xml                                                    
          │   -848 B │           │ -1.8 KiB │ - res/0M.xml                                                     
    847 B │   +847 B │   1.8 KiB │ +1.8 KiB │ + res/lK.xml                                                     
          │   -838 B │           │ -1.8 KiB │ - res/jf.xml                                                     
    798 B │   +798 B │   1.6 KiB │ +1.6 KiB │ + res/-0.xml                                                     
          │   -798 B │           │ -1.6 KiB │ - res/LG.xml                                                     
          │   -760 B │           │ -1.7 KiB │ - res/4L.xml                                                     
    758 B │   +758 B │   1.7 KiB │ +1.7 KiB │ + res/fQ.xml                                                     
    757 B │   +757 B │   2.3 KiB │ +2.3 KiB │ + res/Al1.xml                                                    
    723 B │   +723 B │   1.6 KiB │ +1.6 KiB │ + res/HO.xml                                                     
    709 B │   +709 B │   1.3 KiB │ +1.3 KiB │ + res/0Z.xml                                                     
          │   -708 B │           │ -1.3 KiB │ - res/CF.xml                                                     
          │   -698 B │           │ -2.7 KiB │ - res/R0.xml                                                     
          │   -663 B │           │ -1.2 KiB │ - res/-Y1.xml                                                    
    662 B │   +662 B │   1.1 KiB │ +1.1 KiB │ + res/8m.xml                                                     
          │   -662 B │           │ -1.1 KiB │ - res/uc.xml                                                     
    660 B │   +660 B │   1.1 KiB │ +1.1 KiB │ + res/PN.xml                                                     
          │   -660 B │           │ -1.1 KiB │ - res/3s.xml                                                     
          │   -649 B
...✂
MANIFEST
@@ -127,3 +127,3 @@
         android:screenOrientation=5
-        android:theme=@style/stripeDefaultTheme
+        android:theme=@style/StripeDefaultTheme
         />
@@ -132,3 +132,3 @@
         android:screenOrientation=5
-        android:theme=@style/stripeDefaultTheme
+        android:theme=@style/StripeDefaultTheme
         />
@@ -158,5 +158,5 @@
         android:exported=false
-        android:label=@string/link
+        android:label=@string/stripe_link
         android:name=com.stripe.android.link.LinkActivity
-        android:theme=@style/LinkBaseTheme
+        android:theme=@style/StripeLinkBaseTheme
         android:windowSoftInputMode=0x16
@@ -246,3 +246,3 @@
         android:name=com.stripe.android.payments.paymentlauncher.PaymentLauncherConfirmationActivity
-        android:theme=@style/PayLauncherDefaultTheme
+        android:theme=@style/StripePayLauncherDefaultTheme
         />
DEX
STRINGS:

   old   │ new   │ diff      
  ───────┼───────┼───────────
   35775 │ 35775 │ 0 (+6 -6) 
  + getString(R.string.stripe_google_pay)
  + getString(R.string.stripe_link)
  + inflate(Landroid/view/LayoutInflater;Landroid/view/ViewGroup;Z)Lcom/stripe/android/paymentsheet/databinding/StripeFragmentAchBinding;
  + inflate(Landroid/view/LayoutInflater;Landroid/view/ViewGroup;Z)Lcom/stripe/android/paymentsheet/databinding/StripeFragmentPaymentOptionsPrimaryButtonBinding;
  + inflate(Landroid/view/LayoutInflater;Landroid/view/ViewGroup;Z)Lcom/stripe/android/paymentsheet/databinding/StripeFragmentPaymentSheetPrimaryButtonBinding;
  + ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:e18554a,r8-mode:full,version:4.0.52}
  
  - getString(R.string.google_pay)
  - getString(R.string.link)
  - inflate(Landroid/view/LayoutInflater;Landroid/view/ViewGroup;Z)Lcom/stripe/android/paymentsheet/databinding/FragmentAchBinding;
  - inflate(Landroid/view/LayoutInflater;Landroid/view/ViewGroup;Z)Lcom/stripe/android/paymentsheet/databinding/FragmentPaymentOptionsPrimaryButtonBinding;
  - inflate(Landroid/view/LayoutInflater;Landroid/view/ViewGroup;Z)Lcom/stripe/android/paymentsheet/databinding/FragmentPaymentSheetPrimaryButtonBinding;
  - ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:b1f1ab6,r8-mode:full,version:4.0.52}
  

METHODS:

   old   │ new   │ diff        
  ───────┼───────┼─────────────
   52686 │ 52686 │ 0 (+22 -22) 
  + ca.a <init>(FragmentContainerView)
  + ca.b <init>(RelativeLayout, LinearProgressIndicator, Toolbar, ViewStub)
  + ca.c <init>(ViewGroup, View, View, View, int)
  + ca.d <init>(ShippingInfoWidget, CountryTextInputLayout, StripeEditText, StripeEditText, StripeEditText, StripeEditText, StripeEditText, StripeEditText, StripeEditText, TextInputLayout, TextInputLayout, TextInputLayout, TextInputLayout, TextInputLayout, TextInputLayout, TextInputLayout)
  + ca.e <init>(View, View, View, int)
  + ca.e a() → LinearLayout
  + ca.f <init>(View, AppCompatImageView, AppCompatImageView, AppCompatTextView)
  + ca.g <init>(CoordinatorLayout, CircularProgressIndicator, Toolbar, PaymentAuthWebView, FrameLayout)
  + ca.h <init>(FrameLayout, PaymentFlowViewPager)
  + ca.i <init>(CoordinatorLayout, CoordinatorLayout, FrameLayout, LinearProgressIndicator, PaymentMethodsRecyclerView, Toolbar)
  + ca.j <init>(View, TextView, TextView, TextView, AppCompatImageView)
  + com.stripe.android.paymentsheet.ui.PrimaryButton getViewBinding_paymentsheet_release() → g
  + com.stripe.android.view.MaskedCardView getViewBinding_payments_core_release() → f
  + com.stripe.android.view.PaymentAuthWebViewActivity k() → g
  + com.stripe.android.view.PaymentMethodsActivity m() → i
  + com.stripe.android.view.ShippingInfoWidget getViewBinding() → d
  + he.r k() → c
  + qf.a3 i() → b
  + qf.l <init>(c, j3)
  + tc.f <init>(View, RelativeLayout, PayButton, PrimaryButton)
  + tc.g <init>(View, ImageView, CircularProgressIndicator, ComposeView, ImageView)
  + td.s getViewBinding_paymentsheet_release() → f
  
  - ca.a <init>(ViewGroup, View, View, View, int)
  - ca.a a() → LinearLayout
  - ca.b <init>(ShippingInfoWidget, CountryTextInputLayout, StripeEditText, StripeEditText, StripeEditText, StripeEditText, StripeEditText, StripeEditText, StripeEditText, TextInputLayout, TextInputLayout, TextInputLayout, TextInputLayout, TextInputLayout, TextInputLayout, TextInputLayout)
  - ca.c <init>(View, View, View, int)
  - ca.d <init>(View, AppCompatImageView, AppCompatImageView, AppCompatTextView)
  - ca.e <init>(CoordinatorLayout, CircularProgressIndicator, Toolbar, PaymentAuthWebView, FrameLayout)
  - ca.f <init>(FrameLayout, PaymentFlowViewPager)
  - ca.g <init>(CoordinatorLayout, CoordinatorLayout, FrameLayout, LinearProgressIndicator, PaymentMethodsRecyclerView, Toolbar)
  - ca.h <init>(View, TextView, TextView, TextView, AppCompatImageView)
  - ca.i <init>(FragmentContainerView)
  - ca.j <init>(RelativeLayout, LinearProgressIndicator, Toolbar, ViewStub)
  - com.stripe.android.paymentsheet.ui.PrimaryButton getViewBinding_paymentsheet_release() → f
  - com.stripe.android.view.MaskedCardView getViewBinding_payments_core_release() → d
  - com.stripe.android.view.PaymentAuthWebViewActivity k() → e
  - com.stripe.android.view.PaymentMethodsActivity m() → g
  - com.stripe.android.view.ShippingInfoWidget getViewBinding() → b
  - he.r k() → a
  - qf.a
...✂
ARSC
ENTRIES:

   old  │ new  │ diff         
  ──────┼──────┼──────────────
   6914 │ 6910 │ -4 (+93 -97) 
  + anim/stripe_slide_down
  + anim/stripe_slide_up
  + attr/stripeBackgroundColor
  + attr/stripeBorderDrawable
  + attr/stripeViewFinderType
  + bool/stripe_is_tablet
  + color/stripe_clear_icon_tint
  + color/stripe_divider_text_color
  + color/stripe_link_window_background
  + color/stripe_mandate_text_color
  + dimen/stripe_card_brand_spinner_dropdown_drawable_padding
  + dimen/stripe_card_brand_spinner_dropdown_padding
  + dimen/stripe_card_brand_spinner_dropdown_width
  + dimen/stripe_card_brand_spinner_image_height
  + dimen/stripe_card_brand_spinner_image_width
  + dimen/stripe_card_brand_view_height
  + dimen/stripe_card_brand_view_width
  + dimen/stripe_ciw_stripe_edit_text_size
  + drawable/stripe_ic_chevron_down
  + drawable/stripe_ic_photo_camera
  + drawable/stripe_link_add
  + drawable/stripe_link_add_green
  + drawable/stripe_link_back
  + drawable/stripe_link_bank
  + drawable/stripe_link_card
  + drawable/stripe_link_chevron
  + drawable/stripe_link_close
  + drawable/stripe_link_complete
  + drawable/stripe_link_error
  + drawable/stripe_link_logo
  + layout/stripe_activity_card_scan
  + layout/stripe_activity_cardscan
  + layout/stripe_activity_payment_options
  + layout/stripe_activity_payment_sheet
  + layout/stripe_add_payment_method_activity
  + layout/stripe_add_payment_method_card_view
  + layout/stripe_add_payment_method_row
  + layout/stripe_address_widget
  + layout/stripe_bank_item
  + layout/stripe_bank_list_payment_method
  + layout/stripe_becs_debit_widget
  + layout/stripe_card_brand_spinner_dropdown
  + layout/stripe_card_brand_spinner_main
  + layout/stripe_card_brand_view
  + layout/stripe_card_input_widget
  + layout/stripe_card_multiline_widget
  + layout/stripe_card_widget_progress_view
  + layout/stripe_country_text_view
  + layout/stripe_fragment_ach
  + layout/stripe_fragment_cardscan
  + layout/stripe_fragment_payment_options_primary_button
  + layout/stripe_fragment_payment_sheet_primary_button
  + layout/stripe_fragment_primary_button_container
  + layout/stripe_google_pay_row
  + layout/stripe_masked_card_row
  + layout/stripe_masked_card_view
  + layout/stripe_payment_auth_web_view_activity
  + layout/stripe_payment_flow_activity
  + layout/stripe_payment_methods_activity
  + layout/stripe_primary_button
  + layout/stripe_shipping_info_page
  + layout/stripe_shipping_method_page
  + layout/stripe_shipping_method_view
  + layout/stripe_shipping_method_widget
  + menu/stripe_add_payment_method
  + menu/stripe_payment_auth_web_view_menu
  + string/stripe_becs_widget_account_number_invalid
  + string/stripe_card_number_hint
  + string/stripe_consent_pane_manual_entry
  + string/stripe_consent_pane_manual_entry_microdeposits
  + string/stripe_consent_pane_tc
  + string/stripe_cvc_amex_hint
  + string/stripe_cvc_multiline_helper
  + string/stripe_cvc_multiline_helper_amex
  + string/stripe_cvc_number_hint
  + string/stripe_data_accessible_callout_stripe_direct
  + string/stripe_data_accessible_callout_through_link
  + string/stripe_data_accessible_callout_through_link_no_business
  + string/stripe_data_accessible_callout_through_stripe
  + string/stripe_data_accessible_callout_through_stripe_no_business
  + string/stripe_data_accessible_type_accountdetails
  + string/stripe_data_accessible_type_balances
  + string/stripe_data_accessible_type_ownership
  + string/stripe_data_accessible_type_transactions
  + string/stripe_google_pay
  + string/stripe_paymentsheet_payment_method_item_card_number
  + string/stripe_success_pane_disconnect
  + string/stripe_success_pane_done
  + string/stripe_success_pane_link_more_accounts
  + string/stripe_unable_to_complete_operation
  + style/StripeAlertDialogStyle
  + style/StripeLinkBaseTheme
  + style/StripePayLauncherDefaultTheme
  
  - anim/slide_down
  - anim/slide_up
  - attr/borderDrawable
  - attr/viewFinderType
  - bool/isTablet
  - color/clear_icon_tint
  - color/divider_text_color
  - color/link_window_background
  - color/mandate_text_color
  - dimen/card_brand_spinner_dropdown_drawable_padding
  - dimen/card_brand_spinner_dropdown_padding
  - dimen/card_brand_spinner_dropdown_width
  - dimen/card_brand_spinner_image_height
  - dimen/card_brand_spinner_image_width
  - dimen/card_brand_view_height
  - dimen/card_brand_view_width
  - dimen/ciw_stripe_edit_text_size
  - dimen/stripe_connectionssheet_loading_indicator_size
  - dimen/
...✂

@tillh-stripe tillh-stripe force-pushed the tillh/resource-prefix branch 4 times, most recently from d3365f9 to 8b93dc8 Compare April 26, 2023 19:27
@tillh-stripe tillh-stripe changed the title Add stripe_ resource prefix Add Stripe resource prefix Apr 26, 2023
@tillh-stripe tillh-stripe mentioned this pull request Apr 26, 2023
3 tasks
@tillh-stripe tillh-stripe force-pushed the tillh/resource-prefix branch from 8b93dc8 to a9a9e07 Compare April 26, 2023 19:52
@tillh-stripe tillh-stripe changed the base branch from master to tillh/strings-with-prefix April 26, 2023 19:52
@tillh-stripe tillh-stripe force-pushed the tillh/resource-prefix branch from a9a9e07 to 4701f77 Compare April 26, 2023 19:55
@tillh-stripe tillh-stripe force-pushed the tillh/strings-with-prefix branch 2 times, most recently from 37c2e5b to 987c5d5 Compare April 26, 2023 20:18
@tillh-stripe tillh-stripe force-pushed the tillh/strings-with-prefix branch from bf0ba1f to cdc61f9 Compare April 26, 2023 21:07
@tillh-stripe tillh-stripe force-pushed the tillh/resource-prefix branch from 4701f77 to c457cdf Compare April 27, 2023 13:06
Base automatically changed from tillh/strings-with-prefix to master April 27, 2023 14:12
@tillh-stripe tillh-stripe force-pushed the tillh/resource-prefix branch 5 times, most recently from d430575 to 7563d82 Compare April 27, 2023 17:13
@tillh-stripe tillh-stripe force-pushed the tillh/resource-prefix branch from 7563d82 to a942b9d Compare April 27, 2023 17:30
@tillh-stripe tillh-stripe force-pushed the tillh/resource-prefix branch from a942b9d to 70faa85 Compare April 27, 2023 17:31
@tillh-stripe tillh-stripe force-pushed the tillh/resource-prefix branch from 0079ead to 289db63 Compare April 27, 2023 17:57
Comment on lines +2 to +5
<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">
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

<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?)

Comment on lines +2 to 4
<resources xmlns:tools="http://schemas.android.com/tools">
<declare-styleable name="CardInputView" tools:ignore="ResourceName">
<attr name="cardHintText" format="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.

Ignoring the prefix here because these properties are intended for public use.

@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources xmlns:tools="http://schemas.android.com/tools">
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ignoring the prefix here because these properties are intended for public use.

@@ -1,33 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="CardInputView">
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 are already available in payments-core.

Comment on lines -4 to -6
<!-- Public Styles -->
<public name="StripeDefaultTheme" type="style" />
<public name="StripeToolBarStyle" type="style" />
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 are already available in payments-core.

android:exported="false"
android:label="@string/link"
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like we need to update payments-core/donottranslate.xml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Resource files naming conflicts between Stripe SDK and project modules
4 participants