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 color customization support #17

Merged
merged 5 commits into from
Nov 27, 2023
Merged

Add color customization support #17

merged 5 commits into from
Nov 27, 2023

Conversation

markmur
Copy link
Contributor

@markmur markmur commented Nov 23, 2023

What are you trying to accomplish?

Example configuration for light, dark and web options:

ShopifyCheckoutKit.configure({
  colorScheme: ColorScheme.web,
  colors: {
    ios: {
      backgroundColor: '#f0f0e8',
      spinnerColor: '#2d2a38',
    },
    android: {
      backgroundColor: '#f0f0e8',
      spinnerColor: '#2d2a38',
      headerBackgroundColor: '#f0f0e8',
      headerTextColor: '#2d2a38',
    },
  },
});

Example config for automatic:

ShopifyCheckoutKit.configure({
  colorScheme: ColorScheme.automatic,
  colors: {
    ios: {
      backgroundColor: '#f0f0e8',
      spinnerColor: '#2d2a38',
    },
    android: {
      light: {
        backgroundColor: '#f0f0e8',
        spinnerColor: '#2d2a38',
        headerBackgroundColor: '#f0f0e8',
        headerTextColor: '#2d2a38',
      },
      dark: {
        backgroundColor: '#f0f0e8',
        spinnerColor: '#2d2a38',
        headerBackgroundColor: '#f0f0e8',
        headerTextColor: '#2d2a38',
      },
    },
  },
});

@markmur markmur self-assigned this Nov 23, 2023
@markmur markmur marked this pull request as ready for review November 25, 2023 12:05
@markmur markmur requested a review from a team as a code owner November 25, 2023 12:05
@ReactMethod
public void configure(ReadableMap config) {
Context context = getReactApplicationContext();

ShopifyCheckoutKit.configure(configuration -> {
if (config.hasKey("preloading")) {

Choose a reason for hiding this comment

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

If you create a type for the config (eg a record class might do), all these map checks would go away and clean up the code. You could do all the config validation in this function

Choose a reason for hiding this comment

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

Is it possible to use an external lib like jackson? I think you could convert a map direct to a POJO. I reckon it might clean up the code a bit.

@markmur
Copy link
Contributor Author

markmur commented Nov 27, 2023

@cianbuckley and I paired on this to improve the java codebase, but we decided to handle it in a follow up to avoid blocking progress here

@cianbuckley cianbuckley self-requested a review November 27, 2023 12:43
Copy link

@cianbuckley cianbuckley left a comment

Choose a reason for hiding this comment

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

LGTM

@markmur markmur merged commit e03d2a6 into main Nov 27, 2023
7 checks passed
@markmur markmur deleted the color-support branch November 27, 2023 12:51
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.

2 participants