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

[Paywalls V2] Update color spec #4468

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

joshdholtz
Copy link
Member

@joshdholtz joshdholtz commented Nov 11, 2024

Motivation

Updating color property to hold more types info:

  1. Hex color
  2. Alias to a project color

Note: Developers will soon™️ be able to define global colors for the project and paywall components will be able to reference them by name (alias)

ℹ️ This is A LOT of struct-ural changes to make this complie again but no functional changes were made

Description

Previously

Colors were strictly a hex color value

{
    "light": "#ffffff",
    "dark": "#000000"
}

Now

Colors can be a type of hex or alias (a name to a dictionary that will be coming down in the API response with all paywalls that is common on a project)

{
    "light": {
        "type": "hex",
        "value": "#ffffff"
    },
    "dark": {
        "type": "hex",
        "value": "#000000"
    }
}

or

{
    "light": {
        "type": "alias",
        "value": "primary"
    },
    "dark": {
        "type": "alias",
        "value": "primary_dark"
    }
}

@joshdholtz joshdholtz changed the title Part 1: Respec color Paywalls V2: Update color spec Nov 11, 2024
@joshdholtz joshdholtz changed the title Paywalls V2: Update color spec [Paywalls V2] Update color spec Nov 11, 2024
@joshdholtz joshdholtz requested review from a team November 11, 2024 17:48
@joshdholtz joshdholtz marked this pull request as ready for review November 11, 2024 17:49
Copy link
Contributor

@fire-at-will fire-at-will left a comment

Choose a reason for hiding this comment

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

Looks good to me!

One question: Did you mean to remove Tests/TestingApps/PaywallsTester/PaywallsTester/Config/SamplePaywalls.swift and Tests/TestingApps/PaywallsTester/PaywallsTester/UI/Views/SamplePaywallsList.swift? I didn't see any mention of it in the PR description so I figured I'd double check


}

// struct ColorInfo: Codable, Sendable, Hashable, Equatable {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: remove commented code

Copy link
Member Author

Choose a reason for hiding this comment

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

Ha! I did notice this and it gets removed like 2 PRs in 😛

}
}

public init(from decoder: Decoder) throws {
Copy link
Contributor

Choose a reason for hiding this comment

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

I might think about adding in some tests to validate the custom encoding/decoding of the ColorInfo enum. I know from recent experience in Pines that it's easy to make mistakes in these custom enum codable implementations and it's easy to miss until much later in testing

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes yes, for sure! Tests coming soon™️

@joshdholtz joshdholtz merged commit 44dde1e into main Nov 11, 2024
7 checks passed
@joshdholtz joshdholtz deleted the paywalls-v2/schema-rework-part-1-color branch November 11, 2024 20:12
This was referenced Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants