-
Notifications
You must be signed in to change notification settings - Fork 111
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
[PAY-2456][PAY-2438][PAY-2435] Bring mobile purchase flow up to lossless spec #7490
Changes from 7 commits
536f82d
3d3b8ac
144c33c
0a935c2
0334b31
c88fe30
0306d60
36df262
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -299,6 +299,7 @@ export const Button = (props: ButtonProps) => { | |
<BaseButton | ||
onPressIn={handlePressIn} | ||
onPressOut={handlePressOut} | ||
onLongPress={handlePressOut} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok @dylanjeffers also tagging you for this part too :) Lmk if you have concerns -- PR description should cover it. It only improves the current UX, though we could definitely reconsider how long press works overall in our app |
||
disabled={isDisabled} | ||
style={[animatedButtonStyles, buttonStyles, style]} | ||
sharedValue={pressed} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,8 @@ import { useCallback, useState } from 'react' | |
|
||
import { | ||
useCurrentStems, | ||
useDownloadableContentAccess | ||
useDownloadableContentAccess, | ||
useGatedContentAccess | ||
} from '@audius/common/hooks' | ||
import { ModalSource, DownloadQuality } from '@audius/common/models' | ||
import type { ID } from '@audius/common/models' | ||
|
@@ -60,8 +61,15 @@ export const DownloadSection = ({ trackId }: { trackId: ID }) => { | |
const { onOpen: openWaitForDownloadModal } = useWaitForDownloadModal() | ||
const [quality, setQuality] = useState(DownloadQuality.MP3) | ||
const [isExpanded, setIsExpanded] = useState(false) | ||
const track = useSelector((state: CommonState) => | ||
getTrack(state, { id: trackId }) | ||
) | ||
const { stemTracks } = useCurrentStems({ trackId }) | ||
const shouldDisplayDownloadAll = stemTracks.length > 1 | ||
const { hasStreamAccess, hasDownloadAccess } = useGatedContentAccess(track) | ||
// Hide the download all button if there aren't multiple downloads and if the user | ||
// happens to not have stream access to the track | ||
const shouldDisplayDownloadAll = | ||
stemTracks.length > 1 && hasStreamAccess && hasDownloadAccess | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: not sure if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah good callout -- I think it's helpful to be explicit, but I agree it's not possible as the backend currently allows it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit but i think for simplicity purposes, we can rely on just one boolean. that is one of the goals of this design so that UI doesnt have to do a whole lot of thinking There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok sounds good, will make that change |
||
const { | ||
price, | ||
shouldDisplayPremiumDownloadLocked, | ||
|
@@ -76,9 +84,6 @@ export const DownloadSection = ({ trackId }: { trackId: ID }) => { | |
maximumFractionDigits: 2 | ||
}) | ||
: undefined | ||
const track = useSelector((state: CommonState) => | ||
getTrack(state, { id: trackId }) | ||
) | ||
const shouldHideDownload = | ||
!track?.access.download && !shouldDisplayDownloadFollowGated | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -163,18 +163,10 @@ function* watchFetchTrack() { | |
forceRetrieveFromSource | ||
}) | ||
} else { | ||
const ids = | ||
canBeUnlisted && slug && handle | ||
? [{ id: trackId, url_title: slug, handle }] | ||
: [trackId] | ||
const ids = canBeUnlisted | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dylanjeffers tagging you in this PR only for this part. requiring slug & handle is not necessary for this to work, and probably hasn't been working as written for a while, but in the ts change we added the && slug && handle constraint, which aren't passed in via navigation, only when something is deep linked. Separately, there was an additional retrieveTracks call for no reason There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for fixing, will post in client channel as well There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure I understand @raymondjacobson - if they're not necessary, why the ternary at all? Isn't the point of this line that we retrieve by only the track id if we don't have slug and title? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The backend no longer needs them in order to serve back a hidden track. Isaac made that change a long time ago. They used to be required, but we made changes somewhere else that don't always provide them when canBeUnlisted = true There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So the typescripting of this file totally broke loading stems on mobile across the board There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll make a ticket to rip out this code though, it's very misleading There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That part makes sense, but I'm not sure what this code is accomplishing as it reads after your change - do we not want to retrieve by There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah sorry github comments didn't load in |
||
? [{ id: trackId, url_title: slug, handle }] | ||
: [trackId] | ||
|
||
retrieveTracks({ | ||
trackIds: ids, | ||
canBeUnlisted, | ||
withStems: true, | ||
withRemixes, | ||
withRemixParents: true | ||
}) | ||
const tracks: Track[] = yield* call(retrieveTracks, { | ||
trackIds: ids, | ||
canBeUnlisted, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this seems brittle - we're trying to alternate colors in the table rows right? there's gotta be a better way to do this, but 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not exactly. just show the color as lighter gray when the track is "stream for sale"