Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Migrate getDogEarType to common #3685

Merged
merged 3 commits into from
Jul 3, 2023
Merged

Conversation

dharit-tan
Copy link
Contributor

Description

dogEarType logic was getting hairy and also we were doing the same calculations in every component that used a DogEar. Moved to a util fn in common and updated all the callsites.

getDogEarType should now return null if there's not an exact match on the conditions, which also makes it possible to delete all the showPremiumContent vars too.

Dragons

How Has This Been Tested?

Local ios + web stage
There are probably some cases that I've missed but I think it's ok.
Screenshot 2023-06-30 at 1 09 25 PM
Simulator Screenshot - iPhone 14 Pro - 2023-06-30 at 13 10 02
Screenshot 2023-06-30 at 1 10 12 PM
Screenshot 2023-06-30 at 1 10 20 PM
Screenshot 2023-06-30 at 1 10 30 PM

Screenshot 2023-06-30 at 1 12 27 PM Screenshot 2023-06-30 at 1 12 11 PM

How will this change be monitored?

For features that are critical or could fail silently please describe the monitoring/alerting being added.

Feature Flags

Are all new features properly feature flagged? Describe added feature flags.

@audius-infra
Copy link
Collaborator

Preview this change https://demo.audius.co/rt-dog-ear-common

Copy link
Contributor

@dylanjeffers dylanjeffers left a comment

Choose a reason for hiding this comment

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

Excellent work!

premiumConditions?: Nullable<PremiumConditions>
}

export const getDogEarType = ({
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we also have dog ear for collections, can we specify this to either handle both, or just say this is track related?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this already handles both - correct me if I'm wrong but I grepped DogEar in web and I believe I've changed every instance. Only saw one collection-related instance on CollectionPage that was only used for HIDDEN so that case is covered.
Maybe I should just change the file name to dogEarUtils.ts.

@@ -263,23 +256,12 @@ export const DetailsTile = ({
}, [onPressPlay])

const renderDogEar = () => {
const showPremiumDogEar =
Copy link
Contributor

Choose a reason for hiding this comment

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

Really smart not having to duplicate this everywhere!

Copy link
Contributor

@schottra schottra left a comment

Choose a reason for hiding this comment

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

Awesome.

I have a PR ready for mobile web, so I'll verify it there when I merge in this change.

@dharit-tan dharit-tan merged commit 8080665 into gated-content-updates Jul 3, 2023
@dharit-tan dharit-tan deleted the rt-dog-ear-common branch July 3, 2023 17:56
schottra added a commit that referenced this pull request Jul 3, 2023
…ile-updates

* gated-content-updates:
  Migrate `getDogEarType` to common (#3685)
  [PAY-1505] USDC-gated mobile track tiles (#3684)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants