For the future folder feature & preparation for supporting decoding metadata for any audio file that Android supports, it would make sense to support tracks that don't have any tags.
We'll fallback to the filename for the name of the track.
We have no plans for parsing the filename to potentially get the artist name (yet).
We'll still enforce that we must have an artist or album artist tag for an album.
How
Implementing this change requires a couple of steps:
Create a database migration as we're changing the type on a column. This ended up being a bit more difficult than expected; given that Drizzle ORM doesn't automatically generate the migration file for SQLite and documentation for creating migrations manually is a bit sparse (spent most of my time wondering why my migration wasn't working and it was mainly due to not using --> statement-breakpoint for separating SQL statements and using a transaction inside the migration file, when it wasn't needed).
Update the indexing logic & UI to support these changes. I mainly had to find where we call .artistName and see if it's a place where it's potentially null and potentially provide a fallback value. For the indexing logic, we can remove the throw statements when we check to see if the artist name or track name is undefined. We've wrote code to fallback to the filename of the track (removing the audio extension) to ensure the track name is defined.
Add the migration code to allow checking of tracks we deemed as invalid in the past due to not having any tags.
Update the backup logic as tracks can potentially not have an artist.
During this process, we also did some other changes:
We now display "Save Errors" in the "Statistics" section of the "Insights" page as it'll be more useful now to know if any tracks were rejected for some unknown bug from metadata saving.
We encountered some broken animations when updating the animation packages used.
The first bug was with the <AnimatedHeader />, in which it seems the latest animated value wasn't being applied correctly - so we ended up using useAnimatedStyle() to fix this.
We had an issue with the "periods" loading animation on the loading screen, in which, it never displayed. Upon further investigation, this only occurred if the <AnimatedTextEllipsis /> was nested inside another <Text /> element. Going through each react-native-reanimated versions, I noticed that the animation broke on v3.12.0. On further investigation, it seems that our nested text animation should have never worked in the first place due to animation not working on "virtual components" (which a nested <Text /> element is).
I've also utilized useAnimatedStyle() since we haven't used it here as well.
Test Plan
We've uninstalled the current version of the app and then created a development version of the app built from the v1.0.0-rc.9 build. This allows us to test the migration logic and see if everything works as expected. On my device, we have at least 1 tagless track, so that shouldn't be saved into the database normally.
We'll then install this version of the app with the changes and we should expect to see this tagless track in the "tracks" page. We've also look at any interactions involving this tagless track to see that our UI adjustments are working as expected.
Checklist
[ ] Documentation is up to date to reflect these changes (ie: CHANGELOG.md & README.md).
[ ] Add new dependencies into THIRD_PARTY.md.
[x] This diff will work correctly for pnpm android:prod.
Why
For the future folder feature & preparation for supporting decoding metadata for any audio file that Android supports, it would make sense to support tracks that don't have any tags.
How
Implementing this change requires a couple of steps:
--> statement-breakpoint
for separating SQL statements and using a transaction inside the migration file, when it wasn't needed)..artistName
and see if it's a place where it's potentiallynull
and potentially provide a fallback value. For the indexing logic, we can remove thethrow
statements when we check to see if the artist name or track name isundefined
. We've wrote code to fallback to the filename of the track (removing the audio extension) to ensure the trackname
is defined.artist
.During this process, we also did some other changes:
<AnimatedHeader />
, in which it seems the latest animated value wasn't being applied correctly - so we ended up usinguseAnimatedStyle()
to fix this.<AnimatedTextEllipsis />
was nested inside another<Text />
element. Going through eachreact-native-reanimated
versions, I noticed that the animation broke onv3.12.0
. On further investigation, it seems that our nested text animation should have never worked in the first place due to animation not working on "virtual components" (which a nested<Text />
element is).useAnimatedStyle()
since we haven't used it here as well.Test Plan
We've uninstalled the current version of the app and then created a development version of the app built from the
v1.0.0-rc.9
build. This allows us to test the migration logic and see if everything works as expected. On my device, we have at least 1 tagless track, so that shouldn't be saved into the database normally.We'll then install this version of the app with the changes and we should expect to see this tagless track in the "tracks" page. We've also look at any interactions involving this tagless track to see that our UI adjustments are working as expected.
Checklist
CHANGELOG.md
&README.md
).THIRD_PARTY.md
.pnpm android:prod
.