[C-1065][C-1066] Primitive download and playback for tracks offline#2021
Conversation
| } | ||
|
|
||
| export const getArtFileNameFromUri = (uri: string) => { | ||
| return uri.split('/').slice(-1)[0] |
There was a problem hiding this comment.
what if we just named them all the same thing like "Artwork"? (more predictable)
There was a problem hiding this comment.
these will be named by the image size like 150x150.jpg
| await downloadIfNotExists(coverArtUri, coverArtDirectory, coverArtFileName) | ||
| } | ||
| await tryDownloadTrackFromEachCreatorNode(track) | ||
| await writeTrackJson(track, collection) |
There was a problem hiding this comment.
What do we do if either of these steps fail?
There was a problem hiding this comment.
Really, we should check if all of the assets exist before writing downloaded_time to the track json. There are more steps that need to happen here, so I haven't gotten to that yet, but it's 100% something we need to worry about. I'll add a todo for the next round.
|
|
||
| // Main entrypoint - perform all steps required to complete a download | ||
| export const downloadTrack = async (trackId: number, collection: string) => { | ||
| const state = store.getState() |
There was a problem hiding this comment.
I don't think we are doing this anywhere else, all this logic feels like it might actually belong in sagas. But I'm pretty anti-saga these days so would love to hear other people's thoughts
There was a problem hiding this comment.
It felt weird writing it too. Currently, we usually call this from a component that has the state, but I wanted to keep it reusable for the potential background process. However, we won't be able to use the state their either. Keeping it simple for now, but open to ideas.
There was a problem hiding this comment.
Discussed in standup. Seems like this is the way for now
|
|
||
| const tryDownloadTrackFromEachCreatorNode = async (track: Track) => { | ||
| const state = store.getState() | ||
| const user = ( |
There was a problem hiding this comment.
Do we not already have this in the store?
There was a problem hiding this comment.
Oh, we probably do. I was teaching myself how to use the API 😅
There was a problem hiding this comment.
Actually, wait. Not necessarily. If we're downloading all of our favorites we may not have loaded all of them yet. For now, yes, but in the future we will start this process whenever the app is open (and possibly in the background as well). I think I currently have a mix of logic meant to work in the background and logic that doesn't. It's going to need some further separation and cleanup.
[287f114] [C-1179] Fix edit-profile (#2048) Dylan Jeffers [65456c9] [C-1207] Fix stem downloads (#2041) Dylan Jeffers [aa7183c] Fix duplicate playlists once playlist is confirmed / Await feature flag response in sagas C-1199 (#2044) nicoback2 [2340604] [C-1208] Track playback UID is not consistent when clicking into track (#2046) Sebastian Klingler [b300cba] Add premium content default fields to track upload (#2042) Saliou Diallo [e80e0bb] [PAY-655] Refactor challenges config, fix bugs (#2016) Michael Piazza [86d4741] [C-1206] double check before declaring offline state (#2034) Andrew Mendelsohn [69ccfac] Upgrade sdk 1.0.8 (#2040) Isaac Solo [3c8ac81] Fix image uploads in new native (#2019) nicoback2 [e0faae7] Fix tracks/reposts lineups for artist with handles with capitials (#2039) Dylan Jeffers [32b472b] [C-481] Fix profile header loading jank (#2038) Dylan Jeffers [7e3a4c6] [C-1128] Add profile screen skeleton (#2037) Dylan Jeffers [e3390af] Improve navigation perf related to drawer context (#2036) Dylan Jeffers [9a12d48] Fix profile reposts loading issue (#2035) Dylan Jeffers [544b01e] [C-1065][C-1066] Primitive download and playback for tracks offline (#2021) Andrew Mendelsohn [d335a31] User entity manager (#2017) Joseph Lee [522f044] Disable dominant color on mobile (#2031) Sebastian Klingler [c3093a6] Add AudioTransactionsIcon component (#2030) Kyle Shanks [c31d1b2] Fix some tests c-1140 (#1966) nicoback2 [575caad] [C-1197] Custom skeleton for feed tip tile (#2027) Raymond Jacobson [8399ee1] fix new playlist made from track - invalid date (#2029) nicoback2 [3971aaf] [C-1154] Deep linking (#2023) Sebastian Klingler [fcaf65a] [C-1195] Fix image loading in image hooks (#2025) Dylan Jeffers [6f54ba1] [C-1194] Fix desktop profile state (#2022) Dylan Jeffers [3044ded] Fix navigation context scope and setting (#2026) Dylan Jeffers [4c8bb56] [C-1092] Implement eager load utils in mobile (#2002) Raymond Jacobson [37048f6] Fix static server crash (#2024) Sebastian Klingler [4d7bd27] Add entity manager address to dev (#2013) Isaac Solo [d77ee2d] Fix feeling lucky typecheck (#2020) Isaac Solo [e83d105] Update feeling lucky to not rely on latest track (#1954) Isaac Solo [af72734] Add new table for Artist Dashboard (#2018) Kyle Shanks [f3f8abb] [C-1177] Move tipping requests to api client (#1995) Raymond Jacobson [b2b986d] [C-1170] Optimistically add/remove reposted tracks/collections (#2009) Dylan Jeffers [0fda0b8] [PAY-651][PAY-613] Add Stripe Provider to On Ramps (#1950) Marcus Pasell [5cb01d0] [C-1181] skip connection check if not in foreground (#2010) Andrew Mendelsohn [254f42e] [C-1157] Fix remix icon position (#2014) Dylan Jeffers [33b10ee] [C-1164] Fix collections screen loading issues (#2005) Dylan Jeffers [9c1c1ce] Cast port to number (#2015) Sebastian Klingler [d656b0a] Upgrade sdk 1.0.6 (#2012) Isaac Solo [9e5dfef] Fix static server error (#2011) Sebastian Klingler [42aa891] Hardcode web-sync static-server port (#2008) Dylan Jeffers [9a106c3] Remove more webview instructions from readme (#2007) Sebastian Klingler [d68aa89] Omit creator_node_endpoint when updating metadata via collectible fetch (#2006) Sebastian Klingler [8b16e7f] Use .env.dev instead of .env.dev.local (#2004) Raymond Jacobson [82864e0] Fix start:dev command (#2003) Raymond Jacobson [1661b77] [C-1150, C-1165] Fix app-tab navigation (#2001) Dylan Jeffers [8235eb0] [INF-180] Update client for new compose local dev (#1577) Raymond Jacobson [71d1e92] [C-1167,C-1171] Fix missing tip data (#2000) Dylan Jeffers [1c3d609] [C-1156, C-1055, C-1159] Fix profile follow button (#1999) Dylan Jeffers [2005467] [C-1174] Fix blank listening history screen (#1998) Dylan Jeffers [42945e3] Remove tmpl env vars (#1997) Raymond Jacobson [f637ded] [C-1173] Reintegrate WebAppAccountSync (#1996) Dylan Jeffers [b11f04d] [C-1176] Improve ExploreScreen performance (#1994) Dylan Jeffers [f6680c5] [C-536] Cache makeStyles StyleSheets (#1993) Dylan Jeffers
Description
Checkpoint for offline mode including:
Note: This is not production-ready code, and much of this may be refactored as we encounter other concerns with download and playback. Looking for early feedback and concerns.
Known issues:
Dragons
Just need to ensure there's no impact to current behavior
How Has This Been Tested?
iOS simulator
Feature Flags
All of these changes are experimental and not ready for consumption.
There should be no UI changes to users without the
OFFLINE_MODE_ENABLEDfeature flag.The flag is not enabled for any prod users.